@qti-editor/interaction-associate 1.1.3 → 1.2.1

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.
@@ -14,9 +14,8 @@ export declare const insertAssociateInteraction: Command;
14
14
  */
15
15
  export declare const insertAssociableChoiceOnEnter: Command;
16
16
  /**
17
- * Enter command chain for associate interactions.
18
- * 1) Insert new associable choice when inside qti-associate-interaction.
19
- * 2) Fallback to regular block split behavior elsewhere.
17
+ * Enter command for associate interactions.
18
+ * Inserts new associable choice when inside qti-associate-interaction.
20
19
  */
21
20
  export declare const qtiAssociateEnterCommand: Command;
22
21
  //# sourceMappingURL=qti-associate-interaction.commands.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"qti-associate-interaction.commands.d.ts","sourceRoot":"","sources":["../../../src/components/qti-associate-interaction/qti-associate-interaction.commands.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAOH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAGjD;;GAEG;AACH,eAAO,MAAM,0BAA0B,EAAE,OA4CxC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,6BAA6B,EAAE,OA0B3C,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,EAAE,OAAkE,CAAC"}
1
+ {"version":3,"file":"qti-associate-interaction.commands.d.ts","sourceRoot":"","sources":["../../../src/components/qti-associate-interaction/qti-associate-interaction.commands.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAOH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAGjD;;GAEG;AACH,eAAO,MAAM,0BAA0B,EAAE,OA4CxC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,6BAA6B,EAAE,OA0B3C,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,wBAAwB,EAAE,OAAuC,CAAC"}
@@ -3,7 +3,6 @@
3
3
  *
4
4
  * ProseMirror commands for inserting and manipulating associate interactions.
5
5
  */
6
- import { chainCommands, splitBlock } from 'prosemirror-commands';
7
6
  import { createInsertSiblingOnEnterCommand } from '@qti-editor/interaction-shared/commands/enter.js';
8
7
  import { createInsertBlockInteractionCommand } from '@qti-editor/interaction-shared/commands/insert.js';
9
8
  import { translateQti } from '@qti-editor/interaction-shared';
@@ -64,8 +63,7 @@ export const insertAssociableChoiceOnEnter = (state, dispatch) => {
64
63
  })(state, dispatch);
65
64
  };
66
65
  /**
67
- * Enter command chain for associate interactions.
68
- * 1) Insert new associable choice when inside qti-associate-interaction.
69
- * 2) Fallback to regular block split behavior elsewhere.
66
+ * Enter command for associate interactions.
67
+ * Inserts new associable choice when inside qti-associate-interaction.
70
68
  */
