@vue-skuilder/common-ui 0.2.35 → 0.2.37
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/_virtual/_@oxc-project_runtime@0.115.0/helpers/defineProperty.mjs +13 -0
- package/dist/_virtual/_@oxc-project_runtime@0.115.0/helpers/toPrimitive.mjs +15 -0
- package/dist/_virtual/_@oxc-project_runtime@0.115.0/helpers/toPropertyKey.mjs +10 -0
- package/dist/_virtual/_@oxc-project_runtime@0.115.0/helpers/typeof.mjs +12 -0
- package/dist/_virtual/_plugin-vue_export-helper.mjs +9 -0
- package/dist/_virtual/_rolldown/runtime.mjs +7 -0
- package/dist/admin/common-ui-admin.es.js +259 -23774
- package/dist/admin/common-ui-admin.es.js.map +1 -1
- package/dist/assets/index.css +2 -1
- package/dist/components/CardBrowser.mjs +63 -0
- package/dist/components/CardBrowser.mjs.map +1 -0
- package/dist/components/CardBrowser.vue_vue_type_script_lang.mjs +50 -0
- package/dist/components/CardBrowser.vue_vue_type_script_lang.mjs.map +1 -0
- package/dist/components/CardHistoryViewer.mjs +70 -0
- package/dist/components/CardHistoryViewer.mjs.map +1 -0
- package/dist/components/CardHistoryViewer.vue_vue_type_script_lang.mjs +108 -0
- package/dist/components/CardHistoryViewer.vue_vue_type_script_lang.mjs.map +1 -0
- package/dist/components/CardSearch.mjs +26 -0
- package/dist/components/CardSearch.mjs.map +1 -0
- package/dist/components/CardSearch.vue_vue_type_script_lang.mjs +17 -0
- package/dist/components/CardSearch.vue_vue_type_script_lang.mjs.map +1 -0
- package/dist/components/CardSearchResults.mjs +32 -0
- package/dist/components/CardSearchResults.mjs.map +1 -0
- package/dist/components/CardSearchResults.vue_vue_type_script_lang.mjs +71 -0
- package/dist/components/CardSearchResults.vue_vue_type_script_lang.mjs.map +1 -0
- package/dist/components/CourseCardBrowser.mjs +175 -0
- package/dist/components/CourseCardBrowser.mjs.map +1 -0
- package/dist/components/CourseCardBrowser.vue_vue_type_script_lang.mjs +173 -0
- package/dist/components/CourseCardBrowser.vue_vue_type_script_lang.mjs.map +1 -0
- package/dist/components/CourseInformation.mjs +132 -0
- package/dist/components/CourseInformation.mjs.map +1 -0
- package/dist/components/CourseInformation.vue_vue_type_script_lang.mjs +56 -0
- package/dist/components/CourseInformation.vue_vue_type_script_lang.mjs.map +1 -0
- package/dist/components/CourseTagFilterWidget.mjs +114 -0
- package/dist/components/CourseTagFilterWidget.mjs.map +1 -0
- package/dist/components/CourseTagFilterWidget.vue_vue_type_script_lang.mjs +65 -0
- package/dist/components/CourseTagFilterWidget.vue_vue_type_script_lang.mjs.map +1 -0
- package/dist/components/HeatMap.mjs +40 -0
- package/dist/components/HeatMap.mjs.map +1 -0
- package/dist/components/HeatMap.vue_vue_type_script_lang.mjs +211 -0
- package/dist/components/HeatMap.vue_vue_type_script_lang.mjs.map +1 -0
- package/dist/components/PaginatingToolbar.mjs +94 -0
- package/dist/components/PaginatingToolbar.mjs.map +1 -0
- package/dist/components/PaginatingToolbar.vue_vue_type_script_lang.mjs +36 -0
- package/dist/components/PaginatingToolbar.vue_vue_type_script_lang.mjs.map +1 -0
- package/dist/components/SessionControllerDebug.mjs +130 -0
- package/dist/components/SessionControllerDebug.mjs.map +1 -0
- package/dist/components/SessionControllerDebug.vue_vue_type_script_lang.mjs +45 -0
- package/dist/components/SessionControllerDebug.vue_vue_type_script_lang.mjs.map +1 -0
- package/dist/components/SkMouseTrap.mjs +66 -0
- package/dist/components/SkMouseTrap.mjs.map +1 -0
- package/dist/components/SkMouseTrap.vue_vue_type_script_lang.mjs +31 -0
- package/dist/components/SkMouseTrap.vue_vue_type_script_lang.mjs.map +1 -0
- package/dist/components/SkMouseTrapToolTip.mjs +28 -0
- package/dist/components/SkMouseTrapToolTip.mjs.map +1 -0
- package/dist/components/SkMouseTrapToolTip.vue_vue_type_script_lang.mjs +91 -0
- package/dist/components/SkMouseTrapToolTip.vue_vue_type_script_lang.mjs.map +1 -0
- package/dist/components/SnackbarService.mjs +24 -0
- package/dist/components/SnackbarService.mjs.map +1 -0
- package/dist/components/SnackbarService.vue_vue_type_script_lang.mjs +34 -0
- package/dist/components/SnackbarService.vue_vue_type_script_lang.mjs.map +1 -0
- package/dist/components/SnackbarService2.mjs +40 -0
- package/dist/components/SnackbarService2.mjs.map +1 -0
- package/dist/components/StudySession.mjs +123 -0
- package/dist/components/StudySession.mjs.map +1 -0
- package/dist/components/StudySession.vue_vue_type_script_lang.mjs +280 -0
- package/dist/components/StudySession.vue_vue_type_script_lang.mjs.map +1 -0
- package/dist/components/StudySessionTimer.mjs +50 -0
- package/dist/components/StudySessionTimer.mjs.map +1 -0
- package/dist/components/StudySessionTimer.vue_vue_type_script_lang.mjs +43 -0
- package/dist/components/StudySessionTimer.vue_vue_type_script_lang.mjs.map +1 -0
- package/dist/components/TagsInput.mjs +45 -0
- package/dist/components/TagsInput.mjs.map +1 -0
- package/dist/components/TagsInput.vue_vue_type_script_lang.mjs +117 -0
- package/dist/components/TagsInput.vue_vue_type_script_lang.mjs.map +1 -0
- package/dist/components/UserTagPreferences.mjs +205 -0
- package/dist/components/UserTagPreferences.mjs.map +1 -0
- package/dist/components/UserTagPreferences.vue_vue_type_script_lang.mjs +139 -0
- package/dist/components/UserTagPreferences.vue_vue_type_script_lang.mjs.map +1 -0
- package/dist/components/auth/RequestPasswordReset.mjs +96 -0
- package/dist/components/auth/RequestPasswordReset.mjs.map +1 -0
- package/dist/components/auth/RequestPasswordReset.vue_vue_type_script_lang.mjs +47 -0
- package/dist/components/auth/RequestPasswordReset.vue_vue_type_script_lang.mjs.map +1 -0
- package/dist/components/auth/ResetPassword.mjs +129 -0
- package/dist/components/auth/ResetPassword.mjs.map +1 -0
- package/dist/components/auth/ResetPassword.vue_vue_type_script_lang.mjs +69 -0
- package/dist/components/auth/ResetPassword.vue_vue_type_script_lang.mjs.map +1 -0
- package/dist/components/auth/UserChip.mjs +9 -0
- package/dist/components/auth/UserChip.mjs.map +1 -0
- package/dist/components/auth/UserChip.vue_vue_type_script_setup_true_lang.mjs +213 -0
- package/dist/components/auth/UserChip.vue_vue_type_script_setup_true_lang.mjs.map +1 -0
- package/dist/components/auth/UserLogin.mjs +9 -0
- package/dist/components/auth/UserLogin.mjs.map +1 -0
- package/dist/components/auth/UserLogin.vue_vue_type_script_setup_true_lang.mjs +155 -0
- package/dist/components/auth/UserLogin.vue_vue_type_script_setup_true_lang.mjs.map +1 -0
- package/dist/components/auth/UserLoginAndRegistrationContainer.mjs +9 -0
- package/dist/components/auth/UserLoginAndRegistrationContainer.mjs.map +1 -0
- package/dist/components/auth/UserLoginAndRegistrationContainer.vue_vue_type_script_setup_true_lang.mjs +126 -0
- package/dist/components/auth/UserLoginAndRegistrationContainer.vue_vue_type_script_setup_true_lang.mjs.map +1 -0
- package/dist/components/auth/UserRegistration.mjs +147 -0
- package/dist/components/auth/UserRegistration.mjs.map +1 -0
- package/dist/components/auth/UserRegistration.vue_vue_type_script_lang.mjs +130 -0
- package/dist/components/auth/UserRegistration.vue_vue_type_script_lang.mjs.map +1 -0
- package/dist/components/auth/VerifyEmail.mjs +118 -0
- package/dist/components/auth/VerifyEmail.mjs.map +1 -0
- package/dist/components/auth/VerifyEmail.vue_vue_type_script_lang.mjs +59 -0
- package/dist/components/auth/VerifyEmail.vue_vue_type_script_lang.mjs.map +1 -0
- package/dist/components/cardRendering/AudioAutoPlayer.mjs +9 -0
- package/dist/components/cardRendering/AudioAutoPlayer.mjs.map +1 -0
- package/dist/components/cardRendering/AudioAutoPlayer.vue_vue_type_script_setup_true_lang.mjs +69 -0
- package/dist/components/cardRendering/AudioAutoPlayer.vue_vue_type_script_setup_true_lang.mjs.map +1 -0
- package/dist/components/cardRendering/CardLoader.mjs +31 -0
- package/dist/components/cardRendering/CardLoader.mjs.map +1 -0
- package/dist/components/cardRendering/CardLoader.vue_vue_type_script_lang.mjs +75 -0
- package/dist/components/cardRendering/CardLoader.vue_vue_type_script_lang.mjs.map +1 -0
- package/dist/components/cardRendering/CardViewer.mjs +39 -0
- package/dist/components/cardRendering/CardViewer.mjs.map +1 -0
- package/dist/components/cardRendering/CardViewer.vue_vue_type_script_lang.mjs +66 -0
- package/dist/components/cardRendering/CardViewer.vue_vue_type_script_lang.mjs.map +1 -0
- package/dist/components/cardRendering/CodeBlockRenderer.mjs +8 -0
- package/dist/components/cardRendering/CodeBlockRenderer.mjs.map +1 -0
- package/dist/components/cardRendering/CodeBlockRenderer.vue_vue_type_script_setup_true_lang.mjs +44 -0
- package/dist/components/cardRendering/CodeBlockRenderer.vue_vue_type_script_setup_true_lang.mjs.map +1 -0
- package/dist/components/cardRendering/MarkdownRenderer.mjs +21 -0
- package/dist/components/cardRendering/MarkdownRenderer.mjs.map +1 -0
- package/dist/components/cardRendering/MarkdownRenderer.vue_vue_type_script_lang.mjs +24 -0
- package/dist/components/cardRendering/MarkdownRenderer.vue_vue_type_script_lang.mjs.map +1 -0
- package/dist/components/cardRendering/MarkdownRendererHelpers.mjs +79 -0
- package/dist/components/cardRendering/MarkdownRendererHelpers.mjs.map +1 -0
- package/dist/components/cardRendering/MdTokenRenderer.mjs +9 -0
- package/dist/components/cardRendering/MdTokenRenderer.mjs.map +1 -0
- package/dist/components/cardRendering/MdTokenRenderer.vue_vue_type_script_setup_true_lang.mjs +176 -0
- package/dist/components/cardRendering/MdTokenRenderer.vue_vue_type_script_setup_true_lang.mjs.map +1 -0
- package/dist/components/studentInputs/BaseUserInput.mjs +54 -0
- package/dist/components/studentInputs/BaseUserInput.mjs.map +1 -0
- package/dist/components/studentInputs/MultipleChoiceOption.mjs +26 -0
- package/dist/components/studentInputs/MultipleChoiceOption.mjs.map +1 -0
- package/dist/components/studentInputs/MultipleChoiceOption.vue_vue_type_script_lang.mjs +76 -0
- package/dist/components/studentInputs/MultipleChoiceOption.vue_vue_type_script_lang.mjs.map +1 -0
- package/dist/components/studentInputs/RadioMultipleChoice.mjs +33 -0
- package/dist/components/studentInputs/RadioMultipleChoice.mjs.map +1 -0
- package/dist/components/studentInputs/RadioMultipleChoice.vue_vue_type_script_lang.mjs +105 -0
- package/dist/components/studentInputs/RadioMultipleChoice.vue_vue_type_script_lang.mjs.map +1 -0
- package/dist/components/studentInputs/TrueFalse.mjs +19 -0
- package/dist/components/studentInputs/TrueFalse.mjs.map +1 -0
- package/dist/components/studentInputs/TrueFalse.vue_vue_type_script_lang.mjs +21 -0
- package/dist/components/studentInputs/TrueFalse.vue_vue_type_script_lang.mjs.map +1 -0
- package/dist/components/studentInputs/UserInputNumber.mjs +33 -0
- package/dist/components/studentInputs/UserInputNumber.mjs.map +1 -0
- package/dist/components/studentInputs/UserInputNumber.vue_vue_type_script_lang.mjs +25 -0
- package/dist/components/studentInputs/UserInputNumber.vue_vue_type_script_lang.mjs.map +1 -0
- package/dist/components/studentInputs/UserInputString.mjs +22 -0
- package/dist/components/studentInputs/UserInputString.mjs.map +1 -0
- package/dist/components/studentInputs/UserInputString.vue_vue_type_script_lang.mjs +23 -0
- package/dist/components/studentInputs/UserInputString.vue_vue_type_script_lang.mjs.map +1 -0
- package/dist/components/studentInputs/fillInInput.mjs +25 -0
- package/dist/components/studentInputs/fillInInput.mjs.map +1 -0
- package/dist/components/studentInputs/fillInInput.vue_vue_type_script_lang.mjs +26 -0
- package/dist/components/studentInputs/fillInInput.vue_vue_type_script_lang.mjs.map +1 -0
- package/dist/composables/CompositionViewable.mjs +65 -0
- package/dist/composables/CompositionViewable.mjs.map +1 -0
- package/dist/composables/Displayable.mjs +36 -0
- package/dist/composables/Displayable.mjs.map +1 -0
- package/dist/composables/useAuthUI.mjs +38 -0
- package/dist/composables/useAuthUI.mjs.map +1 -0
- package/dist/composables/useEntitlements.mjs +58 -0
- package/dist/composables/useEntitlements.mjs.map +1 -0
- package/dist/index.mjs +49 -0
- package/dist/plugins/pinia.mjs +12 -0
- package/dist/plugins/pinia.mjs.map +1 -0
- package/dist/services/authAPI.mjs +159 -0
- package/dist/services/authAPI.mjs.map +1 -0
- package/dist/stores/useAuthStore.mjs +68 -0
- package/dist/stores/useAuthStore.mjs.map +1 -0
- package/dist/stores/useCardPreviewModeStore.mjs +20 -0
- package/dist/stores/useCardPreviewModeStore.mjs.map +1 -0
- package/dist/stores/useConfigStore.mjs +60 -0
- package/dist/stores/useConfigStore.mjs.map +1 -0
- package/dist/utils/SkldrMouseTrap.mjs +48 -0
- package/dist/utils/SkldrMouseTrap.mjs.map +1 -0
- package/dist/utils/passwordValidation.mjs +12 -0
- package/dist/utils/passwordValidation.mjs.map +1 -0
- package/package.json +7 -8
- package/dist/MarkdownRenderer-U_iPiA2x.mjs +0 -4966
- package/dist/MarkdownRenderer-U_iPiA2x.mjs.map +0 -1
- package/dist/assets/MarkdownRenderer.css +0 -1
- package/dist/common-ui.es.js +0 -5090
- package/dist/common-ui.es.js.map +0 -1
- package/dist/common-ui.umd.js +0 -77
- package/dist/common-ui.umd.js.map +0 -1
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import { __name as e } from "../../_virtual/_rolldown/runtime.mjs";
|
|
2
|
+
import t from "../studentInputs/fillInInput.mjs";
|
|
3
|
+
import { containsComponent as n, isComponent as r, parseComponentSyntax as i, splitParagraphToken as a, splitTextToken as o } from "./MarkdownRendererHelpers.mjs";
|
|
4
|
+
import s from "./CodeBlockRenderer.mjs";
|
|
5
|
+
import { Fragment as c, createBlock as l, createCommentVNode as u, createElementBlock as d, createElementVNode as f, defineComponent as p, inject as ee, markRaw as m, mergeProps as h, openBlock as g, renderList as _, resolveComponent as v, resolveDynamicComponent as y, toDisplayString as b } from "vue";
|
|
6
|
+
//#region src/components/cardRendering/MdTokenRenderer.vue?vue&type=script&setup=true&lang.ts
|
|
7
|
+
var x = { key: 0 }, S = { key: 0 }, C = { key: 0 }, w = {
|
|
8
|
+
key: 1,
|
|
9
|
+
class: "error--text"
|
|
10
|
+
}, T = { key: 1 }, E = { key: 2 }, D = { key: 1 }, O = { key: 1 }, k = {
|
|
11
|
+
key: 0,
|
|
12
|
+
class: "text-h2"
|
|
13
|
+
}, A = {
|
|
14
|
+
key: 1,
|
|
15
|
+
class: "text-h3"
|
|
16
|
+
}, j = {
|
|
17
|
+
key: 2,
|
|
18
|
+
class: "text-h4"
|
|
19
|
+
}, M = { key: 3 }, N = { key: 4 }, te = { key: 5 }, P = { key: 2 }, F = {
|
|
20
|
+
key: 3,
|
|
21
|
+
class: "text-h5"
|
|
22
|
+
}, I = { key: 0 }, L = ["href", "title"], R = { key: 5 }, z = { key: 6 }, B = { key: 7 }, V = ["src", "alt"], H = { key: 9 }, U = { key: 10 }, W = { key: 11 }, G = ["align"], K = ["innerHTML"], q = ["innerHTML"], J = { key: 16 }, Y = { key: 17 }, X = { key: 18 }, Z = /* @__PURE__ */ p({
|
|
23
|
+
__name: "MdTokenRenderer",
|
|
24
|
+
props: {
|
|
25
|
+
token: {
|
|
26
|
+
type: Object,
|
|
27
|
+
required: !0
|
|
28
|
+
},
|
|
29
|
+
last: {
|
|
30
|
+
type: Boolean,
|
|
31
|
+
required: !1,
|
|
32
|
+
default: !1
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
setup(p, { expose: Z }) {
|
|
36
|
+
let Q = ee("markdownComponents", {}), $ = {
|
|
37
|
+
fillIn: m(t),
|
|
38
|
+
...Q
|
|
39
|
+
};
|
|
40
|
+
function isComponent$1(e) {
|
|
41
|
+
return r(e);
|
|
42
|
+
}
|
|
43
|
+
e(isComponent$1, "isComponent");
|
|
44
|
+
function containsComponent$1(e) {
|
|
45
|
+
return n(e);
|
|
46
|
+
}
|
|
47
|
+
e(containsComponent$1, "containsComponent");
|
|
48
|
+
function splitTextToken$1(e) {
|
|
49
|
+
return o(e);
|
|
50
|
+
}
|
|
51
|
+
e(splitTextToken$1, "splitTextToken");
|
|
52
|
+
function splitParagraphToken$1(e) {
|
|
53
|
+
return a(e);
|
|
54
|
+
}
|
|
55
|
+
e(splitParagraphToken$1, "splitParagraphToken");
|
|
56
|
+
function parsedComponent(e) {
|
|
57
|
+
let t = "";
|
|
58
|
+
"text" in e && typeof e.text == "string" ? t = e.text : "raw" in e && typeof e.raw == "string" && (t = e.raw);
|
|
59
|
+
let n = i(t);
|
|
60
|
+
return n ? {
|
|
61
|
+
is: n.componentName,
|
|
62
|
+
text: "",
|
|
63
|
+
props: n.props
|
|
64
|
+
} : {
|
|
65
|
+
is: "fillIn",
|
|
66
|
+
text: t,
|
|
67
|
+
props: {}
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
function getComponent(e) {
|
|
71
|
+
return $[e] || (console.warn(`[MarkdownRenderer] Unknown component: "${e}". Available components: ${Object.keys($).join(", ")}`), null);
|
|
72
|
+
}
|
|
73
|
+
function decodeBasicEntities(e) {
|
|
74
|
+
return e.replace(/'/g, "'").replace(/"/g, "\"").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
75
|
+
}
|
|
76
|
+
function isText(e) {
|
|
77
|
+
return e.inLink === void 0 && e.type === "text";
|
|
78
|
+
}
|
|
79
|
+
return Z({
|
|
80
|
+
isComponent: isComponent$1,
|
|
81
|
+
containsComponent: containsComponent$1,
|
|
82
|
+
splitTextToken: splitTextToken$1,
|
|
83
|
+
splitParagraphToken: splitParagraphToken$1,
|
|
84
|
+
parsedComponent,
|
|
85
|
+
decodeBasicEntities,
|
|
86
|
+
isText,
|
|
87
|
+
components: $,
|
|
88
|
+
getComponent
|
|
89
|
+
}), (e, t) => {
|
|
90
|
+
let n = v("md-token-renderer", !0);
|
|
91
|
+
return isText(p.token) ? (g(), d("span", x, [!p.token.tokens || p.token.tokens.length === 0 ? (g(), d("span", S, [isComponent$1(p.token) ? (g(), d("span", C, [!p.last && getComponent(parsedComponent(p.token).is) ? (g(), l(y(getComponent(parsedComponent(p.token).is)), h({
|
|
92
|
+
key: 0,
|
|
93
|
+
text: parsedComponent(p.token).text
|
|
94
|
+
}, parsedComponent(p.token).props), null, 16, ["text"])) : !p.last && !getComponent(parsedComponent(p.token).is) ? (g(), d("span", w, " [Unknown component: " + b(parsedComponent(p.token).is) + "] ", 1)) : u("", !0)])) : containsComponent$1(p.token) ? (g(), d("span", T, [(g(!0), d(c, null, _(splitTextToken$1(p.token), (e, t) => (g(), l(n, {
|
|
95
|
+
key: t,
|
|
96
|
+
token: e
|
|
97
|
+
}, null, 8, ["token"]))), 128))])) : (g(), d("span", E, b(decodeBasicEntities(p.token.text)), 1))])) : p.token.tokens && p.token.tokens.length !== 0 ? (g(), d("span", D, [(g(!0), d(c, null, _(p.token.tokens, (e, t) => (g(), l(n, {
|
|
98
|
+
key: t,
|
|
99
|
+
token: e
|
|
100
|
+
}, null, 8, ["token"]))), 128))])) : u("", !0)])) : p.token.type === "heading" ? (g(), d("span", O, [p.token.depth === 1 ? (g(), d("h1", k, [(g(!0), d(c, null, _(p.token.tokens, (e, t) => (g(), l(n, {
|
|
101
|
+
key: t,
|
|
102
|
+
token: e
|
|
103
|
+
}, null, 8, ["token"]))), 128))])) : p.token.depth === 2 ? (g(), d("h2", A, [(g(!0), d(c, null, _(p.token.tokens, (e, t) => (g(), l(n, {
|
|
104
|
+
key: t,
|
|
105
|
+
token: e
|
|
106
|
+
}, null, 8, ["token"]))), 128))])) : p.token.depth === 3 ? (g(), d("h3", j, [(g(!0), d(c, null, _(p.token.tokens, (e, t) => (g(), l(n, {
|
|
107
|
+
key: t,
|
|
108
|
+
token: e
|
|
109
|
+
}, null, 8, ["token"]))), 128))])) : p.token.depth === 4 ? (g(), d("h4", M, [(g(!0), d(c, null, _(p.token.tokens, (e, t) => (g(), l(n, {
|
|
110
|
+
key: t,
|
|
111
|
+
token: e
|
|
112
|
+
}, null, 8, ["token"]))), 128))])) : p.token.depth === 5 ? (g(), d("h5", N, [(g(!0), d(c, null, _(p.token.tokens, (e, t) => (g(), l(n, {
|
|
113
|
+
key: t,
|
|
114
|
+
token: e
|
|
115
|
+
}, null, 8, ["token"]))), 128))])) : p.token.depth === 6 ? (g(), d("h6", te, [(g(!0), d(c, null, _(p.token.tokens, (e, t) => (g(), l(n, {
|
|
116
|
+
key: t,
|
|
117
|
+
token: e
|
|
118
|
+
}, null, 8, ["token"]))), 128))])) : u("", !0)])) : p.token.type === "strong" ? (g(), d("strong", P, [(g(!0), d(c, null, _(p.token.tokens, (e, t) => (g(), l(n, {
|
|
119
|
+
key: t,
|
|
120
|
+
token: e
|
|
121
|
+
}, null, 8, ["token"]))), 128))])) : p.token.type === "paragraph" ? (g(), d("p", F, [containsComponent$1(p.token) ? (g(), d("span", I, [(g(!0), d(c, null, _(splitParagraphToken$1(p.token), (e, t) => (g(), l(n, {
|
|
122
|
+
key: t,
|
|
123
|
+
token: e,
|
|
124
|
+
last: p.last && p.token.tokens.length === 1 && t === splitParagraphToken$1(p.token).length - 1
|
|
125
|
+
}, null, 8, ["token", "last"]))), 128))])) : (g(!0), d(c, { key: 1 }, _(p.token.tokens, (e, t) => (g(), l(n, {
|
|
126
|
+
key: t,
|
|
127
|
+
token: e,
|
|
128
|
+
last: p.last && p.token.tokens.length === 1
|
|
129
|
+
}, null, 8, ["token", "last"]))), 128))])) : p.token.type === "link" ? (g(), d("a", {
|
|
130
|
+
key: 4,
|
|
131
|
+
href: p.token.href,
|
|
132
|
+
title: p.token.title
|
|
133
|
+
}, [(g(!0), d(c, null, _(p.token.tokens, (e, t) => (g(), l(n, {
|
|
134
|
+
key: t,
|
|
135
|
+
token: e
|
|
136
|
+
}, null, 8, ["token"]))), 128))], 8, L)) : p.token.type === "list" && p.token.ordered === !1 ? (g(), d("ul", R, [(g(!0), d(c, null, _(p.token.items, (e, t) => (g(), l(n, {
|
|
137
|
+
key: t,
|
|
138
|
+
token: e
|
|
139
|
+
}, null, 8, ["token"]))), 128))])) : p.token.type === "list" && p.token.ordered === !0 ? (g(), d("ol", z, [(g(!0), d(c, null, _(p.token.items, (e, t) => (g(), l(n, {
|
|
140
|
+
key: t,
|
|
141
|
+
token: e
|
|
142
|
+
}, null, 8, ["token"]))), 128))])) : p.token.type === "list_item" ? (g(), d("li", B, [(g(!0), d(c, null, _(p.token.tokens, (e, t) => (g(), l(n, {
|
|
143
|
+
key: t,
|
|
144
|
+
token: e
|
|
145
|
+
}, null, 8, ["token"]))), 128))])) : p.token.type === "image" ? (g(), d("img", {
|
|
146
|
+
key: 8,
|
|
147
|
+
src: p.token.href,
|
|
148
|
+
alt: p.token.title
|
|
149
|
+
}, null, 8, V)) : p.token.type === "hr" ? (g(), d("hr", H)) : p.token.type === "br" ? (g(), d("br", U)) : p.token.type === "del" ? (g(), d("del", W)) : p.token.type === "table" ? (g(), d("table", {
|
|
150
|
+
key: 12,
|
|
151
|
+
align: p.token.align
|
|
152
|
+
}, [f("thead", null, [(g(!0), d(c, null, _(p.token.header, (e, t) => (g(), d("th", { key: t }, b(e.text), 1))), 128))]), f("tbody", null, [(g(!0), d(c, null, _(p.token.rows, (e, t) => (g(), d("tr", { key: t }, [(g(!0), d(c, null, _(e, (e, t) => (g(), d("td", { key: t }, b(e.text), 1))), 128))]))), 128))])], 8, G)) : p.token.type === "html" ? (g(), d("span", {
|
|
153
|
+
key: 13,
|
|
154
|
+
innerHTML: p.token.raw
|
|
155
|
+
}, null, 8, K)) : p.token.type === "code" ? (g(), l(s, {
|
|
156
|
+
key: 14,
|
|
157
|
+
code: p.token.text,
|
|
158
|
+
language: p.token.lang
|
|
159
|
+
}, null, 8, ["code", "language"])) : p.token.type === "codespan" ? (g(), d("code", {
|
|
160
|
+
key: 15,
|
|
161
|
+
class: "codespan",
|
|
162
|
+
innerHTML: p.token.text
|
|
163
|
+
}, null, 8, q)) : p.token.type === "blockquote" ? (g(), d("blockquote", J, [(g(!0), d(c, null, _(p.token.tokens, (e, t) => (g(), l(n, {
|
|
164
|
+
key: t,
|
|
165
|
+
token: e
|
|
166
|
+
}, null, 8, ["token"]))), 128))])) : p.token.type === "escape" ? (g(), d("span", Y, b(p.token.text), 1)) : p.token.type === "em" ? (g(), d("em", X, [(g(!0), d(c, null, _(p.token.tokens, (e, t) => (g(), l(n, {
|
|
167
|
+
key: t,
|
|
168
|
+
token: e
|
|
169
|
+
}, null, 8, ["token"]))), 128))])) : u("", !0);
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
});
|
|
173
|
+
//#endregion
|
|
174
|
+
export { Z as default };
|
|
175
|
+
|
|
176
|
+
//# sourceMappingURL=MdTokenRenderer.vue_vue_type_script_setup_true_lang.mjs.map
|
package/dist/components/cardRendering/MdTokenRenderer.vue_vue_type_script_setup_true_lang.mjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MdTokenRenderer.vue_vue_type_script_setup_true_lang.mjs","names":[],"sources":["../../../src/components/cardRendering/MdTokenRenderer.vue"],"sourcesContent":["<template>\n <span v-if=\"isText(token)\">\n <span v-if=\"!token.tokens || token.tokens.length === 0\">\n <span v-if=\"isComponent(token)\">\n <!--\n KNOWN LIMITATION: Components cannot be the final token of the entire markdown document\n The v-if=\"!last\" check prevents rendering when this is the last token overall\n Components CAN be the last token in a paragraph (just not the whole document)\n Reason unclear but necessary historically - Chesterton's Fence applies\n Workaround: Add trailing whitespace, punctuation, or newline after component\n See: \"MarkdownRenderer - Known Limitations\" test group\n -->\n <component\n v-if=\"!last && getComponent(parsedComponent(token).is)\"\n :is=\"getComponent(parsedComponent(token).is)\"\n :text=\"parsedComponent(token).text\"\n v-bind=\"parsedComponent(token).props\"\n />\n <span v-else-if=\"!last && !getComponent(parsedComponent(token).is)\" class=\"error--text\">\n [Unknown component: {{ parsedComponent(token).is }}]\n </span>\n </span>\n <span v-else-if=\"containsComponent(token)\">\n <md-token-renderer v-for=\"(subTok, j) in splitTextToken(token)\" :key=\"j\" :token=\"subTok\" />\n </span>\n <span v-else>{{ decodeBasicEntities(token.text) }}</span>\n </span>\n <span v-else-if=\"token.tokens && token.tokens.length !== 0\">\n <md-token-renderer v-for=\"(subTok, j) in token.tokens\" :key=\"j\" :token=\"subTok\" />\n </span>\n </span>\n\n <span v-else-if=\"token.type === 'heading'\">\n <h1 v-if=\"token.depth === 1\" class=\"text-h2\">\n <md-token-renderer v-for=\"(subTok, j) in token.tokens\" :key=\"j\" :token=\"subTok\" />\n </h1>\n <h2 v-else-if=\"token.depth === 2\" class=\"text-h3\">\n <md-token-renderer v-for=\"(subTok, j) in token.tokens\" :key=\"j\" :token=\"subTok\" />\n </h2>\n <h3 v-else-if=\"token.depth === 3\" class=\"text-h4\">\n <md-token-renderer v-for=\"(subTok, j) in token.tokens\" :key=\"j\" :token=\"subTok\" />\n </h3>\n <h4 v-else-if=\"token.depth === 4\">\n <md-token-renderer v-for=\"(subTok, j) in token.tokens\" :key=\"j\" :token=\"subTok\" />\n </h4>\n <h5 v-else-if=\"token.depth === 5\">\n <md-token-renderer v-for=\"(subTok, j) in token.tokens\" :key=\"j\" :token=\"subTok\" />\n </h5>\n <h6 v-else-if=\"token.depth === 6\">\n <md-token-renderer v-for=\"(subTok, j) in token.tokens\" :key=\"j\" :token=\"subTok\" />\n </h6>\n </span>\n\n <strong v-else-if=\"token.type === 'strong'\">\n <md-token-renderer v-for=\"(subTok, j) in token.tokens\" :key=\"j\" :token=\"subTok\" />\n </strong>\n\n <p v-else-if=\"token.type === 'paragraph'\" class=\"text-h5\">\n <span v-if=\"containsComponent(token)\">\n <md-token-renderer\n v-for=\"(splitTok, j) in splitParagraphToken(token)\"\n :key=\"j\"\n :token=\"splitTok\"\n :last=\"last && token.tokens.length === 1 && j === splitParagraphToken(token).length - 1\"\n />\n </span>\n <template v-else>\n <md-token-renderer\n v-for=\"(subTok, j) in token.tokens\"\n :key=\"j\"\n :token=\"subTok\"\n :last=\"last && token.tokens.length === 1\"\n />\n </template>\n </p>\n\n <a v-else-if=\"token.type === 'link'\" :href=\"token.href\" :title=\"token.title\">\n <md-token-renderer v-for=\"(subTok, j) in token.tokens\" :key=\"j\" :token=\"subTok\" />\n </a>\n\n <ul v-else-if=\"token.type === 'list' && token.ordered === false\">\n <md-token-renderer v-for=\"(item, j) in token.items\" :key=\"j\" :token=\"item\" />\n </ul>\n\n <ol v-else-if=\"token.type === 'list' && token.ordered === true\">\n <md-token-renderer v-for=\"(item, j) in token.items\" :key=\"j\" :token=\"item\" />\n </ol>\n\n <li v-else-if=\"token.type === 'list_item'\">\n <md-token-renderer v-for=\"(subTok, j) in token.tokens\" :key=\"j\" :token=\"subTok\" />\n </li>\n\n <img v-else-if=\"token.type === 'image'\" :src=\"token.href\" :alt=\"token.title\" />\n <hr v-else-if=\"token.type === 'hr'\" />\n <br v-else-if=\"token.type === 'br'\" />\n <del v-else-if=\"token.type === 'del'\" />\n\n <table v-else-if=\"token.type === 'table'\" :align=\"token.align\">\n <thead>\n <th v-for=\"(h, j) in token.header\" :key=\"j\">{{ h.text }}</th>\n </thead>\n <tbody>\n <tr v-for=\"(row, r) in token.rows\" :key=\"r\">\n <td v-for=\"(cell, c) in row\" :key=\"c\">{{ cell.text }}</td>\n </tr>\n </tbody>\n </table>\n\n <span v-else-if=\"token.type === 'html'\" v-html=\"token.raw\"></span>\n\n <code-block-renderer v-else-if=\"token.type === 'code'\" :code=\"token.text\" :language=\"token.lang\" />\n <!-- <highlightjs v-else-if=\"token.type === 'code'\" class=\"hljs_render pa-2\" :language=\"token.lang\" :code=\"token.text\" /> -->\n\n <code v-else-if=\"token.type === 'codespan'\" class=\"codespan\" v-html=\"token.text\"></code>\n\n <blockquote v-else-if=\"token.type === 'blockquote'\">\n <md-token-renderer v-for=\"(subTok, j) in token.tokens\" :key=\"j\" :token=\"subTok\" />\n </blockquote>\n\n <span v-else-if=\"token.type === 'escape'\">{{ token.text }}</span>\n\n <em v-else-if=\"token.type === 'em'\">\n <md-token-renderer v-for=\"(subTok, j) in token.tokens\" :key=\"j\" :token=\"subTok\" />\n </em>\n</template>\n\n<script setup lang=\"ts\">\nimport {\n containsComponent as _containsComponent,\n isComponent as _isComponent,\n splitParagraphToken as _splitParagraphToken,\n splitTextToken as _splitTextToken,\n parseComponentSyntax,\n TokenOrComponent,\n} from './MarkdownRendererHelpers';\nimport CodeBlockRenderer from './CodeBlockRenderer.vue';\nimport FillInInput from '../../components/studentInputs/fillInInput.vue';\nimport { MarkedToken, Tokens } from 'marked';\nimport { markRaw, inject } from 'vue';\nimport { PropType } from 'vue';\n\n// Inject custom components provided at app level (defaults to empty object)\nconst providedComponents = inject<Record<string, any>>('markdownComponents', {});\n\n// Register components to be used in the template\n// In Vue 3 with <script setup>, components used via :is must be explicitly registered\n// Merge built-in components with injected custom components\nconst components = {\n fillIn: markRaw(FillInInput),\n ...providedComponents,\n};\n\n// Define component props\ndefineProps({\n token: {\n type: Object as PropType<TokenOrComponent>,\n required: true,\n },\n last: {\n type: Boolean,\n required: false,\n default: false,\n },\n});\n\n// Methods\nfunction isComponent(token: MarkedToken): boolean {\n return _isComponent(token);\n}\n\nfunction containsComponent(token: MarkedToken): boolean {\n return _containsComponent(token);\n}\n\nfunction splitTextToken(token: MarkedToken): Tokens.Text[] {\n return _splitTextToken(token);\n}\n\nfunction splitParagraphToken(token: Tokens.Paragraph): TokenOrComponent[] {\n return _splitParagraphToken(token);\n}\n\nfunction parsedComponent(token: MarkedToken): {\n is: string;\n text: string;\n props: Record<string, string>;\n} {\n let text = '';\n if ('text' in token && typeof token.text === 'string') {\n text = token.text;\n } else if ('raw' in token && typeof token.raw === 'string') {\n text = token.raw;\n }\n\n // Try to parse as inline component syntax\n const parsed = parseComponentSyntax(text);\n\n if (parsed) {\n // Successfully parsed as inline component\n return {\n is: parsed.componentName,\n text: '',\n props: parsed.props,\n };\n }\n\n // Backward compatible: {{ }} or {{ || }} -> fillIn component\n return {\n is: 'fillIn',\n text,\n props: {},\n };\n}\n\nfunction getComponent(componentName: string) {\n const component = components[componentName as keyof typeof components];\n\n if (!component) {\n console.warn(\n `[MarkdownRenderer] Unknown component: \"${componentName}\". Available components: ${Object.keys(components).join(', ')}`\n );\n return null;\n }\n\n return component;\n}\n\nfunction decodeBasicEntities(text: string): string {\n return text\n .replace(/'/g, \"'\")\n .replace(/"/g, '\"')\n .replace(/&/g, '&')\n .replace(/</g, '<')\n .replace(/>/g, '>');\n}\n\nfunction isText(tok: TokenOrComponent): boolean {\n return (tok as any).inLink === undefined && tok.type === 'text';\n}\n\n// Make these functions and objects available to the template\ndefineExpose({\n isComponent,\n containsComponent,\n splitTextToken,\n splitParagraphToken,\n parsedComponent,\n decodeBasicEntities,\n isText,\n components,\n getComponent,\n});\n</script>\n\n<style lang=\"css\" scoped>\nblockquote {\n border-left: 3px teal solid;\n padding-left: 8px;\n}\n\n.codespan {\n padding-left: 3px;\n padding-right: 3px;\n margin-left: 1px;\n margin-right: 1px;\n}\n\np {\n margin-bottom: 15px;\n margin-top: 15px;\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8IA,IAAM,IAAqB,GAA4B,sBAAsB,EAAE,CAAC,EAK1E,IAAa;GACjB,QAAQ,EAAQ,EAAY;GAC5B,GAAG;GACJ;EAgBD,SAAS,cAAY,GAA6B;AAChD,UAAO,EAAa,EAAM;;;EAG5B,SAAS,oBAAkB,GAA6B;AACtD,UAAO,EAAmB,EAAM;;;EAGlC,SAAS,iBAAe,GAAmC;AACzD,UAAO,EAAgB,EAAM;;;EAG/B,SAAS,sBAAoB,GAA6C;AACxE,UAAO,EAAqB,EAAM;;;EAGpC,SAAS,gBAAgB,GAIvB;GACA,IAAI,IAAO;AACX,GAAI,UAAU,KAAS,OAAO,EAAM,QAAS,WAC3C,IAAO,EAAM,OACJ,SAAS,KAAS,OAAO,EAAM,OAAQ,aAChD,IAAO,EAAM;GAIf,IAAM,IAAS,EAAqB,EAAK;AAYzC,UAVI,IAEK;IACL,IAAI,EAAO;IACX,MAAM;IACN,OAAO,EAAO;IACf,GAII;IACL,IAAI;IACJ;IACA,OAAO,EAAE;IACV;;EAGH,SAAS,aAAa,GAAuB;AAU3C,UATkB,EAAW,OAG3B,QAAQ,KACN,0CAA0C,EAAc,2BAA2B,OAAO,KAAK,EAAW,CAAC,KAAK,KAAK,GACtH,EACM;;EAMX,SAAS,oBAAoB,GAAsB;AACjD,UAAO,EACJ,QAAQ,UAAU,IAAG,CACrB,QAAQ,WAAW,KAAG,CACtB,QAAQ,UAAU,IAAG,CACrB,QAAQ,SAAS,IAAG,CACpB,QAAQ,SAAS,IAAI;;EAG1B,SAAS,OAAO,GAAgC;AAC9C,UAAQ,EAAY,WAAW,KAAA,KAAa,EAAI,SAAS;;SAI3D,EAAa;GACX,aAAA;GACA,mBAAA;GACA,gBAAA;GACA,qBAAA;GACA;GACA;GACA;GACA;GACA;GACD,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import "../../_virtual/_rolldown/runtime.mjs";
|
|
2
|
+
import { isQuestionView as e } from "../../composables/CompositionViewable.mjs";
|
|
3
|
+
import { useCardPreviewModeStore as t } from "../../stores/useCardPreviewModeStore.mjs";
|
|
4
|
+
import { defineComponent as n } from "vue";
|
|
5
|
+
import { log as r } from "@vue-skuilder/common";
|
|
6
|
+
//#region src/components/studentInputs/BaseUserInput.ts
|
|
7
|
+
var i = n({
|
|
8
|
+
name: "UserInput",
|
|
9
|
+
data() {
|
|
10
|
+
return {
|
|
11
|
+
answer: "",
|
|
12
|
+
previewModeStore: null
|
|
13
|
+
};
|
|
14
|
+
},
|
|
15
|
+
mounted() {
|
|
16
|
+
this.previewModeStore = t();
|
|
17
|
+
},
|
|
18
|
+
computed: {
|
|
19
|
+
autofocus() {
|
|
20
|
+
return !this.previewModeStore?.previewMode;
|
|
21
|
+
},
|
|
22
|
+
autoFocus() {
|
|
23
|
+
return this.autofocus;
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
methods: {
|
|
27
|
+
submitAnswer(e) {
|
|
28
|
+
return this.submit(e);
|
|
29
|
+
},
|
|
30
|
+
submit(e) {
|
|
31
|
+
return this.getQuestionViewAncestor().submitAnswer(e, this.$options.name ?? "UserInput");
|
|
32
|
+
},
|
|
33
|
+
getQuestionViewAncestor() {
|
|
34
|
+
let t = this.$parent, n = 0;
|
|
35
|
+
for (; t && !e(t);) {
|
|
36
|
+
let e = t.$parent;
|
|
37
|
+
if (!e) {
|
|
38
|
+
let e = "\nUserInput.submit() has failed.\nThe input element has no QuestionView ancestor element.";
|
|
39
|
+
throw r(e), Error(e);
|
|
40
|
+
}
|
|
41
|
+
if (t = e, n++, n > 100) {
|
|
42
|
+
let e = "\nUserInput.submit() has failed.\nExceeded maximum ancestor lookup depth.";
|
|
43
|
+
throw r(e), Error(e);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
if (!t) throw Error("No QuestionView ancestor found");
|
|
47
|
+
return t;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
//#endregion
|
|
52
|
+
export { i as default };
|
|
53
|
+
|
|
54
|
+
//# sourceMappingURL=BaseUserInput.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BaseUserInput.mjs","names":[],"sources":["../../../src/components/studentInputs/BaseUserInput.ts"],"sourcesContent":["import { defineComponent } from 'vue';\nimport { Answer, log } from '@vue-skuilder/common';\nimport { useCardPreviewModeStore } from '../../stores/useCardPreviewModeStore';\nimport { ViewComponent } from '../../composables/Displayable';\nimport { isQuestionView } from '../../composables/CompositionViewable';\nimport { QuestionRecord } from '@vue-skuilder/db';\n\nexport default defineComponent({\n name: 'UserInput',\n data() {\n return {\n answer: '' as Answer,\n previewModeStore: null as ReturnType<typeof useCardPreviewModeStore> | null,\n };\n },\n mounted() {\n // This happens after Pinia is initialized but before the component is used\n this.previewModeStore = useCardPreviewModeStore();\n },\n computed: {\n autofocus(): boolean {\n return !this.previewModeStore?.previewMode;\n },\n autoFocus(): boolean {\n return this.autofocus;\n },\n },\n methods: {\n submitAnswer(answer: Answer): QuestionRecord {\n return this.submit(answer);\n },\n // isQuestionView(a: any): a is QuestionView<Question> {\n // return (a as QuestionView<Question>).submitAnswer !== undefined;\n // },\n submit(answer: Answer) {\n return this.getQuestionViewAncestor().submitAnswer(answer, this.$options.name ?? 'UserInput');\n },\n getQuestionViewAncestor(): ViewComponent {\n let ancestor = this.$parent;\n let count = 0;\n\n while (ancestor && !isQuestionView(ancestor)) {\n const nextAncestor = ancestor.$parent;\n if (!nextAncestor) {\n const err = `\nUserInput.submit() has failed.\nThe input element has no QuestionView ancestor element.`;\n log(err);\n throw new Error(err);\n }\n ancestor = nextAncestor;\n count++;\n\n if (count > 100) {\n const err = `\nUserInput.submit() has failed.\nExceeded maximum ancestor lookup depth.`;\n log(err);\n throw new Error(err);\n }\n }\n\n if (!ancestor) {\n throw new Error('No QuestionView ancestor found');\n }\n\n return ancestor;\n },\n },\n});\n"],"mappings":";;;;;;AAOA,IAAA,IAAe,EAAgB;CAC7B,MAAM;CACN,OAAO;AACL,SAAO;GACL,QAAQ;GACR,kBAAkB;GACnB;;CAEH,UAAU;AAER,OAAK,mBAAmB,GAAyB;;CAEnD,UAAU;EACR,YAAqB;AACnB,UAAO,CAAC,KAAK,kBAAkB;;EAEjC,YAAqB;AACnB,UAAO,KAAK;;EAEf;CACD,SAAS;EACP,aAAa,GAAgC;AAC3C,UAAO,KAAK,OAAO,EAAO;;EAK5B,OAAO,GAAgB;AACrB,UAAO,KAAK,yBAAyB,CAAC,aAAa,GAAQ,KAAK,SAAS,QAAQ,YAAY;;EAE/F,0BAAyC;GACvC,IAAI,IAAW,KAAK,SAChB,IAAQ;AAEZ,UAAO,KAAY,CAAC,EAAe,EAAS,GAAE;IAC5C,IAAM,IAAe,EAAS;AAC9B,QAAI,CAAC,GAAc;KACjB,IAAM,IAAM;AAIZ,WADA,EAAI,EAAI,EACE,MAAM,EAAI;;AAKtB,QAHA,IAAW,GACX,KAEI,IAAQ,KAAK;KACf,IAAM,IAAM;AAIZ,WADA,EAAI,EAAI,EACE,MAAM,EAAI;;;AAIxB,OAAI,CAAC,EACH,OAAU,MAAM,iCAAiC;AAGnD,UAAO;;EAEV;CACF,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import "../../_virtual/_rolldown/runtime.mjs";
|
|
2
|
+
import e from "../../_virtual/_plugin-vue_export-helper.mjs";
|
|
3
|
+
import t from "./MultipleChoiceOption.vue_vue_type_script_lang.mjs";
|
|
4
|
+
/* empty css */
|
|
5
|
+
import { createBlock as n, createVNode as r, normalizeClass as i, openBlock as a, resolveComponent as o, withCtx as s } from "vue";
|
|
6
|
+
//#region src/components/studentInputs/MultipleChoiceOption.vue
|
|
7
|
+
function _sfc_render(e, t, c, l, u, d) {
|
|
8
|
+
let f = o("markdown-renderer"), p = o("v-card");
|
|
9
|
+
return a(), n(p, {
|
|
10
|
+
class: i(`${e.className}`),
|
|
11
|
+
onMouseover: e.select,
|
|
12
|
+
onClick: e.submitThisOption
|
|
13
|
+
}, {
|
|
14
|
+
default: s(() => [r(f, { md: e.content }, null, 8, ["md"])]),
|
|
15
|
+
_: 1
|
|
16
|
+
}, 8, [
|
|
17
|
+
"class",
|
|
18
|
+
"onMouseover",
|
|
19
|
+
"onClick"
|
|
20
|
+
]);
|
|
21
|
+
}
|
|
22
|
+
var c = /* @__PURE__ */ e(t, [["render", _sfc_render], ["__scopeId", "data-v-96de7172"]]);
|
|
23
|
+
//#endregion
|
|
24
|
+
export { c as default };
|
|
25
|
+
|
|
26
|
+
//# sourceMappingURL=MultipleChoiceOption.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MultipleChoiceOption.mjs","names":[],"sources":["../../../src/components/studentInputs/MultipleChoiceOption.vue"],"sourcesContent":["<template>\n <v-card :class=\"`${className}`\" @mouseover=\"select\" @click=\"submitThisOption\">\n <markdown-renderer :md=\"content\" />\n </v-card>\n</template>\n\n<script lang=\"ts\">\nimport { defineComponent, defineAsyncComponent, PropType } from 'vue';\n\nexport default defineComponent({\n name: 'MultipleChoiceOption',\n\n components: {\n MarkdownRenderer: defineAsyncComponent(() => import('../../components/cardRendering/MarkdownRenderer.vue')),\n },\n\n props: {\n content: {\n type: String,\n required: true,\n },\n selected: {\n type: Boolean,\n required: true,\n },\n number: {\n type: Number,\n required: true,\n },\n setSelection: {\n type: Function as PropType<(selection: number) => void>,\n required: true,\n },\n submit: {\n type: Function as PropType<() => void>,\n required: true,\n },\n markedWrong: {\n type: Boolean,\n required: true,\n },\n },\n\n computed: {\n className(): string {\n let color: string;\n\n switch (this.number) {\n case 0:\n color = 'bg-red';\n break;\n case 1:\n color = 'bg-purple';\n break;\n case 2:\n color = 'bg-indigo';\n break;\n case 3:\n color = 'bg-light-blue';\n break;\n case 4:\n color = 'bg-teal';\n break;\n case 5:\n color = 'bg-deep-orange';\n break;\n default:\n color = 'bg-grey';\n break;\n }\n\n if (this.selected && !this.markedWrong) {\n return `choice selected ${color} lighten-3 elevation-8`;\n } else if (!this.selected && !this.markedWrong) {\n return `choice not-selected ${color} lighten-4 elevation-1`;\n } else if (this.selected && this.markedWrong) {\n return `choice selected grey lighten-2 elevation-8`;\n } else if (!this.selected && this.markedWrong) {\n return 'choice not-selected grey lighten-2 elevation-0';\n } else {\n throw new Error(\n `'selected' and 'markedWrong' props in MultipleChoiceOption are in an impossible configuration.`\n );\n }\n },\n },\n\n methods: {\n select(): void {\n this.setSelection(this.number);\n },\n\n submitThisOption(): void {\n if (this.markedWrong) {\n return;\n } else {\n this.select();\n this.submit();\n }\n },\n },\n});\n</script>\n\n<style scoped>\n.choice {\n text-align: center;\n display: inline-block;\n border-radius: 4px;\n padding-left: 15px;\n padding-right: 15px;\n padding-top: 5px;\n padding-bottom: 5px;\n margin: 10px;\n min-width: 75px; /* prevent tiny click-btns on, eg, one-letter answers */\n transition: all 0.2s ease-in-out;\n}\n\n.selected {\n transform: translateY(-10px) /* rotate(3deg) */ scale(1.15);\n z-index: 1;\n}\n\n.not-selected {\n z-index: 0;\n}\n</style>\n"],"mappings":";;;;;;;;aACE,EAES,GAAA;EAFA,OADX,EAAA,GACqB,EAAA,YAAS;EAAK,aAAW,EAAA;EAAS,SAAO,EAAA;;EAD9D,SAAA,QAEuC,CAAnC,EAAmC,GAAA,EAAf,IAAI,EAAA,SAAO,EAAA,MAAA,GAAA,CAAA,KAAA,CAAA,CAAA,CAAA;EAFnC,GAAA"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import "../../_virtual/_rolldown/runtime.mjs";
|
|
2
|
+
import { defineAsyncComponent as e, defineComponent as t } from "vue";
|
|
3
|
+
//#region src/components/studentInputs/MultipleChoiceOption.vue?vue&type=script&lang.ts
|
|
4
|
+
var n = t({
|
|
5
|
+
name: "MultipleChoiceOption",
|
|
6
|
+
components: { MarkdownRenderer: e(() => import("../cardRendering/MarkdownRenderer.mjs")) },
|
|
7
|
+
props: {
|
|
8
|
+
content: {
|
|
9
|
+
type: String,
|
|
10
|
+
required: !0
|
|
11
|
+
},
|
|
12
|
+
selected: {
|
|
13
|
+
type: Boolean,
|
|
14
|
+
required: !0
|
|
15
|
+
},
|
|
16
|
+
number: {
|
|
17
|
+
type: Number,
|
|
18
|
+
required: !0
|
|
19
|
+
},
|
|
20
|
+
setSelection: {
|
|
21
|
+
type: Function,
|
|
22
|
+
required: !0
|
|
23
|
+
},
|
|
24
|
+
submit: {
|
|
25
|
+
type: Function,
|
|
26
|
+
required: !0
|
|
27
|
+
},
|
|
28
|
+
markedWrong: {
|
|
29
|
+
type: Boolean,
|
|
30
|
+
required: !0
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
computed: { className() {
|
|
34
|
+
let e;
|
|
35
|
+
switch (this.number) {
|
|
36
|
+
case 0:
|
|
37
|
+
e = "bg-red";
|
|
38
|
+
break;
|
|
39
|
+
case 1:
|
|
40
|
+
e = "bg-purple";
|
|
41
|
+
break;
|
|
42
|
+
case 2:
|
|
43
|
+
e = "bg-indigo";
|
|
44
|
+
break;
|
|
45
|
+
case 3:
|
|
46
|
+
e = "bg-light-blue";
|
|
47
|
+
break;
|
|
48
|
+
case 4:
|
|
49
|
+
e = "bg-teal";
|
|
50
|
+
break;
|
|
51
|
+
case 5:
|
|
52
|
+
e = "bg-deep-orange";
|
|
53
|
+
break;
|
|
54
|
+
default:
|
|
55
|
+
e = "bg-grey";
|
|
56
|
+
break;
|
|
57
|
+
}
|
|
58
|
+
if (this.selected && !this.markedWrong) return `choice selected ${e} lighten-3 elevation-8`;
|
|
59
|
+
if (!this.selected && !this.markedWrong) return `choice not-selected ${e} lighten-4 elevation-1`;
|
|
60
|
+
if (this.selected && this.markedWrong) return "choice selected grey lighten-2 elevation-8";
|
|
61
|
+
if (!this.selected && this.markedWrong) return "choice not-selected grey lighten-2 elevation-0";
|
|
62
|
+
throw Error("'selected' and 'markedWrong' props in MultipleChoiceOption are in an impossible configuration.");
|
|
63
|
+
} },
|
|
64
|
+
methods: {
|
|
65
|
+
select() {
|
|
66
|
+
this.setSelection(this.number);
|
|
67
|
+
},
|
|
68
|
+
submitThisOption() {
|
|
69
|
+
this.markedWrong || (this.select(), this.submit());
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
//#endregion
|
|
74
|
+
export { n as default };
|
|
75
|
+
|
|
76
|
+
//# sourceMappingURL=MultipleChoiceOption.vue_vue_type_script_lang.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MultipleChoiceOption.vue_vue_type_script_lang.mjs","names":[],"sources":["../../../src/components/studentInputs/MultipleChoiceOption.vue"],"sourcesContent":["<template>\n <v-card :class=\"`${className}`\" @mouseover=\"select\" @click=\"submitThisOption\">\n <markdown-renderer :md=\"content\" />\n </v-card>\n</template>\n\n<script lang=\"ts\">\nimport { defineComponent, defineAsyncComponent, PropType } from 'vue';\n\nexport default defineComponent({\n name: 'MultipleChoiceOption',\n\n components: {\n MarkdownRenderer: defineAsyncComponent(() => import('../../components/cardRendering/MarkdownRenderer.vue')),\n },\n\n props: {\n content: {\n type: String,\n required: true,\n },\n selected: {\n type: Boolean,\n required: true,\n },\n number: {\n type: Number,\n required: true,\n },\n setSelection: {\n type: Function as PropType<(selection: number) => void>,\n required: true,\n },\n submit: {\n type: Function as PropType<() => void>,\n required: true,\n },\n markedWrong: {\n type: Boolean,\n required: true,\n },\n },\n\n computed: {\n className(): string {\n let color: string;\n\n switch (this.number) {\n case 0:\n color = 'bg-red';\n break;\n case 1:\n color = 'bg-purple';\n break;\n case 2:\n color = 'bg-indigo';\n break;\n case 3:\n color = 'bg-light-blue';\n break;\n case 4:\n color = 'bg-teal';\n break;\n case 5:\n color = 'bg-deep-orange';\n break;\n default:\n color = 'bg-grey';\n break;\n }\n\n if (this.selected && !this.markedWrong) {\n return `choice selected ${color} lighten-3 elevation-8`;\n } else if (!this.selected && !this.markedWrong) {\n return `choice not-selected ${color} lighten-4 elevation-1`;\n } else if (this.selected && this.markedWrong) {\n return `choice selected grey lighten-2 elevation-8`;\n } else if (!this.selected && this.markedWrong) {\n return 'choice not-selected grey lighten-2 elevation-0';\n } else {\n throw new Error(\n `'selected' and 'markedWrong' props in MultipleChoiceOption are in an impossible configuration.`\n );\n }\n },\n },\n\n methods: {\n select(): void {\n this.setSelection(this.number);\n },\n\n submitThisOption(): void {\n if (this.markedWrong) {\n return;\n } else {\n this.select();\n this.submit();\n }\n },\n },\n});\n</script>\n\n<style scoped>\n.choice {\n text-align: center;\n display: inline-block;\n border-radius: 4px;\n padding-left: 15px;\n padding-right: 15px;\n padding-top: 5px;\n padding-bottom: 5px;\n margin: 10px;\n min-width: 75px; /* prevent tiny click-btns on, eg, one-letter answers */\n transition: all 0.2s ease-in-out;\n}\n\n.selected {\n transform: translateY(-10px) /* rotate(3deg) */ scale(1.15);\n z-index: 1;\n}\n\n.not-selected {\n z-index: 0;\n}\n</style>\n"],"mappings":";;;AASA,IAAA,IAAe,EAAgB;CAC7B,MAAM;CAEN,YAAY,EACV,kBAAkB,QAA2B,OAAO,yCAAuD,EAC5G;CAED,OAAO;EACL,SAAS;GACP,MAAM;GACN,UAAU;GACX;EACD,UAAU;GACR,MAAM;GACN,UAAU;GACX;EACD,QAAQ;GACN,MAAM;GACN,UAAU;GACX;EACD,cAAc;GACZ,MAAM;GACN,UAAU;GACX;EACD,QAAQ;GACN,MAAM;GACN,UAAU;GACX;EACD,aAAa;GACX,MAAM;GACN,UAAU;GACX;EACF;CAED,UAAU,EACR,YAAoB;EAClB,IAAI;AAEJ,UAAQ,KAAK,QAAb;GACE,KAAK;AACH,QAAQ;AACR;GACF,KAAK;AACH,QAAQ;AACR;GACF,KAAK;AACH,QAAQ;AACR;GACF,KAAK;AACH,QAAQ;AACR;GACF,KAAK;AACH,QAAQ;AACR;GACF,KAAK;AACH,QAAQ;AACR;GACF;AACE,QAAQ;AACR;;AAGJ,MAAI,KAAK,YAAY,CAAC,KAAK,YACzB,QAAO,mBAAmB,EAAK;MACtB,CAAC,KAAK,YAAY,CAAC,KAAK,YACjC,QAAO,uBAAuB,EAAK;MAC1B,KAAK,YAAY,KAAK,YAC/B,QAAO;MACE,CAAC,KAAK,YAAY,KAAK,YAChC,QAAO;AAEP,QAAU,MACR,iGACD;IAGN;CAED,SAAS;EACP,SAAe;AACb,QAAK,aAAa,KAAK,OAAO;;EAGhC,mBAAyB;AACnB,QAAK,gBAGP,KAAK,QAAQ,EACb,KAAK,QAAQ;;EAGlB;CACF,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import "../../_virtual/_rolldown/runtime.mjs";
|
|
2
|
+
import e from "../../_virtual/_plugin-vue_export-helper.mjs";
|
|
3
|
+
import t from "./RadioMultipleChoice.vue_vue_type_script_lang.mjs";
|
|
4
|
+
import { Fragment as n, createBlock as r, createElementBlock as i, openBlock as a, renderList as o, resolveComponent as s } from "vue";
|
|
5
|
+
//#region src/components/studentInputs/RadioMultipleChoice.vue
|
|
6
|
+
var c = {
|
|
7
|
+
ref: "containerRef",
|
|
8
|
+
class: "multipleChoice"
|
|
9
|
+
};
|
|
10
|
+
function _sfc_render(e, t, l, u, d, f) {
|
|
11
|
+
let p = s("MultipleChoiceOption");
|
|
12
|
+
return a(), i("div", c, [(a(!0), i(n, null, o(e.choiceList, (t, n) => (a(), r(p, {
|
|
13
|
+
key: n,
|
|
14
|
+
content: t,
|
|
15
|
+
selected: e.choiceList.indexOf(t) === e.currentSelection,
|
|
16
|
+
number: e.choiceList.indexOf(t),
|
|
17
|
+
"set-selection": e.setSelection,
|
|
18
|
+
submit: e.forwardSelection,
|
|
19
|
+
"marked-wrong": e.choiceIsWrong(t)
|
|
20
|
+
}, null, 8, [
|
|
21
|
+
"content",
|
|
22
|
+
"selected",
|
|
23
|
+
"number",
|
|
24
|
+
"set-selection",
|
|
25
|
+
"submit",
|
|
26
|
+
"marked-wrong"
|
|
27
|
+
]))), 128))], 512);
|
|
28
|
+
}
|
|
29
|
+
var l = /* @__PURE__ */ e(t, [["render", _sfc_render]]);
|
|
30
|
+
//#endregion
|
|
31
|
+
export { l as default };
|
|
32
|
+
|
|
33
|
+
//# sourceMappingURL=RadioMultipleChoice.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RadioMultipleChoice.mjs","names":[],"sources":["../../../src/components/studentInputs/RadioMultipleChoice.vue"],"sourcesContent":["<template>\n <div ref=\"containerRef\" class=\"multipleChoice\">\n <MultipleChoiceOption\n v-for=\"(choice, i) in choiceList\"\n :key=\"i\"\n :content=\"choice\"\n :selected=\"choiceList.indexOf(choice) === currentSelection\"\n :number=\"choiceList.indexOf(choice)\"\n :set-selection=\"setSelection\"\n :submit=\"forwardSelection\"\n :marked-wrong=\"choiceIsWrong(choice)\"\n />\n </div>\n</template>\n\n<script lang=\"ts\">\nimport UserInput from './BaseUserInput';\nimport MultipleChoiceOption from './MultipleChoiceOption.vue';\nimport { defineComponent, PropType } from 'vue';\nimport { SkldrMouseTrap } from '../../utils/SkldrMouseTrap';\nimport { RadioMultipleChoiceAnswer } from './RadioMultipleChoice.types';\n\nexport default defineComponent({\n name: 'RadioMultipleChoice',\n components: {\n MultipleChoiceOption,\n },\n extends: UserInput,\n props: {\n choiceList: {\n type: Array as PropType<string[]>,\n required: true,\n },\n },\n data() {\n return {\n currentSelection: -1,\n incorrectSelections: [] as number[],\n containerRef: null as null | HTMLElement,\n _registeredHotkeys: [] as (string | string[])[],\n };\n },\n watch: {\n choiceList: {\n immediate: true,\n handler(newList) {\n if (newList?.length) {\n this.bindKeys();\n }\n },\n },\n },\n mounted() {\n if (this.containerRef) {\n this.containerRef.focus();\n }\n },\n unmounted() {\n this.unbindKeys();\n },\n methods: {\n forwardSelection(): void {\n if (this.choiceIsWrong(this.choiceList[this.currentSelection])) {\n return;\n } else if (this.currentSelection !== -1) {\n const ans: RadioMultipleChoiceAnswer = {\n choiceList: this.choiceList,\n selection: this.currentSelection,\n };\n const record = this.submitAnswer(ans);\n\n if (!record.isCorrect) {\n this.incorrectSelections.push(this.currentSelection);\n }\n }\n },\n setSelection(selection: number): void {\n if (selection < this.choiceList.length) {\n this.currentSelection = selection;\n }\n },\n incrementSelection(): void {\n if (this.currentSelection === -1) {\n this.currentSelection = Math.ceil(this.choiceList.length / 2);\n } else {\n this.currentSelection = Math.min(this.choiceList.length - 1, this.currentSelection + 1);\n }\n },\n decrementSelection(): void {\n if (this.currentSelection === -1) {\n this.currentSelection = Math.floor(this.choiceList.length / 2 - 1);\n } else {\n this.currentSelection = Math.max(0, this.currentSelection - 1);\n }\n },\n choiceIsWrong(choice: string): boolean {\n let ret = false;\n this.incorrectSelections.forEach((sel) => {\n if (this.choiceList[sel] === choice) {\n ret = true;\n }\n });\n return ret;\n },\n bindKeys() {\n const hotkeys = [\n {\n hotkey: 'left',\n callback: this.decrementSelection,\n command: 'Move selection left',\n },\n {\n hotkey: 'right',\n callback: this.incrementSelection,\n command: 'Move selection right',\n },\n {\n hotkey: 'enter',\n callback: this.forwardSelection,\n command: 'Submit selection',\n },\n // Add number key bindings\n ...Array.from({ length: this.choiceList.length }, (_, i) => ({\n hotkey: (i + 1).toString(),\n callback: () => this.setSelection(i),\n command: `Select ${((i) => {\n switch (i) {\n case 0:\n return 'first';\n case 1:\n return 'second';\n case 2:\n return 'third';\n case 3:\n return 'fourth';\n case 4:\n return 'fifth';\n case 5:\n return 'sixth';\n default:\n return `${i + 1}th`;\n }\n })(i)} option`,\n })),\n ];\n\n SkldrMouseTrap.addBinding(hotkeys);\n \n // Store hotkeys for cleanup\n this._registeredHotkeys = hotkeys.map(k => k.hotkey);\n },\n\n unbindKeys() {\n // Remove specific hotkeys instead of resetting all\n if (this._registeredHotkeys) {\n this._registeredHotkeys.forEach(key => {\n SkldrMouseTrap.removeBinding(key);\n });\n }\n },\n // bindNumberKey(n: number): void {\n // this.MouseTrap.bind(n.toString(), () => {\n // this.currentSelection = n - 1;\n // });\n // },\n },\n});\n</script>\n"],"mappings":";;;;;;CACO,KAAI;CAAe,OAAM;;;;aAA9B,EAWM,OAXN,GAWM,EAAA,EAAA,GAAA,EAVJ,EASE,GAAA,MAXN,EAG4B,EAAA,aAAd,GAAQ,YADlB,EASE,GAAA;EAPC,KAAK;EACL,SAAS;EACT,UAAU,EAAA,WAAW,QAAQ,EAAM,KAAM,EAAA;EACzC,QAAQ,EAAA,WAAW,QAAQ,EAAM;EACjC,iBAAe,EAAA;EACf,QAAQ,EAAA;EACR,gBAAc,EAAA,cAAc,EAAM"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import "../../_virtual/_rolldown/runtime.mjs";
|
|
2
|
+
import { SkldrMouseTrap as e } from "../../utils/SkldrMouseTrap.mjs";
|
|
3
|
+
import t from "./BaseUserInput.mjs";
|
|
4
|
+
import n from "./MultipleChoiceOption.mjs";
|
|
5
|
+
import { defineComponent as r } from "vue";
|
|
6
|
+
//#region src/components/studentInputs/RadioMultipleChoice.vue?vue&type=script&lang.ts
|
|
7
|
+
var i = r({
|
|
8
|
+
name: "RadioMultipleChoice",
|
|
9
|
+
components: { MultipleChoiceOption: n },
|
|
10
|
+
extends: t,
|
|
11
|
+
props: { choiceList: {
|
|
12
|
+
type: Array,
|
|
13
|
+
required: !0
|
|
14
|
+
} },
|
|
15
|
+
data() {
|
|
16
|
+
return {
|
|
17
|
+
currentSelection: -1,
|
|
18
|
+
incorrectSelections: [],
|
|
19
|
+
containerRef: null,
|
|
20
|
+
_registeredHotkeys: []
|
|
21
|
+
};
|
|
22
|
+
},
|
|
23
|
+
watch: { choiceList: {
|
|
24
|
+
immediate: !0,
|
|
25
|
+
handler(e) {
|
|
26
|
+
e?.length && this.bindKeys();
|
|
27
|
+
}
|
|
28
|
+
} },
|
|
29
|
+
mounted() {
|
|
30
|
+
this.containerRef && this.containerRef.focus();
|
|
31
|
+
},
|
|
32
|
+
unmounted() {
|
|
33
|
+
this.unbindKeys();
|
|
34
|
+
},
|
|
35
|
+
methods: {
|
|
36
|
+
forwardSelection() {
|
|
37
|
+
if (!this.choiceIsWrong(this.choiceList[this.currentSelection]) && this.currentSelection !== -1) {
|
|
38
|
+
let e = {
|
|
39
|
+
choiceList: this.choiceList,
|
|
40
|
+
selection: this.currentSelection
|
|
41
|
+
};
|
|
42
|
+
this.submitAnswer(e).isCorrect || this.incorrectSelections.push(this.currentSelection);
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
setSelection(e) {
|
|
46
|
+
e < this.choiceList.length && (this.currentSelection = e);
|
|
47
|
+
},
|
|
48
|
+
incrementSelection() {
|
|
49
|
+
this.currentSelection === -1 ? this.currentSelection = Math.ceil(this.choiceList.length / 2) : this.currentSelection = Math.min(this.choiceList.length - 1, this.currentSelection + 1);
|
|
50
|
+
},
|
|
51
|
+
decrementSelection() {
|
|
52
|
+
this.currentSelection === -1 ? this.currentSelection = Math.floor(this.choiceList.length / 2 - 1) : this.currentSelection = Math.max(0, this.currentSelection - 1);
|
|
53
|
+
},
|
|
54
|
+
choiceIsWrong(e) {
|
|
55
|
+
let t = !1;
|
|
56
|
+
return this.incorrectSelections.forEach((n) => {
|
|
57
|
+
this.choiceList[n] === e && (t = !0);
|
|
58
|
+
}), t;
|
|
59
|
+
},
|
|
60
|
+
bindKeys() {
|
|
61
|
+
let t = [
|
|
62
|
+
{
|
|
63
|
+
hotkey: "left",
|
|
64
|
+
callback: this.decrementSelection,
|
|
65
|
+
command: "Move selection left"
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
hotkey: "right",
|
|
69
|
+
callback: this.incrementSelection,
|
|
70
|
+
command: "Move selection right"
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
hotkey: "enter",
|
|
74
|
+
callback: this.forwardSelection,
|
|
75
|
+
command: "Submit selection"
|
|
76
|
+
},
|
|
77
|
+
...Array.from({ length: this.choiceList.length }, (e, t) => ({
|
|
78
|
+
hotkey: (t + 1).toString(),
|
|
79
|
+
callback: () => this.setSelection(t),
|
|
80
|
+
command: `Select ${((e) => {
|
|
81
|
+
switch (e) {
|
|
82
|
+
case 0: return "first";
|
|
83
|
+
case 1: return "second";
|
|
84
|
+
case 2: return "third";
|
|
85
|
+
case 3: return "fourth";
|
|
86
|
+
case 4: return "fifth";
|
|
87
|
+
case 5: return "sixth";
|
|
88
|
+
default: return `${e + 1}th`;
|
|
89
|
+
}
|
|
90
|
+
})(t)} option`
|
|
91
|
+
}))
|
|
92
|
+
];
|
|
93
|
+
e.addBinding(t), this._registeredHotkeys = t.map((e) => e.hotkey);
|
|
94
|
+
},
|
|
95
|
+
unbindKeys() {
|
|
96
|
+
this._registeredHotkeys && this._registeredHotkeys.forEach((t) => {
|
|
97
|
+
e.removeBinding(t);
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
//#endregion
|
|
103
|
+
export { i as default };
|
|
104
|
+
|
|
105
|
+
//# sourceMappingURL=RadioMultipleChoice.vue_vue_type_script_lang.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RadioMultipleChoice.vue_vue_type_script_lang.mjs","names":[],"sources":["../../../src/components/studentInputs/RadioMultipleChoice.vue"],"sourcesContent":["<template>\n <div ref=\"containerRef\" class=\"multipleChoice\">\n <MultipleChoiceOption\n v-for=\"(choice, i) in choiceList\"\n :key=\"i\"\n :content=\"choice\"\n :selected=\"choiceList.indexOf(choice) === currentSelection\"\n :number=\"choiceList.indexOf(choice)\"\n :set-selection=\"setSelection\"\n :submit=\"forwardSelection\"\n :marked-wrong=\"choiceIsWrong(choice)\"\n />\n </div>\n</template>\n\n<script lang=\"ts\">\nimport UserInput from './BaseUserInput';\nimport MultipleChoiceOption from './MultipleChoiceOption.vue';\nimport { defineComponent, PropType } from 'vue';\nimport { SkldrMouseTrap } from '../../utils/SkldrMouseTrap';\nimport { RadioMultipleChoiceAnswer } from './RadioMultipleChoice.types';\n\nexport default defineComponent({\n name: 'RadioMultipleChoice',\n components: {\n MultipleChoiceOption,\n },\n extends: UserInput,\n props: {\n choiceList: {\n type: Array as PropType<string[]>,\n required: true,\n },\n },\n data() {\n return {\n currentSelection: -1,\n incorrectSelections: [] as number[],\n containerRef: null as null | HTMLElement,\n _registeredHotkeys: [] as (string | string[])[],\n };\n },\n watch: {\n choiceList: {\n immediate: true,\n handler(newList) {\n if (newList?.length) {\n this.bindKeys();\n }\n },\n },\n },\n mounted() {\n if (this.containerRef) {\n this.containerRef.focus();\n }\n },\n unmounted() {\n this.unbindKeys();\n },\n methods: {\n forwardSelection(): void {\n if (this.choiceIsWrong(this.choiceList[this.currentSelection])) {\n return;\n } else if (this.currentSelection !== -1) {\n const ans: RadioMultipleChoiceAnswer = {\n choiceList: this.choiceList,\n selection: this.currentSelection,\n };\n const record = this.submitAnswer(ans);\n\n if (!record.isCorrect) {\n this.incorrectSelections.push(this.currentSelection);\n }\n }\n },\n setSelection(selection: number): void {\n if (selection < this.choiceList.length) {\n this.currentSelection = selection;\n }\n },\n incrementSelection(): void {\n if (this.currentSelection === -1) {\n this.currentSelection = Math.ceil(this.choiceList.length / 2);\n } else {\n this.currentSelection = Math.min(this.choiceList.length - 1, this.currentSelection + 1);\n }\n },\n decrementSelection(): void {\n if (this.currentSelection === -1) {\n this.currentSelection = Math.floor(this.choiceList.length / 2 - 1);\n } else {\n this.currentSelection = Math.max(0, this.currentSelection - 1);\n }\n },\n choiceIsWrong(choice: string): boolean {\n let ret = false;\n this.incorrectSelections.forEach((sel) => {\n if (this.choiceList[sel] === choice) {\n ret = true;\n }\n });\n return ret;\n },\n bindKeys() {\n const hotkeys = [\n {\n hotkey: 'left',\n callback: this.decrementSelection,\n command: 'Move selection left',\n },\n {\n hotkey: 'right',\n callback: this.incrementSelection,\n command: 'Move selection right',\n },\n {\n hotkey: 'enter',\n callback: this.forwardSelection,\n command: 'Submit selection',\n },\n // Add number key bindings\n ...Array.from({ length: this.choiceList.length }, (_, i) => ({\n hotkey: (i + 1).toString(),\n callback: () => this.setSelection(i),\n command: `Select ${((i) => {\n switch (i) {\n case 0:\n return 'first';\n case 1:\n return 'second';\n case 2:\n return 'third';\n case 3:\n return 'fourth';\n case 4:\n return 'fifth';\n case 5:\n return 'sixth';\n default:\n return `${i + 1}th`;\n }\n })(i)} option`,\n })),\n ];\n\n SkldrMouseTrap.addBinding(hotkeys);\n \n // Store hotkeys for cleanup\n this._registeredHotkeys = hotkeys.map(k => k.hotkey);\n },\n\n unbindKeys() {\n // Remove specific hotkeys instead of resetting all\n if (this._registeredHotkeys) {\n this._registeredHotkeys.forEach(key => {\n SkldrMouseTrap.removeBinding(key);\n });\n }\n },\n // bindNumberKey(n: number): void {\n // this.MouseTrap.bind(n.toString(), () => {\n // this.currentSelection = n - 1;\n // });\n // },\n },\n});\n</script>\n"],"mappings":";;;;;;AAsBA,IAAA,IAAe,EAAgB;CAC7B,MAAM;CACN,YAAY,EACV,sBAAA,GACD;CACD,SAAS;CACT,OAAO,EACL,YAAY;EACV,MAAM;EACN,UAAU;EACX,EACF;CACD,OAAO;AACL,SAAO;GACL,kBAAkB;GAClB,qBAAqB,EAAC;GACtB,cAAc;GACd,oBAAoB,EAAC;GACtB;;CAEH,OAAO,EACL,YAAY;EACV,WAAW;EACX,QAAQ,GAAS;AACf,GAAI,GAAS,UACX,KAAK,UAAU;;EAGpB,EACF;CACD,UAAU;AACR,EAAI,KAAK,gBACP,KAAK,aAAa,OAAO;;CAG7B,YAAY;AACV,OAAK,YAAY;;CAEnB,SAAS;EACP,mBAAyB;AACnB,aAAK,cAAc,KAAK,WAAW,KAAK,kBAAkB,IAEnD,KAAK,qBAAqB,IAAI;IACvC,IAAM,IAAiC;KACrC,YAAY,KAAK;KACjB,WAAW,KAAK;KACjB;AAGD,IAFe,KAAK,aAAa,EAAI,CAEzB,aACV,KAAK,oBAAoB,KAAK,KAAK,iBAAiB;;;EAI1D,aAAa,GAAyB;AACpC,GAAI,IAAY,KAAK,WAAW,WAC9B,KAAK,mBAAmB;;EAG5B,qBAA2B;AACzB,GAAI,KAAK,qBAAqB,KAC5B,KAAK,mBAAmB,KAAK,KAAK,KAAK,WAAW,SAAS,EAAE,GAE7D,KAAK,mBAAmB,KAAK,IAAI,KAAK,WAAW,SAAS,GAAG,KAAK,mBAAmB,EAAE;;EAG3F,qBAA2B;AACzB,GAAI,KAAK,qBAAqB,KAC5B,KAAK,mBAAmB,KAAK,MAAM,KAAK,WAAW,SAAS,IAAI,EAAE,GAElE,KAAK,mBAAmB,KAAK,IAAI,GAAG,KAAK,mBAAmB,EAAE;;EAGlE,cAAc,GAAyB;GACrC,IAAI,IAAM;AAMV,UALA,KAAK,oBAAoB,SAAS,MAAQ;AACxC,IAAI,KAAK,WAAW,OAAS,MAC3B,IAAM;KAER,EACK;;EAET,WAAW;GACT,IAAM,IAAU;IACd;KACE,QAAQ;KACR,UAAU,KAAK;KACf,SAAS;KACV;IACD;KACE,QAAQ;KACR,UAAU,KAAK;KACf,SAAS;KACV;IACD;KACE,QAAQ;KACR,UAAU,KAAK;KACf,SAAS;KACV;IAED,GAAG,MAAM,KAAK,EAAE,QAAQ,KAAK,WAAW,QAAQ,GAAG,GAAG,OAAO;KAC3D,SAAS,IAAI,GAAG,UAAU;KAC1B,gBAAgB,KAAK,aAAa,EAAE;KACpC,SAAS,YAAY,MAAM;AACzB,cAAQ,GAAR;OACE,KAAK,EACH,QAAO;OACT,KAAK,EACH,QAAO;OACT,KAAK,EACH,QAAO;OACT,KAAK,EACH,QAAO;OACT,KAAK,EACH,QAAO;OACT,KAAK,EACH,QAAO;OACT,QACE,QAAO,GAAG,IAAI,EAAE;;QAEnB,EAAE,CAAA;KACN,EAAE;IACJ;AAKD,GAHA,EAAe,WAAW,EAAQ,EAGlC,KAAK,qBAAqB,EAAQ,KAAI,MAAK,EAAE,OAAO;;EAGtD,aAAa;AAEX,GAAI,KAAK,sBACP,KAAK,mBAAmB,SAAQ,MAAO;AACrC,MAAe,cAAc,EAAI;KACjC;;EAQP;CACF,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import "../../_virtual/_rolldown/runtime.mjs";
|
|
2
|
+
import e from "../../_virtual/_plugin-vue_export-helper.mjs";
|
|
3
|
+
import t from "./TrueFalse.vue_vue_type_script_lang.mjs";
|
|
4
|
+
import { createElementBlock as n, createVNode as r, openBlock as i, resolveComponent as a } from "vue";
|
|
5
|
+
//#region src/components/studentInputs/TrueFalse.vue
|
|
6
|
+
var o = { "data-viewable": "TrueFalse" };
|
|
7
|
+
function _sfc_render(e, t, s, c, l, u) {
|
|
8
|
+
let d = a("RadioMultipleChoice");
|
|
9
|
+
return i(), n("div", o, [r(d, {
|
|
10
|
+
"choice-list": ["True", "False"],
|
|
11
|
+
MouseTrap: e.MouseTrap,
|
|
12
|
+
submit: e.submit
|
|
13
|
+
}, null, 8, ["MouseTrap", "submit"])]);
|
|
14
|
+
}
|
|
15
|
+
var s = /* @__PURE__ */ e(t, [["render", _sfc_render]]);
|
|
16
|
+
//#endregion
|
|
17
|
+
export { s as default };
|
|
18
|
+
|
|
19
|
+
//# sourceMappingURL=TrueFalse.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TrueFalse.mjs","names":[],"sources":["../../../src/components/studentInputs/TrueFalse.vue"],"sourcesContent":["<template>\n <div data-viewable=\"TrueFalse\">\n <RadioMultipleChoice :choice-list=\"['True', 'False']\" :MouseTrap=\"MouseTrap\" :submit=\"submit\" />\n </div>\n</template>\n\n<script lang=\"ts\">\nimport { defineComponent, PropType } from 'vue';\nimport RadioMultipleChoice from './RadioMultipleChoice.vue';\n\nexport default defineComponent({\n name: 'TrueFalse',\n components: {\n RadioMultipleChoice,\n },\n props: {\n MouseTrap: {\n type: Object as PropType<any>,\n required: true,\n },\n submit: {\n type: Function as PropType<(selection: number) => void>,\n required: true,\n },\n },\n});\n</script>\n"],"mappings":";;;;;UACO,iBAAc,aAAW;;;aAA9B,EAEM,OAFN,GAEM,CADJ,EAAgG,GAAA;EAA1E,eAAa,CAAA,QAAA,QAAiB;EAAG,WAAW,EAAA;EAAY,QAAQ,EAAA"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import e from "./RadioMultipleChoice.mjs";
|
|
2
|
+
import { defineComponent as t } from "vue";
|
|
3
|
+
//#region src/components/studentInputs/TrueFalse.vue?vue&type=script&lang.ts
|
|
4
|
+
var n = t({
|
|
5
|
+
name: "TrueFalse",
|
|
6
|
+
components: { RadioMultipleChoice: e },
|
|
7
|
+
props: {
|
|
8
|
+
MouseTrap: {
|
|
9
|
+
type: Object,
|
|
10
|
+
required: !0
|
|
11
|
+
},
|
|
12
|
+
submit: {
|
|
13
|
+
type: Function,
|
|
14
|
+
required: !0
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
//#endregion
|
|
19
|
+
export { n as default };
|
|
20
|
+
|
|
21
|
+
//# sourceMappingURL=TrueFalse.vue_vue_type_script_lang.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TrueFalse.vue_vue_type_script_lang.mjs","names":[],"sources":["../../../src/components/studentInputs/TrueFalse.vue"],"sourcesContent":["<template>\n <div data-viewable=\"TrueFalse\">\n <RadioMultipleChoice :choice-list=\"['True', 'False']\" :MouseTrap=\"MouseTrap\" :submit=\"submit\" />\n </div>\n</template>\n\n<script lang=\"ts\">\nimport { defineComponent, PropType } from 'vue';\nimport RadioMultipleChoice from './RadioMultipleChoice.vue';\n\nexport default defineComponent({\n name: 'TrueFalse',\n components: {\n RadioMultipleChoice,\n },\n props: {\n MouseTrap: {\n type: Object as PropType<any>,\n required: true,\n },\n submit: {\n type: Function as PropType<(selection: number) => void>,\n required: true,\n },\n },\n});\n</script>\n"],"mappings":";;;AAUA,IAAA,IAAe,EAAgB;CAC7B,MAAM;CACN,YAAY,EACV,qBAAA,GACD;CACD,OAAO;EACL,WAAW;GACT,MAAM;GACN,UAAU;GACX;EACD,QAAQ;GACN,MAAM;GACN,UAAU;GACX;EACF;CACF,CAAC"}
|