@pie-element/matrix 4.1.2-next.15 → 4.1.2-next.16
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":"index.js","names":[],"sources":["../../../src/controller/defaults.ts","../../../src/controller/index.ts"],"sourcesContent":["// @ts-nocheck\n/**\n * @synced-from pie-elements/packages/matrix/controller/src/defaults.js\n * @auto-generated\n *\n * This file is automatically synced from pie-elements and converted to TypeScript.\n * Manual edits will be overwritten on next sync.\n * To make changes, edit the upstream JavaScript file and run sync again.\n */\n\nexport default {\n columnLabels: ['COLUMN 1', 'COLUMN 2', 'COLUMN 3'],\n labelType: 'agreement',\n matrixValues: {},\n prompt: '',\n promptEnabled: true,\n rowLabels: ['STATEMENT 1', 'STATEMENT 2'],\n teacherInstructions: '',\n teacherInstructionsEnabled: true,\n};\n","// @ts-nocheck\n/**\n * @synced-from pie-elements/packages/matrix/controller/src/index.js\n * @auto-generated\n *\n * This file is automatically synced from pie-elements and converted to TypeScript.\n * Manual edits will be overwritten on next sync.\n * To make changes, edit the upstream JavaScript file and run sync again.\n */\n\nimport defaults from './defaults.js';\nimport { isEmpty } from '@pie-element/shared-lodash';\n\nexport const createDefaultModel = (model = {}) => new Promise((resolve) => resolve({ ...defaults, ...model }));\n\n/**\n *\n * @param {*} question\n * @param {*} session\n * @param {*} env\n */\nexport async function model(question, session, env) {\n const normalizedQuestion = { ...defaults, ...question };\n\n const out = {\n ...normalizedQuestion,\n disabled: env.mode !== 'gather',\n mode: env.mode,\n };\n\n const { role, mode } = env || {};\n\n if (role === 'instructor' && (mode === 'view' || mode === 'evaluate')) {\n out.teacherInstructions = normalizedQuestion.teacherInstructionsEnabled\n ? normalizedQuestion.teacherInstructions\n : null;\n } else {\n out.teacherInstructions = null;\n }\n\n return out;\n}\n\nexport function outcome(model, session) {\n return new Promise((resolve) => {\n if (!session || isEmpty(session)) {\n return resolve({ score: 0, empty: true });\n }\n\n const score = Object.keys(session.value).reduce((acc, key) => {\n const matrixValue = model.matrixValues[key];\n return acc + (matrixValue || 0);\n }, 0);\n\n resolve({ score, empty: false });\n });\n}\n\nexport const createCorrectResponseSession = (question, env) => {\n return new Promise((resolve) => {\n if (env.mode !== 'evaluate' && env.role === 'instructor') {\n const { matrixValues } = question || [];\n\n resolve({\n id: '1',\n value: matrixValues,\n });\n } else {\n resolve(null);\n }\n });\n};\n\n// remove all html tags\nconst getInnerText = (html) => (html || '').replaceAll(/<[^>]*>/g, '');\n\n// remove all html tags except img, iframe and source tag for audio\nconst getContent = (html) => (html || '').replace(/(<(?!img|iframe|source)([^>]+)>)/gi, '');\n\nexport const validate = (model = {}, config = {}) => {\n const errors = {};\n\n ['teacherInstructions', 'prompt'].forEach((field) => {\n if (config[field]?.required && !getContent(model[field])) {\n errors[field] = 'This field is required.';\n }\n });\n\n return errors;\n};\n"],"mappings":";;AAUA,IAAA,IAAe;CACb,cAAc;EAAC;EAAY;EAAY;CAAU;CACjD,WAAW;CACX,cAAc,CAAC;CACf,QAAQ;CACR,eAAe;CACf,WAAW,CAAC,eAAe,aAAa;CACxC,qBAAqB;CACrB,4BAA4B;AAC9B,GCNa,KAAsB,IAAQ,CAAC,MAAM,IAAI,SAAS,MAAY,EAAQ;CAAE,GAAG;CAAU,GAAG;AAAM,CAAC,CAAC;AAQ7G,eAAsB,EAAM,GAAU,GAAS,GAAK;CAClD,IAAM,IAAqB;EAAE,GAAG;EAAU,GAAG;CAAS,GAEhD,IAAM;EACV,GAAG;EACH,UAAU,EAAI,SAAS;EACvB,MAAM,EAAI;CACZ,GAEM,EAAE,SAAM,YAAS,KAAO,CAAC;CAU/B,OARI,MAAS,iBAAiB,MAAS,UAAU,MAAS,cACxD,EAAI,sBAAsB,EAAmB,6BACzC,EAAmB,sBACnB,OAEJ,EAAI,sBAAsB,MAGrB;AACT;AAEA,SAAgB,EAAQ,GAAO,GAAS;CACtC,OAAO,IAAI,SAAS,MAAY;
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/controller/defaults.ts","../../../src/controller/index.ts"],"sourcesContent":["// @ts-nocheck\n/**\n * @synced-from pie-elements/packages/matrix/controller/src/defaults.js\n * @auto-generated\n *\n * This file is automatically synced from pie-elements and converted to TypeScript.\n * Manual edits will be overwritten on next sync.\n * To make changes, edit the upstream JavaScript file and run sync again.\n */\n\nexport default {\n columnLabels: ['COLUMN 1', 'COLUMN 2', 'COLUMN 3'],\n labelType: 'agreement',\n matrixValues: {},\n prompt: '',\n promptEnabled: true,\n rowLabels: ['STATEMENT 1', 'STATEMENT 2'],\n teacherInstructions: '',\n teacherInstructionsEnabled: true,\n};\n","// @ts-nocheck\n/**\n * @synced-from pie-elements/packages/matrix/controller/src/index.js\n * @auto-generated\n *\n * This file is automatically synced from pie-elements and converted to TypeScript.\n * Manual edits will be overwritten on next sync.\n * To make changes, edit the upstream JavaScript file and run sync again.\n */\n\nimport defaults from './defaults.js';\nimport { isEmpty } from '@pie-element/shared-lodash';\n\nexport const createDefaultModel = (model = {}) => new Promise((resolve) => resolve({ ...defaults, ...model }));\n\n/**\n *\n * @param {*} question\n * @param {*} session\n * @param {*} env\n */\nexport async function model(question, session, env) {\n const normalizedQuestion = { ...defaults, ...question };\n\n const out = {\n ...normalizedQuestion,\n disabled: env.mode !== 'gather',\n mode: env.mode,\n };\n\n const { role, mode } = env || {};\n\n if (role === 'instructor' && (mode === 'view' || mode === 'evaluate')) {\n out.teacherInstructions = normalizedQuestion.teacherInstructionsEnabled\n ? normalizedQuestion.teacherInstructions\n : null;\n } else {\n out.teacherInstructions = null;\n }\n\n return out;\n}\n\nexport function outcome(model, session) {\n return new Promise((resolve) => {\n // A player sends an untouched item's session as `{ id, element }`, without `value`.\n if (!session || isEmpty(session) || !session.value) {\n return resolve({ score: 0, empty: true });\n }\n\n const score = Object.keys(session.value).reduce((acc, key) => {\n const matrixValue = model.matrixValues[key];\n return acc + (matrixValue || 0);\n }, 0);\n\n resolve({ score, empty: false });\n });\n}\n\nexport const createCorrectResponseSession = (question, env) => {\n return new Promise((resolve) => {\n if (env.mode !== 'evaluate' && env.role === 'instructor') {\n const { matrixValues } = question || [];\n\n resolve({\n id: '1',\n value: matrixValues,\n });\n } else {\n resolve(null);\n }\n });\n};\n\n// remove all html tags\nconst getInnerText = (html) => (html || '').replaceAll(/<[^>]*>/g, '');\n\n// remove all html tags except img, iframe and source tag for audio\nconst getContent = (html) => (html || '').replace(/(<(?!img|iframe|source)([^>]+)>)/gi, '');\n\nexport const validate = (model = {}, config = {}) => {\n const errors = {};\n\n ['teacherInstructions', 'prompt'].forEach((field) => {\n if (config[field]?.required && !getContent(model[field])) {\n errors[field] = 'This field is required.';\n }\n });\n\n return errors;\n};\n"],"mappings":";;AAUA,IAAA,IAAe;CACb,cAAc;EAAC;EAAY;EAAY;CAAU;CACjD,WAAW;CACX,cAAc,CAAC;CACf,QAAQ;CACR,eAAe;CACf,WAAW,CAAC,eAAe,aAAa;CACxC,qBAAqB;CACrB,4BAA4B;AAC9B,GCNa,KAAsB,IAAQ,CAAC,MAAM,IAAI,SAAS,MAAY,EAAQ;CAAE,GAAG;CAAU,GAAG;AAAM,CAAC,CAAC;AAQ7G,eAAsB,EAAM,GAAU,GAAS,GAAK;CAClD,IAAM,IAAqB;EAAE,GAAG;EAAU,GAAG;CAAS,GAEhD,IAAM;EACV,GAAG;EACH,UAAU,EAAI,SAAS;EACvB,MAAM,EAAI;CACZ,GAEM,EAAE,SAAM,YAAS,KAAO,CAAC;CAU/B,OARI,MAAS,iBAAiB,MAAS,UAAU,MAAS,cACxD,EAAI,sBAAsB,EAAmB,6BACzC,EAAmB,sBACnB,OAEJ,EAAI,sBAAsB,MAGrB;AACT;AAEA,SAAgB,EAAQ,GAAO,GAAS;CACtC,OAAO,IAAI,SAAS,MAAY;EAE9B,IAAI,CAAC,KAAW,EAAQ,CAAO,KAAK,CAAC,EAAQ,OAC3C,OAAO,EAAQ;GAAE,OAAO;GAAG,OAAO;EAAK,CAAC;EAQ1C,EAAQ;GAAE,OALI,OAAO,KAAK,EAAQ,KAAK,CAAC,CAAC,QAAQ,GAAK,MAE7C,KADa,EAAM,aAAa,MACV,IAC5B,CAEO;GAAO,OAAO;EAAM,CAAC;CACjC,CAAC;AACH;AAEA,IAAa,KAAgC,GAAU,MAC9C,IAAI,SAAS,MAAY;CAC9B,IAAI,EAAI,SAAS,cAAc,EAAI,SAAS,cAAc;EACxD,IAAM,EAAE,oBAAiB,KAAY,CAAC;EAEtC,EAAQ;GACN,IAAI;GACJ,OAAO;EACT,CAAC;CACH,OACE,EAAQ,IAAI;AAEhB,CAAC,GAOG,KAAc,OAAU,KAAQ,GAAA,CAAI,QAAQ,sCAAsC,EAAE,GAE7E,KAAY,IAAQ,CAAC,GAAG,IAAS,CAAC,MAAM;CACnD,IAAM,IAAS,CAAC;CAQhB,OANA,CAAC,uBAAuB,QAAQ,CAAC,CAAC,SAAS,MAAU;EACnD,AAAI,EAAO,EAAM,EAAE,YAAY,CAAC,EAAW,EAAM,EAAM,MACrD,EAAO,KAAS;CAEpB,CAAC,GAEM;AACT"}
|
package/dist/controller/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-element/matrix",
|
|
3
|
-
"version": "4.1.2-next.
|
|
3
|
+
"version": "4.1.2-next.16",
|
|
4
4
|
"description": "",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -12,16 +12,16 @@
|
|
|
12
12
|
"@emotion/style": "^0.8.0",
|
|
13
13
|
"@mui/icons-material": "^7.3.4",
|
|
14
14
|
"@mui/material": "^7.3.4",
|
|
15
|
-
"@pie-lib/render-ui": "6.2.0-next.
|
|
15
|
+
"@pie-lib/render-ui": "6.2.0-next.45",
|
|
16
16
|
"debug": "^4.1.1",
|
|
17
17
|
"prop-types": "^15.8.1",
|
|
18
18
|
"styled-components": "^6.5.3",
|
|
19
|
-
"@pie-lib/editable-html-tip-tap": "3.0.0-next.
|
|
20
|
-
"@pie-lib/config-ui": "14.0.0-next.
|
|
21
|
-
"@pie-element/shared-configure-events": "0.1.0",
|
|
19
|
+
"@pie-lib/editable-html-tip-tap": "3.0.0-next.39",
|
|
20
|
+
"@pie-lib/config-ui": "14.0.0-next.39",
|
|
21
|
+
"@pie-element/shared-configure-events": "0.1.1-next.0",
|
|
22
22
|
"@pie-element/shared-lodash": "0.1.1-next.2",
|
|
23
|
-
"@pie-element/shared-player-events": "0.1.1-next.
|
|
24
|
-
"@pie-element/shared-math-rendering-mathjax": "0.1.1-next.
|
|
23
|
+
"@pie-element/shared-player-events": "0.1.1-next.1",
|
|
24
|
+
"@pie-element/shared-math-rendering-mathjax": "0.1.1-next.1",
|
|
25
25
|
"react-is": "^18.3.1",
|
|
26
26
|
"react": "^18.2.0",
|
|
27
27
|
"react-dom": "^18.2.0"
|