71
- export const qtiAssociateEnterCommand = chainCommands(insertAssociableChoiceOnEnter, splitBlock);
69
+ export const qtiAssociateEnterCommand = insertAssociableChoiceOnEnter;
@@ -1 +1 @@
1
- {"version":3,"file":"qti-associate-interaction.compose.d.ts","sourceRoot":"","sources":["../../../src/components/qti-associate-interaction/qti-associate-interaction.compose.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAmB,wBAAwB,EAAkC,MAAM,kDAAkD,CAAC;AAclJ,wBAAgB,kCAAkC,CAAC,aAAa,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,GAAG,wBAAwB,CA6CrH"}
1
+ {"version":3,"file":"qti-associate-interaction.compose.d.ts","sourceRoot":"","sources":["../../../src/components/qti-associate-interaction/qti-associate-interaction.compose.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAmB,wBAAwB,EAAkC,MAAM,kDAAkD,CAAC;AAclJ,wBAAgB,kCAAkC,CAAC,aAAa,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,GAAG,wBAAwB,CA+CrH"}
@@ -19,6 +19,7 @@ export function composeAssociateInteractionElement(sourceElement, xmlDoc) {
19
19
  const correctResponse = toNonEmptyString(sourceElement.getAttribute('correct-response'));
20
20
  const maxAssociations = toFiniteNumber(sourceElement.getAttribute('max-associations'), 1);
21
21
  const minAssociations = toFiniteNumber(sourceElement.getAttribute('min-associations'), 0);
22
+ const score = toFiniteNumber(sourceElement.getAttribute('score'), 1);
22
23
  const editorOnlyAttributes = [...metadata.editorOnlyAttributes];
23
24
  editorOnlyAttributes.forEach(attr => normalizedElement.removeAttribute(attr));
24
25
  normalizedElement.setAttribute('max-associations', String(maxAssociations > 0 ? maxAssociations : 1));
@@ -43,6 +44,7 @@ export function composeAssociateInteractionElement(sourceElement, xmlDoc) {
43
44
  baseType: 'identifier',
44
45
  correctResponse: correctResponse ?? undefined,
45
46
  sourceTag: metadata.tagName,
47
+ score,
46
48
  };
47
49
  }
48
50
  return {
@@ -1 +1 @@
1
- {"version":3,"file":"qti-associate-interaction.schema.d.ts","sourceRoot":"","sources":["../../../src/components/qti-associate-interaction/qti-associate-interaction.schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiB,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAEjE,eAAO,MAAM,+BAA+B,EAAE,QA+C7C,CAAC"}
1
+ {"version":3,"file":"qti-associate-interaction.schema.d.ts","sourceRoot":"","sources":["../../../src/components/qti-associate-interaction/qti-associate-interaction.schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiB,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAEjE,eAAO,MAAM,+BAA+B,EAAE,QAmD7C,CAAC"}
@@ -7,7 +7,8 @@ export const qtiAssociateInteractionNodeSpec = {
7
7
  shuffle: { default: false },
8
8
  class: { default: null },
9
9
  correctResponse: { default: null },
10
- responseIdentifier: { default: null }
10
+ responseIdentifier: { default: null },
11
+ score: { default: 1 },
11
12
  },
12
13
  parseDOM: [
13
14
  {
@@ -18,13 +19,15 @@ export const qtiAssociateInteractionNodeSpec = {
18
19
  const maxAssociations = node.getAttribute('max-associations');
19
20
  const minAssociations = node.getAttribute('min-associations');
20
21
  const className = node.getAttribute('class');
22
+ const scoreAttr = node.getAttribute('score');
21
23
  return {
22
24
  maxAssociations: maxAssociations ? parseInt(maxAssociations, 10) : 1,
23
25
  minAssociations: minAssociations ? parseInt(minAssociations, 10) : 0,
24
26
  shuffle: node.getAttribute('shuffle') === 'true',
25
27
  class: className || null,
26
28
  correctResponse: node.getAttribute('correct-response'),
27
- responseIdentifier: node.getAttribute('response-identifier')
29
+ responseIdentifier: node.getAttribute('response-identifier'),
30
+ score: scoreAttr && Number.isFinite(Number(scoreAttr)) ? Number(scoreAttr) : 1,
28
31
  };
29
32
  }
30
33
  }
@@ -45,6 +48,7 @@ export const qtiAssociateInteractionNodeSpec = {
45
48
  attrs['correct-response'] = node.attrs.correctResponse;
46
49
  if (node.attrs.responseIdentifier)
47
50
  attrs['response-identifier'] = node.attrs.responseIdentifier;
51
+ attrs.score = String(node.attrs.score ?? 1);
48
52
  return ['qti-associate-interaction', attrs, 0];
49
53
  },
50
54
  defining: true,
@@ -16,6 +16,12 @@ export declare const associateNodeAttributePanelMetadataByNodeTypeName: {
16
16
  [x: string]: {
17
17
  nodeTypeName: "qtiAssociateInteraction";
18
18
  editableAttributes: string[];
19
+ fields: {
20
+ score: {
21
+ label: string;
22
+ input: "number";
23
+ };
24
+ };
19
25
  };
20
26
  };
21
27
  //# sourceMappingURL=metadata.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"metadata.d.ts","sourceRoot":"","sources":["../../src/composer/metadata.ts"],"names":[],"mappings":"AAsBA,eAAO,MAAM,yBAAyB,EAAG,2BAAoC,CAAC;AAC9E,eAAO,MAAM,+BAA+B,EAAG,yBAAkC,CAAC;AAElF,eAAO,MAAM,oCAAoC;;;;;;;;;;;CAWV,CAAC;AAExC,eAAO,MAAM,iDAAiD;;;;;CAKR,CAAC"}
1
+ {"version":3,"file":"metadata.d.ts","sourceRoot":"","sources":["../../src/composer/metadata.ts"],"names":[],"mappings":"AAsBA,eAAO,MAAM,yBAAyB,EAAG,2BAAoC,CAAC;AAC9E,eAAO,MAAM,+BAA+B,EAAG,yBAAkC,CAAC;AAElF,eAAO,MAAM,oCAAoC;;;;;;;;;;;CAWV,CAAC;AAExC,eAAO,MAAM,iDAAiD;;;;;;;;;;;CAMR,CAAC"}
@@ -27,12 +27,13 @@ export const associateInteractionComposerMetadata = {
27
27
  internalKind: 'map_response',
28
28
  internalSourceXml: MAP_RESPONSE_INTERNAL_TEMPLATE,
29
29
  },
30
- editorOnlyAttributes: ['class'],
31
- userEditableAttributes: ['maxAssociations', 'minAssociations', 'shuffle', 'correctResponse'],
30
+ editorOnlyAttributes: ['class', 'score'],
31
+ userEditableAttributes: ['maxAssociations', 'minAssociations', 'shuffle', 'correctResponse', 'score'],
32
32
  };
33
33
  export const associateNodeAttributePanelMetadataByNodeTypeName = {
34
34
  [ASSOCIATE_INTERACTION_NODE_TYPE.toLowerCase()]: {
35
35
  nodeTypeName: ASSOCIATE_INTERACTION_NODE_TYPE,
36
36
  editableAttributes: associateInteractionComposerMetadata.userEditableAttributes,
37
+ fields: { score: { label: 'Score', input: 'number' } },
37
38
  },
38
39
  };
@@ -27,6 +27,12 @@ export declare const associateInteractionDescriptor: {
27
27
  [x: string]: {
28
28
  nodeTypeName: "qtiAssociateInteraction";
29
29
  editableAttributes: string[];
30
+ fields: {
31
+ score: {
32
+ label: string;
33
+ input: "number";
34
+ };
35
+ };
30
36
  };
31
37
  };
32
38
  };
@@ -1 +1 @@
1
- {"version":3,"file":"descriptor.d.ts","sourceRoot":"","sources":["../src/descriptor.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,oCAAoC,EAAE,MAAM,kCAAkC,CAAC;AAKxF,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiBV,CAAC"}
1
+ {"version":3,"file":"descriptor.d.ts","sourceRoot":"","sources":["../src/descriptor.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,oCAAoC,EAAE,MAAM,kCAAkC,CAAC;AAKxF,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiBV,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@qti-editor/interaction-associate",
3
3
  "description": "QTI associate interaction schemas, components, commands, and composer",
4
- "version": "1.1.3",
4
+ "version": "1.2.1",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/Citolab/qti-editor",
@@ -24,8 +24,8 @@
24
24
  "@qti-components/associate-interaction": "^1.1.3",
25
25
  "@qti-components/interactions": "1.10.2",
26
26
  "@qti-components/utilities": "1.3.2",
27
- "@qti-editor/interaction-shared": "1.2.0",
28
- "@qti-editor/interfaces": "1.1.0"
27
+ "@qti-editor/interaction-shared": "1.3.0",
28
+ "@qti-editor/interfaces": "1.2.0"
29
29
  },
30
30
  "devDependencies": {
31
31
  "lit": "^3.3.2",
@@ -36,7 +36,7 @@
36
36
  },
37
37
  "peerDependencies": {
38
38
  "lit": "^3.3.1",
39
- "prosekit": "^0.18.4"
39
+ "prosekit": "^0.20.0"
40
40
  },
41
41
  "files": [
42
42
  "dist"