@pie-element/number-line 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/_virtual/_rolldown/runtime.js +11 -0
- package/dist/author/arrows.d.ts +29 -0
- package/dist/author/arrows.d.ts.map +1 -0
- package/dist/author/arrows.js +69 -0
- package/dist/author/card-bar.d.ts +21 -0
- package/dist/author/card-bar.d.ts.map +1 -0
- package/dist/author/card-bar.js +41 -0
- package/dist/author/defaults.d.ts +179 -0
- package/dist/author/defaults.d.ts.map +1 -0
- package/dist/author/defaults.js +144 -0
- package/dist/author/domain.d.ts +16 -0
- package/dist/author/domain.d.ts.map +1 -0
- package/dist/author/domain.js +53 -0
- package/dist/author/index.d.ts +24 -0
- package/dist/author/index.d.ts.map +1 -0
- package/dist/author/index.js +89 -0
- package/dist/author/main.d.ts +45 -0
- package/dist/author/main.d.ts.map +1 -0
- package/dist/author/main.js +482 -0
- package/dist/author/number-text-field.d.ts +14 -0
- package/dist/author/number-text-field.d.ts.map +1 -0
- package/dist/author/number-text-field.js +11 -0
- package/dist/author/point-config.d.ts +26 -0
- package/dist/author/point-config.d.ts.map +1 -0
- package/dist/author/point-config.js +69 -0
- package/dist/author/size.d.ts +25 -0
- package/dist/author/size.d.ts.map +1 -0
- package/dist/author/size.js +48 -0
- package/dist/author/ticks.d.ts +23 -0
- package/dist/author/ticks.d.ts.map +1 -0
- package/dist/author/ticks.js +115 -0
- package/dist/author/utils.d.ts +10 -0
- package/dist/author/utils.d.ts.map +1 -0
- package/dist/author/utils.js +4 -0
- package/dist/controller/defaults.d.ts +59 -0
- package/dist/controller/defaults.d.ts.map +1 -0
- package/dist/controller/defaults.js +50 -0
- package/dist/controller/index.d.ts +34 -0
- package/dist/controller/index.d.ts.map +1 -0
- package/dist/controller/index.js +170 -0
- package/dist/controller/tickUtils.d.ts +21 -0
- package/dist/controller/tickUtils.d.ts.map +1 -0
- package/dist/controller/tickUtils.js +254 -0
- package/dist/controller/utils.d.ts +10 -0
- package/dist/controller/utils.d.ts.map +1 -0
- package/dist/controller/utils.js +68 -0
- package/dist/delivery/data-converter.d.ts +65 -0
- package/dist/delivery/data-converter.d.ts.map +1 -0
- package/dist/delivery/data-converter.js +70 -0
- package/dist/delivery/draggable/index.d.ts +34 -0
- package/dist/delivery/draggable/index.d.ts.map +1 -0
- package/dist/delivery/draggable/index.js +39 -0
- package/dist/delivery/index.d.ts +36 -0
- package/dist/delivery/index.d.ts.map +1 -0
- package/dist/delivery/index.js +109 -0
- package/dist/delivery/number-line/colors.d.ts +12 -0
- package/dist/delivery/number-line/colors.d.ts.map +1 -0
- package/dist/delivery/number-line/colors.js +5 -0
- package/dist/delivery/number-line/feedback.d.ts +20 -0
- package/dist/delivery/number-line/feedback.d.ts.map +1 -0
- package/dist/delivery/number-line/feedback.js +57 -0
- package/dist/delivery/number-line/graph/arrow.d.ts +31 -0
- package/dist/delivery/number-line/graph/arrow.d.ts.map +1 -0
- package/dist/delivery/number-line/graph/arrow.js +27 -0
- package/dist/delivery/number-line/graph/elements/base.d.ts +17 -0
- package/dist/delivery/number-line/graph/elements/base.d.ts.map +1 -0
- package/dist/delivery/number-line/graph/elements/base.js +11 -0
- package/dist/delivery/number-line/graph/elements/builder.d.ts +34 -0
- package/dist/delivery/number-line/graph/elements/builder.d.ts.map +1 -0
- package/dist/delivery/number-line/graph/elements/builder.js +30 -0
- package/dist/delivery/number-line/graph/elements/line.d.ts +52 -0
- package/dist/delivery/number-line/graph/elements/line.d.ts.map +1 -0
- package/dist/delivery/number-line/graph/elements/line.js +189 -0
- package/dist/delivery/number-line/graph/elements/point.d.ts +44 -0
- package/dist/delivery/number-line/graph/elements/point.d.ts.map +1 -0
- package/dist/delivery/number-line/graph/elements/point.js +127 -0
- package/dist/delivery/number-line/graph/elements/ray.d.ts +44 -0
- package/dist/delivery/number-line/graph/elements/ray.d.ts.map +1 -0
- package/dist/delivery/number-line/graph/elements/ray.js +130 -0
- package/dist/delivery/number-line/graph/index.d.ts +60 -0
- package/dist/delivery/number-line/graph/index.d.ts.map +1 -0
- package/dist/delivery/number-line/graph/index.js +196 -0
- package/dist/delivery/number-line/graph/line.d.ts +47 -0
- package/dist/delivery/number-line/graph/line.d.ts.map +1 -0
- package/dist/delivery/number-line/graph/line.js +27 -0
- package/dist/delivery/number-line/graph/stacks.d.ts +11 -0
- package/dist/delivery/number-line/graph/stacks.d.ts.map +1 -0
- package/dist/delivery/number-line/graph/stacks.js +40 -0
- package/dist/delivery/number-line/graph/tick-utils.d.ts +74 -0
- package/dist/delivery/number-line/graph/tick-utils.d.ts.map +1 -0
- package/dist/delivery/number-line/graph/tick-utils.js +297 -0
- package/dist/delivery/number-line/graph/ticks.d.ts +47 -0
- package/dist/delivery/number-line/graph/ticks.d.ts.map +1 -0
- package/dist/delivery/number-line/graph/ticks.js +115 -0
- package/dist/delivery/number-line/index.d.ts +36 -0
- package/dist/delivery/number-line/index.d.ts.map +1 -0
- package/dist/delivery/number-line/index.js +218 -0
- package/dist/delivery/number-line/point-chooser/button.d.ts +32 -0
- package/dist/delivery/number-line/point-chooser/button.d.ts.map +1 -0
- package/dist/delivery/number-line/point-chooser/button.js +36 -0
- package/dist/delivery/number-line/point-chooser/img.d.ts +11 -0
- package/dist/delivery/number-line/point-chooser/img.d.ts.map +1 -0
- package/dist/delivery/number-line/point-chooser/img.js +4 -0
- package/dist/delivery/number-line/point-chooser/index.d.ts +38 -0
- package/dist/delivery/number-line/point-chooser/index.d.ts.map +1 -0
- package/dist/delivery/number-line/point-chooser/index.js +154 -0
- package/dist/delivery/number-line/point-chooser/styles.d.ts +193 -0
- package/dist/delivery/number-line/point-chooser/styles.d.ts.map +1 -0
- package/dist/delivery/number-line/transitions/fade.d.ts +35 -0
- package/dist/delivery/number-line/transitions/fade.d.ts.map +1 -0
- package/dist/delivery/number-line/transitions/fade.js +75 -0
- package/dist/delivery/number-line/transitions/index.d.ts +11 -0
- package/dist/delivery/number-line/transitions/index.d.ts.map +1 -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 +201 -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/_assignMergeValue.js +8 -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/_baseFindIndex.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseFor.js +5 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseGet.js +10 -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/_baseHasIn.js +6 -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/_baseIsMatch.js +26 -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/_baseIteratee.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/_baseMatches.js +12 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseMatchesProperty.js +17 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseMerge.js +19 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseMergeDeep.js +31 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_basePickBy.js +13 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseProperty.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_basePropertyDeep.js +9 -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/_baseTrim.js +8 -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/_createAssigner.js +15 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_createBaseFor.js +12 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_createFind.js +19 -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/_getMatchData.js +16 -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/_hasPath.js +18 -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/_isIndex.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_isIterateeCall.js +12 -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/_isStrictComparable.js +7 -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/_matchesStrictComparable.js +8 -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/_safeGet.js +6 -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/_trimmedEndIndex.js +8 -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/eq.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/find.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/findIndex.js +13 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/get.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/hasIn.js +8 -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/isEqualWith.js +9 -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/isNumber.js +9 -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/isPlainObject.js +14 -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/memoize.js +16 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/merge.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/negate.js +17 -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/omitBy.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/pickBy.js +16 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/property.js +10 -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/toFinite.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/toInteger.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/toNumber.js +19 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/toPlainObject.js +8 -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/uniqWith.js +7 -0
- package/package.json +77 -0
- package/src/author/arrows.tsx +87 -0
- package/src/author/card-bar.tsx +70 -0
- package/src/author/defaults.ts +127 -0
- package/src/author/domain.tsx +79 -0
- package/src/author/index.ts +199 -0
- package/src/author/main.tsx +777 -0
- package/src/author/number-text-field.tsx +28 -0
- package/src/author/point-config.tsx +93 -0
- package/src/author/size.tsx +74 -0
- package/src/author/ticks.tsx +272 -0
- package/src/author/utils.ts +16 -0
- package/src/controller/defaults.ts +40 -0
- package/src/controller/index.ts +437 -0
- package/src/controller/tickUtils.ts +324 -0
- package/src/controller/utils.ts +159 -0
- package/src/delivery/data-converter.ts +88 -0
- package/src/delivery/draggable/index.ts +116 -0
- package/src/delivery/index.ts +225 -0
- package/src/delivery/number-line/colors.ts +15 -0
- package/src/delivery/number-line/feedback.tsx +85 -0
- package/src/delivery/number-line/graph/arrow.tsx +43 -0
- package/src/delivery/number-line/graph/elements/base.ts +20 -0
- package/src/delivery/number-line/graph/elements/builder.ts +37 -0
- package/src/delivery/number-line/graph/elements/line.tsx +259 -0
- package/src/delivery/number-line/graph/elements/point.tsx +219 -0
- package/src/delivery/number-line/graph/elements/ray.tsx +168 -0
- package/src/delivery/number-line/graph/index.tsx +258 -0
- package/src/delivery/number-line/graph/line.tsx +33 -0
- package/src/delivery/number-line/graph/stacks.ts +82 -0
- package/src/delivery/number-line/graph/tick-utils.ts +369 -0
- package/src/delivery/number-line/graph/ticks.tsx +189 -0
- package/src/delivery/number-line/index.tsx +385 -0
- package/src/delivery/number-line/point-chooser/button.tsx +54 -0
- package/src/delivery/number-line/point-chooser/img.ts +11 -0
- package/src/delivery/number-line/point-chooser/index.tsx +200 -0
- package/src/delivery/number-line/point-chooser/styles.ts +86 -0
- package/src/delivery/number-line/transitions/fade.tsx +100 -0
- package/src/delivery/number-line/transitions/index.ts +12 -0
- package/src/index.iife.ts +16 -0
- package/src/index.ts +1 -0
|
@@ -0,0 +1,385 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
/**
|
|
3
|
+
* @synced-from pie-elements/packages/number-line/src/number-line/index.jsx
|
|
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 Toggle from '@pie-lib/correct-answer-toggle';
|
|
13
|
+
import { cloneDeep, isArray, isEqual, isNumber } from 'lodash-es';
|
|
14
|
+
import Translator from '@pie-lib/translator';
|
|
15
|
+
import { Collapsible as CollapsibleImport, color, hasMedia, hasText, PreviewPrompt as PreviewPromptImport, UiLayout as UiLayoutImport } from '@pie-lib/render-ui';
|
|
16
|
+
|
|
17
|
+
function isRenderableReactInteropType(value: any) {
|
|
18
|
+
return (
|
|
19
|
+
typeof value === 'function' ||
|
|
20
|
+
(typeof value === 'object' && value !== null && typeof value.$$typeof === 'symbol')
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function unwrapReactInteropSymbol(maybeSymbol: any, namedExport?: string) {
|
|
25
|
+
if (!maybeSymbol) return maybeSymbol;
|
|
26
|
+
if (isRenderableReactInteropType(maybeSymbol)) return maybeSymbol;
|
|
27
|
+
if (isRenderableReactInteropType(maybeSymbol.default)) return maybeSymbol.default;
|
|
28
|
+
if (namedExport && isRenderableReactInteropType(maybeSymbol[namedExport])) {
|
|
29
|
+
return maybeSymbol[namedExport];
|
|
30
|
+
}
|
|
31
|
+
if (namedExport && isRenderableReactInteropType(maybeSymbol[namedExport]?.default)) {
|
|
32
|
+
return maybeSymbol[namedExport].default;
|
|
33
|
+
}
|
|
34
|
+
return maybeSymbol;
|
|
35
|
+
}
|
|
36
|
+
const UiLayout = unwrapReactInteropSymbol(UiLayoutImport, 'UiLayout') || unwrapReactInteropSymbol(renderUi.UiLayout, 'UiLayout');
|
|
37
|
+
const PreviewPrompt = unwrapReactInteropSymbol(PreviewPromptImport, 'PreviewPrompt') || unwrapReactInteropSymbol(renderUi.PreviewPrompt, 'PreviewPrompt');
|
|
38
|
+
const Collapsible = unwrapReactInteropSymbol(CollapsibleImport, 'Collapsible') || unwrapReactInteropSymbol(renderUi.Collapsible, 'Collapsible');
|
|
39
|
+
import * as RenderUiNamespace from '@pie-lib/render-ui';
|
|
40
|
+
const renderUiNamespaceAny = RenderUiNamespace as any;
|
|
41
|
+
const renderUiDefaultMaybe = renderUiNamespaceAny['default'];
|
|
42
|
+
const renderUi =
|
|
43
|
+
renderUiDefaultMaybe && typeof renderUiDefaultMaybe === 'object'
|
|
44
|
+
? renderUiDefaultMaybe
|
|
45
|
+
: renderUiNamespaceAny;
|
|
46
|
+
import { styled } from '@mui/material/styles';
|
|
47
|
+
|
|
48
|
+
import Feedback from './feedback.js';
|
|
49
|
+
import Graph from './graph/index.js';
|
|
50
|
+
import PropTypes from 'prop-types';
|
|
51
|
+
import PointChooser from './point-chooser/index.js';
|
|
52
|
+
import { buildElementModel } from './graph/elements/builder.js';
|
|
53
|
+
|
|
54
|
+
const { translator } = Translator;
|
|
55
|
+
|
|
56
|
+
export { Graph };
|
|
57
|
+
|
|
58
|
+
const StyledUiLayout: any = styled(UiLayout)(({ $colorContrast }) => ({
|
|
59
|
+
color: color.text(),
|
|
60
|
+
backgroundColor: color.background(),
|
|
61
|
+
...($colorContrast === 'black_on_rose' && {
|
|
62
|
+
backgroundColor: 'mistyrose',
|
|
63
|
+
}),
|
|
64
|
+
...($colorContrast === 'white_on_black' && {
|
|
65
|
+
backgroundColor: 'black',
|
|
66
|
+
'--correct-answer-toggle-label-color': 'white',
|
|
67
|
+
'--tick-color': 'white',
|
|
68
|
+
'--line-stroke': 'white',
|
|
69
|
+
'--arrow-color': 'white',
|
|
70
|
+
'--point-stroke': 'white',
|
|
71
|
+
'--point-fill': 'black',
|
|
72
|
+
}),
|
|
73
|
+
}));
|
|
74
|
+
|
|
75
|
+
const NumberLineContainer: any = styled('div')(({ $colorContrast }) => ({
|
|
76
|
+
boxSizing: 'unset',
|
|
77
|
+
color: color.text(),
|
|
78
|
+
backgroundColor: color.background(),
|
|
79
|
+
...($colorContrast === 'black_on_rose' && {
|
|
80
|
+
backgroundColor: 'mistyrose',
|
|
81
|
+
}),
|
|
82
|
+
...($colorContrast === 'white_on_black' && {
|
|
83
|
+
backgroundColor: 'black',
|
|
84
|
+
'--correct-answer-toggle-label-color': 'white',
|
|
85
|
+
'--tick-color': 'white',
|
|
86
|
+
'--line-stroke': 'white',
|
|
87
|
+
'--arrow-color': 'white',
|
|
88
|
+
'--point-stroke': 'white',
|
|
89
|
+
'--point-fill': 'black',
|
|
90
|
+
}),
|
|
91
|
+
}));
|
|
92
|
+
|
|
93
|
+
const GraphTitle: any = styled('div')({
|
|
94
|
+
textAlign: 'center',
|
|
95
|
+
pointerEvents: 'none',
|
|
96
|
+
userSelect: 'none',
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
const ToggleContainer: any = styled('div')({
|
|
100
|
+
marginBottom: '16px',
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
const PromptContainer: any = styled('div')({
|
|
104
|
+
verticalAlign: 'middle',
|
|
105
|
+
marginBottom: '16px',
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
const StyledCollapsible: any = styled(Collapsible)(({ theme }) => ({
|
|
109
|
+
paddingBottom: theme.spacing(2),
|
|
110
|
+
}));
|
|
111
|
+
|
|
112
|
+
export class NumberLine extends React.Component {
|
|
113
|
+
static propTypes = {
|
|
114
|
+
onMoveElement: PropTypes.func.isRequired,
|
|
115
|
+
onDeleteElements: PropTypes.func.isRequired,
|
|
116
|
+
onAddElement: PropTypes.func.isRequired,
|
|
117
|
+
onUndoElement: PropTypes.func.isRequired,
|
|
118
|
+
onClearElements: PropTypes.func.isRequired,
|
|
119
|
+
model: PropTypes.object.isRequired,
|
|
120
|
+
answer: PropTypes.array,
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
constructor(props, context) {
|
|
124
|
+
super(props, context);
|
|
125
|
+
|
|
126
|
+
let initialType = props.model.graph ? props.model.graph.initialType : null;
|
|
127
|
+
initialType = initialType ? initialType.toLowerCase() : PointChooser.DEFAULT_TYPE;
|
|
128
|
+
|
|
129
|
+
this.state = {
|
|
130
|
+
selectedElements: [],
|
|
131
|
+
elementType: initialType,
|
|
132
|
+
answers: props.answer,
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
toggleElement(index) {
|
|
137
|
+
let selected = [];
|
|
138
|
+
if (this.state.selectedElements.indexOf(index) === -1) {
|
|
139
|
+
selected = this.state.selectedElements.concat([index]);
|
|
140
|
+
} else {
|
|
141
|
+
selected = this.state.selectedElements.filter((e) => e !== index);
|
|
142
|
+
}
|
|
143
|
+
this.setState({ selectedElements: selected });
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
elementTypeSelected(t) {
|
|
147
|
+
this.setState({ elementType: t });
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
addElement(x) {
|
|
151
|
+
if (this.hasMaxNoOfPoints()) {
|
|
152
|
+
this.setState({ showMaxPointsWarning: true });
|
|
153
|
+
setTimeout(() => {
|
|
154
|
+
this.setState({ showMaxPointsWarning: false });
|
|
155
|
+
}, 2000);
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
const { ticks, domain, availableTypes } = this.props.model.graph;
|
|
160
|
+
|
|
161
|
+
// check if the element type is enabled in availableTypes
|
|
162
|
+
if (availableTypes && !availableTypes[this.state.elementType.toUpperCase()]) {
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
let elementData = buildElementModel(x, this.state.elementType, domain, ticks.minor);
|
|
167
|
+
|
|
168
|
+
if (elementData) {
|
|
169
|
+
const { answers } = this.state;
|
|
170
|
+
|
|
171
|
+
const contains = answers.some((element) => {
|
|
172
|
+
return isEqual(element, elementData);
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
if (!contains) {
|
|
176
|
+
answers.push(elementData);
|
|
177
|
+
this.setState({ answers });
|
|
178
|
+
this.props.onAddElement(elementData);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
hasMaxNoOfPoints() {
|
|
184
|
+
let {
|
|
185
|
+
answer,
|
|
186
|
+
model: {
|
|
187
|
+
graph: { maxNumberOfPoints },
|
|
188
|
+
},
|
|
189
|
+
} = this.props;
|
|
190
|
+
|
|
191
|
+
return isNumber(maxNumberOfPoints) && maxNumberOfPoints > 0 && (answer || []).length >= maxNumberOfPoints;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
UNSAFE_componentWillReceiveProps(nextProps) {
|
|
195
|
+
const { answer } = nextProps;
|
|
196
|
+
|
|
197
|
+
if (!isEqual(this.state.answers, answer)) {
|
|
198
|
+
this.setState({ showCorrectAnswer: false, answers: answer });
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
deselectElements() {
|
|
203
|
+
this.setState({ selectedElements: [] });
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
getSize(type, min, max, defaultValue) {
|
|
207
|
+
const {
|
|
208
|
+
model: { graph },
|
|
209
|
+
} = this.props;
|
|
210
|
+
|
|
211
|
+
if (graph && graph[type]) {
|
|
212
|
+
return Math.max(min, Math.min(max, graph[type]));
|
|
213
|
+
} else {
|
|
214
|
+
return defaultValue;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
undo() {
|
|
219
|
+
const { answers } = this.state;
|
|
220
|
+
const { onUndoElement } = this.props;
|
|
221
|
+
|
|
222
|
+
answers.pop();
|
|
223
|
+
this.setState({ answers });
|
|
224
|
+
onUndoElement();
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
clearAll() {
|
|
228
|
+
const { onClearElements } = this.props;
|
|
229
|
+
|
|
230
|
+
this.setState({ answers: [] });
|
|
231
|
+
onClearElements();
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
render() {
|
|
235
|
+
let { model, onDeleteElements, onMoveElement, minWidth = 400, maxWidth = 1600, maxHeight } = this.props;
|
|
236
|
+
let { showCorrectAnswer, answers, selectedElements, showMaxPointsWarning, elementType } = this.state;
|
|
237
|
+
let {
|
|
238
|
+
corrected = { correct: [], incorrect: [] },
|
|
239
|
+
disabled,
|
|
240
|
+
extraCSSRules,
|
|
241
|
+
graph,
|
|
242
|
+
correctResponse,
|
|
243
|
+
prompt,
|
|
244
|
+
emptyAnswer,
|
|
245
|
+
feedback,
|
|
246
|
+
colorContrast,
|
|
247
|
+
language,
|
|
248
|
+
teacherInstructions,
|
|
249
|
+
} = model;
|
|
250
|
+
let addElement = this.addElement.bind(this);
|
|
251
|
+
let elementsSelected = !disabled && selectedElements && selectedElements.length > 0;
|
|
252
|
+
const { ticks, domain, arrows, maxNumberOfPoints, height = 100, availableTypes, title, fraction } = graph;
|
|
253
|
+
const width = this.getSize('width', minWidth, maxWidth, 600);
|
|
254
|
+
const showTeacherInstructions =
|
|
255
|
+
teacherInstructions && (hasText(teacherInstructions) || hasMedia(teacherInstructions));
|
|
256
|
+
|
|
257
|
+
const graphProps = {
|
|
258
|
+
disabled,
|
|
259
|
+
domain,
|
|
260
|
+
ticks,
|
|
261
|
+
width,
|
|
262
|
+
height: (height > maxHeight ? maxHeight : height) || 100,
|
|
263
|
+
arrows,
|
|
264
|
+
fraction,
|
|
265
|
+
};
|
|
266
|
+
|
|
267
|
+
let getAnswerElements = () => {
|
|
268
|
+
return (answers || []).map((e, index) => {
|
|
269
|
+
let out = cloneDeep(e);
|
|
270
|
+
out.selected = selectedElements.indexOf(index) !== -1;
|
|
271
|
+
|
|
272
|
+
if (corrected.correct.includes(index)) {
|
|
273
|
+
out.correct = true;
|
|
274
|
+
} else if (corrected.incorrect.includes(index)) {
|
|
275
|
+
out.correct = false;
|
|
276
|
+
} else {
|
|
277
|
+
out.correct = undefined;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
return out;
|
|
281
|
+
});
|
|
282
|
+
};
|
|
283
|
+
|
|
284
|
+
let getCorrectAnswerElements = () => {
|
|
285
|
+
return (correctResponse || []).map((r) => {
|
|
286
|
+
r.correct = true;
|
|
287
|
+
return r;
|
|
288
|
+
});
|
|
289
|
+
};
|
|
290
|
+
|
|
291
|
+
// Determine which elements to show on the chart
|
|
292
|
+
let elements = showCorrectAnswer && correctResponse ? getCorrectAnswerElements() : getAnswerElements();
|
|
293
|
+
|
|
294
|
+
let maxPointsMessage = () =>
|
|
295
|
+
maxNumberOfPoints == 1
|
|
296
|
+
? translator.t('numberLine.addElementLimit_one', { lng: language, count: 1 })
|
|
297
|
+
: translator.t('numberLine.addElementLimit_other', { lng: language, count: maxNumberOfPoints });
|
|
298
|
+
|
|
299
|
+
let deleteElements = () => {
|
|
300
|
+
onDeleteElements(selectedElements);
|
|
301
|
+
|
|
302
|
+
answers = answers.filter((v, index) => {
|
|
303
|
+
return !selectedElements.some((d) => d === index);
|
|
304
|
+
});
|
|
305
|
+
|
|
306
|
+
this.setState({ selectedElements: [], answers });
|
|
307
|
+
};
|
|
308
|
+
|
|
309
|
+
let getIcons = () => {
|
|
310
|
+
if (availableTypes) {
|
|
311
|
+
return Object.keys(availableTypes)
|
|
312
|
+
.filter((k) => availableTypes[k])
|
|
313
|
+
.map((k) => k.toLowerCase());
|
|
314
|
+
}
|
|
315
|
+
};
|
|
316
|
+
|
|
317
|
+
let onShowCorrectAnswer = (show) => {
|
|
318
|
+
this.setState({ showCorrectAnswer: show });
|
|
319
|
+
};
|
|
320
|
+
|
|
321
|
+
let adjustedWidth = graphProps.width - 20;
|
|
322
|
+
|
|
323
|
+
return (
|
|
324
|
+
<StyledUiLayout extraCSSRules={extraCSSRules} $colorContrast={colorContrast}>
|
|
325
|
+
{showTeacherInstructions && (
|
|
326
|
+
<StyledCollapsible
|
|
327
|
+
labels={{
|
|
328
|
+
hidden: 'Show Teacher Instructions',
|
|
329
|
+
visible: 'Hide Teacher Instructions',
|
|
330
|
+
}}
|
|
331
|
+
>
|
|
332
|
+
<PreviewPrompt prompt={teacherInstructions} />
|
|
333
|
+
</StyledCollapsible>
|
|
334
|
+
)}
|
|
335
|
+
|
|
336
|
+
{prompt && (
|
|
337
|
+
<PromptContainer>
|
|
338
|
+
<PreviewPrompt prompt={prompt} />
|
|
339
|
+
</PromptContainer>
|
|
340
|
+
)}
|
|
341
|
+
|
|
342
|
+
<NumberLineContainer $colorContrast={colorContrast} style={{ width }}>
|
|
343
|
+
<ToggleContainer style={{ width: adjustedWidth }}>
|
|
344
|
+
<Toggle
|
|
345
|
+
show={isArray(correctResponse) && correctResponse.length && !emptyAnswer}
|
|
346
|
+
toggled={showCorrectAnswer}
|
|
347
|
+
onToggle={onShowCorrectAnswer}
|
|
348
|
+
initialValue={false}
|
|
349
|
+
language={language}
|
|
350
|
+
/>
|
|
351
|
+
</ToggleContainer>
|
|
352
|
+
|
|
353
|
+
{!disabled && (
|
|
354
|
+
<PointChooser
|
|
355
|
+
elementType={elementType}
|
|
356
|
+
showDeleteButton={elementsSelected}
|
|
357
|
+
onDeleteClick={deleteElements}
|
|
358
|
+
onElementType={this.elementTypeSelected.bind(this)}
|
|
359
|
+
onClearElements={this.clearAll.bind(this)}
|
|
360
|
+
onUndoElement={this.undo.bind(this)}
|
|
361
|
+
icons={getIcons()}
|
|
362
|
+
language={language}
|
|
363
|
+
/>
|
|
364
|
+
)}
|
|
365
|
+
|
|
366
|
+
<Graph
|
|
367
|
+
{...graphProps}
|
|
368
|
+
elements={elements}
|
|
369
|
+
onAddElement={addElement}
|
|
370
|
+
onMoveElement={onMoveElement}
|
|
371
|
+
onToggleElement={this.toggleElement.bind(this)}
|
|
372
|
+
onDeselectElements={this.deselectElements.bind(this)}
|
|
373
|
+
debug={false}
|
|
374
|
+
/>
|
|
375
|
+
{title && <GraphTitle dangerouslySetInnerHTML={{ __html: title }} />}
|
|
376
|
+
|
|
377
|
+
{showMaxPointsWarning && <Feedback type="info" width={adjustedWidth} message={maxPointsMessage()} />}
|
|
378
|
+
{feedback && !showCorrectAnswer && <Feedback {...feedback} width={adjustedWidth} />}
|
|
379
|
+
</NumberLineContainer>
|
|
380
|
+
</StyledUiLayout>
|
|
381
|
+
);
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
export default NumberLine;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
/**
|
|
3
|
+
* @synced-from pie-elements/packages/number-line/src/number-line/point-chooser/button.jsx
|
|
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 PropTypes from 'prop-types';
|
|
13
|
+
import { styled } from '@mui/material/styles';
|
|
14
|
+
import Button from '@mui/material/Button';
|
|
15
|
+
|
|
16
|
+
const StyledButton: any = styled(Button)({
|
|
17
|
+
fontSize: '0.9em',
|
|
18
|
+
marginLeft: 8,
|
|
19
|
+
minWidth: 32,
|
|
20
|
+
height: 32,
|
|
21
|
+
'& span': {
|
|
22
|
+
'& svg': {
|
|
23
|
+
width: '1.3em !important',
|
|
24
|
+
height: '1.3em !important',
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
const RawButton = ({ label, onClick, disabled, title }) => (
|
|
30
|
+
<StyledButton
|
|
31
|
+
title={title}
|
|
32
|
+
onClick={onClick}
|
|
33
|
+
disabled={disabled}
|
|
34
|
+
size="small"
|
|
35
|
+
variant="contained">
|
|
36
|
+
{label}
|
|
37
|
+
</StyledButton>
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
RawButton.propTypes = {
|
|
41
|
+
disabled: PropTypes.bool,
|
|
42
|
+
label: PropTypes.oneOfType([PropTypes.string, PropTypes.object]),
|
|
43
|
+
onClick: PropTypes.func,
|
|
44
|
+
title: PropTypes.string,
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
RawButton.defaultProps = {
|
|
48
|
+
disabled: false,
|
|
49
|
+
label: 'Add',
|
|
50
|
+
onClick: () => {},
|
|
51
|
+
title: '',
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export default RawButton;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
/**
|
|
3
|
+
* @synced-from pie-elements/packages/number-line/src/number-line/point-chooser/img.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
|
+
export default 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAaIAAAB6CAYAAAD9EVeZAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA35pVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOk9yaWdpbmFsRG9jdW1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+hQsXVCeoajxFnePj458dNRw6dKh9tCE/1766upqMTo1+XeO28nNQv1YaNZNmiLUWei3VPaWk6afVvIde91an6UKtEe9C9PTpU6ftnz9/rmqQ6/jaVI2nqPPy5ct9t5HnuxOZgs6q/Z44caL09bGxMae4rfzsnsPeDk2N2yXNQb6FnPOYa0kSpyQw1wSs7afVvMdY976easbhm+e9T82tr687bb+xsaG6I7uOr03VeIo6Dx482HebAwcOJKVTo1/XuGP7qalR68jdes5jryX5EDy2nxbzHnPdu3qqHYdvnvcuRMUj3irIz8Jq4jq+NlXjKep8/fp1323Kno+lU6Nf17hj+6mpsUusHyJz1RljLclRdNkRdkg/LeY91rr38VQ7Dt88712IXN8OHzt2TNUg1/GnpqaytbW10iavW8RT1Fl2NCdHeinp1OjXNW4rP6uiqbGLnK+/evVq8CTvqlN7LfVrGgnTwk+LebdY91aeasfhm+e9PyOSi5iqnHsvbq+J9vhW8RT7ffz4cTY9Pd2+7kHezsqRhEzio0ePktJZdfu5ubnS1+WiN824ff28d+9e6cV2ovHixYvqGnuTp9D9MFnoTSLbUdRpsdZCruUrV654Xfdj5afVvGuve0tPU4jDuxB1r6it8o0bi6vTtce3iqe330EfnqekU9vPunFb9GulsUryTGmthVrLWglT20+LeQ+1b1kWoZBx1Lqg9dq1a+0ragchr8t2FmiPbxUPOtPVGWofrntayVqndf/aCTN1P4fR05he1bpnidzO4caNG9np06fbFVO+uiffmpAPrORcofV9urTHt4oHnenqDLkP17nGw1qndf8WCTNlP4fV02heab19i3ljSO3xreJBZ7o6Q+3DdS84tNYZey03zc9h9DRGHPwMBAAARIVCBAAAFCIAAKAQAQAAUIgAAIBCBAAAQCECAAAKEQAAQLBC9EH7Nyw06Gj6s/AUOtGJTnSis4E6pRCtbm5uJifww4cP8lC8ux460YlOdKKzgTqlEM28e/duQ+4d9OnTp+jCRINoWV9fl5/6mym8hE50ohOd6GygTrnX3C+tVuvk27dv5/I2mf97d2SNUrblBy6m8/aq8Dw60YlOdKKzgTr/I8AAfqzhPjCMsb4AAAAASUVORK5CYII=';
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
/**
|
|
3
|
+
* @synced-from pie-elements/packages/number-line/src/number-line/point-chooser/index.jsx
|
|
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
|
+
|
|
13
|
+
import { styled } from '@mui/material/styles';
|
|
14
|
+
import PropTypes from 'prop-types';
|
|
15
|
+
import Button from './button.js';
|
|
16
|
+
import Translator from '@pie-lib/translator';
|
|
17
|
+
|
|
18
|
+
const { translator } = Translator;
|
|
19
|
+
|
|
20
|
+
const iconHeight = 41;
|
|
21
|
+
const iconWidth = 42;
|
|
22
|
+
import img from './img.js';
|
|
23
|
+
|
|
24
|
+
const StyledDeleteIcon: any = styled('svg')({
|
|
25
|
+
fill: 'black',
|
|
26
|
+
cursor: 'pointer',
|
|
27
|
+
transition: 'opacity 100ms linear',
|
|
28
|
+
'&:hover': {
|
|
29
|
+
opacity: '0.5',
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
const DeleteIcon = () => {
|
|
34
|
+
return (
|
|
35
|
+
<StyledDeleteIcon
|
|
36
|
+
fill="#000000"
|
|
37
|
+
height="24"
|
|
38
|
+
viewBox="0 0 24 24"
|
|
39
|
+
width="24"
|
|
40
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
41
|
+
>
|
|
42
|
+
<path d="M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z" />
|
|
43
|
+
<path d="M0 0h24v24H0z" fill="none" />
|
|
44
|
+
</StyledDeleteIcon>
|
|
45
|
+
);
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const iconIndexMap = {
|
|
49
|
+
pf: 0,
|
|
50
|
+
lff: 1,
|
|
51
|
+
lef: 2,
|
|
52
|
+
lfe: 3,
|
|
53
|
+
lee: 4,
|
|
54
|
+
rfn: 5,
|
|
55
|
+
rfp: 6,
|
|
56
|
+
ren: 7,
|
|
57
|
+
rep: 8,
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
const StyledPointLink: any = styled('a')(({ $iconIndex, $active }) => ({
|
|
61
|
+
display: 'inline-block',
|
|
62
|
+
width: iconWidth,
|
|
63
|
+
height: iconHeight,
|
|
64
|
+
position: 'relative',
|
|
65
|
+
top: '1px',
|
|
66
|
+
cursor: 'pointer',
|
|
67
|
+
background: `url(${img}) -${$iconIndex * iconWidth}px 0px`,
|
|
68
|
+
...($active && {
|
|
69
|
+
backgroundPosition: `-${$iconIndex * iconWidth}px -${2 * iconHeight}px`,
|
|
70
|
+
}),
|
|
71
|
+
'&:hover': {
|
|
72
|
+
textDecoration: 'none',
|
|
73
|
+
backgroundPosition: `-${$iconIndex * iconWidth}px -${iconHeight}px`,
|
|
74
|
+
},
|
|
75
|
+
...($active && {
|
|
76
|
+
'&:hover': {
|
|
77
|
+
backgroundPosition: `-${$iconIndex * iconWidth}px -${2 * iconHeight}px`,
|
|
78
|
+
},
|
|
79
|
+
}),
|
|
80
|
+
}));
|
|
81
|
+
|
|
82
|
+
const RawPoint = (props) => {
|
|
83
|
+
const { iconKey, active, onClick } = props;
|
|
84
|
+
const iconIndex = iconIndexMap[iconKey.toLowerCase()] ?? 0;
|
|
85
|
+
return (
|
|
86
|
+
<span role="presentation" key={iconKey} onClick={onClick}>
|
|
87
|
+
<StyledPointLink $iconIndex={iconIndex} $active={active}> </StyledPointLink>
|
|
88
|
+
</span>
|
|
89
|
+
);
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
RawPoint.propTypes = {
|
|
93
|
+
iconKey: PropTypes.string.isRequired,
|
|
94
|
+
active: PropTypes.bool,
|
|
95
|
+
onClick: PropTypes.func,
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
export const Point = RawPoint;
|
|
99
|
+
|
|
100
|
+
const ElementSelector: any = styled('div')({
|
|
101
|
+
width: '55%',
|
|
102
|
+
padding: '1px',
|
|
103
|
+
'-webkit-touch-callout': 'none',
|
|
104
|
+
'-webkit-user-select': 'none',
|
|
105
|
+
'-khtml-user-select': 'none',
|
|
106
|
+
'-moz-user-select': 'none',
|
|
107
|
+
'-ms-user-select': 'none',
|
|
108
|
+
'user-select': 'none',
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
const Points = ({ selectPoint, selected, icons }) => {
|
|
112
|
+
const iconTags = icons.map((key) => {
|
|
113
|
+
let active = key === selected;
|
|
114
|
+
let onClick = active ? () => {} : selectPoint.bind(null, key);
|
|
115
|
+
return <Point key={key.toLowerCase()} iconKey={key.toLowerCase()} active={active} onClick={onClick} />;
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
return <ElementSelector>{iconTags}</ElementSelector>;
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
Points.propTypes = {
|
|
122
|
+
selectPoint: PropTypes.func.isRequired,
|
|
123
|
+
selected: PropTypes.string,
|
|
124
|
+
icons: PropTypes.array,
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
const PointChooserContainer: any = styled('div')({
|
|
128
|
+
display: 'flex',
|
|
129
|
+
justifyContent: 'space-between',
|
|
130
|
+
borderRadius: '4px',
|
|
131
|
+
padding: '1px',
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
const Controls: any = styled('div')({
|
|
135
|
+
display: 'flex',
|
|
136
|
+
paddingTop: '7px',
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
const DeleteIconHolder: any = styled('span')({
|
|
140
|
+
position: 'relative',
|
|
141
|
+
top: '3px',
|
|
142
|
+
width: '30px',
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
export class PointChooser extends React.Component {
|
|
146
|
+
static defaultProps = {
|
|
147
|
+
showDeleteButton: false,
|
|
148
|
+
elementType: PointChooser.DEFAULT_TYPE,
|
|
149
|
+
icons: ['pf', 'lff', 'lef', 'lfe', 'lee', 'rfn', 'rfp', 'ren', 'rep'],
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
static propTypes = {
|
|
153
|
+
elementType: PropTypes.string,
|
|
154
|
+
showDeleteButton: PropTypes.bool,
|
|
155
|
+
onDeleteClick: PropTypes.func.isRequired,
|
|
156
|
+
onElementType: PropTypes.func.isRequired,
|
|
157
|
+
onUndoElement: PropTypes.func.isRequired,
|
|
158
|
+
onClearElements: PropTypes.func.isRequired,
|
|
159
|
+
icons: PropTypes.array,
|
|
160
|
+
language: PropTypes.string,
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
render() {
|
|
164
|
+
const {
|
|
165
|
+
elementType,
|
|
166
|
+
showDeleteButton,
|
|
167
|
+
onDeleteClick,
|
|
168
|
+
onUndoElement,
|
|
169
|
+
onClearElements,
|
|
170
|
+
icons,
|
|
171
|
+
onElementType,
|
|
172
|
+
language,
|
|
173
|
+
} = this.props;
|
|
174
|
+
|
|
175
|
+
return (
|
|
176
|
+
<PointChooserContainer>
|
|
177
|
+
<Points selected={elementType} selectPoint={onElementType} icons={icons} />
|
|
178
|
+
<Controls>
|
|
179
|
+
{showDeleteButton && (
|
|
180
|
+
<DeleteIconHolder onClick={onDeleteClick}>
|
|
181
|
+
<DeleteIcon />
|
|
182
|
+
</DeleteIconHolder>
|
|
183
|
+
)}
|
|
184
|
+
<Button
|
|
185
|
+
onClick={onUndoElement}
|
|
186
|
+
label={translator.t('common:undo', { lng: language })}
|
|
187
|
+
/>
|
|
188
|
+
<Button
|
|
189
|
+
onClick={onClearElements}
|
|
190
|
+
label={translator.t('numberLine.clearAll', { lng: language })}
|
|
191
|
+
/>
|
|
192
|
+
</Controls>
|
|
193
|
+
</PointChooserContainer>
|
|
194
|
+
);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
export default PointChooser;
|
|
199
|
+
|
|
200
|
+
PointChooser.DEFAULT_TYPE = 'pf';
|