@enspiredigital/xlms-headless 0.0.10 → 0.0.11

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.
@@ -0,0 +1,4 @@
1
+ import { DragDropQuestionType, PropsComponent } from '../types';
2
+ import { useDragDrop } from '../hooks';
3
+ export declare function DragDropQuestion({ getData, children, }: PropsComponent<DragDropQuestionType, ReturnType<typeof useDragDrop>>): import('react').ReactNode;
4
+ //# sourceMappingURL=DragDrop.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DragDrop.d.ts","sourceRoot":"","sources":["../../src/components/DragDrop.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEvC,wBAAgB,gBAAgB,CAAC,EAC/B,OAAO,EACP,QAAQ,GACT,EAAE,cAAc,CACf,oBAAoB,EACpB,UAAU,CAAC,OAAO,WAAW,CAAC,CAC/B,6BAGA"}
@@ -0,0 +1,4 @@
1
+ import { LabelingQuestionType, PropsComponent } from '../types';
2
+ import { useLabeling } from '../hooks';
3
+ export declare function LabelingQuestion({ getData, children, }: PropsComponent<LabelingQuestionType, ReturnType<typeof useLabeling>>): import('react').ReactNode;
4
+ //# sourceMappingURL=Labeling.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Labeling.d.ts","sourceRoot":"","sources":["../../src/components/Labeling.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEvC,wBAAgB,gBAAgB,CAAC,EAC/B,OAAO,EACP,QAAQ,GACT,EAAE,cAAc,CACf,oBAAoB,EACpB,UAAU,CAAC,OAAO,WAAW,CAAC,CAC/B,6BAGA"}
@@ -0,0 +1,4 @@
1
+ import { OrderingQuestionType, PropsComponent } from '../types';
2
+ import { useOrdering } from '../hooks';
3
+ export declare function OrderingQuestion({ getData, children, }: PropsComponent<OrderingQuestionType, ReturnType<typeof useOrdering>>): import('react').ReactNode;
4
+ //# sourceMappingURL=Ordering.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Ordering.d.ts","sourceRoot":"","sources":["../../src/components/Ordering.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEvC,wBAAgB,gBAAgB,CAAC,EAC/B,OAAO,EACP,QAAQ,GACT,EAAE,cAAc,CACf,oBAAoB,EACpB,UAAU,CAAC,OAAO,WAAW,CAAC,CAC/B,6BAGA"}
@@ -1,6 +1,9 @@
1
1
  export * from './MultipleChoices';
2
2
  export * from './Matching';
3
3
  export * from './Video';
4
+ export * from './DragDrop';
5
+ export * from './Ordering';
6
+ export * from './Labeling';
4
7
  export * from './FillInBlank';
5
8
  export * from './Grouping';
6
9
  export * from './Powerpoint';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC"}
@@ -2,6 +2,9 @@ export * from './useMultipleChoices';
2
2
  export * from './useBaseQuestion';
3
3
  export * from './useMatching';
4
4
  export * from './useVideo';
5
+ export * from './useDragDrop';
6
+ export * from './useOrdering';
7
+ export * from './useLabeling';
5
8
  export * from './useFillInBlank';
6
9
  export * from './useGrouping';
7
10
  export * from './usePowerpoint';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC"}
