first commit

This commit is contained in:
2026-06-24 09:48:54 +02:00
commit 41e62ddcad
33739 changed files with 4266226 additions and 0 deletions
+21
View File
@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2024 [Motion](https://motion.dev) B.V.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
+66
View File
@@ -0,0 +1,66 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
/*#__NO_SIDE_EFFECTS__*/
const noop = (any) => any;
exports.warning = noop;
exports.invariant = noop;
if (process.env.NODE_ENV !== "production") {
exports.warning = (check, message) => {
if (!check && typeof console !== "undefined") {
console.warn(message);
}
};
exports.invariant = (check, message) => {
if (!check) {
throw new Error(message);
}
};
}
/*#__NO_SIDE_EFFECTS__*/
function memo(callback) {
let result;
return () => {
if (result === undefined)
result = callback();
return result;
};
}
/*
Progress within given range
Given a lower limit and an upper limit, we return the progress
(expressed as a number 0-1) represented by the given value, and
limit that progress to within 0-1.
@param [number]: Lower limit
@param [number]: Upper limit
@param [number]: Value to find progress within given range
@return [number]: Progress of value within range as expressed 0-1
*/
/*#__NO_SIDE_EFFECTS__*/
const progress = (from, to, value) => {
const toFromDifference = to - from;
return toFromDifference === 0 ? 1 : (value - from) / toFromDifference;
};
/**
* Converts seconds to milliseconds
*
* @param seconds - Time in seconds.
* @return milliseconds - Converted time in milliseconds.
*/
/*#__NO_SIDE_EFFECTS__*/
const secondsToMilliseconds = (seconds) => seconds * 1000;
/*#__NO_SIDE_EFFECTS__*/
const millisecondsToSeconds = (milliseconds) => milliseconds / 1000;
exports.memo = memo;
exports.millisecondsToSeconds = millisecondsToSeconds;
exports.noop = noop;
exports.progress = progress;
exports.secondsToMilliseconds = secondsToMilliseconds;
+18
View File
@@ -0,0 +1,18 @@
import { noop } from './noop.mjs';
let warning = noop;
let invariant = noop;
if (process.env.NODE_ENV !== "production") {
warning = (check, message) => {
if (!check && typeof console !== "undefined") {
console.warn(message);
}
};
invariant = (check, message) => {
if (!check) {
throw new Error(message);
}
};
}
export { invariant, warning };
+5
View File
@@ -0,0 +1,5 @@
export { invariant, warning } from './errors.mjs';
export { memo } from './memo.mjs';
export { noop } from './noop.mjs';
export { progress } from './progress.mjs';
export { millisecondsToSeconds, secondsToMilliseconds } from './time-conversion.mjs';
+11
View File
@@ -0,0 +1,11 @@
/*#__NO_SIDE_EFFECTS__*/
function memo(callback) {
let result;
return () => {
if (result === undefined)
result = callback();
return result;
};
}
export { memo };
+4
View File
@@ -0,0 +1,4 @@
/*#__NO_SIDE_EFFECTS__*/
const noop = (any) => any;
export { noop };
+19
View File
@@ -0,0 +1,19 @@
/*
Progress within given range
Given a lower limit and an upper limit, we return the progress
(expressed as a number 0-1) represented by the given value, and
limit that progress to within 0-1.
@param [number]: Lower limit
@param [number]: Upper limit
@param [number]: Value to find progress within given range
@return [number]: Progress of value within range as expressed 0-1
*/
/*#__NO_SIDE_EFFECTS__*/
const progress = (from, to, value) => {
const toFromDifference = to - from;
return toFromDifference === 0 ? 1 : (value - from) / toFromDifference;
};
export { progress };
+12
View File
@@ -0,0 +1,12 @@
/**
* Converts seconds to milliseconds
*
* @param seconds - Time in seconds.
* @return milliseconds - Converted time in milliseconds.
*/
/*#__NO_SIDE_EFFECTS__*/
const secondsToMilliseconds = (seconds) => seconds * 1000;
/*#__NO_SIDE_EFFECTS__*/
const millisecondsToSeconds = (milliseconds) => milliseconds / 1000;
export { millisecondsToSeconds, secondsToMilliseconds };
+20
View File
@@ -0,0 +1,20 @@
type DevMessage = (check: boolean, message: string) => void;
declare let warning: DevMessage;
declare let invariant: DevMessage;
declare function memo<T extends any>(callback: () => T): () => T;
declare const noop: <T>(any: T) => T;
declare const progress: (from: number, to: number, value: number) => number;
/**
* Converts seconds to milliseconds
*
* @param seconds - Time in seconds.
* @return milliseconds - Converted time in milliseconds.
*/
declare const secondsToMilliseconds: (seconds: number) => number;
declare const millisecondsToSeconds: (milliseconds: number) => number;
export { type DevMessage, invariant, memo, millisecondsToSeconds, noop, progress, secondsToMilliseconds, warning };
+24
View File
@@ -0,0 +1,24 @@
{
"name": "motion-utils",
"version": "11.18.1",
"author": "Matt Perry",
"license": "MIT",
"repository": "https://github.com/motiondivision/motion",
"main": "./dist/cjs/index.js",
"types": "./dist/index.d.ts",
"module": "./dist/es/index.mjs",
"exports": {
".": {
"types": "./dist/index.d.ts",
"require": "./dist/cjs/index.js",
"import": "./dist/es/index.mjs",
"default": "./dist/cjs/index.js"
}
},
"scripts": {
"clean": "rm -rf types dist lib",
"build": "yarn clean && tsc -p . && rollup -c",
"dev": "concurrently -c blue,red -n tsc,rollup --kill-others \"tsc --watch -p . --preserveWatchOutput\" \"rollup --config --watch --no-watch.clearScreen\""
},
"gitHead": "95d7d7b515c886d195aad906fa4154f075764053"
}