@cloudvoyant/helix 0.16.0 → 0.17.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/dist/index.cjs +480 -2
- package/dist/index.d.cts +286 -1
- package/dist/index.d.ts +286 -1
- package/dist/index.js +398 -1
- package/package.json +12 -2
- package/src/theme.css +2 -2
package/dist/index.cjs
CHANGED
|
@@ -37,6 +37,7 @@ __export(index_exports, {
|
|
|
37
37
|
THEMES: () => THEMES,
|
|
38
38
|
THEME_NAMES: () => THEME_NAMES,
|
|
39
39
|
badgeVariants: () => badgeVariants,
|
|
40
|
+
buildChartDefinition: () => buildChartDefinition,
|
|
40
41
|
buttonVariants: () => buttonVariants,
|
|
41
42
|
cardBodyBase: () => cardBodyBase,
|
|
42
43
|
cardCoverVariants: () => cardCoverVariants,
|
|
@@ -46,11 +47,27 @@ __export(index_exports, {
|
|
|
46
47
|
cardTitleBase: () => cardTitleBase,
|
|
47
48
|
cardVariants: () => cardVariants,
|
|
48
49
|
centerBase: () => centerBase,
|
|
50
|
+
chartPlaceholderBase: () => chartPlaceholderBase,
|
|
51
|
+
chartPlaceholderLabelBase: () => chartPlaceholderLabelBase,
|
|
52
|
+
chartRootBase: () => chartRootBase,
|
|
49
53
|
checkboxGroupBase: () => checkboxGroupBase,
|
|
50
54
|
checkboxIndicatorBase: () => checkboxIndicatorBase,
|
|
51
55
|
checkboxLabelBase: () => checkboxLabelBase,
|
|
52
56
|
checkboxVariants: () => checkboxVariants,
|
|
57
|
+
clipboardTriggerBase: () => clipboardTriggerBase,
|
|
53
58
|
cn: () => cn,
|
|
59
|
+
codeBlockBodyBase: () => codeBlockBodyBase,
|
|
60
|
+
codeBlockBodyScrollableBase: () => codeBlockBodyScrollableBase,
|
|
61
|
+
codeBlockContentBase: () => codeBlockContentBase,
|
|
62
|
+
codeBlockCopyFloatBase: () => codeBlockCopyFloatBase,
|
|
63
|
+
codeBlockHeaderBase: () => codeBlockHeaderBase,
|
|
64
|
+
codeBlockHeaderInfoBase: () => codeBlockHeaderInfoBase,
|
|
65
|
+
codeBlockHighlightBase: () => codeBlockHighlightBase,
|
|
66
|
+
codeBlockLineNumbersBase: () => codeBlockLineNumbersBase,
|
|
67
|
+
codeBlockLoadingBase: () => codeBlockLoadingBase,
|
|
68
|
+
codeBlockRootBase: () => codeBlockRootBase,
|
|
69
|
+
codeBlockSpinnerBase: () => codeBlockSpinnerBase,
|
|
70
|
+
codeBlockTitleBase: () => codeBlockTitleBase,
|
|
54
71
|
colBase: () => colBase,
|
|
55
72
|
comboboxClearTriggerBase: () => comboboxClearTriggerBase,
|
|
56
73
|
comboboxContentBase: () => comboboxContentBase,
|
|
@@ -64,6 +81,7 @@ __export(index_exports, {
|
|
|
64
81
|
comboboxPositionerBase: () => comboboxPositionerBase,
|
|
65
82
|
comboboxTriggerBase: () => comboboxTriggerBase,
|
|
66
83
|
containerBase: () => containerBase,
|
|
84
|
+
defaultChartColor: () => defaultChartColor,
|
|
67
85
|
dialogBackdropBase: () => dialogBackdropBase,
|
|
68
86
|
dialogCloseTriggerBase: () => dialogCloseTriggerBase,
|
|
69
87
|
dialogContentBase: () => dialogContentBase,
|
|
@@ -75,6 +93,11 @@ __export(index_exports, {
|
|
|
75
93
|
dialogHeaderStickyBase: () => dialogHeaderStickyBase,
|
|
76
94
|
dialogPositionerBase: () => dialogPositionerBase,
|
|
77
95
|
dialogTitleBase: () => dialogTitleBase,
|
|
96
|
+
extractYouTubeId: () => extractYouTubeId,
|
|
97
|
+
feedbackCorrectBase: () => feedbackCorrectBase,
|
|
98
|
+
feedbackExplanationBase: () => feedbackExplanationBase,
|
|
99
|
+
feedbackIncorrectBase: () => feedbackIncorrectBase,
|
|
100
|
+
fetchYouTubeMetadata: () => fetchYouTubeMetadata,
|
|
78
101
|
fieldErrorBase: () => fieldErrorBase,
|
|
79
102
|
fieldHelperBase: () => fieldHelperBase,
|
|
80
103
|
fieldLabelBase: () => fieldLabelBase,
|
|
@@ -84,9 +107,24 @@ __export(index_exports, {
|
|
|
84
107
|
fieldsetHelperBase: () => fieldsetHelperBase,
|
|
85
108
|
fieldsetLegendBase: () => fieldsetLegendBase,
|
|
86
109
|
fieldsetRootBase: () => fieldsetRootBase,
|
|
110
|
+
figureCaptionBase: () => figureCaptionBase,
|
|
111
|
+
figureImageBase: () => figureImageBase,
|
|
112
|
+
figureRootBase: () => figureRootBase,
|
|
113
|
+
formatTime: () => formatTime,
|
|
87
114
|
hstackBase: () => hstackBase,
|
|
115
|
+
injectCodeBlockStyles: () => injectCodeBlockStyles,
|
|
88
116
|
inputVariants: () => inputVariants,
|
|
89
117
|
itemVariants: () => itemVariants,
|
|
118
|
+
latexDisplayBase: () => latexDisplayBase,
|
|
119
|
+
latexErrorBase: () => latexErrorBase,
|
|
120
|
+
latexInlineBase: () => latexInlineBase,
|
|
121
|
+
latexRootBase: () => latexRootBase,
|
|
122
|
+
manimCaptionBase: () => manimCaptionBase,
|
|
123
|
+
manimContainerBase: () => manimContainerBase,
|
|
124
|
+
manimErrorBase: () => manimErrorBase,
|
|
125
|
+
manimPlaceholderBase: () => manimPlaceholderBase,
|
|
126
|
+
manimPlaceholderLabelBase: () => manimPlaceholderLabelBase,
|
|
127
|
+
manimRootBase: () => manimRootBase,
|
|
90
128
|
mermaidLoadingBase: () => mermaidLoadingBase,
|
|
91
129
|
mermaidRootBase: () => mermaidRootBase,
|
|
92
130
|
mermaidSourceBase: () => mermaidSourceBase,
|
|
@@ -121,6 +159,9 @@ __export(index_exports, {
|
|
|
121
159
|
navbarShrunkBase: () => navbarShrunkBase,
|
|
122
160
|
navbarTriggerVariants: () => navbarTriggerVariants,
|
|
123
161
|
navbarVariants: () => navbarVariants,
|
|
162
|
+
noticeDescriptionBase: () => noticeDescriptionBase,
|
|
163
|
+
noticeTitleBase: () => noticeTitleBase,
|
|
164
|
+
noticeVariants: () => noticeVariants,
|
|
124
165
|
numberInputControlBase: () => numberInputControlBase,
|
|
125
166
|
numberInputInputBase: () => numberInputInputBase,
|
|
126
167
|
numberInputRootBase: () => numberInputRootBase,
|
|
@@ -136,6 +177,7 @@ __export(index_exports, {
|
|
|
136
177
|
paginationItemBase: () => paginationItemBase,
|
|
137
178
|
paginationRootBase: () => paginationRootBase,
|
|
138
179
|
paginationTriggerBase: () => paginationTriggerBase,
|
|
180
|
+
parseYouTubeChapters: () => parseYouTubeChapters,
|
|
139
181
|
popoverArrowBase: () => popoverArrowBase,
|
|
140
182
|
popoverCloseTriggerBase: () => popoverCloseTriggerBase,
|
|
141
183
|
popoverContentBase: () => popoverContentBase,
|
|
@@ -143,8 +185,41 @@ __export(index_exports, {
|
|
|
143
185
|
popoverIndicatorBase: () => popoverIndicatorBase,
|
|
144
186
|
popoverPositionerBase: () => popoverPositionerBase,
|
|
145
187
|
popoverTitleBase: () => popoverTitleBase,
|
|
188
|
+
prevNextDirectionBase: () => prevNextDirectionBase,
|
|
189
|
+
prevNextLinkBase: () => prevNextLinkBase,
|
|
190
|
+
prevNextLinkNextBase: () => prevNextLinkNextBase,
|
|
191
|
+
prevNextRootBase: () => prevNextRootBase,
|
|
192
|
+
prevNextSpacerBase: () => prevNextSpacerBase,
|
|
193
|
+
prevNextTitleBase: () => prevNextTitleBase,
|
|
194
|
+
questionCardBase: () => questionCardBase,
|
|
195
|
+
questionCheckButtonBase: () => questionCheckButtonBase,
|
|
196
|
+
questionGroupBase: () => questionGroupBase,
|
|
197
|
+
questionInputBase: () => questionInputBase,
|
|
198
|
+
questionOptionBase: () => questionOptionBase,
|
|
199
|
+
questionOptionCorrectBase: () => questionOptionCorrectBase,
|
|
200
|
+
questionOptionIncorrectBase: () => questionOptionIncorrectBase,
|
|
201
|
+
questionPromptBase: () => questionPromptBase,
|
|
202
|
+
questionUnitBase: () => questionUnitBase,
|
|
203
|
+
quizHeaderBase: () => quizHeaderBase,
|
|
204
|
+
quizResetButtonBase: () => quizResetButtonBase,
|
|
205
|
+
quizResultBase: () => quizResultBase,
|
|
206
|
+
quizResultTextBase: () => quizResultTextBase,
|
|
207
|
+
quizResultTitleBase: () => quizResultTitleBase,
|
|
208
|
+
quizRootBase: () => quizRootBase,
|
|
209
|
+
quizScoreBase: () => quizScoreBase,
|
|
210
|
+
quizSubmitButtonBase: () => quizSubmitButtonBase,
|
|
211
|
+
quizTitleBase: () => quizTitleBase,
|
|
212
|
+
radioGroupItemControlBase: () => radioGroupItemControlBase,
|
|
213
|
+
radioGroupItemTextBase: () => radioGroupItemTextBase,
|
|
214
|
+
radioGroupRootBase: () => radioGroupRootBase,
|
|
215
|
+
renderChartSvgString: () => renderChartSvgString,
|
|
216
|
+
renderCodeToHtml: () => renderCodeToHtml,
|
|
146
217
|
renderMermaidSource: () => renderMermaidSource,
|
|
147
218
|
resolveMermaidThemeVariables: () => resolveMermaidThemeVariables,
|
|
219
|
+
revealChevronBase: () => revealChevronBase,
|
|
220
|
+
revealContentBase: () => revealContentBase,
|
|
221
|
+
revealRootBase: () => revealRootBase,
|
|
222
|
+
revealTriggerBase: () => revealTriggerBase,
|
|
148
223
|
rowBase: () => rowBase,
|
|
149
224
|
scrollContentBase: () => scrollContentBase,
|
|
150
225
|
scrollCornerBase: () => scrollCornerBase,
|
|
@@ -190,6 +265,7 @@ __export(index_exports, {
|
|
|
190
265
|
tagsInputItemTextBase: () => tagsInputItemTextBase,
|
|
191
266
|
tagsInputRootBase: () => tagsInputRootBase,
|
|
192
267
|
textareaBase: () => textareaBase,
|
|
268
|
+
toLaTeX: () => toLaTeX,
|
|
193
269
|
toggleButtonVariants: () => toggleButtonVariants,
|
|
194
270
|
tooltipArrowBase: () => tooltipArrowBase,
|
|
195
271
|
tooltipContentBase: () => tooltipContentBase,
|
|
@@ -204,7 +280,20 @@ __export(index_exports, {
|
|
|
204
280
|
windowPositionerBase: () => windowPositionerBase,
|
|
205
281
|
windowResizeTriggerBase: () => windowResizeTriggerBase,
|
|
206
282
|
windowStageTriggerBase: () => windowStageTriggerBase,
|
|
207
|
-
windowTitleBase: () => windowTitleBase
|
|
283
|
+
windowTitleBase: () => windowTitleBase,
|
|
284
|
+
youtubeChapterButtonBase: () => youtubeChapterButtonBase,
|
|
285
|
+
youtubeChapterLabelBase: () => youtubeChapterLabelBase,
|
|
286
|
+
youtubeChapterTimeBase: () => youtubeChapterTimeBase,
|
|
287
|
+
youtubeChaptersBase: () => youtubeChaptersBase,
|
|
288
|
+
youtubeChaptersChevronBase: () => youtubeChaptersChevronBase,
|
|
289
|
+
youtubeChaptersListBase: () => youtubeChaptersListBase,
|
|
290
|
+
youtubeChaptersSummaryBase: () => youtubeChaptersSummaryBase,
|
|
291
|
+
youtubeDescriptionBase: () => youtubeDescriptionBase,
|
|
292
|
+
youtubeFacadeBase: () => youtubeFacadeBase,
|
|
293
|
+
youtubePlayButtonBase: () => youtubePlayButtonBase,
|
|
294
|
+
youtubePlayButtonInnerBase: () => youtubePlayButtonInnerBase,
|
|
295
|
+
youtubeRootBase: () => youtubeRootBase,
|
|
296
|
+
youtubeTitleBase: () => youtubeTitleBase
|
|
208
297
|
});
|
|
209
298
|
module.exports = __toCommonJS(index_exports);
|
|
210
299
|
|
|
@@ -1017,6 +1106,306 @@ async function renderMermaidSource(code) {
|
|
|
1017
1106
|
const { svg } = await mermaid.render(`helix-mmd-${Date.now()}-${mermaidSeq++}`, code);
|
|
1018
1107
|
return svg;
|
|
1019
1108
|
}
|
|
1109
|
+
|
|
1110
|
+
// src/clipboard.ts
|
|
1111
|
+
var clipboardTriggerBase = "inline-flex h-7 w-7 shrink-0 items-center justify-center gap-1.5 rounded-md text-xs text-muted-foreground transition-colors hover:bg-background hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring [&_svg]:size-3.5 [&_svg]:shrink-0";
|
|
1112
|
+
|
|
1113
|
+
// src/radio-group.ts
|
|
1114
|
+
var radioGroupRootBase = "flex flex-col gap-2";
|
|
1115
|
+
var radioGroupItemControlBase = "relative inline-flex size-4 shrink-0 items-center justify-center rounded-full border border-input bg-transparent shadow-xs transition-shadow focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/30 focus-visible:ring-offset-1 focus-visible:ring-offset-background data-invalid:border-destructive data-invalid:ring-[3px] data-invalid:ring-destructive/24 data-[state=checked]:border-primary data-[state=checked]:text-primary disabled:pointer-events-none disabled:opacity-50";
|
|
1116
|
+
var radioGroupItemTextBase = "select-none text-sm font-medium leading-none";
|
|
1117
|
+
|
|
1118
|
+
// src/notice.ts
|
|
1119
|
+
var import_class_variance_authority16 = require("class-variance-authority");
|
|
1120
|
+
var noticeVariants = (0, import_class_variance_authority16.cva)(
|
|
1121
|
+
"not-prose relative my-4 grid w-full items-center gap-y-0.5 rounded-lg border px-3 py-2.5 text-sm grid-cols-[0_1fr] has-[>svg]:grid-cols-[calc(var(--spacing)*3)_1fr] has-[>svg]:gap-x-2.5 [&>svg]:size-4",
|
|
1122
|
+
{
|
|
1123
|
+
variants: {
|
|
1124
|
+
variant: {
|
|
1125
|
+
none: "bg-card text-card-foreground",
|
|
1126
|
+
info: "border-info/30 bg-info/5 [&>svg]:text-info",
|
|
1127
|
+
success: "border-success/30 bg-success/5 [&>svg]:text-success",
|
|
1128
|
+
warning: "border-warn/30 bg-warn/5 [&>svg]:text-warn",
|
|
1129
|
+
error: "border-danger/30 bg-danger/5 [&>svg]:text-danger"
|
|
1130
|
+
}
|
|
1131
|
+
},
|
|
1132
|
+
defaultVariants: {
|
|
1133
|
+
variant: "info"
|
|
1134
|
+
}
|
|
1135
|
+
}
|
|
1136
|
+
);
|
|
1137
|
+
var noticeTitleBase = "col-start-2 min-h-4 font-semibold tracking-tight";
|
|
1138
|
+
var noticeDescriptionBase = "col-start-2 text-sm text-foreground [&_p]:leading-relaxed";
|
|
1139
|
+
|
|
1140
|
+
// src/figure.ts
|
|
1141
|
+
var figureRootBase = "not-prose my-4 flex flex-col items-center";
|
|
1142
|
+
var figureImageBase = "rounded-lg border border-border";
|
|
1143
|
+
var figureCaptionBase = "mt-2 text-center text-sm text-muted-foreground";
|
|
1144
|
+
|
|
1145
|
+
// src/reveal.ts
|
|
1146
|
+
var revealRootBase = "not-prose my-4 overflow-hidden rounded-lg border border-border bg-muted/40";
|
|
1147
|
+
var revealTriggerBase = "flex w-full cursor-pointer items-center gap-2 px-3 py-2.5 text-sm font-semibold";
|
|
1148
|
+
var revealChevronBase = "size-4 shrink-0 text-muted-foreground transition-transform duration-200 data-[state=open]:rotate-90";
|
|
1149
|
+
var revealContentBase = "border-t border-border px-3 py-2.5 text-sm text-foreground";
|
|
1150
|
+
|
|
1151
|
+
// src/prevnext.ts
|
|
1152
|
+
var prevNextRootBase = "not-prose mt-8 flex flex-col gap-3 border-t border-border pt-6 sm:flex-row sm:justify-between";
|
|
1153
|
+
var prevNextLinkBase = "group flex min-w-0 flex-1 flex-col rounded-lg border border-border px-4 py-3 no-underline transition-colors hover:border-primary";
|
|
1154
|
+
var prevNextLinkNextBase = "items-end text-right";
|
|
1155
|
+
var prevNextDirectionBase = "text-xs font-medium text-muted-foreground";
|
|
1156
|
+
var prevNextTitleBase = "truncate text-sm font-medium text-foreground transition-colors group-hover:text-primary";
|
|
1157
|
+
var prevNextSpacerBase = "flex-1";
|
|
1158
|
+
|
|
1159
|
+
// src/latex.ts
|
|
1160
|
+
var import_katex = __toESM(require("katex"), 1);
|
|
1161
|
+
var latexRootBase = "not-prose";
|
|
1162
|
+
var latexDisplayBase = "my-4 block w-full overflow-x-auto py-1";
|
|
1163
|
+
var latexInlineBase = "inline-block align-middle";
|
|
1164
|
+
var latexErrorBase = "font-mono text-sm text-destructive";
|
|
1165
|
+
function toLaTeX(latex, opts) {
|
|
1166
|
+
return import_katex.default.renderToString(latex, {
|
|
1167
|
+
displayMode: opts?.displayMode ?? false,
|
|
1168
|
+
throwOnError: false,
|
|
1169
|
+
strict: false
|
|
1170
|
+
});
|
|
1171
|
+
}
|
|
1172
|
+
|
|
1173
|
+
// src/code-block.ts
|
|
1174
|
+
var codeBlockRootBase = "not-prose my-4 overflow-hidden rounded-lg border";
|
|
1175
|
+
var codeBlockHeaderBase = "flex h-10 items-center justify-between gap-2 border-b bg-muted/50 px-4";
|
|
1176
|
+
var codeBlockHeaderInfoBase = "flex min-w-0 items-center gap-2 text-muted-foreground";
|
|
1177
|
+
var codeBlockTitleBase = "min-w-0 truncate font-mono text-xs";
|
|
1178
|
+
var codeBlockBodyBase = "hx-cb relative overflow-x-auto bg-background";
|
|
1179
|
+
var codeBlockBodyScrollableBase = "overflow-y-auto";
|
|
1180
|
+
var codeBlockContentBase = "text-sm [&>pre]:p-4 [&_.line]:leading-[1.7]";
|
|
1181
|
+
var codeBlockLineNumbersBase = "cbln";
|
|
1182
|
+
var codeBlockHighlightBase = "cbhl";
|
|
1183
|
+
var codeBlockLoadingBase = "flex h-16 items-center justify-center";
|
|
1184
|
+
var codeBlockSpinnerBase = "h-4 w-4 animate-spin rounded-full border-2 border-muted-foreground border-t-transparent";
|
|
1185
|
+
var codeBlockCopyFloatBase = "absolute right-2 top-2";
|
|
1186
|
+
var CODE_BLOCK_STYLES = `
|
|
1187
|
+
.hx-cb pre.shiki{margin:0!important;border:0!important;border-radius:0!important;background:transparent!important}
|
|
1188
|
+
.hx-cb pre.shiki code{border:0!important;border-radius:0!important;background:transparent!important;padding:0!important}
|
|
1189
|
+
:root.dark .hx-cb .shiki,
|
|
1190
|
+
:root.dark .hx-cb .shiki span{color:var(--shiki-dark)!important;font-style:var(--shiki-dark-font-style)!important;font-weight:var(--shiki-dark-font-weight)!important;text-decoration:var(--shiki-dark-text-decoration)!important}
|
|
1191
|
+
.hx-cb .cbln code{counter-reset:line;counter-increment:line 0}
|
|
1192
|
+
.hx-cb .cbln .line::before{content:counter(line);counter-increment:line;display:inline-block;min-width:1.5rem;padding-right:.75rem;margin-right:1rem;text-align:right;font-size:.75rem;line-height:1.7;user-select:none;color:color-mix(in srgb,var(--muted-foreground,#888) 55%,transparent)}
|
|
1193
|
+
.hx-cb .cbhl .line-highlighted{display:block;background-color:oklch(0.828 0.189 84.429/.12);border-left:2px solid oklch(0.769 0.188 70.08);margin:0 -1rem;padding:0 1rem}
|
|
1194
|
+
`;
|
|
1195
|
+
function injectCodeBlockStyles() {
|
|
1196
|
+
if (typeof document === "undefined") return;
|
|
1197
|
+
if (document.getElementById("hx-code-block")) return;
|
|
1198
|
+
const el = document.createElement("style");
|
|
1199
|
+
el.id = "hx-code-block";
|
|
1200
|
+
el.textContent = CODE_BLOCK_STYLES;
|
|
1201
|
+
document.head.appendChild(el);
|
|
1202
|
+
}
|
|
1203
|
+
function escapeHtml(s) {
|
|
1204
|
+
return s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
1205
|
+
}
|
|
1206
|
+
function plaintextFallback(code) {
|
|
1207
|
+
const lines = code.split("\n").map((l) => `<span class="line">${escapeHtml(l)}</span>`).join("\n");
|
|
1208
|
+
return `<pre class="shiki" tabindex="-1"><code>${lines}</code></pre>`;
|
|
1209
|
+
}
|
|
1210
|
+
async function renderCodeToHtml(code, language, highlightLines) {
|
|
1211
|
+
injectCodeBlockStyles();
|
|
1212
|
+
try {
|
|
1213
|
+
const { codeToHtml } = await import("shiki/bundle/full");
|
|
1214
|
+
return await codeToHtml(code, {
|
|
1215
|
+
lang: language,
|
|
1216
|
+
themes: { light: "github-light", dark: "github-dark" },
|
|
1217
|
+
tabindex: false,
|
|
1218
|
+
transformers: [
|
|
1219
|
+
{
|
|
1220
|
+
pre(node) {
|
|
1221
|
+
if (node.properties?.["style"]) {
|
|
1222
|
+
node.properties["style"] = node.properties["style"].replace(/background-color:\s*[^;]+;?\s*/gi, "").replace(/--shiki-dark-bg:\s*[^;]+;?\s*/gi, "");
|
|
1223
|
+
}
|
|
1224
|
+
},
|
|
1225
|
+
line(node, line) {
|
|
1226
|
+
if (highlightLines?.includes(line)) {
|
|
1227
|
+
this.addClassToHast(node, "line-highlighted");
|
|
1228
|
+
}
|
|
1229
|
+
}
|
|
1230
|
+
}
|
|
1231
|
+
]
|
|
1232
|
+
});
|
|
1233
|
+
} catch {
|
|
1234
|
+
return plaintextFallback(code);
|
|
1235
|
+
}
|
|
1236
|
+
}
|
|
1237
|
+
|
|
1238
|
+
// src/manim.ts
|
|
1239
|
+
var manimRootBase = "not-prose my-4";
|
|
1240
|
+
var manimContainerBase = "relative w-full overflow-hidden rounded-lg border border-border [&_canvas]:!h-auto [&_canvas]:!max-w-full";
|
|
1241
|
+
var manimPlaceholderBase = "flex w-full items-center justify-center bg-muted/40";
|
|
1242
|
+
var manimPlaceholderLabelBase = "text-sm text-muted-foreground";
|
|
1243
|
+
var manimErrorBase = "flex items-center justify-center border-destructive/50 bg-destructive/5 p-6 text-sm text-destructive";
|
|
1244
|
+
var manimCaptionBase = "mt-2 text-center text-sm text-muted-foreground";
|
|
1245
|
+
|
|
1246
|
+
// src/youtube.ts
|
|
1247
|
+
var youtubeRootBase = "not-prose my-4";
|
|
1248
|
+
var youtubeTitleBase = "mb-2 text-lg font-semibold text-foreground";
|
|
1249
|
+
var youtubeFacadeBase = "group relative aspect-video w-full cursor-pointer overflow-hidden rounded-md border border-border bg-muted/40";
|
|
1250
|
+
var youtubePlayButtonBase = "absolute inset-0 flex items-center justify-center";
|
|
1251
|
+
var youtubePlayButtonInnerBase = "flex items-center justify-center rounded-xl bg-red-600 px-4 py-2 text-white shadow-lg transition-transform group-hover:scale-105";
|
|
1252
|
+
var youtubeDescriptionBase = "mt-2 text-sm text-muted-foreground";
|
|
1253
|
+
var youtubeChaptersBase = "group mt-3 rounded-lg border border-border bg-muted/40";
|
|
1254
|
+
var youtubeChaptersSummaryBase = "flex cursor-pointer list-none items-center gap-2 px-3 py-2.5 text-sm font-medium [&::-webkit-details-marker]:hidden";
|
|
1255
|
+
var youtubeChaptersChevronBase = "size-4 shrink-0 text-muted-foreground transition-transform duration-200 group-open:rotate-90";
|
|
1256
|
+
var youtubeChaptersListBase = "border-t border-border px-2 py-2";
|
|
1257
|
+
var youtubeChapterButtonBase = "inline-flex w-full items-center gap-2 rounded-md px-2 py-1 text-left text-sm transition-colors hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring";
|
|
1258
|
+
var youtubeChapterTimeBase = "font-mono text-xs text-primary";
|
|
1259
|
+
var youtubeChapterLabelBase = "text-foreground";
|
|
1260
|
+
function extractYouTubeId(raw) {
|
|
1261
|
+
try {
|
|
1262
|
+
const url = new URL(raw);
|
|
1263
|
+
const v = url.searchParams.get("v");
|
|
1264
|
+
if (v) return v;
|
|
1265
|
+
if (url.hostname === "youtu.be") return url.pathname.slice(1);
|
|
1266
|
+
} catch {
|
|
1267
|
+
}
|
|
1268
|
+
return raw;
|
|
1269
|
+
}
|
|
1270
|
+
function formatTime(seconds) {
|
|
1271
|
+
const h = Math.floor(seconds / 3600);
|
|
1272
|
+
const m = Math.floor(seconds % 3600 / 60);
|
|
1273
|
+
const s = Math.floor(seconds % 60);
|
|
1274
|
+
const mm = String(m).padStart(2, "0");
|
|
1275
|
+
const ss = String(s).padStart(2, "0");
|
|
1276
|
+
return h > 0 ? `${h}:${mm}:${ss}` : `${mm}:${ss}`;
|
|
1277
|
+
}
|
|
1278
|
+
var TIMESTAMP_RE = /^\s*\[?\(?(?:(\d+):)?(\d{1,2}):(\d{2})\)?\]?\s+(\S.*)$/;
|
|
1279
|
+
function parseYouTubeChapters(description) {
|
|
1280
|
+
return description.split("\n").map((line) => {
|
|
1281
|
+
const m = TIMESTAMP_RE.exec(line);
|
|
1282
|
+
if (!m) return null;
|
|
1283
|
+
const hours = m[1] ? Number(m[1]) : 0;
|
|
1284
|
+
const t = hours * 3600 + Number(m[2]) * 60 + Number(m[3]);
|
|
1285
|
+
return { t, label: m[4] };
|
|
1286
|
+
}).filter((c) => c !== null);
|
|
1287
|
+
}
|
|
1288
|
+
async function fetchYouTubeMetadata(url) {
|
|
1289
|
+
const videoId = extractYouTubeId(url);
|
|
1290
|
+
const res = await fetch(
|
|
1291
|
+
`https://noembed.com/embed?url=${encodeURIComponent(`https://www.youtube.com/watch?v=${videoId}`)}`
|
|
1292
|
+
);
|
|
1293
|
+
if (!res.ok) return {};
|
|
1294
|
+
const data = await res.json();
|
|
1295
|
+
return { title: data.title, description: data.description };
|
|
1296
|
+
}
|
|
1297
|
+
|
|
1298
|
+
// src/chart.ts
|
|
1299
|
+
var import_charts = require("@tanstack/charts");
|
|
1300
|
+
var import_polar = require("@tanstack/charts/polar");
|
|
1301
|
+
var import_linear = require("@tanstack/charts/scales/linear");
|
|
1302
|
+
var import_ordinal = require("@tanstack/charts/scales/ordinal");
|
|
1303
|
+
var import_point = require("@tanstack/charts/scales/point");
|
|
1304
|
+
var import_tooltip = require("@tanstack/charts/tooltip");
|
|
1305
|
+
var chartRootBase = "not-prose my-4";
|
|
1306
|
+
var chartPlaceholderBase = "flex items-center justify-center rounded-md border border-border bg-muted/40";
|
|
1307
|
+
var chartPlaceholderLabelBase = "text-sm text-muted-foreground";
|
|
1308
|
+
function defaultChartColor(index) {
|
|
1309
|
+
return `var(--chart-${index % 5 + 1})`;
|
|
1310
|
+
}
|
|
1311
|
+
var COLOR_TOKENS = ["var(--chart-1)", "var(--chart-2)", "var(--chart-3)", "var(--chart-4)", "var(--chart-5)"];
|
|
1312
|
+
function buildChartDefinition(props) {
|
|
1313
|
+
const {
|
|
1314
|
+
type,
|
|
1315
|
+
data,
|
|
1316
|
+
series,
|
|
1317
|
+
xKey = "name",
|
|
1318
|
+
nameKey = "name",
|
|
1319
|
+
showLegend = true,
|
|
1320
|
+
showGrid = true,
|
|
1321
|
+
showAxis = true
|
|
1322
|
+
} = props;
|
|
1323
|
+
const colors = series.map((s, i) => s.color ?? COLOR_TOKENS[i % COLOR_TOKENS.length]);
|
|
1324
|
+
if (type === "pie") {
|
|
1325
|
+
const valueKey = series[0]?.key ?? "value";
|
|
1326
|
+
const slices = (0, import_polar.pie)(data, { value: valueKey });
|
|
1327
|
+
const pieColors = data.map((_, i) => series[0]?.color ?? COLOR_TOKENS[i % COLOR_TOKENS.length]);
|
|
1328
|
+
const spec2 = {
|
|
1329
|
+
marks: [
|
|
1330
|
+
(0, import_polar.polar)({
|
|
1331
|
+
scales: { angle: null, radius: null },
|
|
1332
|
+
radiusRatio: 0.82,
|
|
1333
|
+
marks: [(0, import_polar.radialArc)(slices, { color: nameKey, key: nameKey, cornerRadius: 3 })]
|
|
1334
|
+
})
|
|
1335
|
+
],
|
|
1336
|
+
scales: { x: null, y: null },
|
|
1337
|
+
color: {
|
|
1338
|
+
domain: data.map((d) => String(d[nameKey])),
|
|
1339
|
+
range: pieColors,
|
|
1340
|
+
legend: showLegend ? (0, import_charts.colorLegend)({}) : void 0
|
|
1341
|
+
},
|
|
1342
|
+
tooltip: import_tooltip.tooltip
|
|
1343
|
+
};
|
|
1344
|
+
return (0, import_charts.defineChart)(spec2);
|
|
1345
|
+
}
|
|
1346
|
+
const rows = data.flatMap(
|
|
1347
|
+
(row) => series.map((s) => ({
|
|
1348
|
+
...row,
|
|
1349
|
+
_series: s.label ?? s.key,
|
|
1350
|
+
_value: Number(row[s.key])
|
|
1351
|
+
}))
|
|
1352
|
+
);
|
|
1353
|
+
const markOpts = { x: xKey, y: "_value", z: "_series" };
|
|
1354
|
+
const mark = type === "bar" ? (0, import_charts.barY)(rows, { ...markOpts, fillOpacity: 0.85 }) : type === "area" ? (0, import_charts.areaY)(rows, { ...markOpts, fillOpacity: 0.15 }) : (0, import_charts.lineY)(rows, { ...markOpts, strokeWidth: 2 });
|
|
1355
|
+
const spec = {
|
|
1356
|
+
marks: [mark],
|
|
1357
|
+
scales: {
|
|
1358
|
+
x: { scale: () => (0, import_point.scalePoint)().padding(0.4), axis: showAxis ? {} : void 0 },
|
|
1359
|
+
y: {
|
|
1360
|
+
scale: import_linear.scaleLinear,
|
|
1361
|
+
nice: true,
|
|
1362
|
+
grid: showGrid,
|
|
1363
|
+
axis: showAxis ? { ticks: { count: 5 } } : void 0
|
|
1364
|
+
}
|
|
1365
|
+
},
|
|
1366
|
+
color: {
|
|
1367
|
+
scale: () => (0, import_ordinal.scaleOrdinal)().range(colors),
|
|
1368
|
+
domain: series.map((s) => s.label ?? s.key),
|
|
1369
|
+
legend: showLegend ? (0, import_charts.colorLegend)({}) : void 0
|
|
1370
|
+
},
|
|
1371
|
+
tooltip: import_tooltip.tooltip
|
|
1372
|
+
};
|
|
1373
|
+
return (0, import_charts.defineChart)(spec);
|
|
1374
|
+
}
|
|
1375
|
+
function renderChartSvgString(props, opts = {}) {
|
|
1376
|
+
const { width = 720, height = props.height ?? 400, ariaLabel = "Chart" } = opts;
|
|
1377
|
+
const definition = buildChartDefinition(props);
|
|
1378
|
+
const runtime = (0, import_charts.createChartRuntime)();
|
|
1379
|
+
try {
|
|
1380
|
+
const scene = runtime.render(definition, { width, height });
|
|
1381
|
+
return (0, import_charts.renderChartSvg)(scene, { ariaLabel, idPrefix: "hx-chart" });
|
|
1382
|
+
} finally {
|
|
1383
|
+
runtime.destroy();
|
|
1384
|
+
}
|
|
1385
|
+
}
|
|
1386
|
+
|
|
1387
|
+
// src/question.ts
|
|
1388
|
+
var questionCardBase = "not-prose my-4 rounded-lg border border-border bg-card p-4";
|
|
1389
|
+
var questionPromptBase = "mb-3 text-sm font-medium text-foreground";
|
|
1390
|
+
var questionGroupBase = "grid gap-2";
|
|
1391
|
+
var questionOptionBase = "rounded-md px-3 py-2 transition-colors hover:bg-muted/60";
|
|
1392
|
+
var questionOptionCorrectBase = "bg-success/10";
|
|
1393
|
+
var questionOptionIncorrectBase = "bg-destructive/10";
|
|
1394
|
+
var questionCheckButtonBase = "mt-3 rounded-md bg-primary px-3 py-1.5 text-sm font-medium text-primary-foreground transition-colors hover:bg-primary/90 focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50";
|
|
1395
|
+
var questionInputBase = "h-9 w-32 rounded-md border border-input bg-background px-3 text-sm text-foreground focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/50 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50";
|
|
1396
|
+
var questionUnitBase = "text-sm text-muted-foreground";
|
|
1397
|
+
var feedbackCorrectBase = "text-success";
|
|
1398
|
+
var feedbackIncorrectBase = "text-destructive";
|
|
1399
|
+
var feedbackExplanationBase = "mt-1.5 text-sm text-muted-foreground";
|
|
1400
|
+
var quizRootBase = "not-prose my-6 rounded-lg border border-border bg-card/50 p-4";
|
|
1401
|
+
var quizHeaderBase = "mb-4 flex items-center justify-between gap-3";
|
|
1402
|
+
var quizTitleBase = "text-base font-semibold text-foreground";
|
|
1403
|
+
var quizScoreBase = "inline-flex items-center rounded-full bg-muted px-2.5 py-0.5 text-xs font-medium text-muted-foreground";
|
|
1404
|
+
var quizResultBase = "mt-4 rounded-lg border border-border bg-muted/40 p-4";
|
|
1405
|
+
var quizResultTitleBase = "text-lg font-semibold text-foreground";
|
|
1406
|
+
var quizResultTextBase = "mt-1 text-sm text-muted-foreground";
|
|
1407
|
+
var quizSubmitButtonBase = "rounded-md bg-primary px-3 py-1.5 text-sm font-medium text-primary-foreground transition-colors hover:bg-primary/90 focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50";
|
|
1408
|
+
var quizResetButtonBase = "inline-flex items-center gap-1.5 rounded-md border border-border bg-background px-3 py-1.5 text-sm font-medium text-foreground transition-colors hover:bg-muted focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2";
|
|
1020
1409
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1021
1410
|
0 && (module.exports = {
|
|
1022
1411
|
SIDEBAR_KEYBOARD_SHORTCUT,
|
|
@@ -1026,6 +1415,7 @@ async function renderMermaidSource(code) {
|
|
|
1026
1415
|
THEMES,
|
|
1027
1416
|
THEME_NAMES,
|
|
1028
1417
|
badgeVariants,
|
|
1418
|
+
buildChartDefinition,
|
|
1029
1419
|
buttonVariants,
|
|
1030
1420
|
cardBodyBase,
|
|
1031
1421
|
cardCoverVariants,
|
|
@@ -1035,11 +1425,27 @@ async function renderMermaidSource(code) {
|
|
|
1035
1425
|
cardTitleBase,
|
|
1036
1426
|
cardVariants,
|
|
1037
1427
|
centerBase,
|
|
1428
|
+
chartPlaceholderBase,
|
|
1429
|
+
chartPlaceholderLabelBase,
|
|
1430
|
+
chartRootBase,
|
|
1038
1431
|
checkboxGroupBase,
|
|
1039
1432
|
checkboxIndicatorBase,
|
|
1040
1433
|
checkboxLabelBase,
|
|
1041
1434
|
checkboxVariants,
|
|
1435
|
+
clipboardTriggerBase,
|
|
1042
1436
|
cn,
|
|
1437
|
+
codeBlockBodyBase,
|
|
1438
|
+
codeBlockBodyScrollableBase,
|
|
1439
|
+
codeBlockContentBase,
|
|
1440
|
+
codeBlockCopyFloatBase,
|
|
1441
|
+
codeBlockHeaderBase,
|
|
1442
|
+
codeBlockHeaderInfoBase,
|
|
1443
|
+
codeBlockHighlightBase,
|
|
1444
|
+
codeBlockLineNumbersBase,
|
|
1445
|
+
codeBlockLoadingBase,
|
|
1446
|
+
codeBlockRootBase,
|
|
1447
|
+
codeBlockSpinnerBase,
|
|
1448
|
+
codeBlockTitleBase,
|
|
1043
1449
|
colBase,
|
|
1044
1450
|
comboboxClearTriggerBase,
|
|
1045
1451
|
comboboxContentBase,
|
|
@@ -1053,6 +1459,7 @@ async function renderMermaidSource(code) {
|
|
|
1053
1459
|
comboboxPositionerBase,
|
|
1054
1460
|
comboboxTriggerBase,
|
|
1055
1461
|
containerBase,
|
|
1462
|
+
defaultChartColor,
|
|
1056
1463
|
dialogBackdropBase,
|
|
1057
1464
|
dialogCloseTriggerBase,
|
|
1058
1465
|
dialogContentBase,
|
|
@@ -1064,6 +1471,11 @@ async function renderMermaidSource(code) {
|
|
|
1064
1471
|
dialogHeaderStickyBase,
|
|
1065
1472
|
dialogPositionerBase,
|
|
1066
1473
|
dialogTitleBase,
|
|
1474
|
+
extractYouTubeId,
|
|
1475
|
+
feedbackCorrectBase,
|
|
1476
|
+
feedbackExplanationBase,
|
|
1477
|
+
feedbackIncorrectBase,
|
|
1478
|
+
fetchYouTubeMetadata,
|
|
1067
1479
|
fieldErrorBase,
|
|
1068
1480
|
fieldHelperBase,
|
|
1069
1481
|
fieldLabelBase,
|
|
@@ -1073,9 +1485,24 @@ async function renderMermaidSource(code) {
|
|
|
1073
1485
|
fieldsetHelperBase,
|
|
1074
1486
|
fieldsetLegendBase,
|
|
1075
1487
|
fieldsetRootBase,
|
|
1488
|
+
figureCaptionBase,
|
|
1489
|
+
figureImageBase,
|
|
1490
|
+
figureRootBase,
|
|
1491
|
+
formatTime,
|
|
1076
1492
|
hstackBase,
|
|
1493
|
+
injectCodeBlockStyles,
|
|
1077
1494
|
inputVariants,
|
|
1078
1495
|
itemVariants,
|
|
1496
|
+
latexDisplayBase,
|
|
1497
|
+
latexErrorBase,
|
|
1498
|
+
latexInlineBase,
|
|
1499
|
+
latexRootBase,
|
|
1500
|
+
manimCaptionBase,
|
|
1501
|
+
manimContainerBase,
|
|
1502
|
+
manimErrorBase,
|
|
1503
|
+
manimPlaceholderBase,
|
|
1504
|
+
manimPlaceholderLabelBase,
|
|
1505
|
+
manimRootBase,
|
|
1079
1506
|
mermaidLoadingBase,
|
|
1080
1507
|
mermaidRootBase,
|
|
1081
1508
|
mermaidSourceBase,
|
|
@@ -1110,6 +1537,9 @@ async function renderMermaidSource(code) {
|
|
|
1110
1537
|
navbarShrunkBase,
|
|
1111
1538
|
navbarTriggerVariants,
|
|
1112
1539
|
navbarVariants,
|
|
1540
|
+
noticeDescriptionBase,
|
|
1541
|
+
noticeTitleBase,
|
|
1542
|
+
noticeVariants,
|
|
1113
1543
|
numberInputControlBase,
|
|
1114
1544
|
numberInputInputBase,
|
|
1115
1545
|
numberInputRootBase,
|
|
@@ -1125,6 +1555,7 @@ async function renderMermaidSource(code) {
|
|
|
1125
1555
|
paginationItemBase,
|
|
1126
1556
|
paginationRootBase,
|
|
1127
1557
|
paginationTriggerBase,
|
|
1558
|
+
parseYouTubeChapters,
|
|
1128
1559
|
popoverArrowBase,
|
|
1129
1560
|
popoverCloseTriggerBase,
|
|
1130
1561
|
popoverContentBase,
|
|
@@ -1132,8 +1563,41 @@ async function renderMermaidSource(code) {
|
|
|
1132
1563
|
popoverIndicatorBase,
|
|
1133
1564
|
popoverPositionerBase,
|
|
1134
1565
|
popoverTitleBase,
|
|
1566
|
+
prevNextDirectionBase,
|
|
1567
|
+
prevNextLinkBase,
|
|
1568
|
+
prevNextLinkNextBase,
|
|
1569
|
+
prevNextRootBase,
|
|
1570
|
+
prevNextSpacerBase,
|
|
1571
|
+
prevNextTitleBase,
|
|
1572
|
+
questionCardBase,
|
|
1573
|
+
questionCheckButtonBase,
|
|
1574
|
+
questionGroupBase,
|
|
1575
|
+
questionInputBase,
|
|
1576
|
+
questionOptionBase,
|
|
1577
|
+
questionOptionCorrectBase,
|
|
1578
|
+
questionOptionIncorrectBase,
|
|
1579
|
+
questionPromptBase,
|
|
1580
|
+
questionUnitBase,
|
|
1581
|
+
quizHeaderBase,
|
|
1582
|
+
quizResetButtonBase,
|
|
1583
|
+
quizResultBase,
|
|
1584
|
+
quizResultTextBase,
|
|
1585
|
+
quizResultTitleBase,
|
|
1586
|
+
quizRootBase,
|
|
1587
|
+
quizScoreBase,
|
|
1588
|
+
quizSubmitButtonBase,
|
|
1589
|
+
quizTitleBase,
|
|
1590
|
+
radioGroupItemControlBase,
|
|
1591
|
+
radioGroupItemTextBase,
|
|
1592
|
+
radioGroupRootBase,
|
|
1593
|
+
renderChartSvgString,
|
|
1594
|
+
renderCodeToHtml,
|
|
1135
1595
|
renderMermaidSource,
|
|
1136
1596
|
resolveMermaidThemeVariables,
|
|
1597
|
+
revealChevronBase,
|
|
1598
|
+
revealContentBase,
|
|
1599
|
+
revealRootBase,
|
|
1600
|
+
revealTriggerBase,
|
|
1137
1601
|
rowBase,
|
|
1138
1602
|
scrollContentBase,
|
|
1139
1603
|
scrollCornerBase,
|
|
@@ -1179,6 +1643,7 @@ async function renderMermaidSource(code) {
|
|
|
1179
1643
|
tagsInputItemTextBase,
|
|
1180
1644
|
tagsInputRootBase,
|
|
1181
1645
|
textareaBase,
|
|
1646
|
+
toLaTeX,
|
|
1182
1647
|
toggleButtonVariants,
|
|
1183
1648
|
tooltipArrowBase,
|
|
1184
1649
|
tooltipContentBase,
|
|
@@ -1193,5 +1658,18 @@ async function renderMermaidSource(code) {
|
|
|
1193
1658
|
windowPositionerBase,
|
|
1194
1659
|
windowResizeTriggerBase,
|
|
1195
1660
|
windowStageTriggerBase,
|
|
1196
|
-
windowTitleBase
|
|
1661
|
+
windowTitleBase,
|
|
1662
|
+
youtubeChapterButtonBase,
|
|
1663
|
+
youtubeChapterLabelBase,
|
|
1664
|
+
youtubeChapterTimeBase,
|
|
1665
|
+
youtubeChaptersBase,
|
|
1666
|
+
youtubeChaptersChevronBase,
|
|
1667
|
+
youtubeChaptersListBase,
|
|
1668
|
+
youtubeChaptersSummaryBase,
|
|
1669
|
+
youtubeDescriptionBase,
|
|
1670
|
+
youtubeFacadeBase,
|
|
1671
|
+
youtubePlayButtonBase,
|
|
1672
|
+
youtubePlayButtonInnerBase,
|
|
1673
|
+
youtubeRootBase,
|
|
1674
|
+
youtubeTitleBase
|
|
1197
1675
|
});
|