@vue-skuilder/common-ui 0.2.34 → 0.2.36
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/admin.css +1 -1
- package/dist/admin/common-ui-admin.es.js +1074 -473
- package/dist/admin/common-ui-admin.es.js.map +1 -1
- package/dist/admin/components/EChart.vue.d.ts +14 -0
- package/dist/admin/components/EChart.vue.d.ts.map +1 -0
- package/dist/admin/components/LearnerDiagnostics.vue.d.ts +3 -3
- package/dist/admin/components/LearnerDiagnostics.vue.d.ts.map +1 -1
- package/dist/admin/components/LearnerTagElo.vue.d.ts +14 -0
- package/dist/admin/components/LearnerTagElo.vue.d.ts.map +1 -0
- package/dist/admin/index.d.ts +1 -0
- package/dist/admin/index.d.ts.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.d.ts +3 -3
- 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.d.ts +3 -3
- 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.d.ts +3 -3
- 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.d.ts +1 -1
- 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 +8 -8
- package/src/admin/components/EChart.vue +59 -0
- package/src/admin/components/LearnerDiagnostics.vue +8 -4
- package/src/admin/components/LearnerTagElo.vue +563 -0
- package/src/admin/index.ts +1 -0
- 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 @@
|
|
|
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"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import "../../_virtual/_rolldown/runtime.mjs";
|
|
2
|
+
import e from "../../_virtual/_plugin-vue_export-helper.mjs";
|
|
3
|
+
import t from "./UserInputNumber.vue_vue_type_script_lang.mjs";
|
|
4
|
+
/* empty css */
|
|
5
|
+
import { createBlock as n, createVNode as r, openBlock as i, resolveComponent as a, withCtx as o, withKeys as s } from "vue";
|
|
6
|
+
//#region src/components/studentInputs/UserInputNumber.vue
|
|
7
|
+
function _sfc_render(e, t, c, l, u, d) {
|
|
8
|
+
let f = a("v-text-field"), p = a("v-container");
|
|
9
|
+
return i(), n(p, { class: "pa-0" }, {
|
|
10
|
+
default: o(() => [r(f, {
|
|
11
|
+
ref: "input",
|
|
12
|
+
modelValue: e.answer,
|
|
13
|
+
"onUpdate:modelValue": t[0] || (t[0] = (t) => e.answer = t),
|
|
14
|
+
"prepend-icon": "edit",
|
|
15
|
+
autofocus: e.autofocus,
|
|
16
|
+
"row-height": "24",
|
|
17
|
+
"toggle-keys": "[13,32]",
|
|
18
|
+
class: "text-h5",
|
|
19
|
+
rules: [e.isNumeric],
|
|
20
|
+
onKeyup: t[1] || (t[1] = s((t) => e.submitAnswer(e.makeNumeric(e.answer)), ["enter"]))
|
|
21
|
+
}, null, 8, [
|
|
22
|
+
"modelValue",
|
|
23
|
+
"autofocus",
|
|
24
|
+
"rules"
|
|
25
|
+
])]),
|
|
26
|
+
_: 1
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
var c = /* @__PURE__ */ e(t, [["render", _sfc_render], ["__scopeId", "data-v-a56dcd1c"]]);
|
|
30
|
+
//#endregion
|
|
31
|
+
export { c as default };
|
|
32
|
+
|
|
33
|
+
//# sourceMappingURL=UserInputNumber.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UserInputNumber.mjs","names":[],"sources":["../../../src/components/studentInputs/UserInputNumber.vue"],"sourcesContent":["<template>\n <v-container class=\"pa-0\">\n <v-text-field\n ref=\"input\"\n v-model=\"answer\"\n prepend-icon=\"edit\"\n :autofocus=\"autofocus\"\n row-height=\"24\"\n toggle-keys=\"[13,32]\"\n class=\"text-h5\"\n :rules=\"[isNumeric]\"\n @keyup.enter=\"submitAnswer(makeNumeric(answer))\"\n ></v-text-field>\n </v-container>\n</template>\n\n<script lang=\"ts\">\nimport { Answer } from '@vue-skuilder/common';\nimport UserInput from './BaseUserInput';\nimport { defineComponent } from 'vue';\n\ntype InputNumberRefs = {\n input: HTMLInputElement;\n};\n\ntype InputNumberInstance = ReturnType<typeof defineComponent> & {\n $refs: InputNumberRefs;\n};\n\nexport default defineComponent({\n name: 'UserInputNumber',\n\n ref: {} as InputNumberRefs,\n\n extends: UserInput,\n\n methods: {\n mounted(this: InputNumberInstance) {\n this.$refs.input.focus();\n },\n\n isNumeric(s: string): boolean {\n return !isNaN(Number.parseFloat(s));\n },\n\n makeNumeric(num: Answer): number {\n if (typeof num === 'string') {\n return Number.parseFloat(num);\n } else {\n throw new Error('Expected a string, got ' + typeof num);\n }\n },\n },\n});\n</script>\n\n<style scoped>\n.userInput {\n border: none;\n text-align: center;\n border-bottom: 1px black;\n}\n</style>\n"],"mappings":";;;;;;;;aACE,EAYc,GAAA,EAZD,OAAM,QAAM,EAAA;EAD3B,SAAA,QAYoB,CAVhB,EAUgB,GAAA;GATd,KAAI;GAHV,YAIe,EAAA;GAJf,uBAAA,EAAA,OAAA,EAAA,MAAA,MAAA,EAIe,SAAM;GACf,gBAAa;GACZ,WAAW,EAAA;GACZ,cAAW;GACX,eAAY;GACZ,OAAM;GACL,OAAK,CAAG,EAAA,UAAS;GACjB,SAAK,EAAA,OAAA,EAAA,KAXZ,GAAA,MAWoB,EAAA,aAAa,EAAA,YAAY,EAAA,OAAM,CAAA,EAAA,CAAA,QAAA,CAAA;;;;;;EAXnD,GAAA"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import "../../_virtual/_rolldown/runtime.mjs";
|
|
2
|
+
import e from "./BaseUserInput.mjs";
|
|
3
|
+
import { defineComponent as t } from "vue";
|
|
4
|
+
//#region src/components/studentInputs/UserInputNumber.vue?vue&type=script&lang.ts
|
|
5
|
+
var n = t({
|
|
6
|
+
name: "UserInputNumber",
|
|
7
|
+
ref: {},
|
|
8
|
+
extends: e,
|
|
9
|
+
methods: {
|
|
10
|
+
mounted() {
|
|
11
|
+
this.$refs.input.focus();
|
|
12
|
+
},
|
|
13
|
+
isNumeric(e) {
|
|
14
|
+
return !isNaN(Number.parseFloat(e));
|
|
15
|
+
},
|
|
16
|
+
makeNumeric(e) {
|
|
17
|
+
if (typeof e == "string") return Number.parseFloat(e);
|
|
18
|
+
throw Error("Expected a string, got " + typeof e);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
//#endregion
|
|
23
|
+
export { n as default };
|
|
24
|
+
|
|
25
|
+
//# sourceMappingURL=UserInputNumber.vue_vue_type_script_lang.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UserInputNumber.vue_vue_type_script_lang.mjs","names":[],"sources":["../../../src/components/studentInputs/UserInputNumber.vue"],"sourcesContent":["<template>\n <v-container class=\"pa-0\">\n <v-text-field\n ref=\"input\"\n v-model=\"answer\"\n prepend-icon=\"edit\"\n :autofocus=\"autofocus\"\n row-height=\"24\"\n toggle-keys=\"[13,32]\"\n class=\"text-h5\"\n :rules=\"[isNumeric]\"\n @keyup.enter=\"submitAnswer(makeNumeric(answer))\"\n ></v-text-field>\n </v-container>\n</template>\n\n<script lang=\"ts\">\nimport { Answer } from '@vue-skuilder/common';\nimport UserInput from './BaseUserInput';\nimport { defineComponent } from 'vue';\n\ntype InputNumberRefs = {\n input: HTMLInputElement;\n};\n\ntype InputNumberInstance = ReturnType<typeof defineComponent> & {\n $refs: InputNumberRefs;\n};\n\nexport default defineComponent({\n name: 'UserInputNumber',\n\n ref: {} as InputNumberRefs,\n\n extends: UserInput,\n\n methods: {\n mounted(this: InputNumberInstance) {\n this.$refs.input.focus();\n },\n\n isNumeric(s: string): boolean {\n return !isNaN(Number.parseFloat(s));\n },\n\n makeNumeric(num: Answer): number {\n if (typeof num === 'string') {\n return Number.parseFloat(num);\n } else {\n throw new Error('Expected a string, got ' + typeof num);\n }\n },\n },\n});\n</script>\n\n<style scoped>\n.userInput {\n border: none;\n text-align: center;\n border-bottom: 1px black;\n}\n</style>\n"],"mappings":";;;;AA6BA,IAAA,IAAe,EAAgB;CAC7B,MAAM;CAEN,KAAK,EAAC;CAEN,SAAS;CAET,SAAS;EACP,UAAmC;AACjC,QAAK,MAAM,MAAM,OAAO;;EAG1B,UAAU,GAAoB;AAC5B,UAAO,CAAC,MAAM,OAAO,WAAW,EAAE,CAAC;;EAGrC,YAAY,GAAqB;AAC/B,OAAI,OAAO,KAAQ,SACjB,QAAO,OAAO,WAAW,EAAI;AAE7B,SAAU,MAAM,4BAA4B,OAAO,EAAI;;EAG5D;CACF,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import "../../_virtual/_rolldown/runtime.mjs";
|
|
2
|
+
import e from "../../_virtual/_plugin-vue_export-helper.mjs";
|
|
3
|
+
import t from "./UserInputString.vue_vue_type_script_lang.mjs";
|
|
4
|
+
/* empty css */
|
|
5
|
+
import { createElementBlock as n, createElementVNode as r, openBlock as i, vModelText as a, withDirectives as o, withKeys as s } from "vue";
|
|
6
|
+
//#region src/components/studentInputs/UserInputString.vue
|
|
7
|
+
var c = { class: "user-input-container" }, l = ["autofocus"];
|
|
8
|
+
function _sfc_render(e, t, u, d, f, p) {
|
|
9
|
+
return i(), n("span", c, [o(r("input", {
|
|
10
|
+
"onUpdate:modelValue": t[0] || (t[0] = (t) => e.answer = t),
|
|
11
|
+
autofocus: e.autofocus,
|
|
12
|
+
type: "text",
|
|
13
|
+
class: "user-input-string",
|
|
14
|
+
ref: "input",
|
|
15
|
+
onKeyup: t[1] || (t[1] = s((t) => e.submitAnswer(e.answer), ["enter"]))
|
|
16
|
+
}, null, 40, l), [[a, e.answer]])]);
|
|
17
|
+
}
|
|
18
|
+
var u = /* @__PURE__ */ e(t, [["render", _sfc_render], ["__scopeId", "data-v-aa14961f"]]);
|
|
19
|
+
//#endregion
|
|
20
|
+
export { u as default };
|
|
21
|
+
|
|
22
|
+
//# sourceMappingURL=UserInputString.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UserInputString.mjs","names":[],"sources":["../../../src/components/studentInputs/UserInputString.vue"],"sourcesContent":["<template>\n <span class=\"user-input-container\">\n <input\n v-model=\"answer\"\n :autofocus=\"autofocus\"\n type=\"text\"\n class=\"user-input-string\"\n ref=\"input\"\n @keyup.enter=\"submitAnswer(answer)\"\n />\n </span>\n</template>\n\n<script lang=\"ts\">\n// @compositionstart=\"onCompositionStart\"\n// @compositionend=\"onCompositionEnd\"\nimport UserInput from './BaseUserInput';\nimport { defineComponent } from 'vue';\n\nexport default defineComponent({\n name: 'UserInputString',\n extends: UserInput,\n\n props: {\n icon: {\n type: Boolean,\n required: false,\n },\n },\n\n computed: {\n prependIcon(): string {\n return this.icon ? 'edit' : '';\n },\n },\n\n mounted() {\n (this.$refs.input as HTMLInputElement)?.focus();\n },\n\n methods: {\n // debugInput(e: Event) {\n // const target = e.target as HTMLInputElement;\n // console.log('Input event:', {\n // value: target.value,\n // currentAnswer: this.answer,\n // target,\n // });\n // },\n // debugKeyup(e: KeyboardEvent) {\n // const target = e.target as HTMLInputElement;\n // console.log('Keyup event:', {\n // key: e.key,\n // value: target.value,\n // currentAnswer: this.answer,\n // target,\n // });\n // },\n },\n});\n</script>\n\n<style scoped>\n.user-input-container {\n display: inline-block;\n min-width: 6em;\n vertical-align: baseline;\n}\n\n.user-input-string {\n display: inline-block;\n background: transparent;\n border: none;\n border-bottom: 1px solid currentColor;\n color: currentColor;\n font-family: inherit;\n font-size: inherit;\n line-height: inherit;\n padding: 0;\n margin: 0;\n text-align: center;\n width: 100%;\n outline: none;\n}\n\n.user-input-string:focus {\n border-bottom: 2px solid currentColor;\n}\n</style>\n"],"mappings":";;;;;;UACQ,OAAM,wBAAsB,MADpC,CAAA,YAAA;;aACE,EASO,QATP,GASO,CAAA,EARL,EAOE,SAAA;EATN,uBAAA,EAAA,OAAA,EAAA,MAAA,MAAA,EAGe,SAAM;EACd,WAAW,EAAA;EACZ,MAAK;EACL,OAAM;EACN,KAAI;EACH,SAAK,EAAA,OAAA,EAAA,KARZ,GAAA,MAQoB,EAAA,aAAa,EAAA,OAAM,EAAA,CAAA,QAAA,CAAA;cARvC,EAAA,EAAA,CAAA,CAAA,GAGe,EAAA,OAAM,CAAA,CAAA,CAAA,CAAA"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import "../../_virtual/_rolldown/runtime.mjs";
|
|
2
|
+
import e from "./BaseUserInput.mjs";
|
|
3
|
+
import { defineComponent as t } from "vue";
|
|
4
|
+
//#region src/components/studentInputs/UserInputString.vue?vue&type=script&lang.ts
|
|
5
|
+
var n = t({
|
|
6
|
+
name: "UserInputString",
|
|
7
|
+
extends: e,
|
|
8
|
+
props: { icon: {
|
|
9
|
+
type: Boolean,
|
|
10
|
+
required: !1
|
|
11
|
+
} },
|
|
12
|
+
computed: { prependIcon() {
|
|
13
|
+
return this.icon ? "edit" : "";
|
|
14
|
+
} },
|
|
15
|
+
mounted() {
|
|
16
|
+
this.$refs.input?.focus();
|
|
17
|
+
},
|
|
18
|
+
methods: {}
|
|
19
|
+
});
|
|
20
|
+
//#endregion
|
|
21
|
+
export { n as default };
|
|
22
|
+
|
|
23
|
+
//# sourceMappingURL=UserInputString.vue_vue_type_script_lang.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UserInputString.vue_vue_type_script_lang.mjs","names":[],"sources":["../../../src/components/studentInputs/UserInputString.vue"],"sourcesContent":["<template>\n <span class=\"user-input-container\">\n <input\n v-model=\"answer\"\n :autofocus=\"autofocus\"\n type=\"text\"\n class=\"user-input-string\"\n ref=\"input\"\n @keyup.enter=\"submitAnswer(answer)\"\n />\n </span>\n</template>\n\n<script lang=\"ts\">\n// @compositionstart=\"onCompositionStart\"\n// @compositionend=\"onCompositionEnd\"\nimport UserInput from './BaseUserInput';\nimport { defineComponent } from 'vue';\n\nexport default defineComponent({\n name: 'UserInputString',\n extends: UserInput,\n\n props: {\n icon: {\n type: Boolean,\n required: false,\n },\n },\n\n computed: {\n prependIcon(): string {\n return this.icon ? 'edit' : '';\n },\n },\n\n mounted() {\n (this.$refs.input as HTMLInputElement)?.focus();\n },\n\n methods: {\n // debugInput(e: Event) {\n // const target = e.target as HTMLInputElement;\n // console.log('Input event:', {\n // value: target.value,\n // currentAnswer: this.answer,\n // target,\n // });\n // },\n // debugKeyup(e: KeyboardEvent) {\n // const target = e.target as HTMLInputElement;\n // console.log('Keyup event:', {\n // key: e.key,\n // value: target.value,\n // currentAnswer: this.answer,\n // target,\n // });\n // },\n },\n});\n</script>\n\n<style scoped>\n.user-input-container {\n display: inline-block;\n min-width: 6em;\n vertical-align: baseline;\n}\n\n.user-input-string {\n display: inline-block;\n background: transparent;\n border: none;\n border-bottom: 1px solid currentColor;\n color: currentColor;\n font-family: inherit;\n font-size: inherit;\n line-height: inherit;\n padding: 0;\n margin: 0;\n text-align: center;\n width: 100%;\n outline: none;\n}\n\n.user-input-string:focus {\n border-bottom: 2px solid currentColor;\n}\n</style>\n"],"mappings":";;;;AAmBA,IAAA,IAAe,EAAgB;CAC7B,MAAM;CACN,SAAS;CAET,OAAO,EACL,MAAM;EACJ,MAAM;EACN,UAAU;EACX,EACF;CAED,UAAU,EACR,cAAsB;AACpB,SAAO,KAAK,OAAO,SAAS;IAE/B;CAED,UAAU;AACP,OAAK,MAAM,OAA4B,OAAO;;CAGjD,SAAS,EAkBR;CACF,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import "../../_virtual/_rolldown/runtime.mjs";
|
|
2
|
+
import e from "../../_virtual/_plugin-vue_export-helper.mjs";
|
|
3
|
+
import t from "./fillInInput.vue_vue_type_script_lang.mjs";
|
|
4
|
+
/* empty css */
|
|
5
|
+
import { createBlock as n, createElementBlock as r, openBlock as i, resolveComponent as a } from "vue";
|
|
6
|
+
//#region src/components/studentInputs/fillInInput.vue
|
|
7
|
+
var o = {
|
|
8
|
+
key: 0,
|
|
9
|
+
class: "text-h5 underline"
|
|
10
|
+
};
|
|
11
|
+
function _sfc_render(e, t, s, c, l, u) {
|
|
12
|
+
let d = a("user-input-string");
|
|
13
|
+
return e.radioType ? (i(), r("span", o, "\xA0\xA0\xA0\xA0\xA0\xA0\xA0\xA0\xA0\xA0\xA0\xA0\xA0")) : (i(), n(d, {
|
|
14
|
+
key: 1,
|
|
15
|
+
id: "input",
|
|
16
|
+
icon: !1,
|
|
17
|
+
type: "text",
|
|
18
|
+
value: e.processedText
|
|
19
|
+
}, null, 8, ["value"]));
|
|
20
|
+
}
|
|
21
|
+
var s = /* @__PURE__ */ e(t, [["render", _sfc_render], ["__scopeId", "data-v-486ac035"]]);
|
|
22
|
+
//#endregion
|
|
23
|
+
export { s as default };
|
|
24
|
+
|
|
25
|
+
//# sourceMappingURL=fillInInput.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fillInInput.mjs","names":[],"sources":["../../../src/components/studentInputs/fillInInput.vue"],"sourcesContent":["<template>\n <span v-if=\"radioType\" class=\"text-h5 underline\"\n > </span\n >\n <user-input-string v-else id=\"input\" :icon=\"false\" type=\"text\" :value=\"processedText\" />\n</template>\n\n<script lang=\"ts\">\nimport { defineComponent, ref, computed, onMounted } from 'vue';\nimport UserInputString from './UserInputString.vue';\n\nexport default defineComponent({\n name: 'FillInInput',\n\n components: {\n UserInputString,\n },\n\n props: {\n text: {\n type: String,\n required: true,\n },\n },\n\n setup(props) {\n // State\n const inputType = ref<'text' | 'radio'>('text');\n const processedText = ref('');\n\n // Computed\n const radioType = computed(() => {\n return props.text.split('||').length > 1;\n });\n\n // Process text on mount\n onMounted(() => {\n console.log(`fillinCreated w/ text: ${props.text}`);\n\n // Remove mustache syntax\n processedText.value = props.text.substring(2, props.text.length - 2);\n\n console.log(`fillin text trimmed to: ${processedText.value}`);\n\n const split = processedText.value.split('||');\n if (split.length > 1) {\n inputType.value = 'radio';\n }\n });\n\n return {\n inputType,\n radioType,\n processedText,\n };\n },\n});\n</script>\n\n<style scoped>\n#input {\n display: inline-block;\n min-width: 4em;\n text-align: center;\n}\n\n.underline {\n text-decoration: underline;\n text-decoration-style: solid 14px;\n}\n</style>\n"],"mappings":";;;;;;;CAAA,KAAA;CACyB,OAAM;;;;QAAjB,EAAA,aAAA,GAAA,EAAZ,EAEC,QAFD,GACG,uDAA8E,KAAA,GAAA,EAEjF,EAAwF,GAAA;EAJ1F,KAAA;EAI4B,IAAG;EAAS,MAAM;EAAO,MAAK;EAAQ,OAAO,EAAA"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import "../../_virtual/_rolldown/runtime.mjs";
|
|
2
|
+
import e from "./UserInputString.mjs";
|
|
3
|
+
import { computed as t, defineComponent as n, onMounted as r, ref as i } from "vue";
|
|
4
|
+
//#region src/components/studentInputs/fillInInput.vue?vue&type=script&lang.ts
|
|
5
|
+
var a = n({
|
|
6
|
+
name: "FillInInput",
|
|
7
|
+
components: { UserInputString: e },
|
|
8
|
+
props: { text: {
|
|
9
|
+
type: String,
|
|
10
|
+
required: !0
|
|
11
|
+
} },
|
|
12
|
+
setup(e) {
|
|
13
|
+
let n = i("text"), a = i(""), o = t(() => e.text.split("||").length > 1);
|
|
14
|
+
return r(() => {
|
|
15
|
+
console.log(`fillinCreated w/ text: ${e.text}`), a.value = e.text.substring(2, e.text.length - 2), console.log(`fillin text trimmed to: ${a.value}`), a.value.split("||").length > 1 && (n.value = "radio");
|
|
16
|
+
}), {
|
|
17
|
+
inputType: n,
|
|
18
|
+
radioType: o,
|
|
19
|
+
processedText: a
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
//#endregion
|
|
24
|
+
export { a as default };
|
|
25
|
+
|
|
26
|
+
//# sourceMappingURL=fillInInput.vue_vue_type_script_lang.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fillInInput.vue_vue_type_script_lang.mjs","names":[],"sources":["../../../src/components/studentInputs/fillInInput.vue"],"sourcesContent":["<template>\n <span v-if=\"radioType\" class=\"text-h5 underline\"\n > </span\n >\n <user-input-string v-else id=\"input\" :icon=\"false\" type=\"text\" :value=\"processedText\" />\n</template>\n\n<script lang=\"ts\">\nimport { defineComponent, ref, computed, onMounted } from 'vue';\nimport UserInputString from './UserInputString.vue';\n\nexport default defineComponent({\n name: 'FillInInput',\n\n components: {\n UserInputString,\n },\n\n props: {\n text: {\n type: String,\n required: true,\n },\n },\n\n setup(props) {\n // State\n const inputType = ref<'text' | 'radio'>('text');\n const processedText = ref('');\n\n // Computed\n const radioType = computed(() => {\n return props.text.split('||').length > 1;\n });\n\n // Process text on mount\n onMounted(() => {\n console.log(`fillinCreated w/ text: ${props.text}`);\n\n // Remove mustache syntax\n processedText.value = props.text.substring(2, props.text.length - 2);\n\n console.log(`fillin text trimmed to: ${processedText.value}`);\n\n const split = processedText.value.split('||');\n if (split.length > 1) {\n inputType.value = 'radio';\n }\n });\n\n return {\n inputType,\n radioType,\n processedText,\n };\n },\n});\n</script>\n\n<style scoped>\n#input {\n display: inline-block;\n min-width: 4em;\n text-align: center;\n}\n\n.underline {\n text-decoration: underline;\n text-decoration-style: solid 14px;\n}\n</style>\n"],"mappings":";;;;AAWA,IAAA,IAAe,EAAgB;CAC7B,MAAM;CAEN,YAAY,EACV,iBAAA,GACD;CAED,OAAO,EACL,MAAM;EACJ,MAAM;EACN,UAAU;EACX,EACF;CAED,MAAM,GAAO;EAEX,IAAM,IAAY,EAAsB,OAAO,EACzC,IAAgB,EAAI,GAAG,EAGvB,IAAY,QACT,EAAM,KAAK,MAAM,KAAK,CAAC,SAAS,EACvC;AAiBF,SAdA,QAAgB;AASd,GARA,QAAQ,IAAI,0BAA0B,EAAM,OAAO,EAGnD,EAAc,QAAQ,EAAM,KAAK,UAAU,GAAG,EAAM,KAAK,SAAS,EAAE,EAEpE,QAAQ,IAAI,2BAA2B,EAAc,QAAQ,EAE/C,EAAc,MAAM,MAAM,KAAK,CACnC,SAAS,MACjB,EAAU,QAAQ;IAEpB,EAEK;GACL;GACA;GACA;GACD;;CAEJ,CAAC"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import "../_virtual/_rolldown/runtime.mjs";
|
|
2
|
+
import { customRef as e, ref as t } from "vue";
|
|
3
|
+
import n from "moment";
|
|
4
|
+
//#region src/composables/CompositionViewable.ts
|
|
5
|
+
function useViewable(r, i, a) {
|
|
6
|
+
let o = t(n.utc()), s = t([]), c = {
|
|
7
|
+
log: (e, ...t) => console.log(`[${a}]: `, e, ...t),
|
|
8
|
+
error: (e, ...t) => console.error(`[${a}]: `, e, ...t),
|
|
9
|
+
warn: (e, ...t) => console.warn(`[${a}]: `, e, ...t)
|
|
10
|
+
}, l = e(() => ({
|
|
11
|
+
get: () => Math.abs(n.utc().diff(o.value, "milliseconds")),
|
|
12
|
+
set: () => {}
|
|
13
|
+
})), getURL = (e, t = 0) => {
|
|
14
|
+
try {
|
|
15
|
+
if (r.data[t]?.[e]) return URL.createObjectURL(r.data[t][e]);
|
|
16
|
+
} catch (t) {
|
|
17
|
+
c.error("Error creating URL for item:", e, t);
|
|
18
|
+
}
|
|
19
|
+
return "";
|
|
20
|
+
}, emitResponse = (e) => {
|
|
21
|
+
i("emitResponse", e);
|
|
22
|
+
};
|
|
23
|
+
return {
|
|
24
|
+
startTime: o,
|
|
25
|
+
hotKeys: s,
|
|
26
|
+
timeSpent: l,
|
|
27
|
+
logger: c,
|
|
28
|
+
getURL,
|
|
29
|
+
emitResponse
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
function useQuestionView(e) {
|
|
33
|
+
let n = t(0), r = t(0), i = t([]), a = t(3), o = t(2), s = t(), submitAnswer = (t, n, a) => {
|
|
34
|
+
if (e.logger.log("submitAnswer called..."), !s.value) throw Error("Question not initialized");
|
|
35
|
+
i.value.push([t, n ?? ""]);
|
|
36
|
+
let o = e.timeSpent.value, c = s.value.evaluate(t, o);
|
|
37
|
+
e.logger.log(`evaluation of answer ${t}:`, c);
|
|
38
|
+
let l = {
|
|
39
|
+
...c,
|
|
40
|
+
priorAttemps: r.value,
|
|
41
|
+
courseID: "",
|
|
42
|
+
cardID: "",
|
|
43
|
+
timeSpent: o,
|
|
44
|
+
timeStamp: e.startTime.value,
|
|
45
|
+
userAnswer: t
|
|
46
|
+
};
|
|
47
|
+
return a?.deferAdvance !== void 0 && (l.deferAdvance = a.deferAdvance), c.isCorrect || r.value++, e.emitResponse(l), l;
|
|
48
|
+
};
|
|
49
|
+
return {
|
|
50
|
+
priorSessionViews: n,
|
|
51
|
+
priorAttempts: r,
|
|
52
|
+
priorAnswers: i,
|
|
53
|
+
maxAttemptsPerView: a,
|
|
54
|
+
maxSessionViews: o,
|
|
55
|
+
question: s,
|
|
56
|
+
submitAnswer
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
function isQuestionView(e) {
|
|
60
|
+
return typeof e == "object" && !!e && "submitAnswer" in e && "priorAttempts" in e;
|
|
61
|
+
}
|
|
62
|
+
//#endregion
|
|
63
|
+
export { isQuestionView, useQuestionView, useViewable };
|
|
64
|
+
|
|
65
|
+
//# sourceMappingURL=CompositionViewable.mjs.map
|