@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,82 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
/**
|
|
3
|
+
* @synced-from pie-elements/packages/number-line/src/number-line/graph/stacks.js
|
|
4
|
+
* @auto-generated
|
|
5
|
+
*
|
|
6
|
+
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
7
|
+
* Manual edits will be overwritten on next sync.
|
|
8
|
+
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
export default function Stacks(domain) {
|
|
12
|
+
let stacks = [new Stack(domain)];
|
|
13
|
+
|
|
14
|
+
this.add = function (el) {
|
|
15
|
+
let stack = stacks.find((s) => s.add(el));
|
|
16
|
+
if (stacks.indexOf(stack) === -1) {
|
|
17
|
+
stack = new Stack(domain);
|
|
18
|
+
stacks.push(stack);
|
|
19
|
+
stack.add(el);
|
|
20
|
+
}
|
|
21
|
+
return stacks.indexOf(stack);
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function Stack(domain) {
|
|
26
|
+
let elements = [];
|
|
27
|
+
/**
|
|
28
|
+
* Try to add the element to the stack.
|
|
29
|
+
* @return boolean true if added, else false
|
|
30
|
+
*/
|
|
31
|
+
this.add = function (el) /*boolean*/ {
|
|
32
|
+
let elementRange = getRange(el);
|
|
33
|
+
if (elementRange.left < domain.min || elementRange.right > domain.max) {
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
let touchesExisting = elements.some((e) => touchesRange(e, elementRange));
|
|
38
|
+
|
|
39
|
+
if (touchesExisting) {
|
|
40
|
+
return false;
|
|
41
|
+
} else {
|
|
42
|
+
elements.push(el);
|
|
43
|
+
return true;
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
this.elements = function () {
|
|
48
|
+
return elements;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
let touchesRange = (el, candidate) => {
|
|
52
|
+
let existing = getRange(el);
|
|
53
|
+
let leftOf = candidate.left < existing.left && candidate.right < existing.left;
|
|
54
|
+
let rightOf = candidate.left > existing.right && candidate.right > existing.right;
|
|
55
|
+
return !(leftOf || rightOf);
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
let getRange = (el) => {
|
|
59
|
+
let { type, position } = el;
|
|
60
|
+
|
|
61
|
+
switch (type) {
|
|
62
|
+
case 'point':
|
|
63
|
+
return { left: position, right: position };
|
|
64
|
+
case 'line':
|
|
65
|
+
return position;
|
|
66
|
+
case 'ray':
|
|
67
|
+
if (el.direction === 'positive') {
|
|
68
|
+
return {
|
|
69
|
+
left: position,
|
|
70
|
+
right: domain.max,
|
|
71
|
+
};
|
|
72
|
+
} else {
|
|
73
|
+
return {
|
|
74
|
+
left: domain.min,
|
|
75
|
+
right: position,
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
default:
|
|
79
|
+
return null;
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
}
|
|
@@ -0,0 +1,369 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
/**
|
|
3
|
+
* @synced-from pie-elements/packages/number-line/src/number-line/graph/tick-utils.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 math from 'mathjs';
|
|
12
|
+
import { isNumber, isObject, uniqWith } from 'lodash-es';
|
|
13
|
+
|
|
14
|
+
// All these functions are duplicated in controller/src/tickUtils
|
|
15
|
+
|
|
16
|
+
/*This will store the possible decimal tick values*/
|
|
17
|
+
export const decimalTickValues = [0.001, 0.01, 0.02, 0.04, 0.05, 0.1, 0.125, 0.2, 0.25, 0.5];
|
|
18
|
+
|
|
19
|
+
/*This will store the possible fraction tick values*/
|
|
20
|
+
export const fractionTickValues = [
|
|
21
|
+
'1/1000',
|
|
22
|
+
'1/100',
|
|
23
|
+
'1/64',
|
|
24
|
+
'1/50',
|
|
25
|
+
'1/32',
|
|
26
|
+
'1/25',
|
|
27
|
+
'1/20',
|
|
28
|
+
'1/16',
|
|
29
|
+
'1/15',
|
|
30
|
+
'1/12',
|
|
31
|
+
'1/10',
|
|
32
|
+
'1/9',
|
|
33
|
+
'1/8',
|
|
34
|
+
'1/7',
|
|
35
|
+
'1/6',
|
|
36
|
+
'1/5',
|
|
37
|
+
'1/4',
|
|
38
|
+
'1/3',
|
|
39
|
+
'1/2',
|
|
40
|
+
];
|
|
41
|
+
|
|
42
|
+
/*This const will store possible multiplier for label interval that needs to be multiplied
|
|
43
|
+
with tick interval with denominator represented with object key.*/
|
|
44
|
+
export const labelMultiplier = {
|
|
45
|
+
1: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
|
|
46
|
+
2: [1, 2, 4, 6, 8, 10],
|
|
47
|
+
3: [1, 3, 6, 9],
|
|
48
|
+
4: [1, 2, 4, 8],
|
|
49
|
+
5: [1, 5, 10],
|
|
50
|
+
6: [1, 2, 3, 6],
|
|
51
|
+
7: [1, 7],
|
|
52
|
+
8: [1, 2, 4, 8],
|
|
53
|
+
9: [1, 3, 9],
|
|
54
|
+
10: [1, 2, 5, 10],
|
|
55
|
+
12: [1, 2, 3, 4, 6],
|
|
56
|
+
15: [1, 3, 5],
|
|
57
|
+
16: [1, 2, 4, 8],
|
|
58
|
+
20: [1, 2, 4, 5, 10],
|
|
59
|
+
25: [1, 5],
|
|
60
|
+
32: [1, 2, 4, 8],
|
|
61
|
+
50: [1, 2, 5, 10],
|
|
62
|
+
64: [1, 2, 4, 8],
|
|
63
|
+
100: [1, 2, 4, 5, 10],
|
|
64
|
+
1000: [1, 2, 4, 5, 8, 10],
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export const fractionRange = (start, end, interval) => {
|
|
68
|
+
const m = math.mod(math.abs(start), math.abs(interval));
|
|
69
|
+
if (!math.equal(m, 0)) {
|
|
70
|
+
throw new Error('start point must be divisible by interval');
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
if (math.equal(start, end)) {
|
|
74
|
+
return [];
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const e = math.subtract(end, math.mod(end, math.abs(interval)));
|
|
78
|
+
|
|
79
|
+
const direction = math.larger(interval, 0) ? 'positive' : 'negative';
|
|
80
|
+
|
|
81
|
+
if (direction === 'negative' && math.largerEq(end, start)) {
|
|
82
|
+
throw new Error('start must be > than end when doing a negative decrement');
|
|
83
|
+
}
|
|
84
|
+
if (direction === 'positive' && math.smallerEq(end, start)) {
|
|
85
|
+
throw new Error('start must be < end when doing increments');
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
let compareFn;
|
|
89
|
+
if (direction === 'positive') {
|
|
90
|
+
compareFn = math.smallerEq;
|
|
91
|
+
} else if (math.equal(e, end)) {
|
|
92
|
+
compareFn = math.largerEq;
|
|
93
|
+
} else {
|
|
94
|
+
compareFn = math.larger;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
const out = [];
|
|
98
|
+
|
|
99
|
+
let next = start;
|
|
100
|
+
while (compareFn(next, e)) {
|
|
101
|
+
out.push(next);
|
|
102
|
+
next = math.add(next, interval);
|
|
103
|
+
}
|
|
104
|
+
return out;
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
export const zbrErrorMessage = (start, end) =>
|
|
108
|
+
`Can only do a positive or negative range, but got: start: ${start} and end:${end}`;
|
|
109
|
+
|
|
110
|
+
export const zeroBasedRange = (start, end, interval) => {
|
|
111
|
+
start = math.fraction(start);
|
|
112
|
+
end = math.fraction(end);
|
|
113
|
+
interval = math.fraction(interval);
|
|
114
|
+
|
|
115
|
+
const length = math.abs(math.subtract(end, start));
|
|
116
|
+
|
|
117
|
+
if (math.larger(length, math.abs(end))) {
|
|
118
|
+
throw new Error(zbrErrorMessage(start, end));
|
|
119
|
+
}
|
|
120
|
+
const a = {
|
|
121
|
+
start: math.abs(start),
|
|
122
|
+
end: math.abs(end),
|
|
123
|
+
interval: math.abs(interval),
|
|
124
|
+
multiplier: math.smaller(interval, 0) ? -1 : 1,
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
const m = math.mod(a.start, a.interval);
|
|
128
|
+
const s = math.larger(m, 0) ? math.add(math.subtract(a.start, m), a.interval) : a.start;
|
|
129
|
+
|
|
130
|
+
const r = fractionRange(s, a.end, a.interval);
|
|
131
|
+
const out = a.multiplier === -1 ? r.map((v) => math.multiply(v, -1)) : r;
|
|
132
|
+
|
|
133
|
+
if (math.smaller(interval, 0)) {
|
|
134
|
+
out.reverse();
|
|
135
|
+
}
|
|
136
|
+
return out;
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
const fmin = (a, b) => {
|
|
140
|
+
a = math.fraction(a);
|
|
141
|
+
b = math.fraction(b);
|
|
142
|
+
return math.smaller(a, b) ? a : b;
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
const fmax = (a, b) => {
|
|
146
|
+
a = math.fraction(a);
|
|
147
|
+
b = math.fraction(b);
|
|
148
|
+
return math.larger(a, b) ? a : b;
|
|
149
|
+
};
|
|
150
|
+
/**
|
|
151
|
+
* the lodash range was causing too much variance in the rounding errors
|
|
152
|
+
* such that it was hard to round the numbers.
|
|
153
|
+
* This is a more simplistic version but makes rounding work.
|
|
154
|
+
*/
|
|
155
|
+
export const simpleRange = (start, end, interval) => {
|
|
156
|
+
start = math.fraction(start);
|
|
157
|
+
end = math.fraction(end);
|
|
158
|
+
interval = math.fraction(interval);
|
|
159
|
+
|
|
160
|
+
const positiveRange = math.larger(end, 0) ? zeroBasedRange(fmax(0, start), end, interval) : [];
|
|
161
|
+
|
|
162
|
+
const negativeRange = math.smaller(start, 0) ? zeroBasedRange(fmin(0, end), start, math.multiply(interval, -1)) : [];
|
|
163
|
+
let together = negativeRange.concat(positiveRange);
|
|
164
|
+
|
|
165
|
+
const out = uniqWith(together, math.equal);
|
|
166
|
+
return out;
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
export const closeTo = (a, b, precision) => {
|
|
170
|
+
precision = precision || 2;
|
|
171
|
+
const expectedDiff = Math.pow(10, -precision) / 2;
|
|
172
|
+
const receivedDiff = Math.abs(a - b);
|
|
173
|
+
return receivedDiff < expectedDiff;
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
const limit = (v, min, max) => {
|
|
177
|
+
if (math.smaller(fraction(v), fraction(min))) {
|
|
178
|
+
return min;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
if (math.larger(fraction(v), fraction(max))) {
|
|
182
|
+
return max;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
return v;
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
/*
|
|
189
|
+
* Function to get tick interval limits based on min, max and width entered by the user.
|
|
190
|
+
* @param domain object containing max and min value.
|
|
191
|
+
* @param width number represents width of number line.
|
|
192
|
+
* */
|
|
193
|
+
export const getMinorLimits = (domain, width) => {
|
|
194
|
+
const end = domain.max - domain.min;
|
|
195
|
+
const min = math.number(math.multiply(10, math.divide(math.fraction(end), width)));
|
|
196
|
+
const max = math.number(math.multiply(20, min));
|
|
197
|
+
return {
|
|
198
|
+
min: min,
|
|
199
|
+
max: max,
|
|
200
|
+
};
|
|
201
|
+
};
|
|
202
|
+
|
|
203
|
+
export const isMultiple = (multiple, src) => {
|
|
204
|
+
const mod = math.mod(multiple, src);
|
|
205
|
+
return math.equal(mod, 0);
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* Accepts a fraction object {n,d,s} or number.
|
|
210
|
+
* @param {*} v
|
|
211
|
+
* @return mathjs.fraction
|
|
212
|
+
*/
|
|
213
|
+
export const fraction = (v) => {
|
|
214
|
+
if (isObject(v)) {
|
|
215
|
+
return math.fraction(v.n * v.s, v.d);
|
|
216
|
+
} else if (isNumber(v)) {
|
|
217
|
+
return math.fraction(v);
|
|
218
|
+
}
|
|
219
|
+
};
|
|
220
|
+
|
|
221
|
+
export const normalizeTicks = (domain, width, ticks, opts) => {
|
|
222
|
+
const useLimit = opts ? opts.limit !== false : true;
|
|
223
|
+
const minorLimits = getMinorLimits(domain, width);
|
|
224
|
+
|
|
225
|
+
const minor = useLimit ? limit(fraction(ticks.minor), minorLimits.min, minorLimits.max) : fraction(ticks.minor);
|
|
226
|
+
const major = useLimit ? limit(fraction(ticks.major), minor, math.multiply(minor, 20)) : fraction(ticks.major);
|
|
227
|
+
|
|
228
|
+
const isMajorMultiple = isMultiple(major, minor);
|
|
229
|
+
|
|
230
|
+
if (!isMajorMultiple) {
|
|
231
|
+
const multiplier = math.divide(major, minor);
|
|
232
|
+
const multiplyBy = multiplier <= 2 ? 2 : Math.round(multiplier);
|
|
233
|
+
|
|
234
|
+
// major must be a multiple of minor
|
|
235
|
+
return { minor, major: math.multiply(minor, multiplyBy) };
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
return { major, minor };
|
|
239
|
+
};
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* Build ticks as an array of mathjs Fractions
|
|
243
|
+
*/
|
|
244
|
+
export const buildTickDataAsFractions = (domain, width, ticks, opts) => {
|
|
245
|
+
ticks = normalizeTicks(domain, width, ticks, opts);
|
|
246
|
+
const rng = simpleRange(domain.min, domain.max, ticks.minor);
|
|
247
|
+
|
|
248
|
+
const o = rng
|
|
249
|
+
.filter((x) => math.smallerEq(x, math.fraction(domain.max)))
|
|
250
|
+
.map((x) => {
|
|
251
|
+
let type = 'minor';
|
|
252
|
+
const modulo = math.mod(x, ticks.major);
|
|
253
|
+
|
|
254
|
+
if (closeTo(math.number(modulo), 0)) {
|
|
255
|
+
type = 'major';
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
return { x, type };
|
|
259
|
+
});
|
|
260
|
+
|
|
261
|
+
return o;
|
|
262
|
+
};
|
|
263
|
+
|
|
264
|
+
/*
|
|
265
|
+
* This function will generate tick interval values based on min and max limits of ticks.
|
|
266
|
+
* @param minorLimits object containing min and max values
|
|
267
|
+
* @return out object containing three arrays 1. fraction values, 2. decimal values,
|
|
268
|
+
* */
|
|
269
|
+
export const generateMinorValues = (minorLimits) => {
|
|
270
|
+
let out = { fraction: [], decimal: [] };
|
|
271
|
+
decimalTickValues.forEach((value) => {
|
|
272
|
+
if (value >= minorLimits.min && value <= minorLimits.max) {
|
|
273
|
+
out.decimal.push(value);
|
|
274
|
+
}
|
|
275
|
+
});
|
|
276
|
+
fractionTickValues.forEach((value) => {
|
|
277
|
+
let decimalValue = math.number(math.fraction(value));
|
|
278
|
+
if (decimalValue >= minorLimits.min && decimalValue <= minorLimits.max) {
|
|
279
|
+
out.fraction.push(value);
|
|
280
|
+
}
|
|
281
|
+
});
|
|
282
|
+
return out;
|
|
283
|
+
};
|
|
284
|
+
|
|
285
|
+
/*
|
|
286
|
+
* This function will generate label interval values for provided tick interval value.
|
|
287
|
+
* @param minor number representing tick interval value.
|
|
288
|
+
* @param domain object containing min and max values.
|
|
289
|
+
* @param width number representing width of number line.
|
|
290
|
+
* @return out object containing three arrays 1. fraction values, 2. decimal values,
|
|
291
|
+
* */
|
|
292
|
+
export const generateMajorValuesForMinor = (minor, domain, width) => {
|
|
293
|
+
let out = { decimal: [], fraction: [] };
|
|
294
|
+
let fraction = math.fraction(math.number(math.number(minor)));
|
|
295
|
+
let n = fraction.n;
|
|
296
|
+
let d = fraction.d;
|
|
297
|
+
if (n >= 1 && d === 1) {
|
|
298
|
+
for (let i = 1; i <= 10; i++) {
|
|
299
|
+
let num = math.number(math.multiply(n, i));
|
|
300
|
+
//Here we check if this major value can plot at least 2 points on number line.
|
|
301
|
+
let ticksData = { minor: minor, major: num };
|
|
302
|
+
let output = buildTickData(domain, width, ticksData, { fraction: undefined });
|
|
303
|
+
if (output.filter((x) => x.type === 'major').length > 1) {
|
|
304
|
+
out.fraction.push(num.toString());
|
|
305
|
+
out.decimal.push(num);
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
} else {
|
|
309
|
+
for (const multiplierKey in labelMultiplier[d]) {
|
|
310
|
+
let num = math.multiply(math.fraction(n, d), labelMultiplier[d][multiplierKey]);
|
|
311
|
+
//Here we check if this major value can plot at least 2 points on number line.
|
|
312
|
+
let ticksData = { minor: minor, major: math.number(num) };
|
|
313
|
+
let output = buildTickData(domain, width, ticksData, { fraction: undefined });
|
|
314
|
+
if (output.filter((x) => x.type === 'major').length > 1) {
|
|
315
|
+
if (num.d !== 1) {
|
|
316
|
+
out.fraction.push(num.n + '/' + num.d);
|
|
317
|
+
} else {
|
|
318
|
+
out.fraction.push(num.n.toString());
|
|
319
|
+
}
|
|
320
|
+
out.decimal.push(math.number(num));
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
return out;
|
|
325
|
+
};
|
|
326
|
+
|
|
327
|
+
export const buildTickData = (domain, width, ticks, opts) => {
|
|
328
|
+
const result = buildTickDataAsFractions(domain, width, ticks, opts);
|
|
329
|
+
|
|
330
|
+
const out = result.map((o) => (opts.fraction ? o : { ...o, x: math.number(o.x) || 0 }));
|
|
331
|
+
|
|
332
|
+
return out;
|
|
333
|
+
};
|
|
334
|
+
|
|
335
|
+
export const fractionSnapTo = (min, max, interval, value) => {
|
|
336
|
+
value = fmax(fmin(value, max), min);
|
|
337
|
+
const mod = value.mod(interval);
|
|
338
|
+
let v;
|
|
339
|
+
|
|
340
|
+
const half = interval.div(2);
|
|
341
|
+
if (math.largerEq(math.abs(mod), half)) {
|
|
342
|
+
const d = interval.sub(math.abs(mod));
|
|
343
|
+
const fn = math.largerEq(value, 0) ? 'add' : 'sub';
|
|
344
|
+
v = value[fn](d);
|
|
345
|
+
} else {
|
|
346
|
+
const fn2 = math.largerEq(value, 0) ? 'sub' : 'add';
|
|
347
|
+
v = value[fn2](math.abs(mod));
|
|
348
|
+
}
|
|
349
|
+
return v;
|
|
350
|
+
};
|
|
351
|
+
|
|
352
|
+
export const snapTo = (min, max, interval, value) => {
|
|
353
|
+
const out = fractionSnapTo(math.fraction(min), math.fraction(max), math.fraction(interval), math.fraction(value));
|
|
354
|
+
return math.number(out);
|
|
355
|
+
};
|
|
356
|
+
|
|
357
|
+
export const snapElements = (domain, ticks, elements) => {
|
|
358
|
+
return elements.map((e) => {
|
|
359
|
+
const size = Number.isFinite(e.size) ? snapTo(0, e.size, ticks.minor, e.size) : undefined;
|
|
360
|
+
const domainPosition = snapTo(domain.min, domain.max, ticks.minor, e.domainPosition);
|
|
361
|
+
const out = { ...e, domainPosition };
|
|
362
|
+
|
|
363
|
+
if (Number.isFinite(size)) {
|
|
364
|
+
out.size = size;
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
return out;
|
|
368
|
+
});
|
|
369
|
+
};
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
/**
|
|
3
|
+
* @synced-from pie-elements/packages/number-line/src/number-line/graph/ticks.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 { buildTickData } from './tick-utils.js';
|
|
15
|
+
import { color } from '@pie-lib/render-ui';
|
|
16
|
+
|
|
17
|
+
const StyledText: any = styled('text')({
|
|
18
|
+
userSelect: 'none',
|
|
19
|
+
textAlign: 'center',
|
|
20
|
+
fill: color.primary(),
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
const StyledLine: any = styled('line')({
|
|
24
|
+
stroke: color.primary(),
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
export const TickValidator = PropTypes.shape({
|
|
28
|
+
/** the number of major ticks (including min + max)
|
|
29
|
+
* to display. cant be lower than 2.
|
|
30
|
+
*/
|
|
31
|
+
major: (props, propName) => {},
|
|
32
|
+
/** the number of minor ticks to display between major ticks.
|
|
33
|
+
* Can't be less than zero.
|
|
34
|
+
*/
|
|
35
|
+
minor: (props, propName, componentName) => {
|
|
36
|
+
let minor = props[propName];
|
|
37
|
+
if (minor <= 0) {
|
|
38
|
+
return new Error(`Invalid prop ${propName} must be > 0. ${componentName}`);
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
}).isRequired;
|
|
42
|
+
|
|
43
|
+
export class Tick extends React.Component {
|
|
44
|
+
static propTypes = {
|
|
45
|
+
y: PropTypes.number.isRequired,
|
|
46
|
+
x: PropTypes.number.isRequired,
|
|
47
|
+
major: PropTypes.bool,
|
|
48
|
+
fraction: PropTypes.bool,
|
|
49
|
+
xScale: PropTypes.func,
|
|
50
|
+
type: PropTypes.string,
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
static defaultProps = {
|
|
54
|
+
major: false,
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
constructor(props) {
|
|
58
|
+
super(props);
|
|
59
|
+
this.wasRendered = false;
|
|
60
|
+
this.state = {
|
|
61
|
+
textBox: {
|
|
62
|
+
width: 0,
|
|
63
|
+
height: 0,
|
|
64
|
+
x: 0,
|
|
65
|
+
y: 0,
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
this.resizeObserver = null;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
updateTextBox() {
|
|
72
|
+
if (this.text) {
|
|
73
|
+
const { width, height, x, y } = this.text.getBBox();
|
|
74
|
+
this.text.setAttribute('x', (width / 2) * -1);
|
|
75
|
+
this.setState({ textBox: { width, height, x, y } });
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
componentDidMount() {
|
|
80
|
+
// Set up ResizeObserver
|
|
81
|
+
this.resizeObserver = new ResizeObserver(() => {
|
|
82
|
+
this.updateTextBox();
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
if (this.text) {
|
|
86
|
+
this.resizeObserver.observe(this.text);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
componentWillUnmount() {
|
|
91
|
+
if (this.resizeObserver) {
|
|
92
|
+
this.resizeObserver.disconnect();
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
render() {
|
|
97
|
+
//the domain value
|
|
98
|
+
let { x, y, type, xScale, fraction } = this.props;
|
|
99
|
+
const displayFraction = fraction && x.n !== x.d && x.n !== 0 && x.d !== 1;
|
|
100
|
+
const labelTick = type === 'major';
|
|
101
|
+
const height = labelTick ? 20 : 10;
|
|
102
|
+
const { width: textWidth = 0, height: textHeight = 0, x: textX = 0, y: textY = 0 } = this.state.textBox;
|
|
103
|
+
|
|
104
|
+
const xText = !fraction ? (
|
|
105
|
+
Number(x.toFixed(3))
|
|
106
|
+
) : !displayFraction ? (
|
|
107
|
+
x.n * x.s
|
|
108
|
+
) : (
|
|
109
|
+
<React.Fragment>
|
|
110
|
+
<tspan x="0" dy="0.71em">
|
|
111
|
+
{x.n * x.s}
|
|
112
|
+
</tspan>
|
|
113
|
+
<tspan x="0" dy="1.11em">
|
|
114
|
+
{x.d}
|
|
115
|
+
</tspan>
|
|
116
|
+
</React.Fragment>
|
|
117
|
+
);
|
|
118
|
+
|
|
119
|
+
return (
|
|
120
|
+
<g opacity="1" transform={`translate(${xScale(x)}, ${y})`}>
|
|
121
|
+
<StyledLine y1={(height / 2) * -1} y2={height / 2} x1="0.5" x2="0.5" />
|
|
122
|
+
|
|
123
|
+
{displayFraction && (
|
|
124
|
+
<StyledLine
|
|
125
|
+
x1={textX}
|
|
126
|
+
x2={textX + textWidth}
|
|
127
|
+
y1={textY + textHeight / 2}
|
|
128
|
+
y2={textY + textHeight / 2}
|
|
129
|
+
/>
|
|
130
|
+
)}
|
|
131
|
+
|
|
132
|
+
{labelTick && (
|
|
133
|
+
<StyledText
|
|
134
|
+
ref={(text) => (this.text = text)}
|
|
135
|
+
y="14"
|
|
136
|
+
width="10"
|
|
137
|
+
dy="0.71em"
|
|
138
|
+
textAnchor={displayFraction && 'middle'}
|
|
139
|
+
>
|
|
140
|
+
{xText}
|
|
141
|
+
</StyledText>
|
|
142
|
+
)}
|
|
143
|
+
</g>
|
|
144
|
+
);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
export class Ticks extends React.Component {
|
|
149
|
+
static contextTypes = {
|
|
150
|
+
xScale: PropTypes.func.isRequired,
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
static propTypes = {
|
|
154
|
+
domain: PropTypes.shape({
|
|
155
|
+
min: PropTypes.number.isRequired,
|
|
156
|
+
max: PropTypes.number.isRequired,
|
|
157
|
+
}).isRequired,
|
|
158
|
+
fraction: PropTypes.bool,
|
|
159
|
+
width: PropTypes.number,
|
|
160
|
+
ticks: TickValidator,
|
|
161
|
+
y: PropTypes.number.isRequired,
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
render() {
|
|
165
|
+
let { domain, width, ticks, y, fraction } = this.props;
|
|
166
|
+
let { xScale } = this.context;
|
|
167
|
+
|
|
168
|
+
const tickData = buildTickData(domain, width, ticks, { fraction });
|
|
169
|
+
|
|
170
|
+
return (
|
|
171
|
+
<g>
|
|
172
|
+
{tickData.map(({ x, type }) => {
|
|
173
|
+
return (
|
|
174
|
+
<Tick
|
|
175
|
+
fraction={fraction}
|
|
176
|
+
x={x}
|
|
177
|
+
y={y}
|
|
178
|
+
type={type}
|
|
179
|
+
xScale={xScale}
|
|
180
|
+
key={`${x}-${type}-${fraction}`}
|
|
181
|
+
/>
|
|
182
|
+
);
|
|
183
|
+
})}
|
|
184
|
+
</g>
|
|
185
|
+
);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
export default Ticks;
|