@figliolia/chalk-animation 1.0.2 → 1.0.4
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/cjs/Animation.js +1 -1
- package/dist/cjs/ChalkAnimation.js +1 -1
- package/dist/cjs/Effects.js +1 -1
- package/dist/cjs/InstanceTracker.js +6 -6
- package/dist/cjs/__tests__/ChalkAnimation.test.js +95 -0
- package/dist/cjs/package.json +2 -2
- package/dist/mjs/Animation.js +2 -2
- package/dist/mjs/ChalkAnimation.js +2 -2
- package/dist/mjs/Effects.js +1 -1
- package/dist/mjs/FrameRate.js +1 -1
- package/dist/mjs/__tests__/ChalkAnimation.test.js +93 -0
- package/dist/mjs/index.js +2 -2
- package/dist/mjs/package.json +3 -2
- package/dist/types/__tests__/ChalkAnimation.test.d.ts +1 -0
- package/package.json +21 -18
- package/src/Animation.ts +2 -2
- package/src/ChalkAnimation.ts +1 -1
- package/dist/mjs/Animation.d.ts +0 -16
- package/dist/mjs/ChalkAnimation.d.ts +0 -21
- package/dist/mjs/Decor.d.ts +0 -5
- package/dist/mjs/Effects.d.ts +0 -13
- package/dist/mjs/FrameRate.d.ts +0 -11
- package/dist/mjs/InstanceTracker.d.ts +0 -15
- package/dist/mjs/index.d.ts +0 -5
- package/dist/mjs/types.d.ts +0 -6
- package/dist/{cjs → types}/Animation.d.ts +1 -1
- /package/dist/{cjs → types}/ChalkAnimation.d.ts +0 -0
- /package/dist/{cjs → types}/Decor.d.ts +0 -0
- /package/dist/{cjs → types}/Effects.d.ts +0 -0
- /package/dist/{cjs → types}/FrameRate.d.ts +0 -0
- /package/dist/{cjs → types}/InstanceTracker.d.ts +0 -0
- /package/dist/{cjs → types}/index.d.ts +0 -0
- /package/dist/{cjs → types}/types.d.ts +0 -0
package/dist/cjs/Animation.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Animation = void 0;
|
|
4
|
-
const FrameRate_1 = require("./FrameRate");
|
|
5
4
|
const Decor_1 = require("./Decor");
|
|
5
|
+
const FrameRate_1 = require("./FrameRate");
|
|
6
6
|
class Animation extends FrameRate_1.FrameRate {
|
|
7
7
|
constructor(effect, str, delay = 0, speed = 0) {
|
|
8
8
|
super(delay, speed);
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
var _a;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.ChalkAnimation = void 0;
|
|
5
|
-
const Effects_1 = require("./Effects");
|
|
6
5
|
const Animation_1 = require("./Animation");
|
|
6
|
+
const Effects_1 = require("./Effects");
|
|
7
7
|
/**
|
|
8
8
|
* Chalk Animation
|
|
9
9
|
*
|
package/dist/cjs/Effects.js
CHANGED
|
@@ -111,6 +111,7 @@ class Effects {
|
|
|
111
111
|
chalk_1.default.white(str.substr(chars)));
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
|
+
exports.Effects = Effects;
|
|
114
115
|
Effects.longHsv = { interpolation: "hsv", hsvSpin: "long" };
|
|
115
116
|
Effects.glitchChars = "x*0987654321[]0-~@#(____!!!!\\|?????....0000\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t";
|
|
116
117
|
__decorate([
|
|
@@ -131,4 +132,3 @@ __decorate([
|
|
|
131
132
|
__decorate([
|
|
132
133
|
Decor_1.Decor.bound
|
|
133
134
|
], Effects, "karaoke", null);
|
|
134
|
-
exports.Effects = Effects;
|
|
@@ -5,18 +5,18 @@ exports.InstanceTracker = void 0;
|
|
|
5
5
|
const event_emitter_1 = require("@figliolia/event-emitter");
|
|
6
6
|
class InstanceTracker {
|
|
7
7
|
constructor() {
|
|
8
|
-
|
|
9
|
-
this.ID =
|
|
10
|
-
|
|
8
|
+
_a.clearAll();
|
|
9
|
+
this.ID = _a.IDs.get();
|
|
10
|
+
_a.bucket.set(this.ID, this.instance);
|
|
11
11
|
}
|
|
12
12
|
get instance() {
|
|
13
13
|
return this;
|
|
14
14
|
}
|
|
15
15
|
static clearAll() {
|
|
16
|
-
for (const [, animation] of
|
|
16
|
+
for (const [, animation] of _a.bucket) {
|
|
17
17
|
animation.stop();
|
|
18
18
|
}
|
|
19
|
-
|
|
19
|
+
_a.bucket.clear();
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
exports.InstanceTracker = InstanceTracker;
|
|
@@ -29,7 +29,7 @@ InstanceTracker.loggers = ["log", "warn", "info", "error"];
|
|
|
29
29
|
_a.loggers.forEach(method => {
|
|
30
30
|
const original = console[method];
|
|
31
31
|
console[method] = function (...args) {
|
|
32
|
-
|
|
32
|
+
_a.clearAll();
|
|
33
33
|
return original.apply(console, args);
|
|
34
34
|
};
|
|
35
35
|
});
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const ChalkAnimation_1 = require("../ChalkAnimation");
|
|
4
|
+
const Effects_1 = require("../Effects");
|
|
5
|
+
const InstanceTracker_1 = require("../InstanceTracker");
|
|
6
|
+
const animations = [
|
|
7
|
+
"rainbow",
|
|
8
|
+
"pulse",
|
|
9
|
+
"glitch",
|
|
10
|
+
"radar",
|
|
11
|
+
"neon",
|
|
12
|
+
"karaoke",
|
|
13
|
+
];
|
|
14
|
+
describe("Chalk Animation", () => {
|
|
15
|
+
afterAll(() => {
|
|
16
|
+
jest.restoreAllMocks();
|
|
17
|
+
});
|
|
18
|
+
describe("Spawn", () => {
|
|
19
|
+
beforeAll(() => {
|
|
20
|
+
jest.spyOn(InstanceTracker_1.InstanceTracker, "LOG").mockImplementation(() => { });
|
|
21
|
+
});
|
|
22
|
+
afterEach(() => {
|
|
23
|
+
InstanceTracker_1.InstanceTracker.clearAll();
|
|
24
|
+
InstanceTracker_1.InstanceTracker.IDs.reset();
|
|
25
|
+
});
|
|
26
|
+
animations.forEach(name => {
|
|
27
|
+
it(`ChalkAnimation.${name} - returns an initialized animation instance`, () => {
|
|
28
|
+
const animation = ChalkAnimation_1.ChalkAnimation[name]("hello");
|
|
29
|
+
expect(animation.effect).toEqual(Effects_1.Effects[name]);
|
|
30
|
+
expect(typeof animation.ID).toEqual("string");
|
|
31
|
+
expect(animation.text).toEqual(["hello"]);
|
|
32
|
+
expect(animation.lines).toEqual(1);
|
|
33
|
+
expect(animation.speed).toEqual(1);
|
|
34
|
+
expect(animation.current).toEqual(1);
|
|
35
|
+
expect(animation.initialized).toEqual(true);
|
|
36
|
+
expect(animation.stopped).toEqual(false);
|
|
37
|
+
expect(animation.controller).not.toEqual(null);
|
|
38
|
+
expect(InstanceTracker_1.InstanceTracker.bucket.size).toEqual(1);
|
|
39
|
+
animation.stop();
|
|
40
|
+
expect(animation.stopped).toEqual(true);
|
|
41
|
+
expect(animation.controller).toEqual(null);
|
|
42
|
+
});
|
|
43
|
+
InstanceTracker_1.InstanceTracker.loggers.forEach(method => {
|
|
44
|
+
it(`ChalkAnimation.${name} - subsequent console.${method} stop the animation`, () => {
|
|
45
|
+
const animation = ChalkAnimation_1.ChalkAnimation[name]("hello");
|
|
46
|
+
expect(animation.stopped).toEqual(false);
|
|
47
|
+
console[method]("");
|
|
48
|
+
expect(animation.stopped).toEqual(true);
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
it(`ChalkAnimation.${name} - can be stopped and restarted`, () => {
|
|
52
|
+
const animation = ChalkAnimation_1.ChalkAnimation[name]("hello");
|
|
53
|
+
animation.stop();
|
|
54
|
+
expect(animation.stopped).toEqual(true);
|
|
55
|
+
animation.start();
|
|
56
|
+
expect(animation.current).toEqual(2);
|
|
57
|
+
});
|
|
58
|
+
it(`ChalkAnimation.${name} - can be manually rendered at a desired frame rate`, () => {
|
|
59
|
+
const animation = ChalkAnimation_1.ChalkAnimation[name]("hello").stop();
|
|
60
|
+
expect(animation.current).toEqual(1);
|
|
61
|
+
animation.render();
|
|
62
|
+
expect(animation.current).toEqual(2);
|
|
63
|
+
animation.render();
|
|
64
|
+
expect(animation.current).toEqual(3);
|
|
65
|
+
});
|
|
66
|
+
it(`ChalkAnimation.${name} - text can be replaced`, () => {
|
|
67
|
+
if (name === "radar") {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
const animation = ChalkAnimation_1.ChalkAnimation[name]("Y Y Y").stop();
|
|
71
|
+
const f1 = animation.nextFrame();
|
|
72
|
+
animation.replace("Z Z Z");
|
|
73
|
+
const f2 = animation.nextFrame();
|
|
74
|
+
expect(f1.includes("Y")).toEqual(true);
|
|
75
|
+
expect(f1.includes("Z")).toEqual(false);
|
|
76
|
+
expect(f2.includes("Y")).toEqual(false);
|
|
77
|
+
expect(f2.includes("Z")).toEqual(true);
|
|
78
|
+
});
|
|
79
|
+
it(`ChalkAnimation.${name} - supports multiline strings`, () => {
|
|
80
|
+
const animation = ChalkAnimation_1.ChalkAnimation[name]("Lorem\nipsum\ndolor\nsit\namet").stop();
|
|
81
|
+
const frame = animation.nextFrame();
|
|
82
|
+
expect(animation.lines).toEqual(5);
|
|
83
|
+
expect(frame.split("\n")).toHaveLength(5);
|
|
84
|
+
});
|
|
85
|
+
it(`ChalkAnimation.${name} - supports 5K+ frames`, () => {
|
|
86
|
+
const animation = ChalkAnimation_1.ChalkAnimation[name]("Lorem\nipsum\ndolor\nsit\namet").stop();
|
|
87
|
+
for (let i = 0; i < 5000; i++) {
|
|
88
|
+
expect(() => {
|
|
89
|
+
animation.nextFrame();
|
|
90
|
+
}).not.toThrow();
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
});
|
package/dist/cjs/package.json
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
}
|
|
2
|
+
"type": "commonjs"
|
|
3
|
+
}
|
package/dist/mjs/Animation.js
CHANGED
package/dist/mjs/Effects.js
CHANGED
|
@@ -6,7 +6,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
6
6
|
};
|
|
7
7
|
import chalk from "chalk";
|
|
8
8
|
import gradient from "gradient-string";
|
|
9
|
-
import { Decor } from "./Decor";
|
|
9
|
+
import { Decor } from "./Decor.js";
|
|
10
10
|
export class Effects {
|
|
11
11
|
static longHsv = { interpolation: "hsv", hsvSpin: "long" };
|
|
12
12
|
static glitchChars = "x*0987654321[]0-~@#(____!!!!\\|?????....0000\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t";
|
package/dist/mjs/FrameRate.js
CHANGED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { ChalkAnimation } from "../ChalkAnimation.js";
|
|
2
|
+
import { Effects } from "../Effects.js";
|
|
3
|
+
import { InstanceTracker } from "../InstanceTracker.js";
|
|
4
|
+
const animations = [
|
|
5
|
+
"rainbow",
|
|
6
|
+
"pulse",
|
|
7
|
+
"glitch",
|
|
8
|
+
"radar",
|
|
9
|
+
"neon",
|
|
10
|
+
"karaoke",
|
|
11
|
+
];
|
|
12
|
+
describe("Chalk Animation", () => {
|
|
13
|
+
afterAll(() => {
|
|
14
|
+
jest.restoreAllMocks();
|
|
15
|
+
});
|
|
16
|
+
describe("Spawn", () => {
|
|
17
|
+
beforeAll(() => {
|
|
18
|
+
jest.spyOn(InstanceTracker, "LOG").mockImplementation(() => { });
|
|
19
|
+
});
|
|
20
|
+
afterEach(() => {
|
|
21
|
+
InstanceTracker.clearAll();
|
|
22
|
+
InstanceTracker.IDs.reset();
|
|
23
|
+
});
|
|
24
|
+
animations.forEach(name => {
|
|
25
|
+
it(`ChalkAnimation.${name} - returns an initialized animation instance`, () => {
|
|
26
|
+
const animation = ChalkAnimation[name]("hello");
|
|
27
|
+
expect(animation.effect).toEqual(Effects[name]);
|
|
28
|
+
expect(typeof animation.ID).toEqual("string");
|
|
29
|
+
expect(animation.text).toEqual(["hello"]);
|
|
30
|
+
expect(animation.lines).toEqual(1);
|
|
31
|
+
expect(animation.speed).toEqual(1);
|
|
32
|
+
expect(animation.current).toEqual(1);
|
|
33
|
+
expect(animation.initialized).toEqual(true);
|
|
34
|
+
expect(animation.stopped).toEqual(false);
|
|
35
|
+
expect(animation.controller).not.toEqual(null);
|
|
36
|
+
expect(InstanceTracker.bucket.size).toEqual(1);
|
|
37
|
+
animation.stop();
|
|
38
|
+
expect(animation.stopped).toEqual(true);
|
|
39
|
+
expect(animation.controller).toEqual(null);
|
|
40
|
+
});
|
|
41
|
+
InstanceTracker.loggers.forEach(method => {
|
|
42
|
+
it(`ChalkAnimation.${name} - subsequent console.${method} stop the animation`, () => {
|
|
43
|
+
const animation = ChalkAnimation[name]("hello");
|
|
44
|
+
expect(animation.stopped).toEqual(false);
|
|
45
|
+
console[method]("");
|
|
46
|
+
expect(animation.stopped).toEqual(true);
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
it(`ChalkAnimation.${name} - can be stopped and restarted`, () => {
|
|
50
|
+
const animation = ChalkAnimation[name]("hello");
|
|
51
|
+
animation.stop();
|
|
52
|
+
expect(animation.stopped).toEqual(true);
|
|
53
|
+
animation.start();
|
|
54
|
+
expect(animation.current).toEqual(2);
|
|
55
|
+
});
|
|
56
|
+
it(`ChalkAnimation.${name} - can be manually rendered at a desired frame rate`, () => {
|
|
57
|
+
const animation = ChalkAnimation[name]("hello").stop();
|
|
58
|
+
expect(animation.current).toEqual(1);
|
|
59
|
+
animation.render();
|
|
60
|
+
expect(animation.current).toEqual(2);
|
|
61
|
+
animation.render();
|
|
62
|
+
expect(animation.current).toEqual(3);
|
|
63
|
+
});
|
|
64
|
+
it(`ChalkAnimation.${name} - text can be replaced`, () => {
|
|
65
|
+
if (name === "radar") {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
const animation = ChalkAnimation[name]("Y Y Y").stop();
|
|
69
|
+
const f1 = animation.nextFrame();
|
|
70
|
+
animation.replace("Z Z Z");
|
|
71
|
+
const f2 = animation.nextFrame();
|
|
72
|
+
expect(f1.includes("Y")).toEqual(true);
|
|
73
|
+
expect(f1.includes("Z")).toEqual(false);
|
|
74
|
+
expect(f2.includes("Y")).toEqual(false);
|
|
75
|
+
expect(f2.includes("Z")).toEqual(true);
|
|
76
|
+
});
|
|
77
|
+
it(`ChalkAnimation.${name} - supports multiline strings`, () => {
|
|
78
|
+
const animation = ChalkAnimation[name]("Lorem\nipsum\ndolor\nsit\namet").stop();
|
|
79
|
+
const frame = animation.nextFrame();
|
|
80
|
+
expect(animation.lines).toEqual(5);
|
|
81
|
+
expect(frame.split("\n")).toHaveLength(5);
|
|
82
|
+
});
|
|
83
|
+
it(`ChalkAnimation.${name} - supports 5K+ frames`, () => {
|
|
84
|
+
const animation = ChalkAnimation[name]("Lorem\nipsum\ndolor\nsit\namet").stop();
|
|
85
|
+
for (let i = 0; i < 5000; i++) {
|
|
86
|
+
expect(() => {
|
|
87
|
+
animation.nextFrame();
|
|
88
|
+
}).not.toThrow();
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
});
|
package/dist/mjs/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { ChalkAnimation } from "./ChalkAnimation";
|
|
2
|
-
export * from "./types";
|
|
1
|
+
export { ChalkAnimation } from "./ChalkAnimation.js";
|
|
2
|
+
export * from "./types.js";
|
package/dist/mjs/package.json
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@figliolia/chalk-animation",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "An ESM/Common.js compatible typescript port of the popular 'chalk-animation' library",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"animation",
|
|
@@ -30,24 +30,22 @@
|
|
|
30
30
|
"exports": {
|
|
31
31
|
".": {
|
|
32
32
|
"import": "./dist/mjs/index.js",
|
|
33
|
-
"require": "./dist/cjs/index.js"
|
|
33
|
+
"require": "./dist/cjs/index.js",
|
|
34
|
+
"types": "./dist/types/index.d.ts"
|
|
34
35
|
}
|
|
35
36
|
},
|
|
36
37
|
"main": "dist/cjs/index.js",
|
|
37
38
|
"module": "dist/mjs/index.js",
|
|
38
|
-
"types": "dist/
|
|
39
|
+
"types": "dist/types/index.d.ts",
|
|
39
40
|
"bin": "./cli.js",
|
|
40
41
|
"files": [
|
|
41
42
|
"dist",
|
|
42
43
|
"src/*"
|
|
43
44
|
],
|
|
44
45
|
"scripts": {
|
|
45
|
-
"build": "
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"lint": "tsc --noemit && eslint ./ --fix",
|
|
49
|
-
"package-targets": "cd/package.sh",
|
|
50
|
-
"test": "jest"
|
|
46
|
+
"build": "ts-packager -e src",
|
|
47
|
+
"lint": "tsx ci/commands/Lint.ts",
|
|
48
|
+
"test": "tsx ci/commands/Test.ts"
|
|
51
49
|
},
|
|
52
50
|
"dependencies": {
|
|
53
51
|
"@figliolia/event-emitter": "^1.1.1",
|
|
@@ -55,9 +53,11 @@
|
|
|
55
53
|
"gradient-string": "^2.0.2"
|
|
56
54
|
},
|
|
57
55
|
"devDependencies": {
|
|
58
|
-
"@
|
|
59
|
-
"@
|
|
60
|
-
"@types/
|
|
56
|
+
"@figliolia/child-process": "^1.0.1",
|
|
57
|
+
"@figliolia/ts-packager": "^1.1.0",
|
|
58
|
+
"@types/gradient-string": "^1.1.6",
|
|
59
|
+
"@types/jest": "^29.5.12",
|
|
60
|
+
"@types/node": "^20.11.19",
|
|
61
61
|
"@typescript-eslint/eslint-plugin": "^5.59.1",
|
|
62
62
|
"@typescript-eslint/parser": "^5.59.1",
|
|
63
63
|
"eslint": "^8.39.0",
|
|
@@ -67,13 +67,16 @@
|
|
|
67
67
|
"eslint-import-resolver-typescript": "^3.6.1",
|
|
68
68
|
"eslint-plugin-import": "^2.27.5",
|
|
69
69
|
"eslint-plugin-json-format": "^2.0.1",
|
|
70
|
-
"eslint-plugin-prettier": "^
|
|
70
|
+
"eslint-plugin-prettier": "^5.1.3",
|
|
71
71
|
"eslint-plugin-simple-import-sort": "^10.0.0",
|
|
72
|
+
"eslint-plugin-unused-imports": "3",
|
|
72
73
|
"jest": "^29.7.0",
|
|
73
|
-
"prettier": "^2.
|
|
74
|
-
"ts-jest": "^29.
|
|
75
|
-
"ts-node": "^10.9.
|
|
76
|
-
"
|
|
74
|
+
"prettier": "^3.2.4",
|
|
75
|
+
"ts-jest": "^29.2.4",
|
|
76
|
+
"ts-node": "^10.9.2",
|
|
77
|
+
"tsc-alias": "^1.8.8",
|
|
78
|
+
"tsx": "^4.7.1",
|
|
79
|
+
"typescript": "^5.3.3"
|
|
77
80
|
},
|
|
78
81
|
"engines": {
|
|
79
82
|
"node": ">=16"
|
|
@@ -81,4 +84,4 @@
|
|
|
81
84
|
"publishConfig": {
|
|
82
85
|
"access": "public"
|
|
83
86
|
}
|
|
84
|
-
}
|
|
87
|
+
}
|
package/src/Animation.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { AnimationFN } from "./types";
|
|
2
|
-
import { FrameRate } from "./FrameRate";
|
|
3
1
|
import { Decor } from "./Decor";
|
|
2
|
+
import { FrameRate } from "./FrameRate";
|
|
3
|
+
import type { AnimationFN } from "./types";
|
|
4
4
|
|
|
5
5
|
export class Animation extends FrameRate {
|
|
6
6
|
lines: number;
|
package/src/ChalkAnimation.ts
CHANGED
package/dist/mjs/Animation.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { AnimationFN } from "./types";
|
|
2
|
-
import { FrameRate } from "./FrameRate";
|
|
3
|
-
export declare class Animation extends FrameRate {
|
|
4
|
-
lines: number;
|
|
5
|
-
text: string[];
|
|
6
|
-
stopped: boolean;
|
|
7
|
-
initialized: boolean;
|
|
8
|
-
effect: AnimationFN;
|
|
9
|
-
static readonly LINE_BREAKS: RegExp;
|
|
10
|
-
constructor(effect: AnimationFN, str: string, delay?: number, speed?: number);
|
|
11
|
-
render(): void;
|
|
12
|
-
nextFrame(): string;
|
|
13
|
-
readonly replace: (str: string) => this;
|
|
14
|
-
readonly stop: () => this;
|
|
15
|
-
readonly start: () => this;
|
|
16
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { Animation } from "./Animation";
|
|
2
|
-
/**
|
|
3
|
-
* Chalk Animation
|
|
4
|
-
*
|
|
5
|
-
* Console animations for your CLI tools
|
|
6
|
-
*
|
|
7
|
-
* ```typescript
|
|
8
|
-
* const animation = ChalkAnimation.rainbow("hello!");
|
|
9
|
-
* animation.stop();
|
|
10
|
-
* animation.start();
|
|
11
|
-
* ```
|
|
12
|
-
*/
|
|
13
|
-
export declare class ChalkAnimation {
|
|
14
|
-
static readonly neon: (str: string, speed?: number) => Animation;
|
|
15
|
-
static readonly radar: (str: string, speed?: number) => Animation;
|
|
16
|
-
static readonly pulse: (str: string, speed?: number) => Animation;
|
|
17
|
-
static readonly glitch: (str: string, speed?: number) => Animation;
|
|
18
|
-
static readonly rainbow: (str: string, speed?: number) => Animation;
|
|
19
|
-
static readonly karaoke: (str: string, speed?: number) => Animation;
|
|
20
|
-
private static configure;
|
|
21
|
-
}
|
package/dist/mjs/Decor.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { MethodKeys, MethodLike } from "./types";
|
|
2
|
-
export declare class Decor {
|
|
3
|
-
static bound<T, K extends MethodKeys<T>>(target: T, _propertyKey: K, descriptor: TypedPropertyDescriptor<MethodLike>): void;
|
|
4
|
-
static chainable<I, F extends (...args: any[]) => any>(instance: I, func: F): (...params: Parameters<F>) => I;
|
|
5
|
-
}
|
package/dist/mjs/Effects.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export declare class Effects {
|
|
2
|
-
static readonly longHsv: {
|
|
3
|
-
interpolation: string;
|
|
4
|
-
hsvSpin: string;
|
|
5
|
-
};
|
|
6
|
-
static readonly glitchChars = "x*0987654321[]0-~@#(____!!!!\\|?????....0000\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t";
|
|
7
|
-
static rainbow(str: string, frame: number): string;
|
|
8
|
-
static pulse(str: string, frame: number): string;
|
|
9
|
-
static glitch(str: string, frame: number): string;
|
|
10
|
-
static radar(str: string, frame: number): string;
|
|
11
|
-
static neon(str: string, frame: number): string;
|
|
12
|
-
static karaoke(str: string, frame: number): string;
|
|
13
|
-
}
|
package/dist/mjs/FrameRate.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { InstanceTracker } from "./InstanceTracker";
|
|
2
|
-
export declare class FrameRate extends InstanceTracker {
|
|
3
|
-
current: number;
|
|
4
|
-
speed: number;
|
|
5
|
-
delay: number;
|
|
6
|
-
controller: ReturnType<typeof setTimeout> | null;
|
|
7
|
-
constructor(delay: number, speed: number);
|
|
8
|
-
schedule<F extends () => any>(func: F): void;
|
|
9
|
-
increment(): void;
|
|
10
|
-
clearFrames(): void;
|
|
11
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { AutoIncrementingID } from "@figliolia/event-emitter";
|
|
2
|
-
import type { Animation } from "./Animation";
|
|
3
|
-
export declare class InstanceTracker {
|
|
4
|
-
ID: string;
|
|
5
|
-
static readonly LOG: {
|
|
6
|
-
(...data: any[]): void;
|
|
7
|
-
(message?: any, ...optionalParams: any[]): void;
|
|
8
|
-
};
|
|
9
|
-
static IDs: AutoIncrementingID;
|
|
10
|
-
static bucket: Map<string, Animation>;
|
|
11
|
-
static loggers: readonly ["log", "warn", "info", "error"];
|
|
12
|
-
constructor();
|
|
13
|
-
get instance(): Animation;
|
|
14
|
-
static clearAll(): void;
|
|
15
|
-
}
|
package/dist/mjs/index.d.ts
DELETED
package/dist/mjs/types.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export type AnimationFN = (str: string, frame: number) => string;
|
|
2
|
-
export type AnimationName = "rainbow" | "pulse" | "glitch" | "radar" | "neon" | "karaoke";
|
|
3
|
-
export type MethodLike<T = any> = (...args: any[]) => T;
|
|
4
|
-
export type MethodKeys<T, R = any> = keyof {
|
|
5
|
-
[K in keyof T as Required<T>[K] extends MethodLike<R> ? K : never]: T[K];
|
|
6
|
-
};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|