@dxyl/utils 1.3.4 → 1.3.6
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/index.es.js +6590 -6259
- package/dist/index.umd.js +20 -71
- package/lib/glslang/glslang.d.ts +14 -14
- package/lib/glslang/glslang.js +112 -112
- package/lib/twgsl/twgsl.js +53 -53
- package/package.json +51 -51
- package/types/color/blend/helpers.d.ts +32 -0
- package/types/color/blend/index.d.ts +129 -0
- package/types/color/blend/non-separable-blend.d.ts +9 -0
- package/types/color/blend/non-separable-modes.d.ts +33 -0
- package/types/color/blend/separable-blend.d.ts +9 -0
- package/types/color/blend/separable-modes.d.ts +100 -0
- package/types/color/blend/types.d.ts +38 -0
- package/types/color/blend/unit.d.ts +129 -0
- package/types/color/composite/composite-core.d.ts +34 -0
- package/types/color/composite/composite-types.d.ts +10 -0
- package/types/color/composite/image-data-compositor.d.ts +5 -0
- package/types/color/composite/webgl-compositor.d.ts +10 -0
- package/types/color/composite/webgpu-compositor.d.ts +10 -0
- package/types/data/immer.d.ts +262 -262
- package/types/data/immutable.d.ts +5127 -5127
- package/types/data/mobx.d.ts +2 -2
- package/types/events/event_emiter.d.ts +43 -43
- package/types/fast-deep-equal.d.ts +1 -1
- package/types/index.d.ts +3 -0
- package/types/lodash/add.d.ts +1 -2
- package/types/lodash/after.d.ts +1 -2
- package/types/lodash/array.d.ts +1 -3
- package/types/lodash/array.default.d.ts +68 -70
- package/types/lodash/ary.d.ts +1 -2
- package/types/lodash/assign.d.ts +1 -2
- package/types/lodash/assignIn.d.ts +1 -2
- package/types/lodash/assignInWith.d.ts +1 -2
- package/types/lodash/assignWith.d.ts +1 -2
- package/types/lodash/at.d.ts +1 -2
- package/types/lodash/attempt.d.ts +1 -2
- package/types/lodash/augment.d.ts +2 -2
- package/types/lodash/before.d.ts +1 -2
- package/types/lodash/bind.d.ts +1 -2
- package/types/lodash/bindAll.d.ts +1 -2
- package/types/lodash/bindKey.d.ts +1 -2
- package/types/lodash/cache.d.ts +14 -14
- package/types/lodash/camelCase.d.ts +1 -2
- package/types/lodash/capitalize.d.ts +1 -2
- package/types/lodash/castArray.d.ts +1 -2
- package/types/lodash/ceil.d.ts +1 -2
- package/types/lodash/chain.d.ts +1 -2
- package/types/lodash/chunk.d.ts +1 -2
- package/types/lodash/clamp.d.ts +1 -2
- package/types/lodash/clear-animation-frame.d.ts +1 -1
- package/types/lodash/clone.d.ts +1 -2
- package/types/lodash/cloneDeep.d.ts +1 -2
- package/types/lodash/cloneDeepWith.d.ts +1 -2
- package/types/lodash/cloneWith.d.ts +1 -2
- package/types/lodash/collection.d.ts +1 -3
- package/types/lodash/collection.default.d.ts +31 -33
- package/types/lodash/compact.d.ts +1 -2
- package/types/lodash/concat.d.ts +1 -2
- package/types/lodash/cond.d.ts +1 -2
- package/types/lodash/conforms.d.ts +1 -2
- package/types/lodash/conformsTo.d.ts +1 -2
- package/types/lodash/constant.d.ts +1 -2
- package/types/lodash/contains.d.ts +2 -2
- package/types/lodash/countBy.d.ts +1 -2
- package/types/lodash/create.d.ts +1 -2
- package/types/lodash/curry.d.ts +1 -2
- package/types/lodash/curryRight.d.ts +1 -2
- package/types/lodash/date.d.ts +1 -3
- package/types/lodash/date.default.d.ts +4 -6
- package/types/lodash/debounce.d.ts +2 -4
- package/types/lodash/deburr.d.ts +1 -2
- package/types/lodash/deep-mix.d.ts +2 -2
- package/types/lodash/defaultTo.d.ts +1 -2
- package/types/lodash/defaults.d.ts +1 -2
- package/types/lodash/defaultsDeep.d.ts +1 -2
- package/types/lodash/defer.d.ts +1 -2
- package/types/lodash/delay.d.ts +1 -2
- package/types/lodash/difference.d.ts +1 -2
- package/types/lodash/differenceBy.d.ts +1 -2
- package/types/lodash/differenceWith.d.ts +1 -2
- package/types/lodash/divide.d.ts +1 -2
- package/types/lodash/drop.d.ts +1 -2
- package/types/lodash/dropRight.d.ts +1 -2
- package/types/lodash/dropRightWhile.d.ts +1 -2
- package/types/lodash/dropWhile.d.ts +1 -2
- package/types/lodash/each.d.ts +1 -2
- package/types/lodash/eachRight.d.ts +1 -2
- package/types/lodash/ends-with.d.ts +3 -3
- package/types/lodash/endsWith.d.ts +1 -2
- package/types/lodash/entries.d.ts +1 -2
- package/types/lodash/entriesIn.d.ts +1 -2
- package/types/lodash/eq.d.ts +1 -2
- package/types/lodash/escape.d.ts +1 -2
- package/types/lodash/escapeRegExp.d.ts +1 -2
- package/types/lodash/every.d.ts +1 -2
- package/types/lodash/extend.d.ts +1 -2
- package/types/lodash/extendWith.d.ts +1 -2
- package/types/lodash/fill.d.ts +1 -2
- package/types/lodash/filter.d.ts +1 -2
- package/types/lodash/find-index.d.ts +2 -2
- package/types/lodash/find.d.ts +1 -2
- package/types/lodash/findIndex.d.ts +1 -2
- package/types/lodash/findKey.d.ts +1 -2
- package/types/lodash/findLast.d.ts +1 -2
- package/types/lodash/findLastIndex.d.ts +1 -2
- package/types/lodash/findLastKey.d.ts +1 -2
- package/types/lodash/first-value.d.ts +2 -2
- package/types/lodash/first.d.ts +1 -2
- package/types/lodash/fixed-base.d.ts +2 -2
- package/types/lodash/flatMap.d.ts +1 -2
- package/types/lodash/flatMapDeep.d.ts +1 -2
- package/types/lodash/flatMapDepth.d.ts +1 -2
- package/types/lodash/flatten-deep.d.ts +12 -12
- package/types/lodash/flatten.d.ts +1 -2
- package/types/lodash/flattenDeep.d.ts +1 -2
- package/types/lodash/flattenDepth.d.ts +1 -2
- package/types/lodash/flip.d.ts +1 -2
- package/types/lodash/floor.d.ts +1 -2
- package/types/lodash/flow.d.ts +1 -2
- package/types/lodash/flowRight.d.ts +1 -2
- package/types/lodash/for-in.d.ts +2 -2
- package/types/lodash/forEach.d.ts +1 -2
- package/types/lodash/forEachRight.d.ts +1 -2
- package/types/lodash/forIn.d.ts +1 -2
- package/types/lodash/forInRight.d.ts +1 -2
- package/types/lodash/forOwn.d.ts +1 -2
- package/types/lodash/forOwnRight.d.ts +1 -2
- package/types/lodash/fromPairs.d.ts +1 -2
- package/types/lodash/function.d.ts +1 -3
- package/types/lodash/function.default.d.ts +26 -28
- package/types/lodash/functions.d.ts +1 -2
- package/types/lodash/functionsIn.d.ts +1 -2
- package/types/lodash/get-range.d.ts +6 -6
- package/types/lodash/get-type.d.ts +2 -2
- package/types/lodash/get-wrap-behavior.d.ts +9 -9
- package/types/lodash/get.d.ts +1 -2
- package/types/lodash/group-by.d.ts +6 -6
- package/types/lodash/group-to-map.d.ts +8 -8
- package/types/lodash/group.d.ts +2 -2
- package/types/lodash/groupBy.d.ts +1 -2
- package/types/lodash/gt.d.ts +1 -2
- package/types/lodash/gte.d.ts +1 -2
- package/types/lodash/has-key.d.ts +2 -2
- package/types/lodash/has-value.d.ts +2 -2
- package/types/lodash/has.d.ts +1 -2
- package/types/lodash/hasIn.d.ts +1 -2
- package/types/lodash/head.d.ts +1 -2
- package/types/lodash/identity.d.ts +1 -2
- package/types/lodash/inRange.d.ts +1 -2
- package/types/lodash/includes.d.ts +1 -2
- package/types/lodash/index-of.d.ts +2 -2
- package/types/lodash/index.d.ts +304 -304
- package/types/lodash/indexOf.d.ts +1 -2
- package/types/lodash/initial.d.ts +1 -2
- package/types/lodash/intersection.d.ts +1 -2
- package/types/lodash/intersectionBy.d.ts +1 -2
- package/types/lodash/intersectionWith.d.ts +1 -2
- package/types/lodash/invert.d.ts +1 -2
- package/types/lodash/invertBy.d.ts +1 -2
- package/types/lodash/invoke.d.ts +1 -2
- package/types/lodash/invokeMap.d.ts +1 -2
- package/types/lodash/is-arguments.d.ts +2 -2
- package/types/lodash/is-array-like.d.ts +2 -2
- package/types/lodash/is-array.d.ts +2 -2
- package/types/lodash/is-boolean.d.ts +2 -2
- package/types/lodash/is-date.d.ts +2 -2
- package/types/lodash/is-decimal.d.ts +2 -2
- package/types/lodash/is-element.d.ts +6 -6
- package/types/lodash/is-empty.d.ts +2 -2
- package/types/lodash/is-equal-with.d.ts +24 -24
- package/types/lodash/is-equal.d.ts +2 -2
- package/types/lodash/is-error.d.ts +2 -2
- package/types/lodash/is-even.d.ts +2 -2
- package/types/lodash/is-finite.d.ts +1 -1
- package/types/lodash/is-function.d.ts +2 -2
- package/types/lodash/is-integer.d.ts +2 -2
- package/types/lodash/is-match.d.ts +2 -2
- package/types/lodash/is-negative.d.ts +2 -2
- package/types/lodash/is-nil.d.ts +2 -2
- package/types/lodash/is-null.d.ts +2 -2
- package/types/lodash/is-number-equal.d.ts +1 -1
- package/types/lodash/is-number.d.ts +2 -2
- package/types/lodash/is-object-like.d.ts +2 -2
- package/types/lodash/is-object.d.ts +2 -2
- package/types/lodash/is-odd.d.ts +2 -2
- package/types/lodash/is-plain-object.d.ts +2 -2
- package/types/lodash/is-positive.d.ts +2 -2
- package/types/lodash/is-prototype.d.ts +2 -2
- package/types/lodash/is-reg-exp.d.ts +2 -2
- package/types/lodash/is-segment-equal.d.ts +2 -2
- package/types/lodash/is-string.d.ts +2 -2
- package/types/lodash/is-type.d.ts +2 -2
- package/types/lodash/is-undefined.d.ts +2 -2
- package/types/lodash/isArguments.d.ts +1 -2
- package/types/lodash/isArray.d.ts +1 -2
- package/types/lodash/isArrayBuffer.d.ts +1 -2
- package/types/lodash/isArrayLike.d.ts +1 -2
- package/types/lodash/isArrayLikeObject.d.ts +1 -2
- package/types/lodash/isBoolean.d.ts +1 -2
- package/types/lodash/isBuffer.d.ts +1 -2
- package/types/lodash/isDate.d.ts +1 -2
- package/types/lodash/isElement.d.ts +1 -2
- package/types/lodash/isEmpty.d.ts +1 -2
- package/types/lodash/isEqual.d.ts +1 -2
- package/types/lodash/isEqualWith.d.ts +1 -2
- package/types/lodash/isError.d.ts +1 -2
- package/types/lodash/isFinite.d.ts +1 -2
- package/types/lodash/isFunction.d.ts +1 -2
- package/types/lodash/isInteger.d.ts +1 -2
- package/types/lodash/isLength.d.ts +1 -2
- package/types/lodash/isMap.d.ts +1 -2
- package/types/lodash/isMatch.d.ts +1 -2
- package/types/lodash/isMatchWith.d.ts +1 -2
- package/types/lodash/isNaN.d.ts +1 -2
- package/types/lodash/isNative.d.ts +1 -2
- package/types/lodash/isNil.d.ts +1 -2
- package/types/lodash/isNull.d.ts +1 -2
- package/types/lodash/isNumber.d.ts +1 -2
- package/types/lodash/isObject.d.ts +1 -2
- package/types/lodash/isObjectLike.d.ts +1 -2
- package/types/lodash/isPlainObject.d.ts +1 -2
- package/types/lodash/isRegExp.d.ts +1 -2
- package/types/lodash/isSafeInteger.d.ts +1 -2
- package/types/lodash/isSet.d.ts +1 -2
- package/types/lodash/isString.d.ts +1 -2
- package/types/lodash/isSymbol.d.ts +1 -2
- package/types/lodash/isTypedArray.d.ts +1 -2
- package/types/lodash/isUndefined.d.ts +1 -2
- package/types/lodash/isWeakMap.d.ts +1 -2
- package/types/lodash/isWeakSet.d.ts +1 -2
- package/types/lodash/iteratee.d.ts +1 -2
- package/types/lodash/join.d.ts +1 -2
- package/types/lodash/kebabCase.d.ts +1 -2
- package/types/lodash/keyBy.d.ts +1 -2
- package/types/lodash/keys.d.ts +1 -2
- package/types/lodash/keysIn.d.ts +1 -2
- package/types/lodash/lang.d.ts +1 -3
- package/types/lodash/lang.default.d.ts +59 -61
- package/types/lodash/last.d.ts +1 -2
- package/types/lodash/lastIndexOf.d.ts +1 -2
- package/types/lodash/lower-case.d.ts +2 -2
- package/types/lodash/lower-first.d.ts +2 -2
- package/types/lodash/lowerCase.d.ts +1 -2
- package/types/lodash/lowerFirst.d.ts +1 -2
- package/types/lodash/lt.d.ts +1 -2
- package/types/lodash/lte.d.ts +1 -2
- package/types/lodash/map-values.d.ts +6 -6
- package/types/lodash/map.d.ts +1 -2
- package/types/lodash/mapKeys.d.ts +1 -2
- package/types/lodash/mapValues.d.ts +1 -2
- package/types/lodash/matches.d.ts +1 -2
- package/types/lodash/matchesProperty.d.ts +1 -2
- package/types/lodash/math.d.ts +1 -3
- package/types/lodash/math.default.d.ts +18 -20
- package/types/lodash/max-by.d.ts +16 -16
- package/types/lodash/max.d.ts +1 -2
- package/types/lodash/maxBy.d.ts +1 -2
- package/types/lodash/mean.d.ts +1 -2
- package/types/lodash/meanBy.d.ts +1 -2
- package/types/lodash/memoize.d.ts +1 -2
- package/types/lodash/merge.d.ts +1 -2
- package/types/lodash/mergeWith.d.ts +1 -2
- package/types/lodash/method.d.ts +1 -2
- package/types/lodash/methodOf.d.ts +1 -2
- package/types/lodash/min-by.d.ts +16 -16
- package/types/lodash/min.d.ts +1 -2
- package/types/lodash/minBy.d.ts +1 -2
- package/types/lodash/mix.d.ts +1 -1
- package/types/lodash/mixin.d.ts +1 -2
- package/types/lodash/mod.d.ts +2 -2
- package/types/lodash/multiply.d.ts +1 -2
- package/types/lodash/negate.d.ts +1 -2
- package/types/lodash/noop.d.ts +1 -2
- package/types/lodash/now.d.ts +1 -2
- package/types/lodash/nth.d.ts +1 -2
- package/types/lodash/nthArg.d.ts +1 -2
- package/types/lodash/number.d.ts +1 -3
- package/types/lodash/number.default.d.ts +6 -8
- package/types/lodash/number2color.d.ts +2 -2
- package/types/lodash/object.d.ts +1 -3
- package/types/lodash/object.default.d.ts +50 -52
- package/types/lodash/omit.d.ts +1 -2
- package/types/lodash/omitBy.d.ts +1 -2
- package/types/lodash/once.d.ts +1 -2
- package/types/lodash/orderBy.d.ts +1 -2
- package/types/lodash/over.d.ts +1 -2
- package/types/lodash/overArgs.d.ts +1 -2
- package/types/lodash/overEvery.d.ts +1 -2
- package/types/lodash/overSome.d.ts +1 -2
- package/types/lodash/pad.d.ts +1 -2
- package/types/lodash/padEnd.d.ts +1 -2
- package/types/lodash/padStart.d.ts +1 -2
- package/types/lodash/parse-radius.d.ts +9 -9
- package/types/lodash/parseInt.d.ts +1 -2
- package/types/lodash/partial.d.ts +1 -2
- package/types/lodash/partialRight.d.ts +1 -2
- package/types/lodash/partition.d.ts +1 -2
- package/types/lodash/pick.d.ts +1 -2
- package/types/lodash/pickBy.d.ts +1 -2
- package/types/lodash/property.d.ts +2 -4
- package/types/lodash/propertyOf.d.ts +1 -2
- package/types/lodash/pull-at.d.ts +2 -2
- package/types/lodash/pull.d.ts +1 -2
- package/types/lodash/pullAll.d.ts +1 -2
- package/types/lodash/pullAllBy.d.ts +1 -2
- package/types/lodash/pullAllWith.d.ts +1 -2
- package/types/lodash/pullAt.d.ts +1 -2
- package/types/lodash/random.d.ts +1 -2
- package/types/lodash/range.d.ts +1 -2
- package/types/lodash/rangeRight.d.ts +1 -2
- package/types/lodash/rearg.d.ts +1 -2
- package/types/lodash/reduce.d.ts +1 -2
- package/types/lodash/reduceRight.d.ts +1 -2
- package/types/lodash/reject.d.ts +1 -2
- package/types/lodash/remove.d.ts +1 -2
- package/types/lodash/repeat.d.ts +1 -2
- package/types/lodash/replace.d.ts +1 -2
- package/types/lodash/request-animation-frame.d.ts +1 -1
- package/types/lodash/rest.d.ts +1 -2
- package/types/lodash/result.d.ts +1 -2
- package/types/lodash/reverse.d.ts +1 -2
- package/types/lodash/round.d.ts +1 -2
- package/types/lodash/sample.d.ts +1 -2
- package/types/lodash/sampleSize.d.ts +1 -2
- package/types/lodash/set.d.ts +1 -2
- package/types/lodash/setWith.d.ts +1 -2
- package/types/lodash/shuffle.d.ts +1 -2
- package/types/lodash/size.d.ts +1 -2
- package/types/lodash/slice.d.ts +1 -2
- package/types/lodash/snakeCase.d.ts +1 -2
- package/types/lodash/some.d.ts +1 -2
- package/types/lodash/sort-by.d.ts +7 -7
- package/types/lodash/sortBy.d.ts +1 -2
- package/types/lodash/sortedIndex.d.ts +1 -2
- package/types/lodash/sortedIndexBy.d.ts +1 -2
- package/types/lodash/sortedIndexOf.d.ts +1 -2
- package/types/lodash/sortedLastIndex.d.ts +1 -2
- package/types/lodash/sortedLastIndexBy.d.ts +1 -2
- package/types/lodash/sortedLastIndexOf.d.ts +1 -2
- package/types/lodash/sortedUniq.d.ts +1 -2
- package/types/lodash/sortedUniqBy.d.ts +1 -2
- package/types/lodash/split.d.ts +1 -2
- package/types/lodash/spread.d.ts +1 -2
- package/types/lodash/startCase.d.ts +1 -2
- package/types/lodash/starts-with.d.ts +3 -3
- package/types/lodash/startsWith.d.ts +1 -2
- package/types/lodash/string.d.ts +1 -3
- package/types/lodash/string.default.d.ts +34 -36
- package/types/lodash/stubArray.d.ts +1 -2
- package/types/lodash/stubFalse.d.ts +1 -2
- package/types/lodash/stubObject.d.ts +1 -2
- package/types/lodash/stubString.d.ts +1 -2
- package/types/lodash/stubTrue.d.ts +1 -2
- package/types/lodash/substitute.d.ts +5 -5
- package/types/lodash/subtract.d.ts +1 -2
- package/types/lodash/sum.d.ts +1 -2
- package/types/lodash/sumBy.d.ts +1 -2
- package/types/lodash/tail.d.ts +1 -2
- package/types/lodash/take.d.ts +1 -2
- package/types/lodash/takeRight.d.ts +1 -2
- package/types/lodash/takeRightWhile.d.ts +1 -2
- package/types/lodash/takeWhile.d.ts +1 -2
- package/types/lodash/tap.d.ts +1 -2
- package/types/lodash/template.d.ts +1 -2
- package/types/lodash/templateSettings.d.ts +1 -2
- package/types/lodash/throttle.d.ts +2 -4
- package/types/lodash/thru.d.ts +1 -2
- package/types/lodash/times.d.ts +1 -2
- package/types/lodash/to-array.d.ts +2 -2
- package/types/lodash/to-degree.d.ts +2 -2
- package/types/lodash/to-integer.d.ts +1 -1
- package/types/lodash/to-radian.d.ts +2 -2
- package/types/lodash/to-string.d.ts +2 -2
- package/types/lodash/toArray.d.ts +1 -2
- package/types/lodash/toFinite.d.ts +1 -2
- package/types/lodash/toInteger.d.ts +1 -2
- package/types/lodash/toLength.d.ts +1 -2
- package/types/lodash/toLower.d.ts +1 -2
- package/types/lodash/toNumber.d.ts +1 -2
- package/types/lodash/toPairs.d.ts +1 -2
- package/types/lodash/toPairsIn.d.ts +1 -2
- package/types/lodash/toPath.d.ts +1 -2
- package/types/lodash/toPlainObject.d.ts +1 -2
- package/types/lodash/toSafeInteger.d.ts +1 -2
- package/types/lodash/toString.d.ts +1 -2
- package/types/lodash/toUpper.d.ts +1 -2
- package/types/lodash/transform.d.ts +1 -2
- package/types/lodash/trim.d.ts +1 -2
- package/types/lodash/trimEnd.d.ts +1 -2
- package/types/lodash/trimStart.d.ts +1 -2
- package/types/lodash/truncate.d.ts +1 -2
- package/types/lodash/types/index.d.ts +3 -3
- package/types/lodash/unary.d.ts +1 -2
- package/types/lodash/unescape.d.ts +1 -2
- package/types/lodash/union.d.ts +1 -2
- package/types/lodash/unionBy.d.ts +1 -2
- package/types/lodash/unionWith.d.ts +1 -2
- package/types/lodash/uniq.d.ts +1 -2
- package/types/lodash/uniqBy.d.ts +1 -2
- package/types/lodash/uniqWith.d.ts +1 -2
- package/types/lodash/unique-id.d.ts +2 -2
- package/types/lodash/uniqueId.d.ts +1 -2
- package/types/lodash/unset.d.ts +1 -2
- package/types/lodash/unzip.d.ts +1 -2
- package/types/lodash/unzipWith.d.ts +1 -2
- package/types/lodash/update.d.ts +1 -2
- package/types/lodash/updateWith.d.ts +1 -2
- package/types/lodash/upper-case.d.ts +2 -2
- package/types/lodash/upper-first.d.ts +2 -2
- package/types/lodash/upperCase.d.ts +1 -2
- package/types/lodash/upperFirst.d.ts +1 -2
- package/types/lodash/util.d.ts +1 -3
- package/types/lodash/util.default.d.ts +35 -37
- package/types/lodash/values-of-key.d.ts +2 -2
- package/types/lodash/values.d.ts +1 -2
- package/types/lodash/valuesIn.d.ts +1 -2
- package/types/lodash/without.d.ts +1 -2
- package/types/lodash/words.d.ts +1 -2
- package/types/lodash/wrap-behavior.d.ts +9 -9
- package/types/lodash/wrap.d.ts +1 -2
- package/types/lodash/xor.d.ts +1 -2
- package/types/lodash/xorBy.d.ts +1 -2
- package/types/lodash/xorWith.d.ts +1 -2
- package/types/lodash/zip.d.ts +1 -2
- package/types/lodash/zipObject.d.ts +1 -2
- package/types/lodash/zipObjectDeep.d.ts +1 -2
- package/types/lodash/zipWith.d.ts +1 -2
- package/types/scheduler.d.ts +46 -0
- package/types/state/StateMachine.d.ts +149 -0
- package/types/state/StateMachinePlus.d.ts +40 -0
- package/types/stats.module.d.ts +3 -3
- package/types/utils/token.d.ts +1 -0
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
export interface StateMachineConfig<S extends string, E extends string, C> {
|
|
2
|
+
initial: S;
|
|
3
|
+
states: {
|
|
4
|
+
[K in S]: {
|
|
5
|
+
on?: {
|
|
6
|
+
[K in E]?: {
|
|
7
|
+
target: S;
|
|
8
|
+
action?: (context: C, event: {
|
|
9
|
+
type: E;
|
|
10
|
+
prevState: S;
|
|
11
|
+
payload?: any;
|
|
12
|
+
}, instance: StateMachine<S, E, C>) => C;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
onEnter?: (context: C, instance: StateMachine<S, E, C>) => void;
|
|
16
|
+
onExit?: (context: C, instance: StateMachine<S, E, C>) => void;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
context: C;
|
|
20
|
+
}
|
|
21
|
+
export declare class StateMachine<S extends string, E extends string, C> {
|
|
22
|
+
private currentState;
|
|
23
|
+
private context;
|
|
24
|
+
private config;
|
|
25
|
+
private listeners;
|
|
26
|
+
constructor(config: StateMachineConfig<S, E, C>);
|
|
27
|
+
getState(): S;
|
|
28
|
+
getContext(): C;
|
|
29
|
+
send(eventType: E, payload?: any): boolean;
|
|
30
|
+
subscribe(listener: (state: S, context: C) => void): () => void;
|
|
31
|
+
reset(): void;
|
|
32
|
+
}
|
|
33
|
+
/***
|
|
34
|
+
* // 定义状态
|
|
35
|
+
type LightState = 'off' | 'low' | 'medium' | 'high';
|
|
36
|
+
|
|
37
|
+
// 定义事件
|
|
38
|
+
type LightEvent = 'TURN_ON' | 'TURN_OFF' | 'INCREASE' | 'DECREASE';
|
|
39
|
+
|
|
40
|
+
// 定义上下文(附加数据)
|
|
41
|
+
interface LightContext {
|
|
42
|
+
brightness: number;
|
|
43
|
+
powerUsage: number;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// 创建配置
|
|
47
|
+
const lightConfig: StateMachineConfig<LightState, LightEvent, LightContext> = {
|
|
48
|
+
initial: 'off',
|
|
49
|
+
context: {
|
|
50
|
+
brightness: 0,
|
|
51
|
+
powerUsage: 0
|
|
52
|
+
},
|
|
53
|
+
states: {
|
|
54
|
+
off: {
|
|
55
|
+
on: {
|
|
56
|
+
TURN_ON: {
|
|
57
|
+
target: 'low',
|
|
58
|
+
action: (ctx) => ({
|
|
59
|
+
...ctx,
|
|
60
|
+
brightness: 10,
|
|
61
|
+
powerUsage: ctx.powerUsage + 5
|
|
62
|
+
})
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
onEnter: (ctx) => {
|
|
66
|
+
console.log('💡 灯已关闭,当前功耗:', ctx.powerUsage);
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
low: {
|
|
70
|
+
on: {
|
|
71
|
+
TURN_OFF: {
|
|
72
|
+
target: 'off',
|
|
73
|
+
action: (ctx) => ({
|
|
74
|
+
...ctx,
|
|
75
|
+
brightness: 0,
|
|
76
|
+
powerUsage: ctx.powerUsage - 5
|
|
77
|
+
})
|
|
78
|
+
},
|
|
79
|
+
INCREASE: {
|
|
80
|
+
target: 'medium',
|
|
81
|
+
action: (ctx) => ({
|
|
82
|
+
...ctx,
|
|
83
|
+
brightness: 50,
|
|
84
|
+
powerUsage: ctx.powerUsage + 10
|
|
85
|
+
})
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
onEnter: (ctx) => {
|
|
89
|
+
console.log('💡 低亮度模式,亮度:', ctx.brightness);
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
medium: {
|
|
93
|
+
on: {
|
|
94
|
+
DECREASE: {
|
|
95
|
+
target: 'low',
|
|
96
|
+
action: (ctx) => ({
|
|
97
|
+
...ctx,
|
|
98
|
+
brightness: 10,
|
|
99
|
+
powerUsage: ctx.powerUsage - 10
|
|
100
|
+
})
|
|
101
|
+
},
|
|
102
|
+
INCREASE: {
|
|
103
|
+
target: 'high',
|
|
104
|
+
action: (ctx) => ({
|
|
105
|
+
...ctx,
|
|
106
|
+
brightness: 100,
|
|
107
|
+
powerUsage: ctx.powerUsage + 15
|
|
108
|
+
})
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
onEnter: (ctx) => {
|
|
112
|
+
console.log('💡 中等亮度模式,亮度:', ctx.brightness);
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
high: {
|
|
116
|
+
on: {
|
|
117
|
+
DECREASE: {
|
|
118
|
+
target: 'medium',
|
|
119
|
+
action: (ctx) => ({
|
|
120
|
+
...ctx,
|
|
121
|
+
brightness: 50,
|
|
122
|
+
powerUsage: ctx.powerUsage - 15
|
|
123
|
+
})
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
onEnter: (ctx) => {
|
|
127
|
+
console.log('💡 高亮度模式,亮度:', ctx.brightness);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
// 使用状态机
|
|
134
|
+
const lightMachine = new StateMachine(lightConfig);
|
|
135
|
+
|
|
136
|
+
// 监听状态变化
|
|
137
|
+
const unsubscribe = lightMachine.subscribe((state, context) => {
|
|
138
|
+
console.log(`状态变更为: ${state}, 亮度: ${context.brightness}`);
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
// 发送事件
|
|
142
|
+
lightMachine.send('TURN_ON'); // off -> low
|
|
143
|
+
lightMachine.send('INCREASE'); // low -> medium
|
|
144
|
+
lightMachine.send('INCREASE'); // medium -> high
|
|
145
|
+
lightMachine.send('DECREASE'); // high -> medium
|
|
146
|
+
lightMachine.send('TURN_OFF'); // medium -> off
|
|
147
|
+
|
|
148
|
+
unsubscribe();
|
|
149
|
+
*/
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export interface State {
|
|
2
|
+
name?: string;
|
|
3
|
+
transitions: string[];
|
|
4
|
+
onEnter?: (context: {
|
|
5
|
+
from: string;
|
|
6
|
+
eventData?: any;
|
|
7
|
+
data: any;
|
|
8
|
+
}) => boolean | void;
|
|
9
|
+
onState?: () => any;
|
|
10
|
+
onExit?: (context: {
|
|
11
|
+
to: string;
|
|
12
|
+
data: any;
|
|
13
|
+
}) => boolean | void;
|
|
14
|
+
onUpdate?: (data: any, elapsedMs: number) => any;
|
|
15
|
+
}
|
|
16
|
+
export interface StateMachineDescription {
|
|
17
|
+
start: string;
|
|
18
|
+
states: {
|
|
19
|
+
[name: string]: State;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
export type PossibleStates<TMachine> = TMachine extends StateMachineDescription ? Extract<keyof TMachine['states'], string> : never;
|
|
23
|
+
export interface StateMachineState {
|
|
24
|
+
data: any;
|
|
25
|
+
currentState: string;
|
|
26
|
+
}
|
|
27
|
+
export declare class StateMachine<TPossibleStates extends string, TData> {
|
|
28
|
+
startState: State;
|
|
29
|
+
private _currentState;
|
|
30
|
+
get currentState(): State;
|
|
31
|
+
set currentState(state: State);
|
|
32
|
+
states: Map<string, State>;
|
|
33
|
+
data?: TData;
|
|
34
|
+
static create<TMachine extends StateMachineDescription, TData>(machineDescription: TMachine, data?: TData): StateMachine<PossibleStates<TMachine>, TData>;
|
|
35
|
+
in(state: TPossibleStates): boolean;
|
|
36
|
+
go(stateName: TPossibleStates, eventData?: any): boolean;
|
|
37
|
+
update(elapsedMs: number): void;
|
|
38
|
+
save(saveKey: string): void;
|
|
39
|
+
restore(saveKey: string): void;
|
|
40
|
+
}
|
package/types/stats.module.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import Stats = require("stats.js");
|
|
2
|
-
|
|
3
|
-
export default Stats;
|
|
1
|
+
import Stats = require("stats.js");
|
|
2
|
+
|
|
3
|
+
export default Stats;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|