@pie-element/select-text 13.1.2-next.0 → 13.1.2-next.10
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/author/design.d.ts +2 -2
- package/dist/author/design.js +78 -79
- package/dist/author/index.js +2 -2
- package/dist/browser/{Check-CXevxzJJ.js → Check-DfUn7PkH.js} +2708 -3429
- package/dist/browser/Check-DfUn7PkH.js.map +1 -0
- package/dist/browser/author/index.js +24219 -21826
- package/dist/browser/author/index.js.map +1 -1
- package/dist/browser/controller/index.js +12 -13
- package/dist/browser/controller/index.js.map +1 -1
- package/dist/browser/delivery/index.js +3 -3
- package/dist/browser/delivery/index.js.map +1 -1
- package/dist/browser/{_getTag-x1UozeM0.js → dist-BamN0-DG.js} +102 -160
- package/dist/browser/dist-BamN0-DG.js.map +1 -0
- package/dist/browser/{main-4aycOoI5.js → main-B3z36nHt.js} +1030 -1022
- package/dist/browser/main-B3z36nHt.js.map +1 -0
- package/dist/browser/print/index.js +7 -8
- package/dist/browser/print/index.js.map +1 -1
- package/dist/controller/index.js +19 -19
- package/dist/delivery/index.js +1 -1
- package/dist/delivery/main.d.ts +2 -0
- package/dist/delivery/main.js +58 -49
- package/dist/index.iife.js +40 -40
- package/dist/print/index.js +9 -9
- package/dist/runtime-support.d.ts +12 -0
- package/dist/runtime-support.js +12 -0
- package/module/print.js +20113 -0
- package/module/print.js.map +1 -0
- package/package.json +28 -12
- package/print.js +2 -0
- package/dist/browser/Check-CXevxzJJ.js.map +0 -1
- package/dist/browser/_getTag-x1UozeM0.js.map +0 -1
- package/dist/browser/debounce-CUpLfqAu.js +0 -86
- package/dist/browser/debounce-CUpLfqAu.js.map +0 -1
- package/dist/browser/isEmpty-Bsms1e2W.js +0 -16
- package/dist/browser/isEmpty-Bsms1e2W.js.map +0 -1
- package/dist/browser/main-4aycOoI5.js.map +0 -1
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_DataView.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Hash.js +0 -16
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_ListCache.js +0 -16
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Map.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_MapCache.js +0 -16
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Promise.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Set.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Stack.js +0 -14
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Symbol.js +0 -5
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Uint8Array.js +0 -5
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_WeakMap.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayEach.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayFilter.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayLikeKeys.js +0 -15
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayPush.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_assignValue.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_assocIndexOf.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseAssign.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseAssignIn.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseAssignValue.js +0 -12
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseClone.js +0 -57
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseCreate.js +0 -14
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseGetAllKeys.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseGetTag.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsArguments.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsMap.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsNative.js +0 -11
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsSet.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsTypedArray.js +0 -11
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseKeys.js +0 -12
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseKeysIn.js +0 -13
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseTimes.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseTrim.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseUnary.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneArrayBuffer.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneBuffer.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneDataView.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneRegExp.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneSymbol.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneTypedArray.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_copyArray.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_copyObject.js +0 -14
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_copySymbols.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_copySymbolsIn.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_coreJsData.js +0 -5
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_defineProperty.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_freeGlobal.js +0 -4
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getAllKeys.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getAllKeysIn.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getMapData.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getNative.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getPrototype.js +0 -5
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getRawTag.js +0 -14
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getSymbols.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getSymbolsIn.js +0 -11
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getTag.js +0 -23
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getValue.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashClear.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashDelete.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashGet.js +0 -13
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashHas.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashSet.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_initCloneArray.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_initCloneByTag.js +0 -33
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_initCloneObject.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isIndex.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isKeyable.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isMasked.js +0 -11
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isPrototype.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheClear.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheDelete.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheGet.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheHas.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheSet.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheClear.js +0 -13
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheDelete.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheGet.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheHas.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheSet.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nativeCreate.js +0 -5
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nativeKeys.js +0 -5
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nativeKeysIn.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nodeUtil.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_objectToString.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_overArg.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_root.js +0 -5
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackClear.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackDelete.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackGet.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackHas.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackSet.js +0 -16
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_toSource.js +0 -15
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_trimmedEndIndex.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/cloneDeep.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/debounce.js +0 -50
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/eq.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArguments.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArray.js +0 -4
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArrayLike.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isBuffer.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isEmpty.js +0 -21
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isFunction.js +0 -11
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isLength.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isMap.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isObject.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isObjectLike.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isSet.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isSymbol.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isTypedArray.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/keys.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/keysIn.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/now.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/stubArray.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/stubFalse.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/toNumber.js +0 -19
|
@@ -1,23 +1,22 @@
|
|
|
1
|
-
import { b as e,
|
|
2
|
-
import {
|
|
3
|
-
import { t as
|
|
4
|
-
import { t as i } from "../debounce-CUpLfqAu.js";
|
|
1
|
+
import { b as e, c as t, g as n } from "../dist-BamN0-DG.js";
|
|
2
|
+
import { C as r } from "../Check-DfUn7PkH.js";
|
|
3
|
+
import { t as i } from "../main-B3z36nHt.js";
|
|
5
4
|
import a from "react";
|
|
6
5
|
import { createRoot as o } from "react-dom/client";
|
|
7
|
-
var s = (0, (/* @__PURE__ */
|
|
6
|
+
var s = (0, (/* @__PURE__ */ e(n(), 1)).default)("pie-element:select-text:print"), c = (e, t) => {
|
|
8
7
|
let n = t.role === "instructor";
|
|
9
8
|
return e.prompt = e.promptEnabled === !1 ? void 0 : e.prompt, e.teacherInstructions = n && e.teacherInstructionsEnabled !== !1 ? e.teacherInstructions : void 0, e.rationale = n && e.rationaleEnabled !== !1 ? e.rationale : void 0, e.showTeacherInstructions = n, e.alwaysShowCorrect = n, e.mode = n ? "evaluate" : e.mode, e.disabled = !0, e.animationsDisabled = !0, e.highlightChoices = !0, e.feedback = void 0, e;
|
|
10
9
|
}, l = class extends HTMLElement {
|
|
11
10
|
constructor() {
|
|
12
|
-
super(), this._options = null, this._model = null, this._session = {}, this._session.selectedTokens = [], this._root = null, this._rerender =
|
|
11
|
+
super(), this._options = null, this._model = null, this._session = {}, this._session.selectedTokens = [], this._root = null, this._rerender = t(() => {
|
|
13
12
|
if (this._model && this._session) {
|
|
14
|
-
let e = c(this._model, this._options), t = this._options && a.createElement(
|
|
13
|
+
let e = c(this._model, this._options), t = this._options && a.createElement(i, {
|
|
15
14
|
model: e,
|
|
16
15
|
session: { selectedTokens: [] },
|
|
17
16
|
onSelectionChange: () => {}
|
|
18
17
|
});
|
|
19
18
|
this._root ||= o(this), this._root.render(t), queueMicrotask(() => {
|
|
20
|
-
s("render complete - render math"),
|
|
19
|
+
s("render complete - render math"), r(this);
|
|
21
20
|
});
|
|
22
21
|
} else s("skip");
|
|
23
22
|
}, 50, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/print/index.tsx"],"sourcesContent":["// @ts-nocheck\n/**\n * @synced-from pie-elements/packages/select-text/src/print.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 React from 'react';\nimport { createRoot } from 'react-dom/client';\nimport { debounce } from 'lodash
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/print/index.tsx"],"sourcesContent":["// @ts-nocheck\n/**\n * @synced-from pie-elements/packages/select-text/src/print.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 React from 'react';\nimport { createRoot } from 'react-dom/client';\nimport { debounce } from '@pie-element/shared-lodash';\nimport Main from '../delivery/main.js';\nimport { renderMath } from '@pie-element/shared-math-rendering-mathjax';\nimport debug from 'debug';\n\nconst log = debug('pie-element:select-text:print');\n\n/**\n * Live in same package as main element - so we can access some of the shared comps!\n *\n * - update pslb to build print if src/print.js is there\n * - update demo el\n * - get configure/controller building\n */\n\nconst preparePrintModel = (model, opts) => {\n const instr = opts.role === 'instructor';\n\n model.prompt = model.promptEnabled !== false ? model.prompt : undefined;\n model.teacherInstructions =\n instr && model.teacherInstructionsEnabled !== false ? model.teacherInstructions : undefined;\n model.rationale = instr && model.rationaleEnabled !== false ? model.rationale : undefined;\n model.showTeacherInstructions = instr;\n model.alwaysShowCorrect = instr;\n model.mode = instr ? 'evaluate' : model.mode;\n\n model.disabled = true;\n model.animationsDisabled = true;\n model.highlightChoices = true;\n model.feedback = undefined;\n\n return model;\n};\n\nexport default class SelectTextPrint extends HTMLElement {\n constructor() {\n super();\n this._options = null;\n this._model = null;\n this._session = {};\n this._session.selectedTokens = [];\n this._root = null;\n this._rerender = debounce(\n () => {\n if (this._model && this._session) {\n const printModel = preparePrintModel(this._model, this._options);\n\n const element =\n this._options &&\n React.createElement(Main, {\n model: printModel,\n session: { selectedTokens: [] },\n onSelectionChange: () => {},\n });\n\n if (!this._root) {\n this._root = createRoot(this);\n }\n this._root.render(element);\n queueMicrotask(() => {\n log('render complete - render math');\n renderMath(this);\n });\n } else {\n log('skip');\n }\n },\n 50,\n { leading: false, trailing: true },\n );\n }\n set options(o) {\n this._options = o;\n }\n\n set model(s) {\n this._model = s;\n this._rerender();\n }\n\n connectedCallback() {}\n\n disconnectedCallback() {\n if (this._root) {\n this._root.unmount();\n }\n }\n}\n"],"mappings":";;;;;AAiBA,IAAM,KAAA,IAAA,wBAAA,EAAA,CAAA,QAAA,CAAY,+BAA+B,GAU3C,KAAqB,GAAO,MAAS;CACzC,IAAM,IAAQ,EAAK,SAAS;CAe5B,OAbA,EAAM,SAAS,EAAM,kBAAkB,KAAuB,KAAA,IAAf,EAAM,QACrD,EAAM,sBACJ,KAAS,EAAM,+BAA+B,KAAQ,EAAM,sBAAsB,KAAA,GACpF,EAAM,YAAY,KAAS,EAAM,qBAAqB,KAAQ,EAAM,YAAY,KAAA,GAChF,EAAM,0BAA0B,GAChC,EAAM,oBAAoB,GAC1B,EAAM,OAAO,IAAQ,aAAa,EAAM,MAExC,EAAM,WAAW,IACjB,EAAM,qBAAqB,IAC3B,EAAM,mBAAmB,IACzB,EAAM,WAAW,KAAA,GAEV;AACT,GAEqB,IAArB,cAA6C,YAAY;CACvD,cAAc;EAOZ,AANA,MAAM,GACN,KAAK,WAAW,MAChB,KAAK,SAAS,MACd,KAAK,WAAW,CAAC,GACjB,KAAK,SAAS,iBAAiB,CAAC,GAChC,KAAK,QAAQ,MACb,KAAK,YAAY,QACT;GACJ,IAAI,KAAK,UAAU,KAAK,UAAU;IAChC,IAAM,IAAa,EAAkB,KAAK,QAAQ,KAAK,QAAQ,GAEzD,IACJ,KAAK,YACL,EAAM,cAAc,GAAM;KACxB,OAAO;KACP,SAAS,EAAE,gBAAgB,CAAC,EAAE;KAC9B,yBAAyB,CAAC;IAC5B,CAAC;IAMH,AAJA,AACE,KAAK,UAAQ,EAAW,IAAI,GAE9B,KAAK,MAAM,OAAO,CAAO,GACzB,qBAAqB;KAEnB,AADA,EAAI,+BAA+B,GACnC,EAAW,IAAI;IACjB,CAAC;GACH,OACE,EAAI,MAAM;EAEd,GACA,IACA;GAAE,SAAS;GAAO,UAAU;EAAK,CACnC;CACF;CACA,IAAI,QAAQ,GAAG;EACb,KAAK,WAAW;CAClB;CAEA,IAAI,MAAM,GAAG;EAEX,AADA,KAAK,SAAS,GACd,KAAK,UAAU;CACjB;CAEA,oBAAoB,CAAC;CAErB,uBAAuB;EACrB,AAAI,KAAK,SACP,KAAK,MAAM,QAAQ;CAEvB;AACF"}
|
package/dist/controller/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import e from "
|
|
2
|
-
import t from "
|
|
3
|
-
import n from "
|
|
1
|
+
import e from "./defaults.js";
|
|
2
|
+
import t from "debug";
|
|
3
|
+
import { isEmpty as n } from "@pie-element/shared-lodash";
|
|
4
4
|
import { getFeedbackForCorrectness as r } from "@pie-element/shared-feedback";
|
|
5
5
|
import { partialScoring as i } from "@pie-element/shared-controller-utils";
|
|
6
6
|
//#region src/controller/index.ts
|
|
7
|
-
var a =
|
|
7
|
+
var a = t("@pie-element:select-text:controller"), o = (e = {}, t = {}) => e?.start === t?.start && e?.end === t?.end || e?.start === t?.oldStart && e?.end === t?.oldEnd, s = (e = [], t = [], n = !1) => (e || []).map((e) => {
|
|
8
8
|
let r = !!e.correct, i = r && !(t || []).find((t) => o(e, t));
|
|
9
9
|
return {
|
|
10
10
|
...e,
|
|
@@ -20,9 +20,9 @@ var a = n("@pie-element:select-text:controller"), o = (e = {}, t = {}) => e?.sta
|
|
|
20
20
|
if (r.length > 0) return "partially-correct";
|
|
21
21
|
}
|
|
22
22
|
return r.length > 0 ? "partially-correct" : "incorrect";
|
|
23
|
-
}, l = (e, t) => (t || []).filter((t) => e.findIndex((e) => e.correct && o(e, t)) !== -1), u = (
|
|
24
|
-
if (!
|
|
25
|
-
let i = l(
|
|
23
|
+
}, l = (e, t) => (t || []).filter((t) => e.findIndex((e) => e.correct && o(e, t)) !== -1), u = (e, t, r) => {
|
|
24
|
+
if (!t || n(t)) return 0;
|
|
25
|
+
let i = l(e.tokens, t.selectedTokens).length, a = (e.tokens || []).filter((e) => e.correct === !0), o = i - (t.selectedTokens && t.selectedTokens.length > a.length ? t.selectedTokens && t.selectedTokens.length - i : 0), s = o < 0 ? 0 : o;
|
|
26
26
|
return r.length ? parseFloat((s / r.length).toFixed(2)) : 0;
|
|
27
27
|
}, d = (e, t, n) => {
|
|
28
28
|
let r = [], a = t?.selectedTokens || [], s = e?.tokens || [];
|
|
@@ -39,38 +39,38 @@ var a = n("@pie-element:select-text:controller"), o = (e = {}, t = {}) => e?.sta
|
|
|
39
39
|
p ? (r.push("Score calculated using partial scoring."), r.push("Score is based on the number of correct minus incorrect selections, divided by the total number of correct tokens."), f > 0 && a.length > c && r.push("Extra selected tokens beyond the correct set reduce the score.")) : (r.push("Score calculated using all-or-nothing scoring."), r.push("Student must select all correct tokens and no incorrect tokens to receive full credit."));
|
|
40
40
|
let m = u(e, t, s.filter((e) => e.correct)), h = p ? m : +(m === 1);
|
|
41
41
|
return r.push(`Final score: ${h}.`), r;
|
|
42
|
-
}, f = (
|
|
43
|
-
if ((!
|
|
42
|
+
}, f = (e, t, r) => new Promise((a) => {
|
|
43
|
+
if ((!t || n(t)) && a({
|
|
44
44
|
score: 0,
|
|
45
45
|
empty: !0,
|
|
46
46
|
logTrace: ["Student did not select any token."]
|
|
47
|
-
}),
|
|
47
|
+
}), t = m(t), r.mode !== "evaluate") a({
|
|
48
48
|
score: void 0,
|
|
49
49
|
completed: void 0,
|
|
50
50
|
logTrace: []
|
|
51
51
|
});
|
|
52
52
|
else {
|
|
53
|
-
let
|
|
53
|
+
let n = i.enabled(e, r, !0), o = e.tokens.filter((e) => e.correct), s = u(e, t, o);
|
|
54
54
|
a({
|
|
55
|
-
score:
|
|
56
|
-
logTrace: d(
|
|
55
|
+
score: n ? s : +(s === 1),
|
|
56
|
+
logTrace: d(e, t, r)
|
|
57
57
|
});
|
|
58
58
|
}
|
|
59
59
|
});
|
|
60
|
-
function p(
|
|
60
|
+
function p(t = {}) {
|
|
61
61
|
return new Promise((n) => {
|
|
62
62
|
n({
|
|
63
|
-
...
|
|
64
|
-
...
|
|
63
|
+
...e,
|
|
64
|
+
...t
|
|
65
65
|
});
|
|
66
66
|
});
|
|
67
67
|
}
|
|
68
68
|
var m = (e) => ({
|
|
69
69
|
selectedTokens: [],
|
|
70
70
|
...e
|
|
71
|
-
}), h = (
|
|
72
|
-
...
|
|
73
|
-
...
|
|
71
|
+
}), h = (t) => ({
|
|
72
|
+
...e,
|
|
73
|
+
...t
|
|
74
74
|
}), g = (e, t, n) => {
|
|
75
75
|
t ||= { selectedToken: [] }, t.selectedTokens = t.selectedTokens || [];
|
|
76
76
|
let i = h(e);
|
package/dist/delivery/index.js
CHANGED
package/dist/delivery/main.d.ts
CHANGED
|
@@ -17,6 +17,8 @@ export declare class Main extends React.Component {
|
|
|
17
17
|
static defaultProps: {};
|
|
18
18
|
constructor(props: any);
|
|
19
19
|
UNSAFE_componentWillReceiveProps(nextProps: any): void;
|
|
20
|
+
componentDidMount(): void;
|
|
21
|
+
componentDidUpdate(): void;
|
|
20
22
|
toggleShowCorrect: any;
|
|
21
23
|
correctAnswer: any;
|
|
22
24
|
render(): React.JSX.Element;
|
package/dist/delivery/main.js
CHANGED
|
@@ -1,36 +1,38 @@
|
|
|
1
1
|
import e from "./utils.js";
|
|
2
2
|
import t from "react";
|
|
3
|
-
import n from "
|
|
4
|
-
import
|
|
5
|
-
import a from "@pie-lib/
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import _ from "
|
|
3
|
+
import n from "react-dom";
|
|
4
|
+
import r from "prop-types";
|
|
5
|
+
import { Legend as i, TextSelect as a } from "@pie-lib/text-select";
|
|
6
|
+
import o from "@pie-lib/correct-answer-toggle";
|
|
7
|
+
import * as s from "@pie-lib/render-ui";
|
|
8
|
+
import { Collapsible as c, Feedback as l, PreviewPrompt as u, UiLayout as d, color as f, hasMedia as p, hasText as m } from "@pie-lib/render-ui";
|
|
9
|
+
import { jsx as h, jsxs as g } from "react/jsx-runtime";
|
|
10
|
+
import { renderMath as _ } from "@pie-element/shared-math-rendering-mathjax";
|
|
11
|
+
import { styled as v } from "@mui/material/styles";
|
|
12
|
+
import y from "debug";
|
|
11
13
|
//#region src/delivery/main.tsx
|
|
12
|
-
function
|
|
14
|
+
function b(e) {
|
|
13
15
|
return typeof e == "function" || typeof e == "object" && !!e && typeof e.$$typeof == "symbol";
|
|
14
16
|
}
|
|
15
|
-
function
|
|
16
|
-
return !e ||
|
|
17
|
+
function x(e, t) {
|
|
18
|
+
return !e || b(e) ? e : b(e.default) ? e.default : t && b(e[t]) ? e[t] : t && b(e[t]?.default) ? e[t].default : e;
|
|
17
19
|
}
|
|
18
|
-
var
|
|
19
|
-
color:
|
|
20
|
-
backgroundColor:
|
|
21
|
-
}),
|
|
20
|
+
var S = x(d, "UiLayout") || x(O.UiLayout, "UiLayout"), C = x(u, "PreviewPrompt") || x(O.PreviewPrompt, "PreviewPrompt"), w = x(c, "Collapsible") || x(O.Collapsible, "Collapsible"), T = x(l, "Feedback") || x(O.Feedback, "Feedback"), E = s, D = E.default, O = D && typeof D == "object" ? D : E, k = y("@pie-ui:select-text"), A = v(S)({
|
|
21
|
+
color: f.text(),
|
|
22
|
+
backgroundColor: f.background()
|
|
23
|
+
}), j = v(a)(({ theme: e }) => ({
|
|
22
24
|
marginBottom: e.spacing(1),
|
|
23
25
|
marginTop: e.spacing(2),
|
|
24
26
|
whiteSpace: "normal"
|
|
25
|
-
})),
|
|
27
|
+
})), M = v("div")(({ theme: e }) => ({
|
|
26
28
|
verticalAlign: "middle",
|
|
27
29
|
marginBottom: e.spacing(1)
|
|
28
|
-
})),
|
|
29
|
-
model:
|
|
30
|
-
session:
|
|
31
|
-
onSelectionChange:
|
|
32
|
-
},
|
|
33
|
-
static propTypes =
|
|
30
|
+
})), N = v(w)(({ theme: e }) => ({ marginBottom: e.spacing(2) })), P = {
|
|
31
|
+
model: r.object,
|
|
32
|
+
session: r.object,
|
|
33
|
+
onSelectionChange: r.func.isRequired
|
|
34
|
+
}, F = class extends t.Component {
|
|
35
|
+
static propTypes = P;
|
|
34
36
|
static defaultProps = {};
|
|
35
37
|
constructor(t) {
|
|
36
38
|
super(t), this.state = {
|
|
@@ -44,6 +46,12 @@ var b = y(u, "UiLayout") || y(E.UiLayout, "UiLayout"), x = y(l, "PreviewPrompt")
|
|
|
44
46
|
model: e(t.model)
|
|
45
47
|
});
|
|
46
48
|
}
|
|
49
|
+
componentDidMount() {
|
|
50
|
+
_(n.findDOMNode(this));
|
|
51
|
+
}
|
|
52
|
+
componentDidUpdate() {
|
|
53
|
+
_(n.findDOMNode(this));
|
|
54
|
+
}
|
|
47
55
|
toggleShowCorrect = () => {
|
|
48
56
|
this.setState({ showCorrectAnswer: !this.state.showCorrectAnswer });
|
|
49
57
|
};
|
|
@@ -52,56 +60,57 @@ var b = y(u, "UiLayout") || y(E.UiLayout, "UiLayout"), x = y(l, "PreviewPrompt")
|
|
|
52
60
|
return e.tokens.filter((e) => e.correct);
|
|
53
61
|
};
|
|
54
62
|
render() {
|
|
55
|
-
let { session: e, onSelectionChange: t } = this.props, { showCorrectAnswer: n, model:
|
|
56
|
-
return
|
|
63
|
+
let { session: e, onSelectionChange: t } = this.props, { showCorrectAnswer: n, model: r } = this.state, { env: a, extraCSSRules: s } = r, { mode: c } = a || {}, l = n ? this.correctAnswer() : e.selectedTokens, u = r.rationale && (m(r.rationale) || p(r.rationale)), d = r.teacherInstructions && (m(r.teacherInstructions) || p(r.teacherInstructions));
|
|
64
|
+
return k("[render] selectedTokens:", l), /* @__PURE__ */ g(A, {
|
|
57
65
|
extraCSSRules: s,
|
|
58
66
|
children: [
|
|
59
|
-
d && (
|
|
67
|
+
d && (r.animationsDisabled ? /* @__PURE__ */ h(M, { children: /* @__PURE__ */ h(C, { prompt: r.teacherInstructions }) }) : /* @__PURE__ */ h(N, {
|
|
60
68
|
labels: {
|
|
61
69
|
hidden: "Show Teacher Instructions",
|
|
62
70
|
visible: "Hide Teacher Instructions"
|
|
63
71
|
},
|
|
64
|
-
children: /* @__PURE__ */
|
|
72
|
+
children: /* @__PURE__ */ h(C, { prompt: r.teacherInstructions })
|
|
65
73
|
})),
|
|
66
|
-
/* @__PURE__ */
|
|
67
|
-
!
|
|
68
|
-
show:
|
|
74
|
+
/* @__PURE__ */ h(M, { children: /* @__PURE__ */ h(C, { prompt: r.prompt }) }),
|
|
75
|
+
!r.alwaysShowCorrect && /* @__PURE__ */ h(o, {
|
|
76
|
+
show: r.disabled && r.incorrect,
|
|
69
77
|
toggled: n,
|
|
70
78
|
onToggle: this.toggleShowCorrect,
|
|
71
|
-
language:
|
|
79
|
+
language: r.language
|
|
72
80
|
}),
|
|
73
|
-
/* @__PURE__ */
|
|
74
|
-
disabled:
|
|
75
|
-
text:
|
|
76
|
-
tokens:
|
|
81
|
+
/* @__PURE__ */ h(j, {
|
|
82
|
+
disabled: r.disabled,
|
|
83
|
+
text: r.text,
|
|
84
|
+
tokens: r.tokens,
|
|
77
85
|
selectedTokens: l,
|
|
78
86
|
onChange: (e) => {
|
|
79
|
-
|
|
87
|
+
let n = e.map((e) => r.tokens.find(({ start: t, end: n }) => e.start === t && e.end === n) || e);
|
|
88
|
+
t(n);
|
|
80
89
|
},
|
|
81
|
-
highlightChoices:
|
|
82
|
-
maxNoOfSelections:
|
|
83
|
-
animationsDisabled:
|
|
90
|
+
highlightChoices: r.highlightChoices,
|
|
91
|
+
maxNoOfSelections: r.maxSelections,
|
|
92
|
+
animationsDisabled: r.animationsDisabled
|
|
84
93
|
}),
|
|
85
|
-
c === "evaluate" && /* @__PURE__ */
|
|
86
|
-
language:
|
|
94
|
+
c === "evaluate" && /* @__PURE__ */ h(i, {
|
|
95
|
+
language: r.language,
|
|
87
96
|
showOnlyCorrect: n
|
|
88
97
|
}),
|
|
89
|
-
u && (
|
|
98
|
+
u && (r.animationsDisabled ? /* @__PURE__ */ h(M, { children: /* @__PURE__ */ h(C, { prompt: r.rationale }) }) : /* @__PURE__ */ h(N, {
|
|
90
99
|
labels: {
|
|
91
100
|
hidden: "Show Rationale",
|
|
92
101
|
visible: "Hide Rationale"
|
|
93
102
|
},
|
|
94
|
-
children: /* @__PURE__ */
|
|
103
|
+
children: /* @__PURE__ */ h(C, { prompt: r.rationale })
|
|
95
104
|
})),
|
|
96
|
-
|
|
97
|
-
correctness:
|
|
98
|
-
feedback:
|
|
105
|
+
r.correctness && r.feedback && !n && /* @__PURE__ */ h(T, {
|
|
106
|
+
correctness: r.correctness,
|
|
107
|
+
feedback: r.feedback
|
|
99
108
|
})
|
|
100
109
|
]
|
|
101
110
|
});
|
|
102
111
|
}
|
|
103
|
-
},
|
|
104
|
-
static propTypes =
|
|
112
|
+
}, I = class extends t.Component {
|
|
113
|
+
static propTypes = P;
|
|
105
114
|
constructor(e) {
|
|
106
115
|
super(e), this.state = {
|
|
107
116
|
model: e.model,
|
|
@@ -125,7 +134,7 @@ var b = y(u, "UiLayout") || y(E.UiLayout, "UiLayout"), x = y(l, "PreviewPrompt")
|
|
|
125
134
|
};
|
|
126
135
|
render() {
|
|
127
136
|
let { model: e, session: t } = this.state;
|
|
128
|
-
return /* @__PURE__ */
|
|
137
|
+
return /* @__PURE__ */ h(F, {
|
|
129
138
|
model: e,
|
|
130
139
|
session: t,
|
|
131
140
|
onSelectionChange: this.change
|
|
@@ -133,4 +142,4 @@ var b = y(u, "UiLayout") || y(E.UiLayout, "UiLayout"), x = y(l, "PreviewPrompt")
|
|
|
133
142
|
}
|
|
134
143
|
};
|
|
135
144
|
//#endregion
|
|
136
|
-
export {
|
|
145
|
+
export { F as Main, I as default };
|