@pocketprep/ui-kit 3.4.90 → 3.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/@pocketprep/ui-kit.js +14834 -16036
- package/dist/@pocketprep/ui-kit.js.map +1 -1
- package/dist/@pocketprep/ui-kit.umd.cjs +12 -12
- package/dist/@pocketprep/ui-kit.umd.cjs.map +1 -1
- package/dist/style.css +1 -1
- package/lib/components/Bundles/BundleSearch.vue +41 -11
- package/lib/components/Pagination/QuestionReviewPagination.vue +21 -19
- package/lib/components/Quiz/Question/ChoicesContainer.vue +95 -129
- package/lib/components/Quiz/Question/DropdownExplanation.vue +39 -53
- package/lib/components/Quiz/Question/Explanation.vue +47 -57
- package/lib/components/Quiz/Question/MatrixChoicesContainer.vue +211 -224
- package/lib/components/Quiz/Question/MatrixRadioGroup.vue +5 -4
- package/lib/components/Quiz/Question/MobileMatrixChoicesContainer.vue +321 -319
- package/lib/components/Quiz/Question/MobileMatrixRadioGroup.vue +7 -6
- package/lib/components/Quiz/Question/PassageAndImage.vue +32 -43
- package/lib/components/Quiz/Question/PassageAndImageDropdown.vue +32 -43
- package/lib/components/Quiz/Question/Paywall.vue +28 -39
- package/lib/components/Quiz/Question/QuestionContext.vue +23 -31
- package/lib/components/Quiz/Question/StatsSummary.vue +10 -20
- package/lib/components/Quiz/Question/Summary.vue +54 -64
- package/lib/components/Quiz/Question/composables.ts +71 -0
- package/lib/components/Quiz/Question/injectionSymbols.ts +69 -0
- package/lib/components/Quiz/Question.vue +788 -988
- package/lib/components/Quiz/QuizContainer.vue +36 -34
- package/lib/components/Quiz/question.d.ts +4 -4
- package/lib/directives.ts +27 -22
- package/lib/styles/_breakpoints.scss +6 -12
- package/package.json +4 -4
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { inject, ref } from 'vue'
|
|
2
|
+
import * as InjectionKeys from './injectionSymbols'
|
|
3
|
+
import type { TChoice, TChoiceKey, TMatrixChoiceKey } from '../question'
|
|
4
|
+
|
|
5
|
+
export const useQuestionContext = () => {
|
|
6
|
+
const question = inject(InjectionKeys.questionKey)
|
|
7
|
+
if (!question) {
|
|
8
|
+
throw new Error('useQuestionContext: no question provided')
|
|
9
|
+
}
|
|
10
|
+
const choiceScores = inject(InjectionKeys.choiceScoresKey)
|
|
11
|
+
if (!choiceScores) {
|
|
12
|
+
throw new Error('useQuestionContext: no choiceScores provided')
|
|
13
|
+
}
|
|
14
|
+
return {
|
|
15
|
+
question,
|
|
16
|
+
choiceScores,
|
|
17
|
+
choices: inject(InjectionKeys.choicesKey, ref<TChoice[]>([])),
|
|
18
|
+
questionEl: inject(InjectionKeys.questionElKey, ref(null)),
|
|
19
|
+
breakpointsWithEl: inject(InjectionKeys.breakpointsWithElKey, ref({
|
|
20
|
+
breakpoints: {
|
|
21
|
+
'mobile': 767,
|
|
22
|
+
'tablet-portrait': 1023,
|
|
23
|
+
'tablet-landscape': 1439,
|
|
24
|
+
},
|
|
25
|
+
containerEl: null,
|
|
26
|
+
})),
|
|
27
|
+
quizLength: inject(InjectionKeys.quizLengthKey),
|
|
28
|
+
quizMode: inject(InjectionKeys.quizModeKey, ref('quick10')),
|
|
29
|
+
questionNumber: inject(InjectionKeys.questionNumberKey),
|
|
30
|
+
isDarkMode: inject(InjectionKeys.isDarkModeKey, ref(false)),
|
|
31
|
+
isCorrect: inject(InjectionKeys.isCorrectKey, ref(false)),
|
|
32
|
+
contextIconType: inject(InjectionKeys.contextIconTypeKey),
|
|
33
|
+
showAnswers: inject(InjectionKeys.showAnswersKey, ref(false)),
|
|
34
|
+
showMatrixAnswers: inject(InjectionKeys.showMatrixAnswersKey, ref(false)),
|
|
35
|
+
imageUrlPrefix: inject(InjectionKeys.imageUrlPrefixKey, ref('')),
|
|
36
|
+
passageImageUrl: inject(InjectionKeys.passageImageUrlKey, ref<string | null>(null)),
|
|
37
|
+
passageImageAlt: inject(InjectionKeys.passageImageAltKey, ref<string | undefined>('')),
|
|
38
|
+
passageImageLongAlt: inject(InjectionKeys.passageImageLongAltKey, ref<string | undefined>('')),
|
|
39
|
+
showPassageImageLongAlt: inject(InjectionKeys.showPassageImageLongAltKey, ref(false)),
|
|
40
|
+
passageAndImageTitle: inject(InjectionKeys.passageAndImageTitleKey, ref('Passage')),
|
|
41
|
+
showExplanation: inject(InjectionKeys.showExplanationKey, ref(false)),
|
|
42
|
+
isMCR: inject(InjectionKeys.isMCRKey, ref(false)),
|
|
43
|
+
isUnanswered: inject(InjectionKeys.isUnansweredKey, ref(false)),
|
|
44
|
+
answerKeys: inject(InjectionKeys.answerKeysKey, ref<TChoiceKey[]>([])),
|
|
45
|
+
hoverChoiceKey: inject(InjectionKeys.hoverChoiceKeyKey, ref(null)),
|
|
46
|
+
focusChoiceKey: inject(InjectionKeys.focusChoiceKeyKey, ref(null)),
|
|
47
|
+
selectedChoices: inject(InjectionKeys.selectedChoicesKey, ref<TChoiceKey[]>([])),
|
|
48
|
+
distractorKeys: inject(InjectionKeys.distractorKeysKey, ref<TChoiceKey[]>([])),
|
|
49
|
+
choiceStrikes: inject(InjectionKeys.choiceStrikesKey, ref<TChoiceKey[]>([])),
|
|
50
|
+
globalMetrics: inject(InjectionKeys.globalMetricsKey, ref(null)),
|
|
51
|
+
reviewMode: inject(InjectionKeys.reviewModeKey, ref(false)),
|
|
52
|
+
showExplanationImageLongAlt: inject(InjectionKeys.showExplanationImageLongAltKey, ref(false)),
|
|
53
|
+
explanationImageUrl: inject(InjectionKeys.explanationImageUrlKey, ref<string | null>(null)),
|
|
54
|
+
explanationImageAlt: inject(InjectionKeys.explanationImageAltKey, ref<string | undefined>(undefined)),
|
|
55
|
+
explanationImageLongAlt: inject(InjectionKeys.explanationImageLongAltKey, ref<string | undefined>(undefined)),
|
|
56
|
+
reference: inject(InjectionKeys.referenceKey, ref<string | undefined>(undefined)),
|
|
57
|
+
hideReferences: inject(InjectionKeys.hideReferencesKey, ref(false)),
|
|
58
|
+
keywordDefinitions: inject(InjectionKeys.keywordDefinitionsKey, ref([])),
|
|
59
|
+
showPaywall: inject(InjectionKeys.showPaywallKey, ref(false)),
|
|
60
|
+
showPassageAndImage: inject(InjectionKeys.showPassageAndImageKey, ref(false)),
|
|
61
|
+
isMatrixQuestion: inject(InjectionKeys.isMatrixQuestionKey, ref(false)),
|
|
62
|
+
matrixChoiceScores: inject(InjectionKeys.matrixChoiceScoresKey, ref({
|
|
63
|
+
totalAnswered: 0,
|
|
64
|
+
answeredCorrectly: 0,
|
|
65
|
+
})),
|
|
66
|
+
isMatrixQuestionCorrect: inject(InjectionKeys.isMatrixQuestionCorrectKey, ref(false)),
|
|
67
|
+
matrixAnswerKeys: inject(InjectionKeys.matrixAnswerKeysKey, ref<TMatrixChoiceKey[]>([])),
|
|
68
|
+
selectedMatrixChoices: inject(InjectionKeys.selectedMatrixChoicesKey, ref([])),
|
|
69
|
+
isTeachGroupReview: inject(InjectionKeys.isTeachGroupReviewKey, ref(false)),
|
|
70
|
+
}
|
|
71
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { Study } from '@pocketprep/types'
|
|
2
|
+
import type {
|
|
3
|
+
TChoice,
|
|
4
|
+
TChoiceKey,
|
|
5
|
+
TChoiceScores,
|
|
6
|
+
TContextIcon,
|
|
7
|
+
TMatrixChoiceKey,
|
|
8
|
+
TMatrixChoiceScores,
|
|
9
|
+
TQuizMode,
|
|
10
|
+
} from '../question'
|
|
11
|
+
import type { ComputedRef, InjectionKey, Ref } from 'vue'
|
|
12
|
+
|
|
13
|
+
export const questionKey = Symbol('question') as InjectionKey<ComputedRef<Study.Class.QuestionJSON>>
|
|
14
|
+
export const choicesKey = Symbol('choices') as InjectionKey<ComputedRef<TChoice[]>>
|
|
15
|
+
export const questionElKey = Symbol('questionEl') as InjectionKey<Ref<Element | null>>
|
|
16
|
+
export const breakpointsWithElKey = Symbol('breakpointsWithEl') as InjectionKey<Ref<{
|
|
17
|
+
breakpoints: {
|
|
18
|
+
mobile: number
|
|
19
|
+
'tablet-portrait': number
|
|
20
|
+
'tablet-landscape': number
|
|
21
|
+
}
|
|
22
|
+
containerEl: HTMLElement | null
|
|
23
|
+
}>>
|
|
24
|
+
export const quizLengthKey = Symbol('quizLength') as InjectionKey<Ref<number>>
|
|
25
|
+
export const quizModeKey = Symbol('quizMode') as InjectionKey<Ref<TQuizMode>>
|
|
26
|
+
export const questionNumberKey = Symbol('questionNumber') as InjectionKey<Ref<number>>
|
|
27
|
+
export const isDarkModeKey = Symbol('isDarkMode') as InjectionKey<Ref<boolean>>
|
|
28
|
+
export const isCorrectKey = Symbol('isCorrect') as InjectionKey<ComputedRef<boolean>>
|
|
29
|
+
export const contextIconTypeKey = Symbol('contextIconType') as InjectionKey<ComputedRef<TContextIcon>>
|
|
30
|
+
export const showAnswersKey = Symbol('showAnswers') as InjectionKey<Ref<boolean>>
|
|
31
|
+
export const showMatrixAnswersKey = Symbol('showMatrixAnswers') as InjectionKey<Ref<boolean>>
|
|
32
|
+
export const imageUrlPrefixKey = Symbol('imageUrlPrefix') as InjectionKey<Ref<string>>
|
|
33
|
+
export const passageImageUrlKey = Symbol('passageImageUrl') as InjectionKey<ComputedRef<string | null>>
|
|
34
|
+
export const passageImageAltKey = Symbol('passageImageAlt') as InjectionKey<ComputedRef<string | undefined>>
|
|
35
|
+
export const passageImageLongAltKey = Symbol('passageImageLongAlt') as InjectionKey<ComputedRef<string | undefined>>
|
|
36
|
+
export const showPassageImageLongAltKey = Symbol('showPassageImageLongAlt') as InjectionKey<Ref<boolean>>
|
|
37
|
+
export const passageAndImageTitleKey = Symbol('passageAndImageTitle') as InjectionKey<ComputedRef<string>>
|
|
38
|
+
export const showExplanationKey = Symbol('showExplanation') as InjectionKey<Ref<boolean>>
|
|
39
|
+
export const isMCRKey = Symbol('isMCR') as InjectionKey<Ref<boolean>>
|
|
40
|
+
export const isUnansweredKey = Symbol('isUnanswered') as InjectionKey<Ref<boolean>>
|
|
41
|
+
export const answerKeysKey = Symbol('answerKeys') as InjectionKey<Ref<TChoiceKey[]>>
|
|
42
|
+
export const hoverChoiceKeyKey = Symbol('hoverChoiceKey') as InjectionKey<Ref<TChoiceKey | null>>
|
|
43
|
+
export const focusChoiceKeyKey = Symbol('focusChoiceKey') as InjectionKey<Ref<TChoiceKey | null>>
|
|
44
|
+
export const selectedChoicesKey = Symbol('selectedChoices') as InjectionKey<Ref<TChoiceKey[]>>
|
|
45
|
+
export const distractorKeysKey = Symbol('distractorKeys') as InjectionKey<ComputedRef<TChoiceKey[]>>
|
|
46
|
+
export const choiceStrikesKey = Symbol('choiceStrikes') as InjectionKey<Ref<TChoiceKey[]>>
|
|
47
|
+
export const choiceScoresKey = Symbol('choiceScores') as InjectionKey<ComputedRef<TChoiceScores>>
|
|
48
|
+
export const globalMetricsKey = Symbol('globalMetrics') as
|
|
49
|
+
InjectionKey<Ref<Study.Class.GlobalQuestionMetricJSON | null>>
|
|
50
|
+
export const reviewModeKey = Symbol('reviewMode') as InjectionKey<Ref<boolean>>
|
|
51
|
+
export const showExplanationImageLongAltKey = Symbol('showExplanationImageLongAlt') as InjectionKey<Ref<boolean>>
|
|
52
|
+
export const explanationImageUrlKey = Symbol('explanationImageUrl') as InjectionKey<ComputedRef<string | null>>
|
|
53
|
+
export const explanationImageAltKey = Symbol('explanationImageAlt') as InjectionKey<ComputedRef<string | undefined>>
|
|
54
|
+
export const explanationImageLongAltKey = Symbol('explanationImageLongAlt') as
|
|
55
|
+
InjectionKey<ComputedRef<string | undefined>>
|
|
56
|
+
export const referenceKey = Symbol('reference') as InjectionKey<ComputedRef<string | undefined>>
|
|
57
|
+
export const hideReferencesKey = Symbol('hideReferences') as InjectionKey<Ref<boolean>>
|
|
58
|
+
export const keywordDefinitionsKey = Symbol('keywordDefinitions') as InjectionKey<Ref<{
|
|
59
|
+
keyword: string
|
|
60
|
+
definition: string
|
|
61
|
+
}[]>>
|
|
62
|
+
export const showPaywallKey = Symbol('showPaywall') as InjectionKey<Ref<boolean>>
|
|
63
|
+
export const showPassageAndImageKey = Symbol('showPassageAndImage') as InjectionKey<ComputedRef<boolean>>
|
|
64
|
+
export const isMatrixQuestionKey = Symbol('isMatrixQuestion') as InjectionKey<ComputedRef<boolean>>
|
|
65
|
+
export const matrixChoiceScoresKey = Symbol('matrixChoiceScores') as InjectionKey<ComputedRef<TMatrixChoiceScores>>
|
|
66
|
+
export const isMatrixQuestionCorrectKey = Symbol('isMatrixQuestionCorrect') as InjectionKey<ComputedRef<boolean>>
|
|
67
|
+
export const matrixAnswerKeysKey = Symbol('matrixAnswerKeys') as InjectionKey<ComputedRef<TMatrixChoiceKey[]>>
|
|
68
|
+
export const selectedMatrixChoicesKey = Symbol('selectedMatrixChoices') as InjectionKey<Ref<TMatrixChoiceKey[]>>
|
|
69
|
+
export const isTeachGroupReviewKey = Symbol('isTeachGroupReview') as InjectionKey<Ref<boolean>>
|