mirror of
https://github.com/ful1e5/Bibata_Cursor.git
synced 2025-05-31 15:18:30 -04:00
📚 JS Docs
This commit is contained in:
parent
427c53679a
commit
5c553f0447
4 changed files with 12 additions and 26 deletions
|
@ -36,8 +36,7 @@ export class BitmapsGenerator {
|
|||
|
||||
/**
|
||||
* Create directory if it doesn't exists.
|
||||
*
|
||||
* @param dirPath directory `absolute` or `relative` path.
|
||||
* @argument dirPath directory `absolute` or `relative` path.
|
||||
*/
|
||||
private createDir(dirPath: string) {
|
||||
dirPath = path.resolve(dirPath);
|
||||
|
@ -48,9 +47,8 @@ export class BitmapsGenerator {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param browser `puppeteer` browser instance.
|
||||
* @param content `.svg` file code.
|
||||
* @argument browser `puppeteer` browser instance.
|
||||
* @argument content `.svg` file code.
|
||||
*/
|
||||
private async getSvgElement(
|
||||
browser: Browser,
|
||||
|
@ -70,8 +68,7 @@ export class BitmapsGenerator {
|
|||
|
||||
/**
|
||||
* Close all pages of `Puppeteer.Browser`.
|
||||
*
|
||||
* @param browser `puppeteer` browser instance.
|
||||
* @argument browser `puppeteer` browser instance.
|
||||
*/
|
||||
private async closeAllPages(browser: Browser) {
|
||||
const pages = await browser.pages();
|
||||
|
@ -80,9 +77,8 @@ export class BitmapsGenerator {
|
|||
|
||||
/**
|
||||
* Generate `static` cursors bitmaps.
|
||||
*
|
||||
* @param browser `puppeteer` browser instance.
|
||||
* @param spinner `Ora` instance.
|
||||
* @argument browser `puppeteer` browser instance.
|
||||
* @argument spinner `Ora` instance.
|
||||
*/
|
||||
private async renderStaticCurs(browser: Browser, spinner: Ora) {
|
||||
for (let [cursor] of Object.entries(this.staticCurs)) {
|
||||
|
@ -104,7 +100,7 @@ export class BitmapsGenerator {
|
|||
|
||||
/**
|
||||
* Save animated cursors frames.
|
||||
* @param frames Record of `binary` Buffer.
|
||||
* @argument frames Record of `binary` Buffer.
|
||||
*/
|
||||
private saveFrames(frames: Frames) {
|
||||
for (let [cursor, { buffer }] of Object.entries(frames)) {
|
||||
|
@ -113,11 +109,9 @@ export class BitmapsGenerator {
|
|||
}
|
||||
}
|
||||
/**
|
||||
*
|
||||
* Generate `animated` cursors bitmaps.
|
||||
*
|
||||
* @param browser `puppeteer` browser instance.
|
||||
* @param spinner `Ora` instance.
|
||||
* @argument browser `puppeteer` browser instance.
|
||||
* @argument spinner `Ora` instance.
|
||||
*/
|
||||
private async renderAnimatedCurs(browser: Browser, spinner: Ora) {
|
||||
for (let [cursor] of Object.entries(this.animatedCurs)) {
|
||||
|
@ -173,7 +167,6 @@ export class BitmapsGenerator {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Generate cursors `bitmaps`.
|
||||
*/
|
||||
public async generate() {
|
||||
|
|
|
@ -24,15 +24,11 @@ export default class ColoredSvgGenerator {
|
|||
private animatedCurs: string[];
|
||||
|
||||
/**
|
||||
*
|
||||
* Generate custom color cursor's `.svg`.
|
||||
*
|
||||
* @param svgDir directory where animated & static cursors located.
|
||||
*
|
||||
* `svgDir` must contain sub-directory `static` and `animated`.
|
||||
*
|
||||
* Example: `svgs/static`, `svgs/animated`
|
||||
*
|
||||
* @param colors `Colors` for static cursors.
|
||||
*/
|
||||
constructor(private readonly themeConfig: ThemeConfig) {
|
||||
|
@ -42,7 +38,6 @@ export default class ColoredSvgGenerator {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Generate `static` cursors .svg file according to `Theme Colors`.
|
||||
*/
|
||||
public getStaticCursors(): Cursors {
|
||||
|
@ -65,7 +60,6 @@ export default class ColoredSvgGenerator {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Generate `animated` cursors .svg file according to `Theme Colors`.
|
||||
*/
|
||||
public getAnimatedCursors(): Cursors {
|
||||
|
|
|
@ -3,9 +3,7 @@ import path from "path";
|
|||
|
||||
export default class SvgDirectoryParser {
|
||||
/**
|
||||
*
|
||||
* Parse the `.svg` files directory.
|
||||
*
|
||||
* @param svgDir is relative/absolute path, Where source `.svg` files are stored.
|
||||
*/
|
||||
constructor(private svgDir: string) {
|
||||
|
@ -15,7 +13,6 @@ export default class SvgDirectoryParser {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Return all static cursors absolute paths from `svgDir/static` directory.
|
||||
*/
|
||||
public getStaticCursors(): string[] {
|
||||
|
@ -37,7 +34,6 @@ export default class SvgDirectoryParser {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Return all animated cursors absolute paths from `svgDir/animated` directory.
|
||||
*/
|
||||
public getAnimatedCursors(): string[] {
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
import { BitmapsGenerator } from "./BitmapsGenerator";
|
||||
import { ThemeColors } from "./types";
|
||||
|
||||
/**
|
||||
* Create cursors `bitmaps` from `svg` & `ThemeColors`.
|
||||
*/
|
||||
const createBitmaps = async (config: {
|
||||
themeColors: ThemeColors;
|
||||
svgDir: string;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue