@pie-element/select-text 13.1.2-next.0 → 13.1.2-next.2

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.
Files changed (143) hide show
  1. package/dist/author/design.d.ts +2 -2
  2. package/dist/author/design.js +77 -78
  3. package/dist/browser/{Check-CXevxzJJ.js → Check-BMR_1cO0.js} +2687 -3367
  4. package/dist/browser/Check-BMR_1cO0.js.map +1 -0
  5. package/dist/browser/author/index.js +8520 -8957
  6. package/dist/browser/author/index.js.map +1 -1
  7. package/dist/browser/controller/index.js +11 -12
  8. package/dist/browser/controller/index.js.map +1 -1
  9. package/dist/browser/delivery/index.js +2 -2
  10. package/dist/browser/{_getTag-x1UozeM0.js → dist-SG92p6xV.js} +98 -160
  11. package/dist/browser/dist-SG92p6xV.js.map +1 -0
  12. package/dist/browser/{main-4aycOoI5.js → main-jVjbBKTM.js} +884 -884
  13. package/dist/browser/main-jVjbBKTM.js.map +1 -0
  14. package/dist/browser/print/index.js +7 -8
  15. package/dist/browser/print/index.js.map +1 -1
  16. package/dist/controller/index.js +19 -19
  17. package/dist/index.iife.js +26 -26
  18. package/dist/print/index.js +11 -11
  19. package/dist/runtime-support.d.ts +12 -0
  20. package/dist/runtime-support.js +12 -0
  21. package/package.json +12 -9
  22. package/dist/browser/Check-CXevxzJJ.js.map +0 -1
  23. package/dist/browser/_getTag-x1UozeM0.js.map +0 -1
  24. package/dist/browser/debounce-CUpLfqAu.js +0 -86
  25. package/dist/browser/debounce-CUpLfqAu.js.map +0 -1
  26. package/dist/browser/isEmpty-Bsms1e2W.js +0 -16
  27. package/dist/browser/isEmpty-Bsms1e2W.js.map +0 -1
  28. package/dist/browser/main-4aycOoI5.js.map +0 -1
  29. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_DataView.js +0 -6
  30. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Hash.js +0 -16
  31. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_ListCache.js +0 -16
  32. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Map.js +0 -6
  33. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_MapCache.js +0 -16
  34. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Promise.js +0 -6
  35. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Set.js +0 -6
  36. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Stack.js +0 -14
  37. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Symbol.js +0 -5
  38. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Uint8Array.js +0 -5
  39. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_WeakMap.js +0 -6
  40. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayEach.js +0 -7
  41. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayFilter.js +0 -10
  42. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayLikeKeys.js +0 -15
  43. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayPush.js +0 -7
  44. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_assignValue.js +0 -10
  45. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_assocIndexOf.js +0 -8
  46. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseAssign.js +0 -8
  47. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseAssignIn.js +0 -8
  48. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseAssignValue.js +0 -12
  49. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseClone.js +0 -57
  50. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseCreate.js +0 -14
  51. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseGetAllKeys.js +0 -9
  52. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseGetTag.js +0 -10
  53. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsArguments.js +0 -9
  54. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsMap.js +0 -9
  55. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsNative.js +0 -11
  56. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsSet.js +0 -9
  57. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsTypedArray.js +0 -11
  58. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseKeys.js +0 -12
  59. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseKeysIn.js +0 -13
  60. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseTimes.js +0 -7
  61. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseTrim.js +0 -8
  62. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseUnary.js +0 -8
  63. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneArrayBuffer.js +0 -8
  64. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneBuffer.js +0 -10
  65. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneDataView.js +0 -8
  66. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneRegExp.js +0 -8
  67. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneSymbol.js +0 -8
  68. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneTypedArray.js +0 -8
  69. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_copyArray.js +0 -8
  70. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_copyObject.js +0 -14
  71. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_copySymbols.js +0 -8
  72. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_copySymbolsIn.js +0 -8
  73. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_coreJsData.js +0 -5
  74. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_defineProperty.js +0 -10
  75. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_freeGlobal.js +0 -4
  76. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getAllKeys.js +0 -9
  77. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getAllKeysIn.js +0 -9
  78. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getMapData.js +0 -8
  79. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getNative.js +0 -9
  80. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getPrototype.js +0 -5
  81. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getRawTag.js +0 -14
  82. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getSymbols.js +0 -10
  83. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getSymbolsIn.js +0 -11
  84. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getTag.js +0 -23
  85. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getValue.js +0 -6
  86. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashClear.js +0 -7
  87. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashDelete.js +0 -7
  88. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashGet.js +0 -13
  89. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashHas.js +0 -9
  90. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashSet.js +0 -9
  91. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_initCloneArray.js +0 -8
  92. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_initCloneByTag.js +0 -33
  93. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_initCloneObject.js +0 -9
  94. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isIndex.js +0 -8
  95. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isKeyable.js +0 -7
  96. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isMasked.js +0 -11
  97. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isPrototype.js +0 -8
  98. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheClear.js +0 -6
  99. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheDelete.js +0 -9
  100. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheGet.js +0 -8
  101. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheHas.js +0 -7
  102. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheSet.js +0 -8
  103. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheClear.js +0 -13
  104. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheDelete.js +0 -8
  105. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheGet.js +0 -7
  106. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheHas.js +0 -7
  107. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheSet.js +0 -8
  108. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nativeCreate.js +0 -5
  109. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nativeKeys.js +0 -5
  110. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nativeKeysIn.js +0 -8
  111. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nodeUtil.js +0 -9
  112. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_objectToString.js +0 -7
  113. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_overArg.js +0 -8
  114. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_root.js +0 -5
  115. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackClear.js +0 -7
  116. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackDelete.js +0 -7
  117. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackGet.js +0 -6
  118. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackHas.js +0 -6
  119. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackSet.js +0 -16
  120. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_toSource.js +0 -15
  121. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_trimmedEndIndex.js +0 -8
  122. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/cloneDeep.js +0 -8
  123. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/debounce.js +0 -50
  124. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/eq.js +0 -6
  125. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArguments.js +0 -10
  126. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArray.js +0 -4
  127. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArrayLike.js +0 -8
  128. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isBuffer.js +0 -6
  129. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isEmpty.js +0 -21
  130. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isFunction.js +0 -11
  131. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isLength.js +0 -7
  132. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isMap.js +0 -7
  133. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isObject.js +0 -7
  134. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isObjectLike.js +0 -6
  135. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isSet.js +0 -7
  136. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isSymbol.js +0 -9
  137. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isTypedArray.js +0 -7
  138. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/keys.js +0 -9
  139. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/keysIn.js +0 -9
  140. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/now.js +0 -7
  141. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/stubArray.js +0 -6
  142. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/stubFalse.js +0 -6
  143. 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, w as t } from "../_getTag-x1UozeM0.js";
