@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,219 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
/**
|
|
3
|
+
* @synced-from pie-elements/packages/number-line/src/number-line/graph/elements/point.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
|
+
import { Draggable } from '../../../draggable/index.js';
|
|
17
|
+
|
|
18
|
+
const duration = '150ms';
|
|
19
|
+
|
|
20
|
+
const StyledCircle: any = styled('circle')(({ $selected, $disabled, $correct, $empty }) => ({
|
|
21
|
+
cursor: 'pointer',
|
|
22
|
+
transition: `r ${duration} linear,
|
|
23
|
+
opacity ${duration} linear,
|
|
24
|
+
fill ${duration} linear,
|
|
25
|
+
stroke ${duration} linear`,
|
|
26
|
+
stroke: color.primary(),
|
|
27
|
+
fill: color.primary(),
|
|
28
|
+
// was ".react-draggable-dragging"
|
|
29
|
+
'&.dnd-kit-dragging': {
|
|
30
|
+
opacity: 0.25,
|
|
31
|
+
r: '10px',
|
|
32
|
+
},
|
|
33
|
+
'&:hover': {
|
|
34
|
+
stroke: color.primaryDark(),
|
|
35
|
+
},
|
|
36
|
+
...($selected && {
|
|
37
|
+
stroke: color.primaryDark(),
|
|
38
|
+
}),
|
|
39
|
+
...($disabled && {
|
|
40
|
+
cursor: 'not-allowed',
|
|
41
|
+
opacity: 0.8,
|
|
42
|
+
}),
|
|
43
|
+
...($correct === true && {
|
|
44
|
+
cursor: 'inherit',
|
|
45
|
+
stroke: color.correct(),
|
|
46
|
+
fill: color.correct(),
|
|
47
|
+
}),
|
|
48
|
+
...($correct === false && {
|
|
49
|
+
cursor: 'inherit',
|
|
50
|
+
stroke: color.incorrect(),
|
|
51
|
+
fill: color.incorrect(),
|
|
52
|
+
}),
|
|
53
|
+
...($empty && {
|
|
54
|
+
fill: 'white',
|
|
55
|
+
}),
|
|
56
|
+
}));
|
|
57
|
+
|
|
58
|
+
export class Point extends React.Component {
|
|
59
|
+
static defaultProps = {
|
|
60
|
+
y: 0,
|
|
61
|
+
selected: false,
|
|
62
|
+
empty: false,
|
|
63
|
+
disabled: false,
|
|
64
|
+
correct: undefined,
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
static propTypes = {
|
|
68
|
+
interval: PropTypes.number.isRequired,
|
|
69
|
+
position: PropTypes.number.isRequired,
|
|
70
|
+
bounds: PropTypes.shape({
|
|
71
|
+
left: PropTypes.number.isRequired,
|
|
72
|
+
right: PropTypes.number.isRequired,
|
|
73
|
+
}),
|
|
74
|
+
selected: PropTypes.bool,
|
|
75
|
+
disabled: PropTypes.bool,
|
|
76
|
+
correct: PropTypes.bool,
|
|
77
|
+
empty: PropTypes.bool,
|
|
78
|
+
y: PropTypes.number,
|
|
79
|
+
onMove: PropTypes.func.isRequired,
|
|
80
|
+
onClick: PropTypes.func,
|
|
81
|
+
onDrag: PropTypes.func,
|
|
82
|
+
onDragStop: PropTypes.func,
|
|
83
|
+
onDragStart: PropTypes.func,
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
static contextTypes = {
|
|
87
|
+
xScale: PropTypes.func.isRequired,
|
|
88
|
+
snapValue: PropTypes.func.isRequired,
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
render() {
|
|
92
|
+
const {
|
|
93
|
+
onDragStop,
|
|
94
|
+
onDragStart,
|
|
95
|
+
onDrag: onDragCallback,
|
|
96
|
+
onClick,
|
|
97
|
+
onMove,
|
|
98
|
+
interval,
|
|
99
|
+
y,
|
|
100
|
+
bounds,
|
|
101
|
+
selected,
|
|
102
|
+
position,
|
|
103
|
+
disabled,
|
|
104
|
+
correct,
|
|
105
|
+
empty,
|
|
106
|
+
} = this.props;
|
|
107
|
+
|
|
108
|
+
const { snapValue, xScale } = this.context;
|
|
109
|
+
|
|
110
|
+
// same as old `is`
|
|
111
|
+
const step = xScale(interval) - xScale(0);
|
|
112
|
+
|
|
113
|
+
const dragPosition = (deltaX) => {
|
|
114
|
+
const normalized = deltaX + xScale(0);
|
|
115
|
+
const inverted = xScale.invert(normalized);
|
|
116
|
+
return snapValue(position + inverted);
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
// bounds in px (same as old scaledBounds)
|
|
120
|
+
const scaledBounds = bounds
|
|
121
|
+
? {
|
|
122
|
+
left: (bounds.left / interval) * step,
|
|
123
|
+
right: (bounds.right / interval) * step,
|
|
124
|
+
}
|
|
125
|
+
: null;
|
|
126
|
+
|
|
127
|
+
const handleMouseDown = (e) => e.nativeEvent.preventDefault();
|
|
128
|
+
|
|
129
|
+
// called when drag starts (via LocalDraggableDndKit)
|
|
130
|
+
const handleDragStart = () => {
|
|
131
|
+
if (onDragStart) {
|
|
132
|
+
onDragStart();
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
// called continuously while dragging (snapped+clamped deltaX in px)
|
|
137
|
+
const handleDragMove = (deltaX) => {
|
|
138
|
+
const p = dragPosition(deltaX);
|
|
139
|
+
if (onDragCallback) {
|
|
140
|
+
onDragCallback(p);
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
// called when drag ends (snapped+clamped deltaX in px)
|
|
145
|
+
const handleDragEnd = (deltaX) => {
|
|
146
|
+
if (onDragStop) {
|
|
147
|
+
onDragStop();
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
const deltaAbs = Math.abs(deltaX);
|
|
151
|
+
|
|
152
|
+
// click vs drag, same threshold as before: is / 10
|
|
153
|
+
if (deltaAbs < step / 10) {
|
|
154
|
+
if (onClick) {
|
|
155
|
+
onClick();
|
|
156
|
+
}
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
const newPosition = dragPosition(deltaX);
|
|
161
|
+
onMove(newPosition);
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
const id = `point-${position}-${y}`;
|
|
165
|
+
|
|
166
|
+
return (
|
|
167
|
+
<Draggable
|
|
168
|
+
id={id}
|
|
169
|
+
disabled={disabled}
|
|
170
|
+
grid={[step]}
|
|
171
|
+
bounds={scaledBounds}
|
|
172
|
+
onMouseDown={handleMouseDown}
|
|
173
|
+
onDragStart={handleDragStart}
|
|
174
|
+
onDragMove={handleDragMove}
|
|
175
|
+
onDragEnd={handleDragEnd}
|
|
176
|
+
>
|
|
177
|
+
{({
|
|
178
|
+
setNodeRef,
|
|
179
|
+
attributes,
|
|
180
|
+
listeners,
|
|
181
|
+
translateX,
|
|
182
|
+
isDragging,
|
|
183
|
+
onMouseDown,
|
|
184
|
+
}) => (
|
|
185
|
+
<g
|
|
186
|
+
ref={setNodeRef}
|
|
187
|
+
onMouseDown={onMouseDown}
|
|
188
|
+
// axis="x": only horizontal translate
|
|
189
|
+
transform={`translate(${translateX}, 0)`}
|
|
190
|
+
{...attributes}
|
|
191
|
+
{...listeners}
|
|
192
|
+
>
|
|
193
|
+
<circle
|
|
194
|
+
r="20"
|
|
195
|
+
strokeWidth="3"
|
|
196
|
+
style={{ fill: 'transparent', pointerEvents: 'visibleStroke' }}
|
|
197
|
+
cx={xScale(position)}
|
|
198
|
+
cy={y}
|
|
199
|
+
stroke={selected ? color.primaryDark() : 'none'}
|
|
200
|
+
/>
|
|
201
|
+
<StyledCircle
|
|
202
|
+
r="5"
|
|
203
|
+
strokeWidth="3"
|
|
204
|
+
cx={xScale(position)}
|
|
205
|
+
cy={y}
|
|
206
|
+
$selected={selected}
|
|
207
|
+
$disabled={disabled}
|
|
208
|
+
$correct={correct}
|
|
209
|
+
$empty={empty}
|
|
210
|
+
className={isDragging ? 'dnd-kit-dragging' : undefined}
|
|
211
|
+
/>
|
|
212
|
+
</g>
|
|
213
|
+
)}
|
|
214
|
+
</ Draggable>
|
|
215
|
+
);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
export default Point;
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
/**
|
|
3
|
+
* @synced-from pie-elements/packages/number-line/src/number-line/graph/elements/ray.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 * as colors from '../../colors.js';
|
|
12
|
+
import { color } from '@pie-lib/render-ui';
|
|
13
|
+
import React from 'react';
|
|
14
|
+
import PropTypes from 'prop-types';
|
|
15
|
+
import { styled } from '@mui/material/styles';
|
|
16
|
+
import Arrow from '../arrow.js';
|
|
17
|
+
import Point from './point.js';
|
|
18
|
+
import { basePropTypes } from './base.js';
|
|
19
|
+
import { isNumber } from 'lodash-es';
|
|
20
|
+
|
|
21
|
+
const StyledRayGroup: any = styled('g')(({ $selected, $correct }) => ({
|
|
22
|
+
'& line': {
|
|
23
|
+
cursor: 'pointer',
|
|
24
|
+
strokeWidth: '5px',
|
|
25
|
+
stroke: color.primary(),
|
|
26
|
+
},
|
|
27
|
+
'& line, & .arrow': {
|
|
28
|
+
transition: 'stroke 150ms linear, fill 150ms linear',
|
|
29
|
+
},
|
|
30
|
+
...($selected && {
|
|
31
|
+
'& line': {
|
|
32
|
+
stroke: colors.selected,
|
|
33
|
+
},
|
|
34
|
+
'& .arrow': {
|
|
35
|
+
fill: colors.selected,
|
|
36
|
+
strokeWidth: '1px',
|
|
37
|
+
stroke: colors.selected,
|
|
38
|
+
},
|
|
39
|
+
}),
|
|
40
|
+
...($correct === true && {
|
|
41
|
+
'& line': {
|
|
42
|
+
stroke: colors.correct,
|
|
43
|
+
},
|
|
44
|
+
'& .arrow': {
|
|
45
|
+
fill: colors.correct,
|
|
46
|
+
strokeWidth: '1px',
|
|
47
|
+
stroke: colors.correct,
|
|
48
|
+
},
|
|
49
|
+
}),
|
|
50
|
+
...($correct === false && {
|
|
51
|
+
'& line': {
|
|
52
|
+
stroke: colors.incorrect,
|
|
53
|
+
},
|
|
54
|
+
'& .arrow': {
|
|
55
|
+
fill: colors.incorrect,
|
|
56
|
+
strokeWidth: '1px',
|
|
57
|
+
stroke: colors.incorrect,
|
|
58
|
+
},
|
|
59
|
+
}),
|
|
60
|
+
}));
|
|
61
|
+
|
|
62
|
+
const StyledArrow: any = styled(Arrow)(({ $correct, $selected }) => ({
|
|
63
|
+
fill: color.primary(),
|
|
64
|
+
...($correct === true && {
|
|
65
|
+
fill: colors.correct,
|
|
66
|
+
'--arrow-color': colors.correct,
|
|
67
|
+
}),
|
|
68
|
+
...($correct === false && {
|
|
69
|
+
fill: colors.incorrect,
|
|
70
|
+
'--arrow-color': colors.incorrect,
|
|
71
|
+
}),
|
|
72
|
+
...($selected && {
|
|
73
|
+
fill: colors.selected,
|
|
74
|
+
'--arrow-color': colors.selected,
|
|
75
|
+
}),
|
|
76
|
+
}));
|
|
77
|
+
|
|
78
|
+
export class Ray extends React.Component {
|
|
79
|
+
static propTypes = {
|
|
80
|
+
...basePropTypes(),
|
|
81
|
+
width: PropTypes.number.isRequired,
|
|
82
|
+
selected: PropTypes.bool,
|
|
83
|
+
disabled: PropTypes.bool,
|
|
84
|
+
empty: PropTypes.bool,
|
|
85
|
+
direction: PropTypes.oneOf(['positive', 'negative']),
|
|
86
|
+
y: PropTypes.number,
|
|
87
|
+
position: PropTypes.number.isRequired,
|
|
88
|
+
onMove: PropTypes.func.isRequired,
|
|
89
|
+
onToggleSelect: PropTypes.func.isRequired,
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
static defaultProps = {
|
|
93
|
+
selected: false,
|
|
94
|
+
direction: 'positive',
|
|
95
|
+
y: 0,
|
|
96
|
+
disabled: false,
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
static contextTypes = {
|
|
100
|
+
xScale: PropTypes.func.isRequired,
|
|
101
|
+
snapValue: PropTypes.func.isRequired,
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
constructor(props) {
|
|
105
|
+
super(props);
|
|
106
|
+
this.state = {
|
|
107
|
+
dragPosition: null,
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
drag(p) {
|
|
112
|
+
const { domain } = this.props;
|
|
113
|
+
if (p >= domain.min && p <= domain.max) {
|
|
114
|
+
this.setState({ dragPosition: p });
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
stopDrag() {
|
|
119
|
+
this.setState({ dragPosition: null });
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
render() {
|
|
123
|
+
/* eslint-disable */
|
|
124
|
+
const { interval, empty, position, direction, domain, y, selected, disabled, width, correct } = this.props;
|
|
125
|
+
/* eslint-enable */
|
|
126
|
+
const { xScale } = this.context;
|
|
127
|
+
|
|
128
|
+
const drag = this.drag.bind(this);
|
|
129
|
+
const stopDrag = this.stopDrag.bind(this);
|
|
130
|
+
|
|
131
|
+
const finalPosition = isNumber(this.state.dragPosition) ? this.state.dragPosition : position;
|
|
132
|
+
|
|
133
|
+
const positive = direction === 'positive';
|
|
134
|
+
const left = positive ? finalPosition : domain.min;
|
|
135
|
+
const right = positive ? domain.max : finalPosition;
|
|
136
|
+
// const triangleX = positive ? xScale(right) : xScale(left);
|
|
137
|
+
|
|
138
|
+
//const et the line run all the way to 0 or width.
|
|
139
|
+
const x1 = positive ? xScale(left) : 8;
|
|
140
|
+
const x2 = positive ? width - 8 : xScale(right);
|
|
141
|
+
const arrowX = positive ? width : 0;
|
|
142
|
+
const arrowDirection = positive ? 'right' : 'left';
|
|
143
|
+
|
|
144
|
+
const noop = () => {};
|
|
145
|
+
|
|
146
|
+
return (
|
|
147
|
+
<StyledRayGroup $selected={selected} $correct={correct} transform={`translate(0, ${y})`}>
|
|
148
|
+
<line onClick={disabled ? noop : this.props.onToggleSelect} className="line-handle" x1={x1} x2={x2} />
|
|
149
|
+
<Point
|
|
150
|
+
disabled={disabled}
|
|
151
|
+
correct={correct}
|
|
152
|
+
selected={selected}
|
|
153
|
+
empty={empty}
|
|
154
|
+
interval={interval}
|
|
155
|
+
bounds={{ left: domain.min - position, right: domain.max - position }}
|
|
156
|
+
position={position}
|
|
157
|
+
onDrag={drag}
|
|
158
|
+
onDragStop={stopDrag}
|
|
159
|
+
onMove={this.props.onMove}
|
|
160
|
+
onClick={this.props.onToggleSelect}
|
|
161
|
+
/>
|
|
162
|
+
<StyledArrow x={arrowX} $correct={correct} $selected={selected} direction={arrowDirection} />
|
|
163
|
+
</StyledRayGroup>
|
|
164
|
+
);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
export default Ray;
|
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
/**
|
|
3
|
+
* @synced-from pie-elements/packages/number-line/src/number-line/graph/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 { scaleLinear } from 'd3-scale';
|
|
13
|
+
import { select, pointer } from 'd3-selection';
|
|
14
|
+
import { color } from '@pie-lib/render-ui';
|
|
15
|
+
import { DndContext } from '@dnd-kit/core';
|
|
16
|
+
import Point from './elements/point.js';
|
|
17
|
+
import Line from './elements/line.js';
|
|
18
|
+
import Ray from './elements/ray.js';
|
|
19
|
+
import BaseLine from './line.js';
|
|
20
|
+
import Arrow from './arrow.js';
|
|
21
|
+
import Ticks from './ticks.js';
|
|
22
|
+
import { snapTo } from './tick-utils.js';
|
|
23
|
+
import Stacks from './stacks.js';
|
|
24
|
+
import { TransitionGroup } from 'react-transition-group';
|
|
25
|
+
import PropTypes from 'prop-types';
|
|
26
|
+
import { Fade } from '../transitions/index.js';
|
|
27
|
+
|
|
28
|
+
const getXScale = (min, max, width, padding) => {
|
|
29
|
+
if (min === undefined || max === undefined || width === undefined) {
|
|
30
|
+
throw new Error('missing min/max/width');
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return scaleLinear()
|
|
34
|
+
.domain([min, max])
|
|
35
|
+
.range([padding, width - padding]);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
const Debug = (props) => (
|
|
39
|
+
<g>
|
|
40
|
+
<text x="00" y="20">
|
|
41
|
+
{JSON.stringify(props)}
|
|
42
|
+
</text>
|
|
43
|
+
</g>
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
export class NumberLineGraph extends React.Component {
|
|
47
|
+
static childContextTypes = {
|
|
48
|
+
xScale: PropTypes.func.isRequired,
|
|
49
|
+
snapValue: PropTypes.func.isRequired,
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
static propTypes = {
|
|
53
|
+
domain: PropTypes.shape({
|
|
54
|
+
min: PropTypes.number.isRequired,
|
|
55
|
+
max: PropTypes.number.isRequired,
|
|
56
|
+
}).isRequired,
|
|
57
|
+
ticks: PropTypes.shape({ minor: PropTypes.number, major: PropTypes.number }).isRequired,
|
|
58
|
+
fraction: PropTypes.bool,
|
|
59
|
+
width: PropTypes.number.isRequired,
|
|
60
|
+
height: PropTypes.number.isRequired,
|
|
61
|
+
onToggleElement: PropTypes.func.isRequired,
|
|
62
|
+
onMoveElement: PropTypes.func.isRequired,
|
|
63
|
+
onAddElement: PropTypes.func.isRequired,
|
|
64
|
+
debug: PropTypes.bool,
|
|
65
|
+
elements: PropTypes.array,
|
|
66
|
+
disabled: PropTypes.bool,
|
|
67
|
+
onDeselectElements: PropTypes.func,
|
|
68
|
+
arrows: PropTypes.shape({ left: PropTypes.bool, right: PropTypes.bool }),
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
static defaultProps = {
|
|
72
|
+
debug: false,
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
constructor(props) {
|
|
76
|
+
super(props);
|
|
77
|
+
this.state = {};
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
xScaleFn() {
|
|
81
|
+
const { domain, width } = this.props;
|
|
82
|
+
const { max, min } = domain || {};
|
|
83
|
+
|
|
84
|
+
let padding = 20;
|
|
85
|
+
|
|
86
|
+
if (max) {
|
|
87
|
+
padding = max.toString().length * 4 + 15;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
return getXScale(min, max, width, padding);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
snapValueFn() {
|
|
94
|
+
const { domain, ticks } = this.props;
|
|
95
|
+
return snapTo.bind(null, domain.min, domain.max, ticks.minor);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
getChildContext() {
|
|
99
|
+
return {
|
|
100
|
+
xScale: this.xScaleFn(),
|
|
101
|
+
snapValue: this.snapValueFn(),
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Note: we use d3 click + pointer to give us domain values directly.
|
|
107
|
+
* Saves us having to calculate them ourselves from a MouseEvent.
|
|
108
|
+
*/
|
|
109
|
+
onRectClick(event) {
|
|
110
|
+
const { elements, disabled } = this.props;
|
|
111
|
+
|
|
112
|
+
if (disabled) {
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
const anyElementSelected = elements.some((e) => e.selected);
|
|
117
|
+
|
|
118
|
+
if (anyElementSelected) {
|
|
119
|
+
this.props.onDeselectElements();
|
|
120
|
+
} else {
|
|
121
|
+
const coords = pointer(event, this.rect);
|
|
122
|
+
const x = this.xScaleFn().invert(coords[0]);
|
|
123
|
+
this.addElement(x);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
componentDidMount() {
|
|
128
|
+
const rect = select(this.rect);
|
|
129
|
+
rect.on('click', this.onRectClick.bind(this));
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
addElement(x) {
|
|
133
|
+
const snapFn = this.snapValueFn();
|
|
134
|
+
const v = snapFn(x);
|
|
135
|
+
this.props.onAddElement(v);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
render() {
|
|
139
|
+
const { domain, width, ticks, height, onToggleElement, onMoveElement, disabled, fraction } = this.props;
|
|
140
|
+
let { arrows } = this.props;
|
|
141
|
+
|
|
142
|
+
arrows = arrows || { left: true, right: true };
|
|
143
|
+
const { min, max } = domain;
|
|
144
|
+
|
|
145
|
+
if (domain.max <= domain.min) {
|
|
146
|
+
return (
|
|
147
|
+
<div>
|
|
148
|
+
{domain.max} is less than or equal to {domain.min}
|
|
149
|
+
</div>
|
|
150
|
+
);
|
|
151
|
+
} else {
|
|
152
|
+
const lineY = height - 30;
|
|
153
|
+
|
|
154
|
+
const stacks = new Stacks(domain);
|
|
155
|
+
|
|
156
|
+
const elements = this.props.elements.map((el, index) => {
|
|
157
|
+
const stackIndex = stacks.add(el);
|
|
158
|
+
|
|
159
|
+
if (stackIndex === -1) {
|
|
160
|
+
throw new Error('stack index is -1, cant add element');
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
const y = lineY - stackIndex * 25;
|
|
164
|
+
|
|
165
|
+
const commonProps = {
|
|
166
|
+
key: index,
|
|
167
|
+
y,
|
|
168
|
+
selected: el.selected && !disabled,
|
|
169
|
+
interval: ticks.minor,
|
|
170
|
+
disabled,
|
|
171
|
+
correct: el.correct,
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
const toggleElement = onToggleElement.bind(null, index, el);
|
|
175
|
+
const moveElement = onMoveElement.bind(null, index, el);
|
|
176
|
+
|
|
177
|
+
if (el.type === 'line') {
|
|
178
|
+
const empty = {
|
|
179
|
+
left: el.leftPoint === 'empty',
|
|
180
|
+
right: el.rightPoint === 'empty',
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
return (
|
|
184
|
+
<Line
|
|
185
|
+
{...commonProps}
|
|
186
|
+
domain={{ min: min, max: max }}
|
|
187
|
+
onMoveLine={moveElement}
|
|
188
|
+
onToggleSelect={toggleElement}
|
|
189
|
+
position={el.position}
|
|
190
|
+
empty={empty}
|
|
191
|
+
key={index}
|
|
192
|
+
/>
|
|
193
|
+
);
|
|
194
|
+
} else if (el.type === 'point') {
|
|
195
|
+
const bounds = {
|
|
196
|
+
left: min - el.position,
|
|
197
|
+
right: max - el.position,
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
return (
|
|
201
|
+
<Point
|
|
202
|
+
{...commonProps}
|
|
203
|
+
empty={el.pointType === 'empty'}
|
|
204
|
+
position={el.position}
|
|
205
|
+
bounds={bounds}
|
|
206
|
+
onClick={toggleElement}
|
|
207
|
+
onMove={moveElement}
|
|
208
|
+
key={index}
|
|
209
|
+
/>
|
|
210
|
+
);
|
|
211
|
+
} else if (el.type === 'ray') {
|
|
212
|
+
return (
|
|
213
|
+
<Ray
|
|
214
|
+
{...commonProps}
|
|
215
|
+
domain={{ min: min, max: max }}
|
|
216
|
+
direction={el.direction}
|
|
217
|
+
position={el.position}
|
|
218
|
+
onMove={moveElement}
|
|
219
|
+
onToggleSelect={toggleElement}
|
|
220
|
+
width={width}
|
|
221
|
+
empty={el.pointType === 'empty'}
|
|
222
|
+
key={index}
|
|
223
|
+
/>
|
|
224
|
+
);
|
|
225
|
+
}
|
|
226
|
+
});
|
|
227
|
+
|
|
228
|
+
return (
|
|
229
|
+
<DndContext>
|
|
230
|
+
<div style={{ display: 'inline-block' }}>
|
|
231
|
+
<svg width={width} height={fraction ? height + 20 : height}>
|
|
232
|
+
{false && <Debug domain={domain} ticks={ticks} />}
|
|
233
|
+
<BaseLine y={lineY} width={width} />
|
|
234
|
+
{arrows.left && <Arrow y={lineY} />}
|
|
235
|
+
{arrows.right && <Arrow x={width} y={lineY} direction="right" />}
|
|
236
|
+
<Ticks y={lineY} domain={domain} width={width} ticks={ticks} fraction={fraction} />
|
|
237
|
+
<rect
|
|
238
|
+
ref={(rect) => (this.rect = rect)}
|
|
239
|
+
//need to have a fill for it to be clickable
|
|
240
|
+
fill={color.primary()}
|
|
241
|
+
fillOpacity="0.0"
|
|
242
|
+
width={width}
|
|
243
|
+
height={height}
|
|
244
|
+
/>
|
|
245
|
+
<TransitionGroup component="g">
|
|
246
|
+
{elements.map((c, index) => (
|
|
247
|
+
<Fade key={index}>{c}</Fade>
|
|
248
|
+
))}
|
|
249
|
+
</TransitionGroup>
|
|
250
|
+
</svg>
|
|
251
|
+
</div>
|
|
252
|
+
</DndContext>
|
|
253
|
+
);
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
export default NumberLineGraph;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
/**
|
|
3
|
+
* @synced-from pie-elements/packages/number-line/src/number-line/graph/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 injectSheet from 'react-jss';
|
|
13
|
+
import PropTypes from 'prop-types';
|
|
14
|
+
import { color } from '@pie-lib/render-ui';
|
|
15
|
+
|
|
16
|
+
const style = {
|
|
17
|
+
root: {
|
|
18
|
+
strokeWidth: 2,
|
|
19
|
+
stroke: color.primary(),
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export function Line({ y, width, classes }) {
|
|
24
|
+
return <line x1={0} y1={y} x2={width} y2={y} className={classes.root} />;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
Line.propTypes = {
|
|
28
|
+
y: PropTypes.number.isRequired,
|
|
29
|
+
width: PropTypes.number.isRequired,
|
|
30
|
+
classes: PropTypes.object.isRequired,
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export default injectSheet(style)(Line);
|