@pie-element/graphing-solution-set 0.1.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.
- package/dist/author/configure.d.ts +27 -0
- package/dist/author/configure.d.ts.map +1 -0
- package/dist/author/configure.js +190 -0
- package/dist/author/correct-response.d.ts +34 -0
- package/dist/author/correct-response.d.ts.map +1 -0
- package/dist/author/correct-response.js +206 -0
- package/dist/author/defaults.d.ts +239 -0
- package/dist/author/defaults.d.ts.map +1 -0
- package/dist/author/defaults.js +339 -0
- package/dist/author/graphing-config.d.ts +34 -0
- package/dist/author/graphing-config.d.ts.map +1 -0
- package/dist/author/graphing-config.js +238 -0
- package/dist/author/index.d.ts +63 -0
- package/dist/author/index.d.ts.map +1 -0
- package/dist/author/index.js +87 -0
- package/dist/author/utils.d.ts +47 -0
- package/dist/author/utils.d.ts.map +1 -0
- package/dist/author/utils.js +474 -0
- package/dist/controller/defaults.d.ts +65 -0
- package/dist/controller/defaults.d.ts.map +1 -0
- package/dist/controller/defaults.js +54 -0
- package/dist/controller/index.d.ts +25 -0
- package/dist/controller/index.d.ts.map +1 -0
- package/dist/controller/index.js +112 -0
- package/dist/controller/utils.d.ts +21 -0
- package/dist/controller/utils.d.ts.map +1 -0
- package/dist/controller/utils.js +42 -0
- package/dist/delivery/index.d.ts +23 -0
- package/dist/delivery/index.d.ts.map +1 -0
- package/dist/delivery/index.js +62 -0
- package/dist/delivery/main.d.ts +32 -0
- package/dist/delivery/main.d.ts.map +1 -0
- package/dist/delivery/main.js +198 -0
- package/dist/delivery/utils.d.ts +13 -0
- package/dist/delivery/utils.d.ts.map +1 -0
- package/dist/delivery/utils.js +220 -0
- package/dist/graphing-solution-set.css +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.iife.d.ts +9 -0
- package/dist/index.iife.d.ts.map +1 -0
- package/dist/index.iife.js +373 -0
- package/dist/index.js +2 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_DataView.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Hash.js +16 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_ListCache.js +16 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Map.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_MapCache.js +16 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Promise.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Set.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_SetCache.js +11 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Stack.js +13 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Symbol.js +5 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Uint8Array.js +5 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_WeakMap.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_apply.js +12 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_arrayEach.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_arrayFilter.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_arrayIncludes.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_arrayIncludesWith.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_arrayLikeKeys.js +15 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_arrayMap.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_arrayPush.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_arraySome.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_assignValue.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_assocIndexOf.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseAssign.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseAssignIn.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseAssignValue.js +12 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseClone.js +57 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseCreate.js +14 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseDifference.js +23 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseFindIndex.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseFlatten.js +13 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseGetAllKeys.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseGetTag.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIndexOf.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsArguments.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsEqual.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsEqualDeep.js +30 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsMap.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsNaN.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsNative.js +11 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsSet.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsTypedArray.js +11 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseKeys.js +12 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseKeysIn.js +13 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseRest.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseSet.js +22 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseSetToString.js +14 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseTimes.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseToString.js +15 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseUnary.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseUniq.js +27 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cacheHas.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_castPath.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cloneArrayBuffer.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cloneBuffer.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cloneDataView.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cloneRegExp.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cloneSymbol.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cloneTypedArray.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_copyArray.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_copyObject.js +14 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_copySymbols.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_copySymbolsIn.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_coreJsData.js +5 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_createSet.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_defineProperty.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_equalArrays.js +35 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_equalByTag.js +35 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_equalObjects.js +32 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_freeGlobal.js +4 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getAllKeys.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getAllKeysIn.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getMapData.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getNative.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getPrototype.js +5 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getRawTag.js +14 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getSymbols.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getSymbolsIn.js +11 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getTag.js +23 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getValue.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_hashClear.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_hashDelete.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_hashGet.js +13 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_hashHas.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_hashSet.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_initCloneArray.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_initCloneByTag.js +33 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_initCloneObject.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_isFlattenable.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_isIndex.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_isKey.js +11 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_isKeyable.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_isMasked.js +11 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_isPrototype.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_listCacheClear.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_listCacheDelete.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_listCacheGet.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_listCacheHas.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_listCacheSet.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheClear.js +13 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheDelete.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheGet.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheHas.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheSet.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_mapToArray.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_memoizeCapped.js +11 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_nativeCreate.js +5 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_nativeKeys.js +5 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_nativeKeysIn.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_nodeUtil.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_objectToString.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_overArg.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_overRest.js +13 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_root.js +5 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_setCacheAdd.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_setCacheHas.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_setToArray.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_setToString.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_shortOut.js +14 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_stackClear.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_stackDelete.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_stackGet.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_stackHas.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_stackSet.js +16 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_strictIndexOf.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_stringToPath.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_toKey.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_toSource.js +15 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/cloneDeep.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/constant.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/differenceWith.js +12 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/eq.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/identity.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isArguments.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isArray.js +4 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isArrayLike.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isArrayLikeObject.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isBuffer.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isEmpty.js +21 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isEqual.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isFunction.js +11 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isLength.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isMap.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isObject.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isObjectLike.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isSet.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isSymbol.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isTypedArray.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/keys.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/keysIn.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/last.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/memoize.js +16 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/noop.js +4 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/set.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/stubArray.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/stubFalse.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/toString.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/uniq.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/uniqWith.js +7 -0
- package/package.json +70 -0
- package/src/author/configure.tsx +266 -0
- package/src/author/correct-response.tsx +408 -0
- package/src/author/defaults.tsx +366 -0
- package/src/author/graphing-config.tsx +318 -0
- package/src/author/index.ts +176 -0
- package/src/author/utils.ts +577 -0
- package/src/controller/defaults.ts +72 -0
- package/src/controller/index.ts +313 -0
- package/src/controller/utils.ts +195 -0
- package/src/delivery/index.ts +159 -0
- package/src/delivery/main.tsx +361 -0
- package/src/delivery/utils.ts +465 -0
- package/src/index.iife.ts +16 -0
- package/src/index.ts +1 -0
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
/**
|
|
3
|
+
* @synced-from pie-elements/packages/graphing-solution-set/configure/src/index.js
|
|
4
|
+
* @auto-generated
|
|
5
|
+
*
|
|
6
|
+
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
7
|
+
* Manual edits will be overwritten on next sync.
|
|
8
|
+
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import React from 'react';
|
|
12
|
+
import { createRoot } from 'react-dom/client';
|
|
13
|
+
import Configure from './configure.js';
|
|
14
|
+
import {
|
|
15
|
+
ModelUpdatedEvent,
|
|
16
|
+
DeleteImageEvent,
|
|
17
|
+
InsertImageEvent,
|
|
18
|
+
InsertSoundEvent,
|
|
19
|
+
DeleteSoundEvent,
|
|
20
|
+
} from '@pie-element/shared-configure-events';
|
|
21
|
+
import debug from 'debug';
|
|
22
|
+
import defaultValues from './defaults.js';
|
|
23
|
+
import { renderMath } from '@pie-element/shared-math-rendering-mathjax';
|
|
24
|
+
|
|
25
|
+
const log = debug('pie-elements:graphing-solution-set:configure');
|
|
26
|
+
|
|
27
|
+
// this function is implemented in controller as well
|
|
28
|
+
const sortedAnswers = (answers) =>
|
|
29
|
+
Object.keys(answers || {})
|
|
30
|
+
.sort()
|
|
31
|
+
.reduce((result, key) => {
|
|
32
|
+
if (key !== 'correctAnswer') {
|
|
33
|
+
result[key] = answers[key];
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return result;
|
|
37
|
+
}, {});
|
|
38
|
+
|
|
39
|
+
export default class GraphLinesConfigure extends HTMLElement {
|
|
40
|
+
static createDefaultModel = (model = {}) => {
|
|
41
|
+
const normalizedModel = { ...defaultValues.model, ...model };
|
|
42
|
+
const { answers = {}, domain = {}, graph = {}, range = {}, standardGrid } = normalizedModel;
|
|
43
|
+
return {
|
|
44
|
+
...normalizedModel,
|
|
45
|
+
answers:
|
|
46
|
+
(answers &&
|
|
47
|
+
answers.correctAnswer && {
|
|
48
|
+
correctAnswer: answers.correctAnswer,
|
|
49
|
+
...sortedAnswers(answers),
|
|
50
|
+
}) ||
|
|
51
|
+
answers,
|
|
52
|
+
range:
|
|
53
|
+
(standardGrid && {
|
|
54
|
+
...range,
|
|
55
|
+
min: domain.min,
|
|
56
|
+
max: domain.max,
|
|
57
|
+
step: domain.step,
|
|
58
|
+
labelStep: domain.labelStep,
|
|
59
|
+
}) ||
|
|
60
|
+
range,
|
|
61
|
+
graph: (standardGrid && { ...graph, height: graph.width }) || graph,
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
constructor() {
|
|
66
|
+
super();
|
|
67
|
+
this._root = null;
|
|
68
|
+
this._model = GraphLinesConfigure.createDefaultModel();
|
|
69
|
+
this._configuration = defaultValues.configuration;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/*
|
|
73
|
+
* Function to set the model
|
|
74
|
+
* */
|
|
75
|
+
set model(m) {
|
|
76
|
+
this._model = GraphLinesConfigure.createDefaultModel(m);
|
|
77
|
+
this._render();
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/*
|
|
81
|
+
* Function to set the configuration
|
|
82
|
+
* */
|
|
83
|
+
set configuration(c) {
|
|
84
|
+
this._configuration = c;
|
|
85
|
+
// if language:enabled is true, then the corresponding default item model should include a language value;
|
|
86
|
+
// if it is false, then the language field should be omitted from the item model.
|
|
87
|
+
// if a default item model includes a language value (e.g., en_US) and the corresponding authoring view settings have language:settings = true,
|
|
88
|
+
// then (a) language:enabled should also be true, and (b) that default language value should be represented in languageChoices[] (as a key).
|
|
89
|
+
//TODO: add logic in controller and add tests
|
|
90
|
+
if (c.language?.enabled) {
|
|
91
|
+
if (c.languageChoices?.options?.length) {
|
|
92
|
+
this._model.language = c.languageChoices.options[0].value;
|
|
93
|
+
}
|
|
94
|
+
} else {
|
|
95
|
+
if (c.language.settings) {
|
|
96
|
+
if (this._model.language) {
|
|
97
|
+
this._configuration.language.enabled = true;
|
|
98
|
+
}
|
|
99
|
+
} else {
|
|
100
|
+
delete this._model.language;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
this._render();
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/*
|
|
107
|
+
* Triggered when the model is changed
|
|
108
|
+
* @param {object} model - the new model
|
|
109
|
+
* */
|
|
110
|
+
onModelChanged: any = (model) => {
|
|
111
|
+
this._model = model;
|
|
112
|
+
this._render();
|
|
113
|
+
log('[onModelChanged]: ', this._model);
|
|
114
|
+
this.dispatchEvent(new ModelUpdatedEvent(this._model));
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
/*
|
|
118
|
+
* Triggered when the configuration is changed
|
|
119
|
+
* @param {object} config - the new configuration
|
|
120
|
+
* */
|
|
121
|
+
onConfigurationChanged: any = (config) => {
|
|
122
|
+
this._configuration = config;
|
|
123
|
+
this._render();
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
insertImage: any = (handler) => {
|
|
127
|
+
this.dispatchEvent(new InsertImageEvent(handler));
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
onDeleteImage: any = (src, done) => {
|
|
131
|
+
this.dispatchEvent(new DeleteImageEvent(src, done));
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
insertSound(handler) {
|
|
135
|
+
this.dispatchEvent(new InsertSoundEvent(handler));
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
onDeleteSound(src, done) {
|
|
139
|
+
this.dispatchEvent(new DeleteSoundEvent(src, done));
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/*
|
|
143
|
+
* Render the component
|
|
144
|
+
* */
|
|
145
|
+
_render() {
|
|
146
|
+
if (this._model) {
|
|
147
|
+
const el = React.createElement(Configure, {
|
|
148
|
+
onModelChanged: this.onModelChanged,
|
|
149
|
+
onConfigurationChanged: this.onConfigurationChanged,
|
|
150
|
+
model: this._model,
|
|
151
|
+
configuration: this._configuration,
|
|
152
|
+
imageSupport: {
|
|
153
|
+
add: this.insertImage,
|
|
154
|
+
delete: this.onDeleteImage,
|
|
155
|
+
},
|
|
156
|
+
uploadSoundSupport: {
|
|
157
|
+
add: this.insertSound.bind(this),
|
|
158
|
+
delete: this.onDeleteSound.bind(this),
|
|
159
|
+
},
|
|
160
|
+
});
|
|
161
|
+
if (!this._root) {
|
|
162
|
+
this._root = createRoot(this);
|
|
163
|
+
}
|
|
164
|
+
this._root.render(el);
|
|
165
|
+
queueMicrotask(() => {
|
|
166
|
+
renderMath(this);
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
disconnectedCallback() {
|
|
172
|
+
if (this._root) {
|
|
173
|
+
this._root.unmount();
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|