coily 0.3.0 → 0.4.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/index.cjs +4 -0
- package/dist/index.d.ts +5 -1
- package/dist/index.js +4 -0
- package/package.json +5 -5
package/dist/index.cjs
CHANGED
|
@@ -321,9 +321,12 @@ var createSpringChain = (initial, links, config, options) => {
|
|
|
321
321
|
};
|
|
322
322
|
|
|
323
323
|
// src/createSpringSystem.ts
|
|
324
|
+
var import_mitt3 = __toESM(require("mitt"), 1);
|
|
324
325
|
var createSpringSystem = () => {
|
|
325
326
|
const springs = /* @__PURE__ */ new Map();
|
|
327
|
+
const { emit, ...emitterApi } = (0, import_mitt3.default)();
|
|
326
328
|
return {
|
|
329
|
+
...emitterApi,
|
|
327
330
|
createSpring: (initial, config, options) => {
|
|
328
331
|
const [spring, simulate] = createSpringImpl(initial, config, options);
|
|
329
332
|
springs.set(spring, simulate);
|
|
@@ -344,6 +347,7 @@ var createSpringSystem = () => {
|
|
|
344
347
|
for (const simulate of springs.values()) {
|
|
345
348
|
simulate(delta);
|
|
346
349
|
}
|
|
350
|
+
emit("simulate:after", delta);
|
|
347
351
|
}
|
|
348
352
|
};
|
|
349
353
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -64,7 +64,11 @@ interface SpringChain extends Omit<SpringChainEmitter, 'emit'> {
|
|
|
64
64
|
interface StandaloneSpringChain extends SpringChain {
|
|
65
65
|
readonly simulate: SimulateFn;
|
|
66
66
|
}
|
|
67
|
-
|
|
67
|
+
type SpringSystemEmitter = Emitter<{
|
|
68
|
+
'simulate:after': number;
|
|
69
|
+
'*': number;
|
|
70
|
+
}>;
|
|
71
|
+
interface SpringSystem extends Omit<SpringSystemEmitter, 'emit'> {
|
|
68
72
|
createSpring: (initial: number, config: SpringConfig, options?: SpringOptions) => Spring;
|
|
69
73
|
createSpringChain: (initial: number, links: SpringChainLinkGetter[], config: SpringConfig, options?: SpringOptions) => SpringChain;
|
|
70
74
|
cleanup: (spring: Spring | SpringChain) => void;
|
package/dist/index.js
CHANGED
|
@@ -283,9 +283,12 @@ var createSpringChain = (initial, links, config, options) => {
|
|
|
283
283
|
};
|
|
284
284
|
|
|
285
285
|
// src/createSpringSystem.ts
|
|
286
|
+
import mitt3 from "mitt";
|
|
286
287
|
var createSpringSystem = () => {
|
|
287
288
|
const springs = /* @__PURE__ */ new Map();
|
|
289
|
+
const { emit, ...emitterApi } = mitt3();
|
|
288
290
|
return {
|
|
291
|
+
...emitterApi,
|
|
289
292
|
createSpring: (initial, config, options) => {
|
|
290
293
|
const [spring, simulate] = createSpringImpl(initial, config, options);
|
|
291
294
|
springs.set(spring, simulate);
|
|
@@ -306,6 +309,7 @@ var createSpringSystem = () => {
|
|
|
306
309
|
for (const simulate of springs.values()) {
|
|
307
310
|
simulate(delta);
|
|
308
311
|
}
|
|
312
|
+
emit("simulate:after", delta);
|
|
309
313
|
}
|
|
310
314
|
};
|
|
311
315
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "coily",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Simulate values using spring physics",
|
|
5
5
|
"author": "Tim Morris <timthewebguy@gmail.com>",
|
|
6
6
|
"homepage": "https://github.com/tkofh/coily#readme",
|
|
@@ -38,12 +38,12 @@
|
|
|
38
38
|
"url": "https://github.com/tkofh/coily/issues"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@vitest/ui": "^0.29.
|
|
42
|
-
"tsup": "^6.
|
|
43
|
-
"vitest": "^0.29.
|
|
41
|
+
"@vitest/ui": "^0.29.8",
|
|
42
|
+
"tsup": "^6.7.0",
|
|
43
|
+
"vitest": "^0.29.8"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"mitt": "^3.0.0"
|
|
47
47
|
},
|
|
48
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "143ecefa887bfffe5b5caa29fddcf01b3b3e17c1"
|
|
49
49
|
}
|