@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,225 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
/**
|
|
3
|
+
* @synced-from pie-elements/packages/number-line/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 * as dataConverter from './data-converter.js';
|
|
12
|
+
import * as pointChooser from './number-line/point-chooser/index.js';
|
|
13
|
+
import * as tickUtils from './number-line/graph/tick-utils.js';
|
|
14
|
+
|
|
15
|
+
import { lineIsSwitched, switchGraphLine, toGraphFormat, toSessionFormat } from './data-converter.js';
|
|
16
|
+
|
|
17
|
+
import Graph from './number-line/graph/index.js';
|
|
18
|
+
import NumberLineComponent from './number-line/index.js';
|
|
19
|
+
import React from 'react';
|
|
20
|
+
import { createRoot } from 'react-dom/client';
|
|
21
|
+
import RootComponent from './number-line/index.js';
|
|
22
|
+
import { cloneDeep } from 'lodash-es';
|
|
23
|
+
import { renderMath } from '@pie-element/shared-math-rendering-mathjax';
|
|
24
|
+
|
|
25
|
+
//Expose some additional modules for configuration
|
|
26
|
+
export { Graph, NumberLineComponent, tickUtils, dataConverter, pointChooser };
|
|
27
|
+
export default class NumberLine extends HTMLElement {
|
|
28
|
+
constructor() {
|
|
29
|
+
super();
|
|
30
|
+
this._root = null;
|
|
31
|
+
this._mathObserver = null;
|
|
32
|
+
this._mathRenderPending = false;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
_scheduleMathRender: any = () => {
|
|
36
|
+
if (this._mathRenderPending) return;
|
|
37
|
+
this._mathRenderPending = true;
|
|
38
|
+
|
|
39
|
+
requestAnimationFrame(() => {
|
|
40
|
+
if (this._mathObserver) {
|
|
41
|
+
this._mathObserver.disconnect();
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
renderMath(this);
|
|
45
|
+
this._mathRenderPending = false;
|
|
46
|
+
|
|
47
|
+
setTimeout(() => {
|
|
48
|
+
if (this._mathObserver) {
|
|
49
|
+
this._mathObserver.observe(this, {
|
|
50
|
+
childList: true,
|
|
51
|
+
subtree: true,
|
|
52
|
+
characterData: false,
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
}, 50);
|
|
56
|
+
});
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
_initMathObserver() {
|
|
60
|
+
if (this._mathObserver) return;
|
|
61
|
+
|
|
62
|
+
this._mathObserver = new MutationObserver(() => {
|
|
63
|
+
this._scheduleMathRender();
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
this._mathObserver.observe(this, {
|
|
67
|
+
childList: true,
|
|
68
|
+
subtree: true,
|
|
69
|
+
characterData: false,
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
_disconnectMathObserver() {
|
|
74
|
+
if (this._mathObserver) {
|
|
75
|
+
this._mathObserver.disconnect();
|
|
76
|
+
this._mathObserver = null;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
set model(m) {
|
|
81
|
+
this._model = m;
|
|
82
|
+
this._applyInitialElements();
|
|
83
|
+
this._render();
|
|
84
|
+
this.dispatch('model-set');
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
set session(s) {
|
|
88
|
+
this._session = s;
|
|
89
|
+
this._applyInitialElements();
|
|
90
|
+
this._render();
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
get session() {
|
|
94
|
+
return this._session;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
connectedCallback() {
|
|
98
|
+
this._initMathObserver();
|
|
99
|
+
this._render();
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
isComplete() {
|
|
103
|
+
return this._session ? (this._session.answer || []).length > 0 : false;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
dispatch(type) {
|
|
107
|
+
this.dispatchEvent(
|
|
108
|
+
new CustomEvent(type, {
|
|
109
|
+
bubbles: true,
|
|
110
|
+
detail: {
|
|
111
|
+
complete: this.isComplete(),
|
|
112
|
+
},
|
|
113
|
+
}),
|
|
114
|
+
);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
dispatchSessionChanged() {
|
|
118
|
+
this.dispatch('session-changed');
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
addElement(data) {
|
|
122
|
+
if (!this._session) {
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
this._session.answer = this._session.answer || [];
|
|
127
|
+
this._session.answer.push(toSessionFormat(data));
|
|
128
|
+
this.dispatchSessionChanged();
|
|
129
|
+
this._render();
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
moveElement(index, el, position) {
|
|
133
|
+
let answer = this._session.answer[index];
|
|
134
|
+
|
|
135
|
+
if (!answer) {
|
|
136
|
+
throw new Error('cant find element at index: ', index);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
if (el.type === 'line' && position.left === position.right) {
|
|
140
|
+
this._render();
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
//set the new position
|
|
145
|
+
el.position = position;
|
|
146
|
+
|
|
147
|
+
let update = el.type === 'line' && lineIsSwitched(el) ? switchGraphLine(el) : el;
|
|
148
|
+
|
|
149
|
+
this._session.answer.splice(index, 1, toSessionFormat(update));
|
|
150
|
+
|
|
151
|
+
this.dispatchSessionChanged();
|
|
152
|
+
this._render();
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
deleteElements(indices) {
|
|
156
|
+
this._session.answer = this._session.answer.filter((v, index) => {
|
|
157
|
+
return !indices.some((d) => d === index);
|
|
158
|
+
});
|
|
159
|
+
this.dispatchSessionChanged();
|
|
160
|
+
this._render();
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
undoElement() {
|
|
164
|
+
this._session.answer.pop();
|
|
165
|
+
this.dispatchSessionChanged();
|
|
166
|
+
this._render();
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
clearElements() {
|
|
170
|
+
this._session.answer = [];
|
|
171
|
+
this.dispatchSessionChanged();
|
|
172
|
+
this._render();
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
_applyInitialElements() {
|
|
176
|
+
if (
|
|
177
|
+
this._model &&
|
|
178
|
+
this._model.graph &&
|
|
179
|
+
this._model.graph.initialElements &&
|
|
180
|
+
this._session &&
|
|
181
|
+
(!this._session.answer || !this._session.answer.length)
|
|
182
|
+
) {
|
|
183
|
+
this._session.answer = cloneDeep(this._model.graph.initialElements);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
_render() {
|
|
188
|
+
if (this._model && this._session) {
|
|
189
|
+
if (!this._session.answer) {
|
|
190
|
+
this._applyInitialElements();
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
let answer = (this._session.answer || []).map(toGraphFormat);
|
|
194
|
+
let model = cloneDeep(this._model);
|
|
195
|
+
model.correctResponse = model.correctResponse && model.correctResponse.map(toGraphFormat);
|
|
196
|
+
|
|
197
|
+
let props = {
|
|
198
|
+
model,
|
|
199
|
+
answer,
|
|
200
|
+
onAddElement: this.addElement.bind(this),
|
|
201
|
+
onMoveElement: this.moveElement.bind(this),
|
|
202
|
+
onDeleteElements: this.deleteElements.bind(this),
|
|
203
|
+
onUndoElement: this.undoElement.bind(this),
|
|
204
|
+
onClearElements: this.clearElements.bind(this),
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
let el = React.createElement(RootComponent, props);
|
|
208
|
+
|
|
209
|
+
if (!this._root) {
|
|
210
|
+
this._root = createRoot(this);
|
|
211
|
+
}
|
|
212
|
+
this._root.render(el);
|
|
213
|
+
|
|
214
|
+
// schedule math rendering via observer pipeline (for initial render as well)
|
|
215
|
+
this._scheduleMathRender();
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
disconnectedCallback() {
|
|
220
|
+
this._disconnectMathObserver();
|
|
221
|
+
if (this._root) {
|
|
222
|
+
this._root.unmount();
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
/**
|
|
3
|
+
* @synced-from pie-elements/packages/number-line/src/number-line/colors.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 { color } from '@pie-lib/render-ui';
|
|
12
|
+
|
|
13
|
+
export const selected = color.primaryDark();
|
|
14
|
+
export const correct = color.correct();
|
|
15
|
+
export const incorrect = color.incorrect();
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
/**
|
|
3
|
+
* @synced-from pie-elements/packages/number-line/src/number-line/feedback.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 { Correct, Incorrect, NothingSubmitted, PartiallyCorrect, ShowRationale } from '@pie-lib/icons';
|
|
12
|
+
import PropTypes from 'prop-types';
|
|
13
|
+
import { color } from '@pie-lib/render-ui';
|
|
14
|
+
|
|
15
|
+
import React, { useRef } from 'react';
|
|
16
|
+
import { TransitionGroup, CSSTransition } from 'react-transition-group';
|
|
17
|
+
import { styled } from '@mui/material/styles';
|
|
18
|
+
|
|
19
|
+
let getIcon = (t) => {
|
|
20
|
+
switch (t) {
|
|
21
|
+
case 'unanswered':
|
|
22
|
+
return NothingSubmitted;
|
|
23
|
+
case 'correct':
|
|
24
|
+
return Correct;
|
|
25
|
+
case 'incorrect':
|
|
26
|
+
return Incorrect;
|
|
27
|
+
case 'partial':
|
|
28
|
+
return PartiallyCorrect;
|
|
29
|
+
case 'info':
|
|
30
|
+
return ShowRationale;
|
|
31
|
+
default:
|
|
32
|
+
return undefined;
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const FeedbackContainer: any = styled('div')(({ $type }) => ({
|
|
37
|
+
marginTop: '10px',
|
|
38
|
+
backgroundColor: '#dddddd',
|
|
39
|
+
padding: '10px',
|
|
40
|
+
display: 'flex',
|
|
41
|
+
alignItems: 'center',
|
|
42
|
+
...($type === 'correct' && {
|
|
43
|
+
backgroundColor: color.correct(),
|
|
44
|
+
}),
|
|
45
|
+
...($type === 'incorrect' && {
|
|
46
|
+
backgroundColor: color.incorrect(),
|
|
47
|
+
}),
|
|
48
|
+
'& svg': {
|
|
49
|
+
height: '30px',
|
|
50
|
+
},
|
|
51
|
+
'& h1': {
|
|
52
|
+
padding: '0px',
|
|
53
|
+
margin: '0px',
|
|
54
|
+
},
|
|
55
|
+
}));
|
|
56
|
+
|
|
57
|
+
const Message: any = styled('span')({
|
|
58
|
+
paddingLeft: '5px',
|
|
59
|
+
userSelect: 'none',
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
const Feedback = (props) => {
|
|
63
|
+
const { type, width, message } = props;
|
|
64
|
+
let Icon = getIcon(type);
|
|
65
|
+
const nodeRef = useRef(null);
|
|
66
|
+
|
|
67
|
+
return (
|
|
68
|
+
<TransitionGroup>
|
|
69
|
+
<CSSTransition classNames={'fb'} key="fb" timeout={300} nodeRef={nodeRef}>
|
|
70
|
+
<FeedbackContainer ref={nodeRef} key="panel" $type={type} style={{ width }}>
|
|
71
|
+
<Icon iconSet="emoji" shape="square" />
|
|
72
|
+
<Message dangerouslySetInnerHTML={{ __html: message }} />
|
|
73
|
+
</FeedbackContainer>
|
|
74
|
+
</CSSTransition>
|
|
75
|
+
</TransitionGroup>
|
|
76
|
+
);
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
Feedback.propTypes = {
|
|
80
|
+
width: PropTypes.number,
|
|
81
|
+
message: PropTypes.string,
|
|
82
|
+
type: PropTypes.string,
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
export default Feedback;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
/**
|
|
3
|
+
* @synced-from pie-elements/packages/number-line/src/number-line/graph/arrow.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 { color } from '@pie-lib/render-ui';
|
|
15
|
+
|
|
16
|
+
const StyledPath: any = styled('path')({
|
|
17
|
+
fill: color.primary(),
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
export function Arrow({ x, y, direction, className }) {
|
|
21
|
+
let transform = `translate(${x || 0},${y})`;
|
|
22
|
+
|
|
23
|
+
if (direction && direction === 'right') {
|
|
24
|
+
transform += ' rotate(180)';
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return <StyledPath d="m 0,0 8,-5 0,10 -8,-5" transform={transform} className={className} />;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
Arrow.propTypes = {
|
|
31
|
+
y: PropTypes.number,
|
|
32
|
+
x: PropTypes.number,
|
|
33
|
+
direction: PropTypes.oneOf(['left', 'right']),
|
|
34
|
+
className: PropTypes.string,
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
Arrow.defaultProps = {
|
|
38
|
+
y: 0,
|
|
39
|
+
x: 0,
|
|
40
|
+
direction: 'left',
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export default Arrow;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
/**
|
|
3
|
+
* @synced-from pie-elements/packages/number-line/src/number-line/graph/elements/base.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'; //eslint-disable-line
|
|
12
|
+
import PropTypes from 'prop-types';
|
|
13
|
+
|
|
14
|
+
export const basePropTypes = () => ({
|
|
15
|
+
interval: PropTypes.number.isRequired,
|
|
16
|
+
domain: PropTypes.shape({
|
|
17
|
+
min: PropTypes.number.isRequired,
|
|
18
|
+
max: PropTypes.number.isRequired,
|
|
19
|
+
}),
|
|
20
|
+
});
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
/**
|
|
3
|
+
* @synced-from pie-elements/packages/number-line/src/number-line/graph/elements/builder.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 function buildElementModel(position, elementType, domain, interval) {
|
|
12
|
+
if (elementType.startsWith('p')) {
|
|
13
|
+
return {
|
|
14
|
+
position: position,
|
|
15
|
+
type: 'point',
|
|
16
|
+
pointType: elementType.endsWith('e') ? 'empty' : 'full',
|
|
17
|
+
};
|
|
18
|
+
} else if (elementType.startsWith('l')) {
|
|
19
|
+
let left = position + interval <= domain.max ? position : position - interval;
|
|
20
|
+
let right = left + interval;
|
|
21
|
+
return {
|
|
22
|
+
type: 'line',
|
|
23
|
+
leftPoint: elementType.charAt(1) === 'e' ? 'empty' : 'full',
|
|
24
|
+
rightPoint: elementType.charAt(2) === 'e' ? 'empty' : 'full',
|
|
25
|
+
position: { left, right },
|
|
26
|
+
};
|
|
27
|
+
} else if (elementType.startsWith('r')) {
|
|
28
|
+
let full = elementType.charAt(1) === 'f';
|
|
29
|
+
let positive = elementType.charAt(2) === 'p';
|
|
30
|
+
return {
|
|
31
|
+
type: 'ray',
|
|
32
|
+
direction: positive ? 'positive' : 'negative',
|
|
33
|
+
pointType: full ? 'full' : 'empty',
|
|
34
|
+
position: position,
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
/**
|
|
3
|
+
* @synced-from pie-elements/packages/number-line/src/number-line/graph/elements/line.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 { isEqual, isNumber } from 'lodash-es';
|
|
15
|
+
import { color } from '@pie-lib/render-ui';
|
|
16
|
+
import { Draggable } from '../../../draggable/index.js';
|
|
17
|
+
|
|
18
|
+
import Point from './point.js';
|
|
19
|
+
import { basePropTypes } from './base.js';
|
|
20
|
+
|
|
21
|
+
const duration = '150ms';
|
|
22
|
+
|
|
23
|
+
const StyledLineGroup: any = styled('g')(({ $disabled, $selected, $correct }) => ({
|
|
24
|
+
'& .line-handle': {
|
|
25
|
+
stroke: color.primary(),
|
|
26
|
+
cursor: 'pointer',
|
|
27
|
+
strokeWidth: '5px',
|
|
28
|
+
transition: `opacity ${duration} linear,
|
|
29
|
+
stroke-width ${duration} linear,
|
|
30
|
+
stroke ${duration} linear`,
|
|
31
|
+
},
|
|
32
|
+
// was ".react-draggable-dragging" in the old version
|
|
33
|
+
'&.dnd-kit-dragging': {
|
|
34
|
+
opacity: 0.6,
|
|
35
|
+
'& .line-handle': {
|
|
36
|
+
opacity: 1.0,
|
|
37
|
+
strokeWidth: '12px',
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
...($disabled && {
|
|
41
|
+
cursor: 'not-allowed',
|
|
42
|
+
opacity: 0.8,
|
|
43
|
+
}),
|
|
44
|
+
...($selected && {
|
|
45
|
+
'& .line-handle': {
|
|
46
|
+
stroke: color.primaryDark(),
|
|
47
|
+
},
|
|
48
|
+
}),
|
|
49
|
+
...($correct === true && {
|
|
50
|
+
'& .line-handle': {
|
|
51
|
+
cursor: 'inherit',
|
|
52
|
+
stroke: color.correct(),
|
|
53
|
+
},
|
|
54
|
+
}),
|
|
55
|
+
...($correct === false && {
|
|
56
|
+
'& .line-handle': {
|
|
57
|
+
cursor: 'inherit',
|
|
58
|
+
stroke: color.incorrect(),
|
|
59
|
+
},
|
|
60
|
+
}),
|
|
61
|
+
}));
|
|
62
|
+
|
|
63
|
+
export class Line extends React.Component {
|
|
64
|
+
static propTypes = {
|
|
65
|
+
...basePropTypes(),
|
|
66
|
+
empty: PropTypes.shape({
|
|
67
|
+
left: PropTypes.bool.isRequired,
|
|
68
|
+
right: PropTypes.bool.isRequired,
|
|
69
|
+
}).isRequired,
|
|
70
|
+
position: PropTypes.shape({
|
|
71
|
+
left: PropTypes.number.isRequired,
|
|
72
|
+
right: PropTypes.number.isRequired,
|
|
73
|
+
}).isRequired,
|
|
74
|
+
y: PropTypes.number,
|
|
75
|
+
selected: PropTypes.bool,
|
|
76
|
+
disabled: PropTypes.bool,
|
|
77
|
+
correct: PropTypes.bool,
|
|
78
|
+
onMoveLine: PropTypes.func.isRequired,
|
|
79
|
+
onToggleSelect: PropTypes.func.isRequired,
|
|
80
|
+
onDragStart: PropTypes.func,
|
|
81
|
+
onDragStop: PropTypes.func,
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
static defaultProps = {
|
|
85
|
+
selected: false,
|
|
86
|
+
y: 0,
|
|
87
|
+
disabled: false,
|
|
88
|
+
correct: undefined,
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
static contextTypes = {
|
|
92
|
+
xScale: PropTypes.func.isRequired,
|
|
93
|
+
snapValue: PropTypes.func.isRequired,
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
constructor(props) {
|
|
97
|
+
super(props);
|
|
98
|
+
this.state = {
|
|
99
|
+
left: null,
|
|
100
|
+
right: null,
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
UNSAFE_componentWillReceiveProps(nextProps) {
|
|
105
|
+
if (nextProps) {
|
|
106
|
+
const { position } = nextProps;
|
|
107
|
+
this.setState({ left: position.left, right: position.right });
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
onDrag(side, p) {
|
|
112
|
+
const { domain } = this.props;
|
|
113
|
+
if (p >= domain.min && p <= domain.max) {
|
|
114
|
+
const newState = {};
|
|
115
|
+
newState[side] = p;
|
|
116
|
+
this.setState(newState);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
onMove(side, d) {
|
|
121
|
+
const { position: p } = this.props;
|
|
122
|
+
const newPosition = { left: p.left, right: p.right };
|
|
123
|
+
newPosition[side] = d;
|
|
124
|
+
this.props.onMoveLine(newPosition);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
render() {
|
|
128
|
+
const { interval, empty, position, domain, y, selected, disabled, correct } = this.props;
|
|
129
|
+
|
|
130
|
+
const { xScale } = this.context;
|
|
131
|
+
|
|
132
|
+
const { onDrag, onMove } = this;
|
|
133
|
+
const onMoveLeft = onMove.bind(this, 'left');
|
|
134
|
+
const onMoveRight = onMove.bind(this, 'right');
|
|
135
|
+
const onDragLeft = onDrag.bind(this, 'left');
|
|
136
|
+
const onDragRight = onDrag.bind(this, 'right');
|
|
137
|
+
|
|
138
|
+
const left = isNumber(this.state.left) ? this.state.left : position.left;
|
|
139
|
+
const right = isNumber(this.state.right) ? this.state.right : position.right;
|
|
140
|
+
|
|
141
|
+
const is = xScale(interval) - xScale(0);
|
|
142
|
+
|
|
143
|
+
const onMouseDown = (e) => e.nativeEvent.preventDefault();
|
|
144
|
+
|
|
145
|
+
const onLineClick = () => {
|
|
146
|
+
// click on the line toggles selection
|
|
147
|
+
this.props.onToggleSelect();
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
const onRectClick = () => {
|
|
151
|
+
this.props.onToggleSelect();
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
// dnd-kit drag stop handler (receives pixel deltaX from LocalDraggableDndKit)
|
|
155
|
+
const onLineDragStop = (deltaX) => {
|
|
156
|
+
// small movement -> treat as click (same threshold as before: is / 10)
|
|
157
|
+
const deltaAbs = Math.abs(deltaX);
|
|
158
|
+
if (deltaAbs < is / 10) {
|
|
159
|
+
this.props.onToggleSelect();
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
// convert pixel delta to domain delta (same math as before)
|
|
164
|
+
const invertedX = xScale.invert(deltaX + xScale(0));
|
|
165
|
+
const newPosition = {
|
|
166
|
+
left: position.left + invertedX,
|
|
167
|
+
right: position.right + invertedX,
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
if (!isEqual(newPosition, this.props.position)) {
|
|
171
|
+
this.props.onMoveLine(newPosition);
|
|
172
|
+
}
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
const scaledLineBounds = {
|
|
176
|
+
left: ((domain.min - position.left) / interval) * is,
|
|
177
|
+
right: ((domain.max - position.right) / interval) * is,
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
const common = {
|
|
181
|
+
interval,
|
|
182
|
+
selected,
|
|
183
|
+
disabled,
|
|
184
|
+
correct,
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
// unique-ish id for this line; if you already have an id prop, use that instead
|
|
188
|
+
const draggableId = `line-${position.left}-${position.right}-${y}`;
|
|
189
|
+
|
|
190
|
+
return (
|
|
191
|
+
<Draggable
|
|
192
|
+
id={draggableId}
|
|
193
|
+
disabled={disabled}
|
|
194
|
+
grid={[is]}
|
|
195
|
+
bounds={scaledLineBounds}
|
|
196
|
+
onMouseDown={onMouseDown}
|
|
197
|
+
onDragEnd={onLineDragStop}
|
|
198
|
+
>
|
|
199
|
+
{({ setNodeRef, attributes, listeners, translateX, isDragging, onMouseDown: handleMouseDown }) => (
|
|
200
|
+
<StyledLineGroup
|
|
201
|
+
ref={setNodeRef}
|
|
202
|
+
$disabled={disabled}
|
|
203
|
+
$selected={selected}
|
|
204
|
+
$correct={correct}
|
|
205
|
+
className={isDragging ? 'dnd-kit-dragging' : undefined}
|
|
206
|
+
onMouseDown={handleMouseDown}
|
|
207
|
+
{...attributes}
|
|
208
|
+
>
|
|
209
|
+
<g transform={`translate(${translateX}, ${y})`}>
|
|
210
|
+
<rect
|
|
211
|
+
x={xScale(left)}
|
|
212
|
+
width={Math.abs(xScale(right) - xScale(left))}
|
|
213
|
+
fill="red"
|
|
214
|
+
fillOpacity="0.0"
|
|
215
|
+
y="-8"
|
|
216
|
+
height={16}
|
|
217
|
+
onClick={onRectClick}
|
|
218
|
+
/>
|
|
219
|
+
<line
|
|
220
|
+
className="line-handle"
|
|
221
|
+
x1={xScale(left)}
|
|
222
|
+
x2={xScale(right)}
|
|
223
|
+
onClick={onLineClick}
|
|
224
|
+
// this is your "handle": only dragging when grabbing this line
|
|
225
|
+
{...listeners}
|
|
226
|
+
/>
|
|
227
|
+
<Point
|
|
228
|
+
{...common}
|
|
229
|
+
empty={empty.left}
|
|
230
|
+
bounds={{
|
|
231
|
+
left: domain.min - position.left,
|
|
232
|
+
right: domain.max - position.left,
|
|
233
|
+
}}
|
|
234
|
+
position={position.left}
|
|
235
|
+
onDrag={onDragLeft}
|
|
236
|
+
onMove={onMoveLeft}
|
|
237
|
+
onClick={onRectClick}
|
|
238
|
+
/>
|
|
239
|
+
<Point
|
|
240
|
+
{...common}
|
|
241
|
+
empty={empty.right}
|
|
242
|
+
bounds={{
|
|
243
|
+
left: domain.min - position.right,
|
|
244
|
+
right: domain.max - position.right,
|
|
245
|
+
}}
|
|
246
|
+
position={position.right}
|
|
247
|
+
onDrag={onDragRight}
|
|
248
|
+
onMove={onMoveRight}
|
|
249
|
+
onClick={onRectClick}
|
|
250
|
+
/>
|
|
251
|
+
</g>
|
|
252
|
+
</StyledLineGroup>
|
|
253
|
+
)}
|
|
254
|
+
</Draggable>
|
|
255
|
+
);
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
export default Line;
|