@superbuilders/incept-renderer 0.1.8 → 0.1.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +537 -14
- package/dist/actions/index.d.ts +4 -1
- package/dist/actions/index.js +65 -6
- package/dist/actions/index.js.map +1 -1
- package/dist/components/index.d.ts +2 -3
- package/dist/components/index.js +43 -28
- package/dist/components/index.js.map +1 -1
- package/dist/index.d.ts +6 -11
- package/dist/index.js +94 -28
- package/dist/index.js.map +1 -1
- package/dist/parser-B8n3iHSM.d.ts +29 -0
- package/dist/qti-stimulus-renderer-CSuLfoff.d.ts +178 -0
- package/dist/{schema-DZoGAQdF.d.ts → schema-DKduufCs.d.ts} +106 -128
- package/dist/styles/duolingo.css +221 -0
- package/dist/styles/duolingo.css.map +1 -0
- package/dist/styles/duolingo.d.ts +2 -0
- package/dist/styles/themes.css +573 -37
- package/dist/styles/themes.css.map +1 -1
- package/dist/types.d.ts +2 -2
- package/package.json +5 -1
- package/dist/types-B7YRTQKt.d.ts +0 -102
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
export { C as ChoiceCorrectness, h as ContentBlockRenderer, a as ContentBlockRendererProps, i as QTIRenderer, Q as QTIRendererProps, b as QTITheme, R as ResponseFeedback } from '../schema-DZoGAQdF.js';
|
|
1
|
+
export { C as ChoiceCorrectness, d as ContentBlockRenderer, a as ContentBlockRendererProps, e as QTIRenderer, Q as QTIRendererProps, f as QTIStimulusRenderer, b as QTIStimulusRendererProps, c as QTITheme, R as ResponseFeedback } from '../qti-stimulus-renderer-CSuLfoff.js';
|
|
3
2
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
|
+
import { C as ChoiceInteraction, A as AssessmentItem, j as DisplayInlineEmbed, l as DisplayTextEmbed, h as DisplayGap } from '../schema-DKduufCs.js';
|
|
4
4
|
import { EvaluationResult } from '../types.js';
|
|
5
5
|
import * as React from 'react';
|
|
6
|
-
import { f as DisplayInlineEmbed, h as DisplayTextEmbed, d as DisplayGap } from '../types-B7YRTQKt.js';
|
|
7
6
|
import 'zod';
|
|
8
7
|
|
|
9
8
|
interface ChoiceInteractionRendererProps {
|
package/dist/components/index.js
CHANGED
|
@@ -29,6 +29,13 @@ var DEFAULT_CONFIG = {
|
|
|
29
29
|
"div",
|
|
30
30
|
"br",
|
|
31
31
|
"hr",
|
|
32
|
+
// Headings
|
|
33
|
+
"h1",
|
|
34
|
+
"h2",
|
|
35
|
+
"h3",
|
|
36
|
+
"h4",
|
|
37
|
+
"h5",
|
|
38
|
+
"h6",
|
|
32
39
|
// Formatting
|
|
33
40
|
"b",
|
|
34
41
|
"i",
|
|
@@ -78,6 +85,9 @@ var DEFAULT_CONFIG = {
|
|
|
78
85
|
"figcaption",
|
|
79
86
|
"blockquote",
|
|
80
87
|
"cite",
|
|
88
|
+
// Interactive
|
|
89
|
+
"details",
|
|
90
|
+
"summary",
|
|
81
91
|
// Links
|
|
82
92
|
"a",
|
|
83
93
|
// Forms (for future interactive elements)
|
|
@@ -345,7 +355,7 @@ var choiceIndicatorVariants = cva(
|
|
|
345
355
|
"data-[state=unchecked]:bg-background data-[state=unchecked]:border-2 data-[state=unchecked]:border-input data-[state=unchecked]:text-muted-foreground",
|
|
346
356
|
"data-[state=checked]:border-2 data-[state=checked]:border-[var(--choice-complement)] data-[state=checked]:text-[var(--choice-foreground)]",
|
|
347
357
|
"data-[filled=true]:data-[state=checked]:bg-[var(--choice-complement)]",
|
|
348
|
-
"data-[filled=true]:data-[state=checked]:shadow-[
|
|
358
|
+
"data-[filled=true]:data-[state=checked]:shadow-[inset_0_0_0_3px_rgb(255_255_255)] dark:data-[filled=true]:data-[state=checked]:shadow-[inset_0_0_0_3px_hsl(var(--background))]",
|
|
349
359
|
"focus-visible:ring-[var(--choice-complement)] focus-visible:ring-[3px]",
|
|
350
360
|
"aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive"
|
|
351
361
|
],
|
|
@@ -374,31 +384,38 @@ function ChoiceIndicator({
|
|
|
374
384
|
letter,
|
|
375
385
|
type = "radio",
|
|
376
386
|
showLetter = true,
|
|
377
|
-
|
|
387
|
+
id,
|
|
388
|
+
value,
|
|
389
|
+
checked,
|
|
390
|
+
onCheckedChange,
|
|
391
|
+
disabled
|
|
378
392
|
}) {
|
|
379
393
|
const baseClassName = cn(choiceIndicatorVariants({ palette }), className);
|
|
380
394
|
if (type === "checkbox") {
|
|
381
|
-
const checkboxProps = props;
|
|
382
395
|
return /* @__PURE__ */ jsx(
|
|
383
396
|
CheckboxPrimitive.Root,
|
|
384
397
|
{
|
|
385
398
|
"data-slot": "choice-indicator",
|
|
386
399
|
"data-palette": palette,
|
|
387
|
-
"data-filled": !showLetter,
|
|
400
|
+
"data-filled": !showLetter ? "true" : void 0,
|
|
388
401
|
className: baseClassName,
|
|
389
|
-
|
|
402
|
+
id,
|
|
403
|
+
checked,
|
|
404
|
+
onCheckedChange,
|
|
405
|
+
disabled,
|
|
390
406
|
children: showLetter && /* @__PURE__ */ jsx("span", { className: "data-[state=unchecked]:block data-[state=checked]:hidden", children: letter })
|
|
391
407
|
}
|
|
392
408
|
);
|
|
393
409
|
}
|
|
394
|
-
const radioProps = props;
|
|
395
410
|
return /* @__PURE__ */ jsx(
|
|
396
411
|
RadioGroupPrimitive.Item,
|
|
397
412
|
{
|
|
398
413
|
"data-slot": "choice-indicator",
|
|
399
414
|
"data-palette": palette,
|
|
400
415
|
className: baseClassName,
|
|
401
|
-
|
|
416
|
+
id,
|
|
417
|
+
value: value ?? "",
|
|
418
|
+
disabled,
|
|
402
419
|
children: letter
|
|
403
420
|
}
|
|
404
421
|
);
|
|
@@ -1751,14 +1768,16 @@ function SortableItem({
|
|
|
1751
1768
|
style,
|
|
1752
1769
|
...attributes,
|
|
1753
1770
|
...listeners,
|
|
1771
|
+
"data-disabled": disabled,
|
|
1772
|
+
"data-dragging": isDragging,
|
|
1754
1773
|
className: cn(
|
|
1755
|
-
"
|
|
1774
|
+
"qti-order-item",
|
|
1756
1775
|
// Styling differs based on orientation
|
|
1757
|
-
isHorizontal ? "
|
|
1758
|
-
disabled ? "cursor-default
|
|
1776
|
+
isHorizontal ? "min-w-[100px] flex items-center justify-center text-center" : "w-full flex items-center gap-3",
|
|
1777
|
+
disabled ? "cursor-default" : "cursor-grab active:cursor-grabbing"
|
|
1759
1778
|
),
|
|
1760
1779
|
children: [
|
|
1761
|
-
!isHorizontal && /* @__PURE__ */ jsx("div", { className: "
|
|
1780
|
+
!isHorizontal && /* @__PURE__ */ jsx("div", { className: "qti-order-item-handle shrink-0", children: /* @__PURE__ */ jsx(DragHandleIcon, {}) }),
|
|
1762
1781
|
/* @__PURE__ */ jsx(HTMLContent, { html: contentHtml })
|
|
1763
1782
|
]
|
|
1764
1783
|
}
|
|
@@ -1768,12 +1787,13 @@ function DragOverlayItem({ contentHtml, isHorizontal }) {
|
|
|
1768
1787
|
return /* @__PURE__ */ jsxs(
|
|
1769
1788
|
"div",
|
|
1770
1789
|
{
|
|
1790
|
+
"data-dragging": "true",
|
|
1771
1791
|
className: cn(
|
|
1772
|
-
"
|
|
1773
|
-
isHorizontal ? "
|
|
1792
|
+
"qti-order-item cursor-grabbing z-50",
|
|
1793
|
+
isHorizontal ? "min-w-[100px] flex items-center justify-center" : "w-full flex items-center gap-3"
|
|
1774
1794
|
),
|
|
1775
1795
|
children: [
|
|
1776
|
-
!isHorizontal && /* @__PURE__ */ jsx("div", { className: "
|
|
1796
|
+
!isHorizontal && /* @__PURE__ */ jsx("div", { className: "qti-order-item-handle shrink-0", children: /* @__PURE__ */ jsx(DragHandleIcon, {}) }),
|
|
1777
1797
|
/* @__PURE__ */ jsx(HTMLContent, { html: contentHtml })
|
|
1778
1798
|
]
|
|
1779
1799
|
}
|
|
@@ -1827,14 +1847,9 @@ function OrderInteraction({
|
|
|
1827
1847
|
styles: { active: { opacity: "0.4" } }
|
|
1828
1848
|
})
|
|
1829
1849
|
};
|
|
1830
|
-
const
|
|
1831
|
-
if (!hasSubmitted)
|
|
1832
|
-
|
|
1833
|
-
}
|
|
1834
|
-
if (isCorrect) {
|
|
1835
|
-
return "bg-owl/10 border-owl";
|
|
1836
|
-
}
|
|
1837
|
-
return "bg-cardinal/10 border-cardinal";
|
|
1850
|
+
const getContainerCorrectness = () => {
|
|
1851
|
+
if (!hasSubmitted) return void 0;
|
|
1852
|
+
return isCorrect;
|
|
1838
1853
|
};
|
|
1839
1854
|
return /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
|
|
1840
1855
|
interaction.promptHtml && /* @__PURE__ */ jsx(HTMLContent, { html: interaction.promptHtml }),
|
|
@@ -1849,11 +1864,8 @@ function OrderInteraction({
|
|
|
1849
1864
|
/* @__PURE__ */ jsx(SortableContext, { items: items.map((i) => i.id), strategy, disabled: disabled || hasSubmitted, children: /* @__PURE__ */ jsx(
|
|
1850
1865
|
"div",
|
|
1851
1866
|
{
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
isHorizontal ? "flex flex-wrap gap-3" : "flex flex-col gap-2",
|
|
1855
|
-
getContainerStyles()
|
|
1856
|
-
),
|
|
1867
|
+
"data-correct": getContainerCorrectness(),
|
|
1868
|
+
className: cn("qti-order-container", isHorizontal ? "flex flex-wrap" : "flex flex-col"),
|
|
1857
1869
|
children: items.map((item) => /* @__PURE__ */ jsx(
|
|
1858
1870
|
SortableItem,
|
|
1859
1871
|
{
|
|
@@ -2403,6 +2415,9 @@ function QTIRenderer({
|
|
|
2403
2415
|
showFeedback && overallFeedback?.messageHtml && /* @__PURE__ */ jsx("div", { className: "qti-feedback mt-6 p-6", "data-correct": overallFeedback.isCorrect, children: /* @__PURE__ */ jsx(HTMLContent, { html: overallFeedback.messageHtml }) })
|
|
2404
2416
|
] });
|
|
2405
2417
|
}
|
|
2418
|
+
function QTIStimulusRenderer({ stimulus, className }) {
|
|
2419
|
+
return /* @__PURE__ */ jsx("article", { className: cn("qti-stimulus", className), lang: stimulus.xmlLang, "data-stimulus-id": stimulus.identifier, children: /* @__PURE__ */ jsx(HTMLContent, { html: stimulus.bodyHtml, className: "qti-stimulus-body" }) });
|
|
2420
|
+
}
|
|
2406
2421
|
function QtiFeedbackBlock({ result, item, className }) {
|
|
2407
2422
|
const feedbackBlock = React3.useMemo(() => {
|
|
2408
2423
|
if (!result.feedbackIdentifier) {
|
|
@@ -2446,6 +2461,6 @@ function QtiFeedbackBlock({ result, item, className }) {
|
|
|
2446
2461
|
] });
|
|
2447
2462
|
}
|
|
2448
2463
|
|
|
2449
|
-
export { ChoiceInteractionRenderer, ContentBlockRenderer, FeedbackMessage, HTMLContent, QTIRenderer, QtiFeedbackBlock };
|
|
2464
|
+
export { ChoiceInteractionRenderer, ContentBlockRenderer, FeedbackMessage, HTMLContent, QTIRenderer, QTIStimulusRenderer, QtiFeedbackBlock };
|
|
2450
2465
|
//# sourceMappingURL=index.js.map
|
|
2451
2466
|
//# sourceMappingURL=index.js.map
|