@@ -0,0 +1,25 @@
1
+ import { DragDropQuestionType, DragDropAnswer, DragDropItem } from '../types';
2
+ export declare function useDragDrop(question: DragDropQuestionType): {
3
+ items: DragDropItem[];
4
+ dropZones: import('..').DragDropZone[];
5
+ answers: DragDropAnswer[];
6
+ availableItems: DragDropItem[];
7
+ question: DragDropQuestionType;
8
+ draggingItemId: string | null;
9
+ submitted: boolean | null;
10
+ isCorrect: boolean | null;
11
+ attempts: number;
12
+ canAnswer: boolean;
13
+ dropItem: (itemId: string, zoneId: string) => void;
14
+ removeItem: (itemId: string) => void;
15
+ moveItem: (itemId: string, newZoneId: string) => void;
16
+ getItemsInZone: (zoneId: string) => DragDropItem[];
17
+ setDraggingItemId: import('react').Dispatch<import('react').SetStateAction<string | null>>;
18
+ submit: () => {
19
+ isCorrect: boolean;
20
+ score: number;
21
+ maxScore: number;
22
+ };
23
+ reset: () => void;
24
+ };
25
+ //# sourceMappingURL=useDragDrop.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useDragDrop.d.ts","sourceRoot":"","sources":["../../src/hooks/useDragDrop.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,oBAAoB,EACpB,cAAc,EACd,YAAY,EACb,MAAM,UAAU,CAAC;AAElB,wBAAgB,WAAW,CAAC,QAAQ,EAAE,oBAAoB;;;;;;;;;;;uBAwB9B,MAAM,UAAU,MAAM;yBAwBpB,MAAM;uBAKR,MAAM,aAAa,MAAM;6BAKnB,MAAM,KAAG,YAAY,EAAE;;;;;;;;EAsFxD"}
@@ -7,7 +7,7 @@ export declare function useFillInBlank(question: FillInBlankQuestionType): {
7
7
  isCorrect: boolean | null;
8
8
  attempts: number;
9
9
  canAnswer: boolean;
10
- answer: (targetId: string, value: string) => void;
10
+ answer: (blankId: string, value: string) => void;
11
11
  submit: () => {
12
12
  isCorrect: boolean;
13
13
  score: number;
@@ -1 +1 @@
1
- {"version":3,"file":"useFillInBlank.d.ts","sourceRoot":"","sources":["../../src/hooks/useFillInBlank.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAEtF,wBAAgB,cAAc,CAAC,QAAQ,EAAE,uBAAuB;;;;;;;;uBAYpC,MAAM,SAAS,MAAM;;;;;;;EA8EhD"}
1
+ {"version":3,"file":"useFillInBlank.d.ts","sourceRoot":"","sources":["../../src/hooks/useFillInBlank.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAEtF,wBAAgB,cAAc,CAAC,QAAQ,EAAE,uBAAuB;;;;;;;;sBAYrC,MAAM,SAAS,MAAM;;;;;;;EA8E/C"}
@@ -3,6 +3,14 @@ export declare function useGrouping(question: GroupingQuestionType): {
3
3
  categories: import('..').GroupingCategory[];
4
4
  allItems: import('..').GroupingItem[];
5
5
  question: GroupingQuestionType;
6
+ categoriesWithItems: {
7
+ items: {
8
+ item: import('..').GroupingItem | undefined;
9
+ }[];
10
+ id: string;
11
+ name: string;
12
+ media?: import('..').Media;
13
+ }[];
6
14
  answers: GroupingAnswer[];
7
15
  unassignedItems: import('..').GroupingItem[];
8
16
  submitted: boolean | null;
@@ -1 +1 @@
1
- {"version":3,"file":"useGrouping.d.ts","sourceRoot":"","sources":["../../src/hooks/useGrouping.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAEzE,wBAAgB,WAAW,CAAC,QAAQ,EAAE,oBAAoB;;;;;;;;;;mBAYlC,MAAM,cAAc,MAAM;qBAYxB,MAAM;;;;;;;EA+E/B"}
1
+ {"version":3,"file":"useGrouping.d.ts","sourceRoot":"","sources":["../../src/hooks/useGrouping.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAEzE,wBAAgB,WAAW,CAAC,QAAQ,EAAE,oBAAoB;;;;;;;;;;;;;;;;;;mBAYlC,MAAM,cAAc,MAAM;qBAYxB,MAAM;;;;;;;EAqG/B"}
@@ -0,0 +1,27 @@
1
+ import { LabelingQuestionType, LabelingAnswer, LabelingLabel } from '../types';
2
+ export declare function useLabeling(question: LabelingQuestionType): {
3
+ image: import('..').Media;
4
+ labels: LabelingLabel[];
5
+ points: import('..').LabelingPoint[];
6
+ answers: LabelingAnswer[];
7
+ availableLabels: LabelingLabel[];
8
+ question: LabelingQuestionType;
9
+ draggingLabelId: string | null;
10
+ submitted: boolean | null;
11
+ isCorrect: boolean | null;
12
+ attempts: number;
13
+ canAnswer: boolean;
14
+ attachLabel: (labelId: string, pointId: string, x?: number, y?: number) => void;
15
+ removeLabel: (labelId: string) => void;
16
+ moveLabel: (labelId: string, newPointId: string, x?: number, y?: number) => void;
17
+ getLabelAtPoint: (pointId: string) => LabelingLabel | null;
18
+ getPointForLabel: (labelId: string) => string | null;
19
+ setDraggingLabelId: import('react').Dispatch<import('react').SetStateAction<string | null>>;
20
+ submit: () => {
21
+ isCorrect: boolean;
22
+ score: number;
23
+ maxScore: number;
24
+ };
25
+ reset: () => void;
26
+ };
27
+ //# sourceMappingURL=useLabeling.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useLabeling.d.ts","sourceRoot":"","sources":["../../src/hooks/useLabeling.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,oBAAoB,EACpB,cAAc,EACd,aAAa,EACd,MAAM,UAAU,CAAC;AAElB,wBAAgB,WAAW,CAAC,QAAQ,EAAE,oBAAoB;;;;;;;;;;;;2BA0B1B,MAAM,WAAW,MAAM,MAAM,MAAM,MAAM,MAAM;2BAqB/C,MAAM;yBAKR,MAAM,cAAc,MAAM,MAAM,MAAM,MAAM,MAAM;+BAK5C,MAAM,KAAG,aAAa,GAAG,IAAI;gCAW5B,MAAM,KAAG,MAAM,GAAG,IAAI;;;;;;;;EAyE1D"}
@@ -0,0 +1,24 @@
1
+ import { OrderingQuestionType, OrderingItem } from '../types';
2
+ export declare function useOrdering(question: OrderingQuestionType): {
3
+ items: OrderingItem[];
4
+ orderedItems: OrderingItem[];
5
+ orderedItemIds: string[];
6
+ question: OrderingQuestionType;
7
+ draggingItemId: string | null;
8
+ submitted: boolean | null;
9
+ isCorrect: boolean | null;
10
+ attempts: number;
11
+ canAnswer: boolean;
12
+ moveItem: (fromIndex: number, toIndex: number) => void;
13
+ moveUp: (itemId: string) => void;
14
+ moveDown: (itemId: string) => void;
15
+ moveToPosition: (itemId: string, newPosition: number) => void;
16
+ setDraggingItemId: import('react').Dispatch<import('react').SetStateAction<string | null>>;
17
+ submit: () => {
18
+ isCorrect: boolean;
19
+ score: number;
20
+ maxScore: number;
21
+ };
22
+ reset: () => void;
23
+ };
24
+ //# sourceMappingURL=useOrdering.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useOrdering.d.ts","sourceRoot":"","sources":["../../src/hooks/useOrdering.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAE9D,wBAAgB,WAAW,CAAC,QAAQ,EAAE,oBAAoB;;;;;;;;;;0BA0B3B,MAAM,WAAW,MAAM;qBAU5B,MAAM;uBAQJ,MAAM;6BAQA,MAAM,eAAe,MAAM;;;;;;;;EAuE5D"}
package/dist/index.js CHANGED
@@ -1,161 +1,161 @@
1
- import { useState as I, useEffect as _, useMemo as j } from "react";
2
- function k() {
3
- const [t, e] = I(null), [s, f] = I(null), [p, w] = I(0);
4
- function g(u) {
5
- e(!0), f(u), w((A) => A + 1);
1
+ import { useState as S, useEffect as y, useMemo as B } from "react";
2
+ function M() {
3
+ const [t, c] = S(null), [u, g] = S(null), [w, h] = S(0);
4
+ function Q(d) {
5
+ c(!0), g(d), h((v) => v + 1);
6
6
  }
7
- function r() {
8
- e(!1), f(null);
7
+ function n() {
8
+ c(!1), g(null);
9
9
  }
10
10
  return {
11
11
  // state
12
12
  submitted: t,
13
- isCorrect: s,
14
- attempts: p,
13
+ isCorrect: u,
14
+ attempts: w,
15
15
  // derived
16
16
  canAnswer: !t,
17
17
  // actions
18
- submitQuestion: g,
19
- resetQuestion: r
18
+ submitQuestion: Q,
19
+ resetQuestion: n
20
20
  };
21
21
  }
22
- function E(t, e) {
23
- if (t.length !== e.length) return !1;
24
- const s = new Set(t), f = new Set(e);
25
- if (s.size !== f.size) return !1;
26
- for (const p of s)
27
- if (!f.has(p)) return !1;
22
+ function k(t, c) {
23
+ if (t.length !== c.length) return !1;
24
+ const u = new Set(t), g = new Set(c);
25
+ if (u.size !== g.size) return !1;
26
+ for (const w of u)
27
+ if (!g.has(w)) return !1;
28
28
  return !0;
29
29
  }
30
- function L(t) {
30
+ function V(t) {
31
31
  const {
32
- canAnswer: e,
33
- submitted: s,
34
- isCorrect: f,
35
- attempts: p,
36
- resetQuestion: w,
37
- submitQuestion: g
38
- } = k(), [r, u] = I([]);
39
- function A(C) {
40
- u((l) => t.options.allowMultipleAnswers ? l.includes(C) ? l.filter((d) => d !== C) : [...l, C] : [C]);
41
- }
42
- function h() {
43
- if (r.length === 0) return;
32
+ canAnswer: c,
33
+ submitted: u,
34
+ isCorrect: g,
35
+ attempts: w,
36
+ resetQuestion: h,
37
+ submitQuestion: Q
38
+ } = M(), [n, d] = S([]);
39
+ function v(C) {
40
+ d((p) => t.options.allowMultipleAnswers ? p.includes(C) ? p.filter((I) => I !== C) : [...p, C] : [C]);
41
+ }
42
+ function O() {
43
+ if (n.length === 0) return;
44
44
  const C = t.options.answers.reduce(
45
- (d, n) => (n.is_correct && d.push(n.id), d),
45
+ (I, A) => (A.is_correct && I.push(A.id), I),
46
46
  []
47
- ), l = E(r, C);
48
- g(l);
47
+ ), p = k(n, C);
48
+ Q(p);
49
49
  }
50
- function S() {
51
- u([]), w();
50
+ function L() {
51
+ d([]), h();
52
52
  }
53
53
  return {
54
54
  // data
55
55
  question: t,
56
- selectedIds: r,
56
+ selectedIds: n,
57
57
  // actions
58
- select: A,
59
- submit: h,
60
- reset: S,
58
+ select: v,
59
+ submit: O,
60
+ reset: L,
61
61
  // base
62
- submitted: s,
63
- isCorrect: f,
64
- attempts: p,
65
- canAnswer: e
62
+ submitted: u,
63
+ isCorrect: g,
64
+ attempts: w,
65
+ canAnswer: c
66
66
  };
67
67
  }
68
- function O(t) {
68
+ function z(t) {
69
69
  const {
70
- canAnswer: e,
71
- submitted: s,
72
- isCorrect: f,
73
- attempts: p,
74
- submitQuestion: w,
75
- resetQuestion: g
76
- } = k(), [r, u] = I([]), [A, h] = I(
70
+ canAnswer: c,
71
+ submitted: u,
72
+ isCorrect: g,
73
+ attempts: w,
74
+ submitQuestion: h,
75
+ resetQuestion: Q
76
+ } = M(), [n, d] = S([]), [v, O] = S(
77
77
  []
78
- ), [S, C] = I(
78
+ ), [L, C] = S(
79
79
  []
80
80
  );
81
- function l(o, i) {
82
- u((c) => [
83
- ...c.filter(
84
- (b) => b.targetId !== o && b.sourceId !== i
81
+ function p(l, r) {
82
+ d((s) => [
83
+ ...s.filter(
84
+ (o) => o.targetId !== l && o.sourceId !== r
85
85
  ),
86
- { targetId: o, sourceId: i }
86
+ { targetId: l, sourceId: r }
87
87
  ]);
88
88
  }
89
- function d(o, i) {
90
- u(
91
- (c) => c.filter((b) => b.targetId !== o || b.sourceId !== i)
89
+ function I(l, r) {
90
+ d(
91
+ (s) => s.filter((o) => o.targetId !== l || o.sourceId !== r)
92
92
  );
93
93
  }
94
- function n() {
95
- let o = 0, i = !0;
96
- return t.options.targets.forEach((c) => {
97
- const b = r.find((x) => x.targetId === c.id), Q = t.options.sources[c.content.correct_position - 1];
98
- b && Q && b.sourceId === Q.id ? o += c.content.point : i = !1;
94
+ function A() {
95
+ let l = 0, r = !0;
96
+ return t.options.targets.forEach((s) => {
97
+ const o = n.find((i) => i.targetId === s.id), e = t.options.sources[s.content.correct_position - 1];
98
+ o && e && o.sourceId === e.id ? l += s.content.point : r = !1;
99
99
  }), {
100
- isCorrect: i,
101
- score: o,
100
+ isCorrect: r,
101
+ score: l,
102
102
  maxScore: t.options.targets.reduce(
103
- (c, b) => c + b.content.point,
103
+ (s, o) => s + o.content.point,
104
104
  0
105
105
  )
106
106
  };
107
107
  }
108
- function m() {
109
- const o = n();
110
- return w(o.isCorrect), o;
111
- }
112
108
  function a() {
113
- u([]), g();
109
+ const l = A();
110
+ return h(l.isCorrect), l;
111
+ }
112
+ function m() {
113
+ d([]), Q();
114
114
  }
115
- return _(() => {
116
- const o = t.options.sources.filter(
117
- (i) => !r.some((c) => c.sourceId === i.id)
115
+ return y(() => {
116
+ const l = t.options.sources.filter(
117
+ (r) => !n.some((s) => s.sourceId === r.id)
118
118
  );
119
- h(o);
120
- }, [r, t.options.sources]), _(() => {
121
- const o = t.options.targets.filter(
122
- (i) => !r.some((c) => c.targetId === i.id)
119
+ O(l);
120
+ }, [n, t.options.sources]), y(() => {
121
+ const l = t.options.targets.filter(
122
+ (r) => !n.some((s) => s.targetId === r.id)
123
123
  );
124
- C(o);
125
- }, [r, t.options.targets]), {
124
+ C(l);
125
+ }, [n, t.options.targets]), {
126
126
  // data
127
127
  sources: t.options.sources,
128
128
  targets: t.options.targets,
129
- answers: r,
129
+ answers: n,
130
130
  question: t,
131
- availableSources: A,
132
- availableTargets: S,
131
+ availableSources: v,
132
+ availableTargets: L,
133
133
  // base
134
- submitted: s,
135
- isCorrect: f,
136
- attempts: p,
137
- canAnswer: e,
134
+ submitted: u,
135
+ isCorrect: g,
136
+ attempts: w,
137
+ canAnswer: c,
138
138
  // actions
139
- select: l,
140
- remove: d,
141
- submit: m,
142
- reset: a
139
+ select: p,
140
+ remove: I,
141
+ submit: a,
142
+ reset: m
143
143
  };
144
144
  }
145
- function T(t) {
145
+ function P(t) {
146
146
  const {
147
- canAnswer: e,
148
- submitted: s,
149
- isCorrect: f,
150
- attempts: p,
151
- resetQuestion: w,
152
- submitQuestion: g
153
- } = k();
154
- function r() {
155
- g(!0);
147
+ canAnswer: c,
148
+ submitted: u,
149
+ isCorrect: g,
150
+ attempts: w,
151
+ resetQuestion: h,
152
+ submitQuestion: Q
153
+ } = M();
154
+ function n() {
155
+ Q(!0);
156
156
  }
157
- function u() {
158
- w();
157
+ function d() {
158
+ h();
159
159
  }
160
160
  return {
161
161
  // data
@@ -163,156 +163,413 @@ function T(t) {
163
163
  url: t.options.url,
164
164
  type: t.options.urlType,
165
165
  // actions
166
+ submit: n,
167
+ reset: d,
168
+ // base
169
+ submitted: u,
170
+ isCorrect: g,
171
+ attempts: w,
172
+ canAnswer: c
173
+ };
174
+ }
175
+ function T(t) {
176
+ const {
177
+ canAnswer: c,
178
+ submitted: u,
179
+ isCorrect: g,
180
+ attempts: w,
181
+ submitQuestion: h,
182
+ resetQuestion: Q
183
+ } = M(), [n, d] = S([]), [v, O] = S(null), L = () => {
184
+ const o = new Set(n.map((e) => e.itemId));
185
+ return t.options.items.filter((e) => !o.has(e.id));
186
+ }, [C, p] = S(
187
+ L()
188
+ );
189
+ function I(o, e) {
190
+ if (!t.options.dropZones.find((b) => b.id === e)) return;
191
+ const x = n.filter((b) => b.zoneId === e).length;
192
+ d((b) => [
193
+ ...b.filter((Z) => Z.itemId !== o),
194
+ {
195
+ itemId: o,
196
+ zoneId: e,
197
+ position: x
198
+ }
199
+ ]);
200
+ }
201
+ function A(o) {
202
+ d((e) => e.filter((i) => i.itemId !== o));
203
+ }
204
+ function a(o, e) {
205
+ I(o, e);
206
+ }
207
+ function m(o) {
208
+ return n.filter((e) => e.zoneId === o).sort((e, i) => e.position - i.position).map((e) => t.options.items.find(
209
+ (f) => f.id === e.itemId
210
+ )).filter(Boolean);
211
+ }
212
+ function l() {
213
+ let o = 0, e = !0;
214
+ return t.options.items.forEach((i) => {
215
+ const f = n.find((b) => b.itemId === i.id), x = t.options.dropZones.find(
216
+ (b) => b.position === i.correctPosition
217
+ );
218
+ f && x && f.zoneId === x.id ? o += i.point : e = !1;
219
+ }), {
220
+ isCorrect: e,
221
+ score: o,
222
+ maxScore: t.options.items.reduce(
223
+ (i, f) => i + f.point,
224
+ 0
225
+ )
226
+ };
227
+ }
228
+ function r() {
229
+ const o = l();
230
+ return h(o.isCorrect), o;
231
+ }
232
+ function s() {
233
+ d([]), Q();
234
+ }
235
+ return y(() => {
236
+ p(L());
237
+ }, [n]), {
238
+ // data
239
+ items: t.options.items,
240
+ dropZones: t.options.dropZones,
241
+ answers: n,
242
+ availableItems: C,
243
+ question: t,
244
+ draggingItemId: v,
245
+ // base
246
+ submitted: u,
247
+ isCorrect: g,
248
+ attempts: w,
249
+ canAnswer: c,
250
+ // actions
251
+ dropItem: I,
252
+ removeItem: A,
253
+ moveItem: a,
254
+ getItemsInZone: m,
255
+ setDraggingItemId: O,
166
256
  submit: r,
167
- reset: u,
257
+ reset: s
258
+ };
259
+ }
260
+ function _(t) {
261
+ const {
262
+ canAnswer: c,
263
+ submitted: u,
264
+ isCorrect: g,
265
+ attempts: w,
266
+ submitQuestion: h,
267
+ resetQuestion: Q
268
+ } = M(), [n, d] = S(() => t.options.items.map((r) => r.id)), [v, O] = S(null);
269
+ function L() {
270
+ return n.map((r) => t.options.items.find((s) => s.id === r)).filter((r) => r !== void 0);
271
+ }
272
+ function C(r, s) {
273
+ d((o) => {
274
+ const e = [...o], [i] = e.splice(r, 1);
275
+ return e.splice(s, 0, i), e;
276
+ });
277
+ }
278
+ function p(r) {
279
+ const s = n.indexOf(r);
280
+ s > 0 && C(s, s - 1);
281
+ }
282
+ function I(r) {
283
+ const s = n.indexOf(r);
284
+ s < n.length - 1 && C(s, s + 1);
285
+ }
286
+ function A(r, s) {
287
+ const o = n.indexOf(r);
288
+ o !== -1 && s >= 0 && s < n.length && C(o, s);
289
+ }
290
+ function a() {
291
+ let r = 0, s = !0;
292
+ return n.forEach((o, e) => {
293
+ const i = t.options.items.find((f) => f.id === o);
294
+ i && (e === i.correctOrder ? r += i.point : s = !1);
295
+ }), {
296
+ isCorrect: s,
297
+ score: r,
298
+ maxScore: t.options.items.reduce(
299
+ (o, e) => o + e.point,
300
+ 0
301
+ )
302
+ };
303
+ }
304
+ function m() {
305
+ const r = a();
306
+ return h(r.isCorrect), r;
307
+ }
308
+ function l() {
309
+ d(t.options.items.map((r) => r.id)), Q();
310
+ }
311
+ return {
312
+ // data
313
+ items: t.options.items,
314
+ orderedItems: L(),
315
+ orderedItemIds: n,
316
+ question: t,
317
+ draggingItemId: v,
318
+ // base
319
+ submitted: u,
320
+ isCorrect: g,
321
+ attempts: w,
322
+ canAnswer: c,
323
+ // actions
324
+ moveItem: C,
325
+ moveUp: p,
326
+ moveDown: I,
327
+ moveToPosition: A,
328
+ setDraggingItemId: O,
329
+ submit: m,
330
+ reset: l
331
+ };
332
+ }
333
+ function j(t) {
334
+ const {
335
+ canAnswer: c,
336
+ submitted: u,
337
+ isCorrect: g,
338
+ attempts: w,
339
+ submitQuestion: h,
340
+ resetQuestion: Q
341
+ } = M(), [n, d] = S([]), [v, O] = S(null), L = () => {
342
+ const e = new Set(n.map((i) => i.labelId));
343
+ return t.options.labels.filter(
344
+ (i) => !e.has(i.id)
345
+ );
346
+ }, [C, p] = S(
347
+ L()
348
+ );
349
+ function I(e, i, f, x) {
350
+ const b = t.options.points.find((D) => D.id === i);
351
+ b && d((D) => [
352
+ ...D.filter((E) => E.labelId !== e),
353
+ {
354
+ labelId: e,
355
+ pointId: i,
356
+ x: f ?? b.x,
357
+ y: x ?? b.y
358
+ }
359
+ ]);
360
+ }
361
+ function A(e) {
362
+ d((i) => i.filter((f) => f.labelId !== e));
363
+ }
364
+ function a(e, i, f, x) {
365
+ I(e, i, f, x);
366
+ }
367
+ function m(e) {
368
+ const i = n.find((f) => f.pointId === e);
369
+ return i && t.options.labels.find((f) => f.id === i.labelId) || null;
370
+ }
371
+ function l(e) {
372
+ const i = n.find((f) => f.labelId === e);
373
+ return i ? i.pointId : null;
374
+ }
375
+ function r() {
376
+ let e = 0, i = !0;
377
+ return t.options.labels.forEach((f) => {
378
+ const x = n.find((b) => b.labelId === f.id);
379
+ x && x.pointId === f.correctPointId ? e += f.point : i = !1;
380
+ }), {
381
+ isCorrect: i,
382
+ score: e,
383
+ maxScore: t.options.labels.reduce(
384
+ (f, x) => f + x.point,
385
+ 0
386
+ )
387
+ };
388
+ }
389
+ function s() {
390
+ const e = r();
391
+ return h(e.isCorrect), e;
392
+ }
393
+ function o() {
394
+ d([]), Q();
395
+ }
396
+ return y(() => {
397
+ p(L());
398
+ }, [n]), {
399
+ // data
400
+ image: t.options.image,
401
+ labels: t.options.labels,
402
+ points: t.options.points,
403
+ answers: n,
404
+ availableLabels: C,
405
+ question: t,
406
+ draggingLabelId: v,
168
407
  // base
169
- submitted: s,
170
- isCorrect: f,
171
- attempts: p,
172
- canAnswer: e
408
+ submitted: u,
409
+ isCorrect: g,
410
+ attempts: w,
411
+ canAnswer: c,
412
+ // actions
413
+ attachLabel: I,
414
+ removeLabel: A,
415
+ moveLabel: a,
416
+ getLabelAtPoint: m,
417
+ getPointForLabel: l,
418
+ setDraggingLabelId: O,
419
+ submit: s,
420
+ reset: o
173
421
  };
174
422
  }
175
- function v(t) {
423
+ function F(t) {
176
424
  const {
177
- canAnswer: e,
178
- submitted: s,
179
- isCorrect: f,
180
- attempts: p,
181
- submitQuestion: w,
182
- resetQuestion: g
183
- } = k(), [r, u] = I([]);
184
- function A(l, d) {
185
- u((n) => {
186
- const m = n.findIndex((a) => a.targetId === l);
187
- if (m >= 0) {
188
- const a = [...n];
189
- return a[m] = { targetId: l, value: d }, a;
425
+ canAnswer: c,
426
+ submitted: u,
427
+ isCorrect: g,
428
+ attempts: w,
429
+ submitQuestion: h,
430
+ resetQuestion: Q
431
+ } = M(), [n, d] = S([]);
432
+ function v(p, I) {
433
+ d((A) => {
434
+ const a = A.findIndex((m) => m.blankId === p);
435
+ if (a >= 0) {
436
+ const m = [...A];
437
+ return m[a] = { blankId: p, value: I }, m;
190
438
  }
191
- return [...n, { targetId: l, value: d }];
439
+ return [...A, { blankId: p, value: I }];
192
440
  });
193
441
  }
194
- function h() {
195
- let l = 0, d = 0, n = 0;
196
- const m = t.correct_answers.list || {}, a = Object.keys(m).length;
197
- Object.entries(m).forEach(([i, c]) => {
198
- const b = String(c).trim().toLowerCase(), Q = t.options.answers.find(
199
- (M) => M.correct_position === Number(i)
200
- ), x = Q && Q.point || 1;
201
- n += x;
202
- const B = r.find((M) => M.targetId === i);
203
- (B ? String(B.value).trim().toLowerCase() : "") === b && (l += x, d++);
442
+ function O() {
443
+ let p = 0, I = 0, A = 0;
444
+ const a = t.correct_answers.list || {}, m = Object.keys(a).length;
445
+ Object.entries(a).forEach(([r, s]) => {
446
+ const o = String(s).trim().toLowerCase(), e = t.options.answers.find(
447
+ (b) => b.correct_position === Number(r)
448
+ ), i = e && e.point || 1;
449
+ A += i;
450
+ const f = n.find((b) => b.blankId === r);
451
+ (f ? String(f.value).trim().toLowerCase() : "") === o && (p += i, I++);
204
452
  });
205
- const o = d === a && a > 0;
206
- return n === 0 && a > 0 && (n = a), {
207
- isCorrect: o,
208
- score: Math.round(l * 100) / 100,
209
- maxScore: Math.round(n * 100) / 100
453
+ const l = I === m && m > 0;
454
+ return A === 0 && m > 0 && (A = m), {
455
+ isCorrect: l,
456
+ score: Math.round(p * 100) / 100,
457
+ maxScore: Math.round(A * 100) / 100
210
458
  };
211
459
  }
212
- function S() {
213
- const l = h();
214
- return w(l.isCorrect), l;
460
+ function L() {
461
+ const p = O();
462
+ return h(p.isCorrect), p;
215
463
  }
216
464
  function C() {
217
- u([]), g();
465
+ d([]), Q();
218
466
  }
219
467
  return {
220
468
  // data
221
469
  groups: t.options.groups,
222
- answers: r,
470
+ answers: n,
223
471
  question: t,
224
472
  // base
225
- submitted: s,
226
- isCorrect: f,
227
- attempts: p,
228
- canAnswer: e,
473
+ submitted: u,
474
+ isCorrect: g,
475
+ attempts: w,
476
+ canAnswer: c,
229
477
  // actions
230
- answer: A,
231
- submit: S,
478
+ answer: v,
479
+ submit: L,
232
480
  reset: C
233
481
  };
234
482
  }
235
- function z(t) {
483
+ function G(t) {
236
484
  const {
237
- canAnswer: e,
238
- submitted: s,
239
- isCorrect: f,
240
- attempts: p,
241
- submitQuestion: w,
242
- resetQuestion: g
243
- } = k(), [r, u] = I([]);
244
- function A(n, m) {
245
- u((a) => {
246
- const o = a.findIndex((i) => i.itemId === n);
247
- if (o >= 0) {
248
- const i = [...a];
249
- return i[o] = { itemId: n, categoryId: m }, i;
485
+ canAnswer: c,
486
+ submitted: u,
487
+ isCorrect: g,
488
+ attempts: w,
489
+ submitQuestion: h,
490
+ resetQuestion: Q
491
+ } = M(), [n, d] = S([]);
492
+ function v(a, m) {
493
+ d((l) => {
494
+ const r = l.findIndex((s) => s.itemId === a);
495
+ if (r >= 0) {
496
+ const s = [...l];
497
+ return s[r] = { itemId: a, categoryId: m }, s;
250
498
  }
251
- return [...a, { itemId: n, categoryId: m }];
499
+ return [...l, { itemId: a, categoryId: m }];
252
500
  });
253
501
  }
254
- function h(n) {
255
- u((m) => m.filter((a) => a.itemId !== n));
256
- }
257
- function S() {
258
- let n = 0, m = 0;
259
- const o = t.correct_answers.list || {}, i = Object.keys(o).length;
260
- let c = 0;
261
- return Object.entries(o).forEach(([Q, x]) => {
262
- const B = t.options.items.find((y) => y.id === Q), V = B ? B.point : 0;
263
- c += V;
264
- const M = r.find((y) => y.itemId === Q);
265
- M && M.categoryId === x && (n += V, m++);
266
- }), n = Math.round(n * 100) / 100, c = Math.round(c * 100) / 100, {
267
- isCorrect: m === i && i > 0,
268
- score: n,
269
- maxScore: c
502
+ function O(a) {
503
+ d((m) => m.filter((l) => l.itemId !== a));
504
+ }
505
+ function L() {
506
+ let a = 0, m = 0;
507
+ const r = t.correct_answers.list || {}, s = Object.keys(r).length;
508
+ let o = 0;
509
+ return Object.entries(r).forEach(([i, f]) => {
510
+ const x = t.options.items.find((Z) => Z.id === i), b = x ? x.point : 0;
511
+ o += b;
512
+ const D = n.find((Z) => Z.itemId === i);
513
+ D && D.categoryId === f && (a += b, m++);
514
+ }), a = Math.round(a * 100) / 100, o = Math.round(o * 100) / 100, {
515
+ isCorrect: m === s && s > 0,
516
+ score: a,
517
+ maxScore: o
270
518
  };
271
519
  }
272
520
  function C() {
273
- const n = S();
274
- return w(n.isCorrect), n;
521
+ const a = L();
522
+ return h(a.isCorrect), a;
275
523
  }
276
- function l() {
277
- u([]), g();
524
+ function p() {
525
+ d([]), Q();
278
526
  }
279
- const d = j(() => t.options.items.filter(
280
- (n) => !r.some((m) => m.itemId === n.id)
281
- ), [t.options.items, r]);
527
+ const I = B(() => t.options.items.filter(
528
+ (a) => !n.some((m) => m.itemId === a.id)
529
+ ), [t.options.items, n]), A = B(() => t.options.categories.map((a) => {
530
+ const m = n.filter((l) => l.categoryId === a.id).map((l) => ({
531
+ item: t.options.items.find((s) => s.id === l.itemId)
532
+ }));
533
+ return {
534
+ ...a,
535
+ items: m
536
+ };
537
+ }), [t.options.categories, t.options.items, n]);
282
538
  return {
283
539
  // data
284
540
  categories: t.options.categories,
285
541
  allItems: t.options.items,
286
542
  question: t,
543
+ categoriesWithItems: A,
287
544
  // state
288
- answers: r,
289
- unassignedItems: d,
545
+ answers: n,
546
+ unassignedItems: I,
290
547
  // base
291
- submitted: s,
292
- isCorrect: f,
293
- attempts: p,
294
- canAnswer: e,
548
+ submitted: u,
549
+ isCorrect: g,
550
+ attempts: w,
551
+ canAnswer: c,
295
552
  // actions
296
- move: A,
297
- remove: h,
553
+ move: v,
554
+ remove: O,
298
555
  submit: C,
299
- reset: l
556
+ reset: p
300
557
  };
301
558
  }
302
- function F(t) {
559
+ function N(t) {
303
560
  const {
304
- canAnswer: e,
305
- submitted: s,
306
- isCorrect: f,
307
- attempts: p,
308
- resetQuestion: w,
309
- submitQuestion: g
310
- } = k();
311
- function r() {
312
- s || g(!0);
561
+ canAnswer: c,
562
+ submitted: u,
563
+ isCorrect: g,
564
+ attempts: w,
565
+ resetQuestion: h,
566
+ submitQuestion: Q
567
+ } = M();
568
+ function n() {
569
+ u || Q(!0);
313
570
  }
314
- function u() {
315
- w();
571
+ function d() {
572
+ h();
316
573
  }
317
574
  return {
318
575
  // data
@@ -320,70 +577,97 @@ function F(t) {
320
577
  url: t.options.url,
321
578
  type: t.options.urlType,
322
579
  // actions
323
- submit: r,
324
- reset: u,
580
+ submit: n,
581
+ reset: d,
325
582
  // base
326
- submitted: s,
327
- isCorrect: f,
328
- attempts: p,
329
- canAnswer: e
583
+ submitted: u,
584
+ isCorrect: g,
585
+ attempts: w,
586
+ canAnswer: c
330
587
  };
331
588
  }
332
- function P({
589
+ function W({
333
590
  getData: t,
334
- children: e
591
+ children: c
335
592
  }) {
336
- const s = L(t());
337
- return e(s);
593
+ const u = V(t());
594
+ return c(u);
338
595
  }
339
- function N({
596
+ function H({
340
597
  getData: t,
341
- children: e
598
+ children: c
342
599
  }) {
343
- const s = O(t());
344
- return e(s);
600
+ const u = z(t());
601
+ return c(u);
345
602
  }
346
- function D({
603
+ function J({
347
604
  getData: t,
348
- children: e
605
+ children: c
349
606
  }) {
350
- const s = T(t());
351
- return e(s);
607
+ const u = P(t());
608
+ return c(u);
352
609
  }
353
- function H({
610
+ function R({
354
611
  getData: t,
355
- children: e
612
+ children: c
356
613
  }) {
357
- const s = v(t());
358
- return e(s);
614
+ const u = T(t());
615
+ return c(u);
359
616
  }
360
- function J({
617
+ function X({
361
618
  getData: t,
362
- children: e
619
+ children: c
363
620
  }) {
364
- const s = z(t());
365
- return e(s);
621
+ const u = _(t());
622
+ return c(u);
366
623
  }
367
- function R({
624
+ function Y({
625
+ getData: t,
626
+ children: c
627
+ }) {
628
+ const u = j(t());
629
+ return c(u);
630
+ }
631
+ function $({
632
+ getData: t,
633
+ children: c
634
+ }) {
635
+ const u = F(t());
636
+ return c(u);
637
+ }
638
+ function K({
639
+ getData: t,
640
+ children: c
641
+ }) {
642
+ const u = G(t());
643
+ return c(u);
644
+ }
645
+ function q({
368
646
  getData: t,
369
- children: e
647
+ children: c
370
648
  }) {
371
- const s = F(t());
372
- return e(s);
649
+ const u = N(t());
650
+ return c(u);
373
651
  }
374
652
  export {
375
- H as FillInBlankQuestion,
376
- J as GroupingQuestion,
377
- N as MatchingQuestion,
378
- P as MultipleChoicesQuestion,
379
- R as PowerpointQuestion,
380
- D as VideoQuestion,
381
- E as isSameSet,
382
- k as useBaseQuestion,
383
- v as useFillInBlank,
384
- z as useGrouping,
385
- O as useMatching,
386
- L as useMultipleChoice,
387
- F as usePowerpoint,
388
- T as useVideo
653
+ R as DragDropQuestion,
654
+ $ as FillInBlankQuestion,
655
+ K as GroupingQuestion,
656
+ Y as LabelingQuestion,
657
+ H as MatchingQuestion,
658
+ W as MultipleChoicesQuestion,
659
+ X as OrderingQuestion,
660
+ q as PowerpointQuestion,
661
+ J as VideoQuestion,
662
+ k as isSameSet,
663
+ M as useBaseQuestion,
664
+ T as useDragDrop,
665
+ F as useFillInBlank,
666
+ G as useGrouping,
667
+ j as useLabeling,
668
+ z as useMatching,
669
+ V as useMultipleChoice,
670
+ _ as useOrdering,
671
+ N as usePowerpoint,
672
+ P as useVideo
389
673
  };
@@ -0,0 +1,27 @@
1
+ import { BaseQuestion, Media } from './common';
2
+ export interface DragDropQuestionType extends BaseQuestion {
3
+ options: {
4
+ items: DragDropItem[];
5
+ dropZones: DragDropZone[];
6
+ };
7
+ }
8
+ export interface DragDropItem {
9
+ id: string;
10
+ content: {
11
+ text: string;
12
+ media?: Media;
13
+ };
14
+ correctPosition: number;
15
+ point: number;
16
+ }
17
+ export interface DragDropZone {
18
+ id: string;
19
+ label?: string;
20
+ position: number;
21
+ }
22
+ export interface DragDropAnswer {
23
+ itemId: string;
24
+ zoneId: string;
25
+ position: number;
26
+ }
27
+ //# sourceMappingURL=dragDrop.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dragDrop.d.ts","sourceRoot":"","sources":["../../src/types/dragDrop.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAE/C,MAAM,WAAW,oBAAqB,SAAQ,YAAY;IACxD,OAAO,EAAE;QACP,KAAK,EAAE,YAAY,EAAE,CAAC;QACtB,SAAS,EAAE,YAAY,EAAE,CAAC;KAC3B,CAAC;CACH;AAED,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE;QACP,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,CAAC,EAAE,KAAK,CAAC;KACf,CAAC;IACF,eAAe,EAAE,MAAM,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;CAClB"}
@@ -24,7 +24,7 @@ export interface FillInBlankGroup {
24
24
  media: Media;
25
25
  }
26
26
  export interface FillInBlankUserAnswer {
27
- targetId: string;
27
+ blankId: string;
28
28
  value: string;
29
29
  }
30
30
  //# sourceMappingURL=fillInBlank.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"fillInBlank.d.ts","sourceRoot":"","sources":["../../src/types/fillInBlank.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAE/C,MAAM,WAAW,uBAAwB,SAAQ,YAAY;IAC3D,OAAO,EAAE;QACP,OAAO,EAAE,iBAAiB,EAAE,CAAC;QAC7B,MAAM,EAAE,gBAAgB,EAAE,CAAC;KAC5B,CAAC;IACF,eAAe,EAAE;QACf,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KAC9B,CAAC;CACH;AAED,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,KAAK,CAAC;IACb,gBAAgB,EAAE,MAAM,CAAC;IACzB,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAChC;AAED,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,KAAK,CAAC;CACd;AAED,MAAM,WAAW,qBAAqB;IACpC,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;CACf"}
1
+ {"version":3,"file":"fillInBlank.d.ts","sourceRoot":"","sources":["../../src/types/fillInBlank.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAE/C,MAAM,WAAW,uBAAwB,SAAQ,YAAY;IAC3D,OAAO,EAAE;QACP,OAAO,EAAE,iBAAiB,EAAE,CAAC;QAC7B,MAAM,EAAE,gBAAgB,EAAE,CAAC;KAC5B,CAAC;IACF,eAAe,EAAE;QACf,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KAC9B,CAAC;CACH;AAED,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,KAAK,CAAC;IACb,gBAAgB,EAAE,MAAM,CAAC;IACzB,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAChC;AAED,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,KAAK,CAAC;CACd;AAED,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;CACf"}
@@ -2,6 +2,9 @@ export * from './multipleChoices';
2
2
  export * from './common';
3
3
  export * from './matching';
4
4
  export * from './url';
5
+ export * from './dragDrop';
6
+ export * from './ordering';
7
+ export * from './labeling';
5
8
  export * from './fillInBlank';
6
9
  export * from './grouping';
7
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,OAAO,CAAC;AACtB,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,OAAO,CAAC;AACtB,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC"}
@@ -0,0 +1,30 @@
1
+ import { BaseQuestion, Media } from './common';
2
+ export interface LabelingQuestionType extends BaseQuestion {
3
+ options: {
4
+ image: Media;
5
+ labels: LabelingLabel[];
6
+ points: LabelingPoint[];
7
+ };
8
+ }
9
+ export interface LabelingLabel {
10
+ id: string;
11
+ content: {
12
+ text: string;
13
+ media?: Media;
14
+ };
15
+ correctPointId: string;
16
+ point: number;
17
+ }
18
+ export interface LabelingPoint {
19
+ id: string;
20
+ x: number;
21
+ y: number;
22
+ label?: string;
23
+ }
24
+ export interface LabelingAnswer {
25
+ labelId: string;
26
+ pointId: string;
27
+ x?: number;
28
+ y?: number;
29
+ }
30
+ //# sourceMappingURL=labeling.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"labeling.d.ts","sourceRoot":"","sources":["../../src/types/labeling.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAE/C,MAAM,WAAW,oBAAqB,SAAQ,YAAY;IACxD,OAAO,EAAE;QACP,KAAK,EAAE,KAAK,CAAC;QACb,MAAM,EAAE,aAAa,EAAE,CAAC;QACxB,MAAM,EAAE,aAAa,EAAE,CAAC;KACzB,CAAC;CACH;AAED,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE;QACP,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,CAAC,EAAE,KAAK,CAAC;KACf,CAAC;IACF,cAAc,EAAE,MAAM,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,CAAC,CAAC,EAAE,MAAM,CAAC;CACZ"}
@@ -0,0 +1,16 @@
1
+ import { BaseQuestion, Media } from './common';
2
+ export interface OrderingQuestionType extends BaseQuestion {
3
+ options: {
4
+ items: OrderingItem[];
5
+ };
6
+ }
7
+ export interface OrderingItem {
8
+ id: string;
9
+ content: {
10
+ text: string;
11
+ media?: Media;
12
+ };
13
+ correctOrder: number;
14
+ point: number;
15
+ }
16
+ //# sourceMappingURL=ordering.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ordering.d.ts","sourceRoot":"","sources":["../../src/types/ordering.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAE/C,MAAM,WAAW,oBAAqB,SAAQ,YAAY;IACxD,OAAO,EAAE;QACP,KAAK,EAAE,YAAY,EAAE,CAAC;KACvB,CAAC;CACH;AAED,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE;QACP,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,CAAC,EAAE,KAAK,CAAC;KACf,CAAC;IACF,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;CACf"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@enspiredigital/xlms-headless",
3
- "version": "0.0.10",
3
+ "version": "0.0.11",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -20,4 +20,4 @@
20
20
  "publishConfig": {
21
21
  "access": "public"
22
22
  }
23
- }
23
+ }