2
- import { q as n } from "../Check-CXevxzJJ.js";
3
- import { t as r } from "../main-4aycOoI5.js";
4
- import { t as i } from "../debounce-CUpLfqAu.js";
1
+ import { b as e, c as t, g as n } from "../dist-SG92p6xV.js";
2
+ import { w as r } from "../Check-BMR_1cO0.js";
3
+ import { t as i } from "../main-jVjbBKTM.js";
5
4
  import a from "react";
6
5
  import { createRoot as o } from "react-dom/client";
7
- var s = (0, (/* @__PURE__ */ t(e(), 1)).default)("pie-element:select-text:print"), c = (e, t) => {
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 = i(() => {
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(r, {
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"), n(this);
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-es';\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,GAAA,SAAY,+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"}
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,GAAA,SAAY,+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"}
@@ -1,10 +1,10 @@
1
- import e from "../node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isEmpty.js";
2
- import t from "./defaults.js";
3
- import n from "debug";
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 = n("@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) => {
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 = (t, n, r) => {
24
- if (!n || e(n)) return 0;
25
- let i = l(t.tokens, n.selectedTokens).length, a = (t.tokens || []).filter((e) => e.correct === !0), o = i - (n.selectedTokens && n.selectedTokens.length > a.length ? n.selectedTokens && n.selectedTokens.length - i : 0), s = o < 0 ? 0 : o;
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 = (t, n, r) => new Promise((a) => {
43
- if ((!n || e(n)) && a({
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
- }), n = m(n), r.mode !== "evaluate") a({
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 e = i.enabled(t, r, !0), o = t.tokens.filter((e) => e.correct), s = u(t, n, o);
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: e ? s : +(s === 1),
56
- logTrace: d(t, n, r)
55
+ score: n ? s : +(s === 1),
56
+ logTrace: d(e, t, r)
57
57
  });
58
58
  }
59
59
  });
60
- function p(e = {}) {
60
+ function p(t = {}) {
61
61
  return new Promise((n) => {
62
62
  n({
63
- ...t,
64
- ...e
63
+ ...e,
64
+ ...t
65
65
  });
66
66
  });
67
67
  }
68
68
  var m = (e) => ({
69
69
  selectedTokens: [],
70
70
  ...e
71
- }), h = (e) => ({
72
- ...t,
73
- ...e
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);