@qti-editor/interaction-select-point 1.1.1 → 1.2.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.
@@ -1 +1 @@
1
- {"version":3,"file":"qti-select-point-interaction.compose.d.ts","sourceRoot":"","sources":["../../../src/components/qti-select-point-interaction/qti-select-point-interaction.compose.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAmB,wBAAwB,EAAmD,MAAM,kDAAkD,CAAC;AA8FnK,wBAAgB,oCAAoC,CAAC,aAAa,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,GAAG,wBAAwB,CAkFvH"}
1
+ {"version":3,"file":"qti-select-point-interaction.compose.d.ts","sourceRoot":"","sources":["../../../src/components/qti-select-point-interaction/qti-select-point-interaction.compose.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAmB,wBAAwB,EAAmD,MAAM,kDAAkD,CAAC;AA8FnK,wBAAgB,oCAAoC,CAAC,aAAa,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,GAAG,wBAAwB,CAoFvH"}
@@ -84,6 +84,7 @@ export function composeSelectPointInteractionElement(sourceElement, xmlDoc) {
84
84
  const responseIdentifier = toNonEmptyString(sourceElement.getAttribute('response-identifier'));
85
85
  const maxChoices = toFiniteNumber(sourceElement.getAttribute('max-choices'), 1);
86
86
  const minChoices = toFiniteNumber(sourceElement.getAttribute('min-choices'), 0);
87
+ const score = toFiniteNumber(sourceElement.getAttribute('score'), 1);
87
88
  const promptFromChild = sourceElement.querySelector('qti-prompt')?.textContent;
88
89
  const prompt = toNonEmptyString(promptFromChild ?? null);
89
90
  const imageElement = sourceElement.querySelector('img');
@@ -141,6 +142,7 @@ export function composeSelectPointInteractionElement(sourceElement, xmlDoc) {
141
142
  correctResponse: correctResponse ?? undefined,
142
143
  areaMapping: areaMappingResult.areaMapping,
143
144
  sourceTag: metadata.tagName,
145
+ score,
144
146
  };
145
147
  }
146
148
  return {
@@ -1 +1 @@
1
- {"version":3,"file":"qti-select-point-interaction.schema.d.ts","sourceRoot":"","sources":["../../../src/components/qti-select-point-interaction/qti-select-point-interaction.schema.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAA0C,QAAQ,EAAU,MAAM,mBAAmB,CAAC;AAqElG,eAAO,MAAM,iCAAiC,EAAE,QA2C/C,CAAC"}
1
+ {"version":3,"file":"qti-select-point-interaction.schema.d.ts","sourceRoot":"","sources":["../../../src/components/qti-select-point-interaction/qti-select-point-interaction.schema.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAA0C,QAAQ,EAAU,MAAM,mBAAmB,CAAC;AAwElG,eAAO,MAAM,iCAAiC,EAAE,QA6C/C,CAAC"}
@@ -14,6 +14,7 @@ function isElementLike(node) {
14
14
  typeof node.querySelector === 'function');
15
15
  }
16
16
  function parseWrapperAttrs(node) {
17
+ const scoreAttr = node.getAttribute('score');
17
18
  return {
18
19
  responseIdentifier: node.getAttribute('response-identifier'),
19
20
  maxChoices: parseNumberAttribute(node.getAttribute('max-choices')) ?? 0,
@@ -21,6 +22,7 @@ function parseWrapperAttrs(node) {
21
22
  class: node.getAttribute('class') || null,
22
23
  areaMappings: node.getAttribute('area-mappings') || '[]',
23
24
  correctResponse: node.getAttribute('correct-response') || null,
25
+ score: scoreAttr && Number.isFinite(Number(scoreAttr)) ? Number(scoreAttr) : 1,
24
26
  };
25
27
  }
26
28
  function buildPromptNode(schema, node) {
@@ -61,6 +63,7 @@ export const qtiSelectPointInteractionNodeSpec = {
61
63
  class: { default: null },
62
64
  areaMappings: { default: '[]' },
63
65
  correctResponse: { default: null },
66
+ score: { default: 1 },
64
67
  },
65
68
  parseDOM: [
66
69
  {
@@ -93,6 +96,7 @@ export const qtiSelectPointInteractionNodeSpec = {
93
96
  attrs['area-mappings'] = String(node.attrs.areaMappings);
94
97
  if (node.attrs.correctResponse)
95
98
  attrs['correct-response'] = String(node.attrs.correctResponse);
99
+ attrs.score = String(node.attrs.score ?? 1);
96
100
  return ['qti-select-point-interaction', attrs, 0];
97
101
  },
98
102
  };
@@ -17,6 +17,12 @@ export declare const selectPointNodeAttributePanelMetadataByNodeTypeName: {
17
17
  [x: string]: {
18
18
  nodeTypeName: "qtiSelectPointInteraction";
19
19
  editableAttributes: string[];
20
+ fields: {
21
+ score: {
22
+ label: string;
23
+ input: "number";
24
+ };
25
+ };
20
26
  };
21
27
  };
22
28
  //# sourceMappingURL=metadata.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"metadata.d.ts","sourceRoot":"","sources":["../../src/composer/metadata.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,2BAA2B,gFACuC,CAAC;AAWhF,eAAO,MAAM,4BAA4B,EAAG,8BAAuC,CAAC;AACpF,eAAO,MAAM,kCAAkC,EAAG,2BAAoC,CAAC;AAEvF,eAAO,MAAM,sCAAsC;;;;;;;;;;;CAWZ,CAAC;AAExC,eAAO,MAAM,mDAAmD;;;;;CAKV,CAAC"}
1
+ {"version":3,"file":"metadata.d.ts","sourceRoot":"","sources":["../../src/composer/metadata.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,2BAA2B,gFACuC,CAAC;AAWhF,eAAO,MAAM,4BAA4B,EAAG,8BAAuC,CAAC;AACpF,eAAO,MAAM,kCAAkC,EAAG,2BAAoC,CAAC;AAEvF,eAAO,MAAM,sCAAsC;;;;;;;;;;;CAWZ,CAAC;AAExC,eAAO,MAAM,mDAAmD;;;;;;;;;;;CAMV,CAAC"}
@@ -18,12 +18,13 @@ export const selectPointInteractionComposerMetadata = {
18
18
  internalKind: 'map_response_point',
19
19
  internalSourceXml: MAP_RESPONSE_POINT_INTERNAL_TEMPLATE,
20
20
  },
21
- editorOnlyAttributes: ['class', 'area-mappings', 'correct-response'],
22
- userEditableAttributes: ['maxChoices', 'minChoices'],
21
+ editorOnlyAttributes: ['class', 'area-mappings', 'correct-response', 'score'],
22
+ userEditableAttributes: ['maxChoices', 'minChoices', 'score'],
23
23
  };
24
24
  export const selectPointNodeAttributePanelMetadataByNodeTypeName = {
25
25
  [SELECT_POINT_INTERACTION_NODE_TYPE.toLowerCase()]: {
26
26
  nodeTypeName: SELECT_POINT_INTERACTION_NODE_TYPE,
27
27
  editableAttributes: selectPointInteractionComposerMetadata.userEditableAttributes,
28
+ fields: { score: { label: 'Score', input: 'number' } },
28
29
  },
29
30
  };
@@ -24,6 +24,12 @@ export declare const selectPointInteractionDescriptor: {
24
24
  [x: string]: {
25
25
  nodeTypeName: "qtiSelectPointInteraction";
26
26
  editableAttributes: string[];
27
+ fields: {
28
+ score: {
29
+ label: string;
30
+ input: "number";
31
+ };
32
+ };
27
33
  };
28
34
  };
29
35
  };
@@ -1 +1 @@
1
- {"version":3,"file":"descriptor.d.ts","sourceRoot":"","sources":["../src/descriptor.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,gCAAgC;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAYZ,CAAC"}
1
+ {"version":3,"file":"descriptor.d.ts","sourceRoot":"","sources":["../src/descriptor.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,gCAAgC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAYZ,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@qti-editor/interaction-select-point",
3
3
  "description": "QTI select-point interaction schemas, components, commands, and composer",
4
- "version": "1.1.1",
4
+ "version": "1.2.0",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/Citolab/qti-editor",
@@ -22,8 +22,8 @@
22
22
  },
23
23
  "dependencies": {
24
24
  "@qti-components/select-point-interaction": "^1.0.1",
25
- "@qti-editor/interaction-shared": "1.2.0",
26
- "@qti-editor/interfaces": "1.1.0",
25
+ "@qti-editor/interaction-shared": "1.3.0",
26
+ "@qti-editor/interfaces": "1.2.0",
27
27
  "prosemirror-model": "^1.25.4",
28
28
  "prosemirror-state": "^1.4.4",
29
29
  "prosemirror-view": "^1.31.0"