@vue-skuilder/common-ui 0.2.33 → 0.2.34
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/{MarkdownRenderer-kStoDRNE.mjs → MarkdownRenderer-U_iPiA2x.mjs} +219 -216
- package/dist/MarkdownRenderer-U_iPiA2x.mjs.map +1 -0
- package/dist/common-ui.es.js +3 -3
- package/dist/common-ui.es.js.map +1 -1
- package/dist/common-ui.umd.js +2 -2
- package/dist/common-ui.umd.js.map +1 -1
- package/dist/composables/CompositionViewable.d.ts +2 -2
- package/dist/composables/CompositionViewable.d.ts.map +1 -1
- package/dist/composables/Displayable.d.ts +6 -1
- package/dist/composables/Displayable.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/composables/CompositionViewable.ts +11 -5
- package/src/composables/Displayable.ts +7 -1
- package/dist/MarkdownRenderer-kStoDRNE.mjs.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { default as moment } from 'moment';
|
|
2
|
-
import {
|
|
2
|
+
import { Ref } from 'vue';
|
|
3
3
|
import { CardRecord, QuestionRecord } from '@vue-skuilder/db';
|
|
4
4
|
import { HotKey } from '../utils/SkldrMouseTrap';
|
|
5
5
|
import { Question } from './Displayable';
|
|
@@ -7,7 +7,7 @@ import { ViewData, Answer } from '@vue-skuilder/common';
|
|
|
7
7
|
export interface ViewableUtils {
|
|
8
8
|
startTime: Ref<moment.Moment>;
|
|
9
9
|
hotKeys: Ref<HotKey[]>;
|
|
10
|
-
timeSpent:
|
|
10
|
+
timeSpent: Readonly<Ref<number>>;
|
|
11
11
|
logger: ViewableLogger;
|
|
12
12
|
getURL: (item: string, dataShapeIndex?: number) => string;
|
|
13
13
|
emitResponse: (record: CardRecord) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CompositionViewable.d.ts","sourceRoot":"","sources":["../../src/composables/CompositionViewable.ts"],"names":[],"mappings":"AAEA,OAAO,MAAM,MAAM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AAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,iBAAiB,CAAC,CAAC,SAAS,QAAQ;IACnD,iBAAiB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC/B,aAAa,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC3B,YAAY,EAAE,GAAG,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC;IACtC,kBAAkB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAChC,eAAe,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC7B,QAAQ,EAAE,GAAG,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC;IAC7B,YAAY,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,eAAe,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,gBAAgB,KAAK,cAAc,CAAC;CACrG;AAGD,wBAAgB,WAAW,CACzB,KAAK,EAAE;IAAE,IAAI,EAAE,QAAQ,EAAE,CAAA;CAAE,EAC3B,IAAI,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,EACjD,aAAa,EAAE,MAAM,GACpB,aAAa,CA2Cf;AAGD,wBAAgB,eAAe,CAAC,CAAC,SAAS,QAAQ,EAChD,aAAa,EAAE,aAAa,GAE3B,iBAAiB,CAAC,CAAC,CAAC,CAsDtB;AAGD,wBAAgB,cAAc,CAAC,SAAS,EAAE,OAAO,GAAG,SAAS,IAAI,iBAAiB,CAAC,QAAQ,CAAC,CAO3F"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DefineComponent, defineComponent } from 'vue';
|
|
2
|
-
import { DataShape, ViewData, Answer, Evaluation } from '@vue-skuilder/common';
|
|
2
|
+
import { DataShape, ViewData, Answer, Evaluation, SeedMeta } from '@vue-skuilder/common';
|
|
3
3
|
export type ViewComponent = DefineComponent<unknown, unknown, unknown> | ReturnType<typeof defineComponent>;
|
|
4
4
|
export declare function isDefineComponent(v: ViewComponent): v is DefineComponent<unknown, unknown, unknown>;
|
|
5
5
|
export declare abstract class Displayable {
|
|
@@ -14,6 +14,11 @@ export declare abstract class Displayable {
|
|
|
14
14
|
* data, and not want any user input.
|
|
15
15
|
*/
|
|
16
16
|
static acceptsUserData: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Optional tags and starting ELO for the cards seeded from one seedData
|
|
19
|
+
* item. Without it, seeded cards start untagged at ~1000.
|
|
20
|
+
*/
|
|
21
|
+
static seedMeta?: (item: unknown) => SeedMeta;
|
|
17
22
|
/**
|
|
18
23
|
*
|
|
19
24
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Displayable.d.ts","sourceRoot":"","sources":["../../src/composables/Displayable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,eAAe,EAAE,eAAe,EAAE,MAAM,KAAK,CAAC;AAC5D,OAAO,EAAa,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"Displayable.d.ts","sourceRoot":"","sources":["../../src/composables/Displayable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,eAAe,EAAE,eAAe,EAAE,MAAM,KAAK,CAAC;AAC5D,OAAO,EAAa,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAGpG,MAAM,MAAM,aAAa,GACrB,eAAe,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,GAC1C,UAAU,CAAC,OAAO,eAAe,CAAC,CAAC;AAEvC,wBAAgB,iBAAiB,CAC/B,CAAC,EAAE,aAAa,GACf,CAAC,IAAI,eAAe,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,CAEjD;AAOD,8BAAsB,WAAW;IAC/B,OAAc,UAAU,EAAE,SAAS,EAAE,CAAC;IAEtC,OAAc,KAAK,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC;IAC1C,OAAc,QAAQ,CAAC,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;IACxC;;;;;;OAMG;IACH,OAAc,eAAe,EAAE,OAAO,CAAQ;IAE9C;;;OAGG;IACH,OAAc,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,QAAQ,CAAC;IAErD;;OAEG;gBACS,QAAQ,EAAE,QAAQ,EAAE;aAShB,UAAU,IAAI,SAAS,EAAE;aACzB,KAAK,IAAI,KAAK,CAAC,aAAa,CAAC;CAC9C;AAeD,8BAAsB,QAAS,SAAQ,WAAW;IAChD;;;;OAIG;IACH,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO;IACrD;;;;;;;OAOG;IACH,SAAS,CAAC,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM;IAmBnE;;;;;OAKG;IACI,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,UAAU;CA8B/D"}
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "0.2.
|
|
6
|
+
"version": "0.2.34",
|
|
7
7
|
"sideEffects": false,
|
|
8
8
|
"main": "./dist/common-ui.umd.js",
|
|
9
9
|
"module": "./dist/common-ui.es.js",
|
|
@@ -47,8 +47,8 @@
|
|
|
47
47
|
"@highlightjs/vue-plugin": "^2.1.2",
|
|
48
48
|
"@mdi/font": "^7.3.67",
|
|
49
49
|
"@vojtechlanka/vue-tags-input": "^3",
|
|
50
|
-
"@vue-skuilder/common": "0.2.
|
|
51
|
-
"@vue-skuilder/db": "0.2.
|
|
50
|
+
"@vue-skuilder/common": "0.2.34",
|
|
51
|
+
"@vue-skuilder/db": "0.2.34",
|
|
52
52
|
"highlight.js": "^11.0.1",
|
|
53
53
|
"marked": "^15.0.6",
|
|
54
54
|
"moment": "^2.29.4",
|
|
@@ -84,5 +84,5 @@
|
|
|
84
84
|
"vite-plugin-dts": "^4.5.3",
|
|
85
85
|
"vitest": "^4.1.0"
|
|
86
86
|
},
|
|
87
|
-
"stableVersion": "0.2.
|
|
87
|
+
"stableVersion": "0.2.34"
|
|
88
88
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// src/base-course/CompositionViewable.ts
|
|
2
2
|
|
|
3
3
|
import moment from 'moment';
|
|
4
|
-
import {
|
|
4
|
+
import { customRef, ref, Ref } from 'vue';
|
|
5
5
|
import { CardRecord, QuestionRecord } from '@vue-skuilder/db';
|
|
6
6
|
import { HotKey } from '../utils/SkldrMouseTrap';
|
|
7
7
|
import { Question } from './Displayable';
|
|
@@ -11,7 +11,7 @@ import { ViewData, Answer } from '@vue-skuilder/common';
|
|
|
11
11
|
export interface ViewableUtils {
|
|
12
12
|
startTime: Ref<moment.Moment>;
|
|
13
13
|
hotKeys: Ref<HotKey[]>;
|
|
14
|
-
timeSpent:
|
|
14
|
+
timeSpent: Readonly<Ref<number>>;
|
|
15
15
|
logger: ViewableLogger;
|
|
16
16
|
getURL: (item: string, dataShapeIndex?: number) => string;
|
|
17
17
|
emitResponse: (record: CardRecord) => void;
|
|
@@ -63,7 +63,12 @@ export function useViewable(
|
|
|
63
63
|
console.warn(`[${componentName}]: `, message, ...params),
|
|
64
64
|
};
|
|
65
65
|
|
|
66
|
-
|
|
66
|
+
// Recomputed on every read. A computed caches its first read (moment.utc() isn't reactive),
|
|
67
|
+
// so retries were recorded with the first attempt's time.
|
|
68
|
+
const timeSpent = customRef<number>(() => ({
|
|
69
|
+
get: () => Math.abs(moment.utc().diff(startTime.value, 'milliseconds')),
|
|
70
|
+
set: () => {},
|
|
71
|
+
}));
|
|
67
72
|
|
|
68
73
|
const getURL = (item: string, dataShapeIndex = 0): string => {
|
|
69
74
|
try {
|
|
@@ -111,7 +116,8 @@ export function useQuestionView<Q extends Question>(
|
|
|
111
116
|
|
|
112
117
|
priorAnswers.value.push([answer, submittingClass ?? '']);
|
|
113
118
|
|
|
114
|
-
const
|
|
119
|
+
const timeSpent = viewableUtils.timeSpent.value;
|
|
120
|
+
const evaluation = question.value.evaluate(answer, timeSpent);
|
|
115
121
|
|
|
116
122
|
viewableUtils.logger.log(`evaluation of answer ${answer}:`, evaluation);
|
|
117
123
|
|
|
@@ -120,7 +126,7 @@ export function useQuestionView<Q extends Question>(
|
|
|
120
126
|
priorAttemps: priorAttempts.value,
|
|
121
127
|
courseID: '',
|
|
122
128
|
cardID: '',
|
|
123
|
-
timeSpent
|
|
129
|
+
timeSpent,
|
|
124
130
|
timeStamp: viewableUtils.startTime.value,
|
|
125
131
|
userAnswer: answer,
|
|
126
132
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type DefineComponent, defineComponent } from 'vue';
|
|
2
|
-
import { FieldType, DataShape, ViewData, Answer, Evaluation } from '@vue-skuilder/common';
|
|
2
|
+
import { FieldType, DataShape, ViewData, Answer, Evaluation, SeedMeta } from '@vue-skuilder/common';
|
|
3
3
|
|
|
4
4
|
// [ ] #vue3 - post migration, specify this more precisely (no longer a hodge-podge)
|
|
5
5
|
export type ViewComponent =
|
|
@@ -31,6 +31,12 @@ export abstract class Displayable {
|
|
|
31
31
|
*/
|
|
32
32
|
public static acceptsUserData: boolean = true;
|
|
33
33
|
|
|
34
|
+
/**
|
|
35
|
+
* Optional tags and starting ELO for the cards seeded from one seedData
|
|
36
|
+
* item. Without it, seeded cards start untagged at ~1000.
|
|
37
|
+
*/
|
|
38
|
+
public static seedMeta?: (item: unknown) => SeedMeta;
|
|
39
|
+
|
|
34
40
|
/**
|
|
35
41
|
*
|
|
36
42
|
*/
|