Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

glitched-writer

Package Overview
Dependencies
Maintainers
1
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

glitched-writer - npm Package Compare versions

Comparing version 2.0.17 to 2.0.18

2

lib/cjs/char.d.ts

@@ -13,3 +13,3 @@ import GlitchedWriter from './index';

afterGlitchChance: number;
letterize?: {
els?: {
charEl?: HTMLSpanElement;

@@ -16,0 +16,0 @@ ghostsBeforeEl: HTMLSpanElement;

@@ -24,3 +24,3 @@ "use strict";

if (writer.options.letterize) {
this.letterize = {
this.els = {
ghostsBeforeEl: document.createElement('span'),

@@ -30,5 +30,5 @@ letterEl: document.createElement('span'),

};
this.letterize.ghostsBeforeEl.className = 'gw-ghosts';
this.letterize.ghostsAfterEl.className = 'gw-ghosts';
this.letterize.letterEl.className = 'gw-letter';
this.els.ghostsBeforeEl.className = 'gw-ghosts';
this.els.ghostsAfterEl.className = 'gw-ghosts';
this.els.letterEl.className = 'gw-letter';
}

@@ -42,2 +42,3 @@ }

this.ghostsBefore = [...initialGhosts];
this.writer.state.nGhosts += initialGhosts.length;
this.stepsLeft = options.stepsLeft;

@@ -52,4 +53,4 @@ if (isTag)

this.setProps(l, gl, initialGhosts, isTag);
if (this.letterize)
this.letterize.letterEl.className = 'gw-letter';
if (this.els)
this.els.letterEl.className = 'gw-letter';
}

@@ -62,3 +63,6 @@ get string() {

const { l: char, gl: goal, ghostsBefore, ghostsAfter } = this;
return (char === goal && ghostsBefore.length === 0 && ghostsAfter.length === 0);
return ((char === goal &&
ghostsBefore.length === 0 &&
ghostsAfter.length === 0) ||
this.isTag);
}

@@ -72,5 +76,5 @@ get interval() {

writeToElement() {
if (!this.letterize)
if (!this.els)
return;
const { ghostsBeforeEl, ghostsAfterEl, letterEl } = this.letterize;
const { ghostsBeforeEl, ghostsAfterEl, letterEl } = this.els;
letterEl.innerHTML = this.l;

@@ -81,5 +85,5 @@ ghostsBeforeEl.textContent = this.ghostsBefore.join('');

set spanElement(el) {
if (!this.letterize)
if (!this.els)
return;
this.letterize.charEl = el;
this.els.charEl = el;
this.appendChildren();

@@ -89,3 +93,3 @@ }

var _a, _b;
(_b = (_a = this.letterize) === null || _a === void 0 ? void 0 : _a.charEl) === null || _b === void 0 ? void 0 : _b.append(this.letterize.ghostsBeforeEl, this.letterize.letterEl, this.letterize.ghostsAfterEl);
(_b = (_a = this.els) === null || _a === void 0 ? void 0 : _a.charEl) === null || _b === void 0 ? void 0 : _b.append(this.els.ghostsBeforeEl, this.els.letterEl, this.els.ghostsAfterEl);
this.writeToElement();

@@ -96,17 +100,25 @@ }

return __awaiter(this, void 0, void 0, function* () {
const { writer } = this;
if (this.isTag) {
this.l = this.gl;
writer.emiter.call('step');
return true;
}
const loop = () => __awaiter(this, void 0, void 0, function* () {
!this.isTag && (yield utils_1.wait(this.interval));
yield utils_1.wait(this.interval);
const lastString = this.string;
this.step();
if (lastString !== this.string) {
this.writer.emiter.call('step');
writer.emiter.call('step');
this.writeToElement();
}
this.stepsLeft--;
!writer.options.endless && this.stepsLeft--;
});
!this.isTag && (yield utils_1.wait(this.writer.options.genInitDelay));
yield utils_1.promiseWhile(() => !this.finished && !this.writer.state.isPaused && !this.stop, loop);
yield utils_1.wait(writer.options.genInitDelay);
yield utils_1.promiseWhile(() => (!this.finished || writer.options.endless) &&
!writer.state.isPaused &&
!this.stop, loop);
if (this.finished) {
(_b = (_a = this.letterize) === null || _a === void 0 ? void 0 : _a.charEl) === null || _b === void 0 ? void 0 : _b.classList.add('gw-finished');
(_c = this.letterize) === null || _c === void 0 ? void 0 : _c.letterEl.classList.remove('gw-glitched');
(_b = (_a = this.els) === null || _a === void 0 ? void 0 : _a.charEl) === null || _b === void 0 ? void 0 : _b.classList.add('gw-finished');
(_c = this.els) === null || _c === void 0 ? void 0 : _c.letterEl.classList.remove('gw-glitched');
}

@@ -118,10 +130,12 @@ return this.finished;

var _a, _b;
const { writer } = this;
if ((this.stepsLeft > 0 && this.l !== this.gl) ||
(utils_1.coinFlip(this.afterGlitchChance) && !this.isTag && !this.isWhitespace)) {
(utils_1.coinFlip(this.afterGlitchChance) && !this.isWhitespace) ||
writer.options.endless) {
/**
* IS GROWING
*/
const { ghostChance, changeChance } = this.writer.options;
const { ghostChance, changeChance } = writer.options;
if (utils_1.coinFlip(ghostChance)) {
if (this.writer.state.ghostsInLimit)
if (writer.state.ghostsInLimit)
this.addGhost();

@@ -132,4 +146,4 @@ else

if (utils_1.coinFlip(changeChance)) {
(_a = this.letterize) === null || _a === void 0 ? void 0 : _a.letterEl.classList.add('gw-glitched');
this.l = this.writer.options.genGhost;
(_a = this.els) === null || _a === void 0 ? void 0 : _a.letterEl.classList.add('gw-glitched');
this.l = writer.options.genGhost;
}

@@ -141,3 +155,3 @@ }

*/
(_b = this.letterize) === null || _b === void 0 ? void 0 : _b.letterEl.classList.remove('gw-glitched');
(_b = this.els) === null || _b === void 0 ? void 0 : _b.letterEl.classList.remove('gw-glitched');
this.l = this.gl;

@@ -155,6 +169,7 @@ this.removeGhost();

removeGhost() {
this.writer.state.nGhosts--;
utils_1.coinFlip() && this.ghostsBefore.length > 0
const deleted = utils_1.coinFlip() && this.ghostsBefore.length > 0
? utils_1.deleteRandom(this.ghostsBefore)
: utils_1.deleteRandom(this.ghostsAfter);
if (deleted)
this.writer.state.nGhosts--;
}

@@ -161,0 +176,0 @@ }

@@ -13,3 +13,3 @@ "use strict";

this.writer.updateString();
const { htmlElement, writerData } = this.writer, string = eventType === 'finish' ? this.writer.goalString : this.writer.string;
const { htmlElement, writerData, string } = this.writer;
if (htmlElement && !this.writer.options.letterize) {

@@ -16,0 +16,0 @@ if (this.writer.options.html)

@@ -86,3 +86,2 @@ "use strict";

this.options.setCharset();
// this.removeSpecialChars()
if (this.options.startFrom === 'matching')

@@ -191,3 +190,2 @@ this.createMatchingCharTable();

pi++;
const pl = previous[pi];
if (gl.type === 'tag') {

@@ -203,6 +201,5 @@ pi--;

pi = fi;
this.state.nGhosts += appendedText.length;
}
else
this.setChar(gi, pl || this.options.space, gl);
this.setChar(gi, previous[pi], gl);
});

@@ -216,3 +213,2 @@ this.removeExtraChars(goalStringArray.length);

pi++;
const pl = previous[pi] || this.options.space;
if (gl.type === 'tag') {

@@ -223,3 +219,3 @@ pi--;

}
this.setChar(gi, pl, gl);
this.setChar(gi, previous[pi], gl);
});

@@ -251,11 +247,10 @@ this.removeExtraChars(goalStringArray.length);

char
? char.reset(pl, gl.value || this.options.space, appendedText, gl.type === 'tag')
: charTable.push(new char_1.default(this, pl, gl.value || this.options.space, appendedText, gl.type === 'tag'));
? char.reset(pl !== null && pl !== void 0 ? pl : '', gl.value || this.options.space, appendedText, gl.type === 'tag')
: charTable.push(new char_1.default(this, pl !== null && pl !== void 0 ? pl : '', gl.value || this.options.space, appendedText, gl.type === 'tag'));
}
get goalStringArray() {
const { goalString: goal, previousString, options } = this, goalArray = options.html
const { goalString: goal, options, previousString } = this, goalArray = options.html
? utils_1.htmlToArray(goal)
: utils_1.stringToLetterItems(goal), prevGtGoal = Math.max(previousString.length - goalArray.length, 0);
goalArray.push(...utils_1.stringToLetterItems(utils_1.arrayOfTheSame('', prevGtGoal)));
return goalArray;
: utils_1.stringToLetterItems(goal), diff = Math.max(0, previousString.length - goalArray.length), nBefore = Math.ceil(diff / 2), nAfter = Math.floor(diff / 2);
return utils_1.stringToLetterItems(utils_1.arrayOfTheSame('', nBefore)).concat(goalArray, utils_1.stringToLetterItems(utils_1.arrayOfTheSame('', nAfter)));
}

@@ -262,0 +257,0 @@ getWriterData(status, message, error) {

@@ -17,2 +17,3 @@ import { ConstructorOptions, OptionsFields, RangeOrNumber } from './types';

letterize: boolean;
endless: boolean;
startFrom: 'matching' | 'previous' | 'erase';

@@ -19,0 +20,0 @@ writer: GlitchedWriter;

@@ -8,3 +8,3 @@ "use strict";

constructor(writer, options) {
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
if (typeof options === 'string')

@@ -26,7 +26,8 @@ options = presets_1.presets[options];

this.letterize = (_l = options.letterize) !== null && _l !== void 0 ? _l : presets_1.presets.default.letterize;
this.endless = (_m = options.endless) !== null && _m !== void 0 ? _m : presets_1.presets.default.endless;
if (typeof document === 'undefined')
this.letterize = false;
this.startFrom = (_m = options.startFrom) !== null && _m !== void 0 ? _m : presets_1.presets.default.startFrom;
this.startFrom = (_o = options.startFrom) !== null && _o !== void 0 ? _o : presets_1.presets.default.startFrom;
this.writer = writer;
this.space = ((_o = options.fillSpace) !== null && _o !== void 0 ? _o : presets_1.presets.default.fillSpace) ? ' ' : '';
this.space = ((_p = options.fillSpace) !== null && _p !== void 0 ? _p : presets_1.presets.default.fillSpace) ? ' ' : '';
}

@@ -33,0 +34,0 @@ get stepsLeft() {

@@ -8,2 +8,3 @@ import { ConstructorOptions, RangeOrNumber } from './types';

neo: string;
uppercase: string;
};

@@ -24,2 +25,3 @@ export declare const presets: {

letterize: boolean;
endless: boolean;
startFrom: "matching" | "previous" | "erase";

@@ -32,3 +34,4 @@ };

neo: ConstructorOptions;
encrypted: ConstructorOptions;
};
export declare type PresetName = keyof typeof presets;

@@ -10,2 +10,3 @@ "use strict";

neo: '!<>-_\\/[]{}—=+*^?#________',
uppercase: '1234567890QWERTYUIOPASDFGHJKLZXCVBNM#$%',
};

@@ -26,2 +27,3 @@ exports.presets = {

letterize: false,
endless: false,
startFrom: 'matching',

@@ -86,3 +88,15 @@ },

},
encrypted: {
glyphs: exports.glyphs.uppercase,
maxGhosts: 0,
ghostChance: 0,
changeChance: 1,
interval: [50, 90],
initialDelay: [0, 1300],
steps: [5, 8],
startFrom: 'previous',
fillSpace: false,
letterize: true,
},
};
//# sourceMappingURL=presets.js.map

@@ -22,2 +22,3 @@ import GlitchedWriter from './index';

letterize: boolean;
endless: boolean;
startFrom: 'matching' | 'previous' | 'erase';

@@ -24,0 +25,0 @@ }

import { RangeOrNumber } from './types';
export declare function random(min: number, max: number, math?: 'floor' | 'round' | 'ceil'): number;
export declare function deleteRandom(array: any[]): void;
export declare const clamp: (min: number, value: number, max: number) => number;
export declare const deleteRandom: (array: any[]) => boolean;
export declare function getRandom<T>(iterable: Array<T>): T;

@@ -25,1 +26,2 @@ export declare function getRandom(iterable: string): string;

export declare function filterHtml(string: string): string;
export declare function trim(str: string, l: string): string;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.filterHtml = exports.htmlToArray = exports.isSpecialChar = exports.stringToLetterItems = exports.letterToLetterItem = exports.coinFlip = exports.getRandomFromRange = exports.animateWithClass = exports.isInRange = exports.arrayOfTheSame = exports.promiseWhile = exports.wait = exports.parseCharset = exports.filterDuplicates = exports.getRandom = exports.deleteRandom = exports.random = void 0;
exports.trim = exports.filterHtml = exports.htmlToArray = exports.isSpecialChar = exports.stringToLetterItems = exports.letterToLetterItem = exports.coinFlip = exports.getRandomFromRange = exports.animateWithClass = exports.isInRange = exports.arrayOfTheSame = exports.promiseWhile = exports.wait = exports.parseCharset = exports.filterDuplicates = exports.getRandom = exports.deleteRandom = exports.clamp = exports.random = void 0;
/* eslint-disable no-unused-vars */

@@ -21,6 +21,5 @@ function random(min, max, math) {

exports.random = random;
function deleteRandom(array) {
const { length } = array;
array.splice(random(0, length, 'floor'), 1);
}
const clamp = (min, value, max) => Math.min(Math.max(value, min), max);
exports.clamp = clamp;
const deleteRandom = (array) => array.splice(random(0, array.length, 'floor'), 1).length > 0;
exports.deleteRandom = deleteRandom;

@@ -120,2 +119,20 @@ function getRandom(iterable) {

exports.filterHtml = filterHtml;
function trim(str, l) {
if (!l || l.length > 1 || !str)
return str;
if (l === ' ')
return str.trim();
const reg = new RegExp(`${l}+`, 'g');
let find, result = str;
// eslint-disable-next-line no-cond-assign
while ((find = reg.exec(str))) {
const from = find.index, to = reg.lastIndex, length = to - from;
if (from === 0)
result = result.substring(to);
else if (to === str.length)
result = result.substring(result.length - length);
}
return result;
}
exports.trim = trim;
//# sourceMappingURL=utils.js.map

@@ -13,3 +13,3 @@ import GlitchedWriter from './index';

afterGlitchChance: number;
letterize?: {
els?: {
charEl?: HTMLSpanElement;

@@ -16,0 +16,0 @@ ghostsBeforeEl: HTMLSpanElement;

@@ -22,3 +22,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

if (writer.options.letterize) {
this.letterize = {
this.els = {
ghostsBeforeEl: document.createElement('span'),

@@ -28,5 +28,5 @@ letterEl: document.createElement('span'),

};
this.letterize.ghostsBeforeEl.className = 'gw-ghosts';
this.letterize.ghostsAfterEl.className = 'gw-ghosts';
this.letterize.letterEl.className = 'gw-letter';
this.els.ghostsBeforeEl.className = 'gw-ghosts';
this.els.ghostsAfterEl.className = 'gw-ghosts';
this.els.letterEl.className = 'gw-letter';
}

@@ -40,2 +40,3 @@ }

this.ghostsBefore = [...initialGhosts];
this.writer.state.nGhosts += initialGhosts.length;
this.stepsLeft = options.stepsLeft;

@@ -50,4 +51,4 @@ if (isTag)

this.setProps(l, gl, initialGhosts, isTag);
if (this.letterize)
this.letterize.letterEl.className = 'gw-letter';
if (this.els)
this.els.letterEl.className = 'gw-letter';
}

@@ -60,3 +61,6 @@ get string() {

const { l: char, gl: goal, ghostsBefore, ghostsAfter } = this;
return (char === goal && ghostsBefore.length === 0 && ghostsAfter.length === 0);
return ((char === goal &&
ghostsBefore.length === 0 &&
ghostsAfter.length === 0) ||
this.isTag);
}

@@ -70,5 +74,5 @@ get interval() {

writeToElement() {
if (!this.letterize)
if (!this.els)
return;
const { ghostsBeforeEl, ghostsAfterEl, letterEl } = this.letterize;
const { ghostsBeforeEl, ghostsAfterEl, letterEl } = this.els;
letterEl.innerHTML = this.l;

@@ -79,5 +83,5 @@ ghostsBeforeEl.textContent = this.ghostsBefore.join('');

set spanElement(el) {
if (!this.letterize)
if (!this.els)
return;
this.letterize.charEl = el;
this.els.charEl = el;
this.appendChildren();

@@ -87,3 +91,3 @@ }

var _a, _b;
(_b = (_a = this.letterize) === null || _a === void 0 ? void 0 : _a.charEl) === null || _b === void 0 ? void 0 : _b.append(this.letterize.ghostsBeforeEl, this.letterize.letterEl, this.letterize.ghostsAfterEl);
(_b = (_a = this.els) === null || _a === void 0 ? void 0 : _a.charEl) === null || _b === void 0 ? void 0 : _b.append(this.els.ghostsBeforeEl, this.els.letterEl, this.els.ghostsAfterEl);
this.writeToElement();

@@ -94,17 +98,25 @@ }

return __awaiter(this, void 0, void 0, function* () {
const { writer } = this;
if (this.isTag) {
this.l = this.gl;
writer.emiter.call('step');
return true;
}
const loop = () => __awaiter(this, void 0, void 0, function* () {
!this.isTag && (yield wait(this.interval));
yield wait(this.interval);
const lastString = this.string;
this.step();
if (lastString !== this.string) {
this.writer.emiter.call('step');
writer.emiter.call('step');
this.writeToElement();
}
this.stepsLeft--;
!writer.options.endless && this.stepsLeft--;
});
!this.isTag && (yield wait(this.writer.options.genInitDelay));
yield promiseWhile(() => !this.finished && !this.writer.state.isPaused && !this.stop, loop);
yield wait(writer.options.genInitDelay);
yield promiseWhile(() => (!this.finished || writer.options.endless) &&
!writer.state.isPaused &&
!this.stop, loop);
if (this.finished) {
(_b = (_a = this.letterize) === null || _a === void 0 ? void 0 : _a.charEl) === null || _b === void 0 ? void 0 : _b.classList.add('gw-finished');
(_c = this.letterize) === null || _c === void 0 ? void 0 : _c.letterEl.classList.remove('gw-glitched');
(_b = (_a = this.els) === null || _a === void 0 ? void 0 : _a.charEl) === null || _b === void 0 ? void 0 : _b.classList.add('gw-finished');
(_c = this.els) === null || _c === void 0 ? void 0 : _c.letterEl.classList.remove('gw-glitched');
}

@@ -116,10 +128,12 @@ return this.finished;

var _a, _b;
const { writer } = this;
if ((this.stepsLeft > 0 && this.l !== this.gl) ||
(coinFlip(this.afterGlitchChance) && !this.isTag && !this.isWhitespace)) {
(coinFlip(this.afterGlitchChance) && !this.isWhitespace) ||
writer.options.endless) {
/**
* IS GROWING
*/
const { ghostChance, changeChance } = this.writer.options;
const { ghostChance, changeChance } = writer.options;
if (coinFlip(ghostChance)) {
if (this.writer.state.ghostsInLimit)
if (writer.state.ghostsInLimit)
this.addGhost();

@@ -130,4 +144,4 @@ else

if (coinFlip(changeChance)) {
(_a = this.letterize) === null || _a === void 0 ? void 0 : _a.letterEl.classList.add('gw-glitched');
this.l = this.writer.options.genGhost;
(_a = this.els) === null || _a === void 0 ? void 0 : _a.letterEl.classList.add('gw-glitched');
this.l = writer.options.genGhost;
}

@@ -139,3 +153,3 @@ }

*/
(_b = this.letterize) === null || _b === void 0 ? void 0 : _b.letterEl.classList.remove('gw-glitched');
(_b = this.els) === null || _b === void 0 ? void 0 : _b.letterEl.classList.remove('gw-glitched');
this.l = this.gl;

@@ -153,6 +167,7 @@ this.removeGhost();

removeGhost() {
this.writer.state.nGhosts--;
coinFlip() && this.ghostsBefore.length > 0
const deleted = coinFlip() && this.ghostsBefore.length > 0
? deleteRandom(this.ghostsBefore)
: deleteRandom(this.ghostsAfter);
if (deleted)
this.writer.state.nGhosts--;
}

@@ -159,0 +174,0 @@ }

@@ -11,3 +11,3 @@ import { filterHtml } from './utils';

this.writer.updateString();
const { htmlElement, writerData } = this.writer, string = eventType === 'finish' ? this.writer.goalString : this.writer.string;
const { htmlElement, writerData, string } = this.writer;
if (htmlElement && !this.writer.options.letterize) {

@@ -14,0 +14,0 @@ if (this.writer.options.html)

@@ -77,3 +77,2 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

this.options.setCharset();
// this.removeSpecialChars()
if (this.options.startFrom === 'matching')

@@ -182,3 +181,2 @@ this.createMatchingCharTable();

pi++;
const pl = previous[pi];
if (gl.type === 'tag') {

@@ -194,6 +192,5 @@ pi--;

pi = fi;
this.state.nGhosts += appendedText.length;
}
else
this.setChar(gi, pl || this.options.space, gl);
this.setChar(gi, previous[pi], gl);
});

@@ -207,3 +204,2 @@ this.removeExtraChars(goalStringArray.length);

pi++;
const pl = previous[pi] || this.options.space;
if (gl.type === 'tag') {

@@ -214,3 +210,3 @@ pi--;

}
this.setChar(gi, pl, gl);
this.setChar(gi, previous[pi], gl);
});

@@ -242,11 +238,10 @@ this.removeExtraChars(goalStringArray.length);

char
? char.reset(pl, gl.value || this.options.space, appendedText, gl.type === 'tag')
: charTable.push(new Char(this, pl, gl.value || this.options.space, appendedText, gl.type === 'tag'));
? char.reset(pl !== null && pl !== void 0 ? pl : '', gl.value || this.options.space, appendedText, gl.type === 'tag')
: charTable.push(new Char(this, pl !== null && pl !== void 0 ? pl : '', gl.value || this.options.space, appendedText, gl.type === 'tag'));
}
get goalStringArray() {
const { goalString: goal, previousString, options } = this, goalArray = options.html
const { goalString: goal, options, previousString } = this, goalArray = options.html
? htmlToArray(goal)
: stringToLetterItems(goal), prevGtGoal = Math.max(previousString.length - goalArray.length, 0);
goalArray.push(...stringToLetterItems(arrayOfTheSame('', prevGtGoal)));
return goalArray;
: stringToLetterItems(goal), diff = Math.max(0, previousString.length - goalArray.length), nBefore = Math.ceil(diff / 2), nAfter = Math.floor(diff / 2);
return stringToLetterItems(arrayOfTheSame('', nBefore)).concat(goalArray, stringToLetterItems(arrayOfTheSame('', nAfter)));
}

@@ -253,0 +248,0 @@ getWriterData(status, message, error) {

@@ -17,2 +17,3 @@ import { ConstructorOptions, OptionsFields, RangeOrNumber } from './types';

letterize: boolean;
endless: boolean;
startFrom: 'matching' | 'previous' | 'erase';

@@ -19,0 +20,0 @@ writer: GlitchedWriter;

@@ -6,3 +6,3 @@ // eslint-disable-next-line import/no-extraneous-dependencies

constructor(writer, options) {
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
if (typeof options === 'string')

@@ -24,7 +24,8 @@ options = presets[options];

this.letterize = (_l = options.letterize) !== null && _l !== void 0 ? _l : presets.default.letterize;
this.endless = (_m = options.endless) !== null && _m !== void 0 ? _m : presets.default.endless;
if (typeof document === 'undefined')
this.letterize = false;
this.startFrom = (_m = options.startFrom) !== null && _m !== void 0 ? _m : presets.default.startFrom;
this.startFrom = (_o = options.startFrom) !== null && _o !== void 0 ? _o : presets.default.startFrom;
this.writer = writer;
this.space = ((_o = options.fillSpace) !== null && _o !== void 0 ? _o : presets.default.fillSpace) ? ' ' : '';
this.space = ((_p = options.fillSpace) !== null && _p !== void 0 ? _p : presets.default.fillSpace) ? ' ' : '';
}

@@ -31,0 +32,0 @@ get stepsLeft() {

@@ -8,2 +8,3 @@ import { ConstructorOptions, RangeOrNumber } from './types';

neo: string;
uppercase: string;
};

@@ -24,2 +25,3 @@ export declare const presets: {

letterize: boolean;
endless: boolean;
startFrom: "matching" | "previous" | "erase";

@@ -32,3 +34,4 @@ };

neo: ConstructorOptions;
encrypted: ConstructorOptions;
};
export declare type PresetName = keyof typeof presets;

@@ -7,2 +7,3 @@ export const glyphs = {

neo: '!<>-_\\/[]{}—=+*^?#________',
uppercase: '1234567890QWERTYUIOPASDFGHJKLZXCVBNM#$%',
};

@@ -23,2 +24,3 @@ export const presets = {

letterize: false,
endless: false,
startFrom: 'matching',

@@ -83,3 +85,15 @@ },

},
encrypted: {
glyphs: glyphs.uppercase,
maxGhosts: 0,
ghostChance: 0,
changeChance: 1,
interval: [50, 90],
initialDelay: [0, 1300],
steps: [5, 8],
startFrom: 'previous',
fillSpace: false,
letterize: true,
},
};
//# sourceMappingURL=presets.js.map

@@ -22,2 +22,3 @@ import GlitchedWriter from './index';

letterize: boolean;
endless: boolean;
startFrom: 'matching' | 'previous' | 'erase';

@@ -24,0 +25,0 @@ }

import { RangeOrNumber } from './types';
export declare function random(min: number, max: number, math?: 'floor' | 'round' | 'ceil'): number;
export declare function deleteRandom(array: any[]): void;
export declare const clamp: (min: number, value: number, max: number) => number;
export declare const deleteRandom: (array: any[]) => boolean;
export declare function getRandom<T>(iterable: Array<T>): T;

@@ -25,1 +26,2 @@ export declare function getRandom(iterable: string): string;

export declare function filterHtml(string: string): string;
export declare function trim(str: string, l: string): string;

@@ -17,6 +17,4 @@ /* eslint-disable no-unused-vars */

}
export function deleteRandom(array) {
const { length } = array;
array.splice(random(0, length, 'floor'), 1);
}
export const clamp = (min, value, max) => Math.min(Math.max(value, min), max);
export const deleteRandom = (array) => array.splice(random(0, array.length, 'floor'), 1).length > 0;
export function getRandom(iterable) {

@@ -100,2 +98,19 @@ return iterable[random(0, iterable.length, 'floor')];

}
export function trim(str, l) {
if (!l || l.length > 1 || !str)
return str;
if (l === ' ')
return str.trim();
const reg = new RegExp(`${l}+`, 'g');
let find, result = str;
// eslint-disable-next-line no-cond-assign
while ((find = reg.exec(str))) {
const from = find.index, to = reg.lastIndex, length = to - from;
if (from === 0)
result = result.substring(to);
else if (to === str.length)
result = result.substring(result.length - length);
}
return result;
}
//# sourceMappingURL=utils.js.map

@@ -1,2 +0,2 @@

!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports["glitched-writer"]=e():t["glitched-writer"]=e()}(self,(function(){return(()=>{"use strict";var t={d:(e,s)=>{for(var i in s)t.o(s,i)&&!t.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:s[i]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};function s(t,e,s){const i=Math.random()*(e-t)+t;if(s)switch(s){case"floor":return Math.floor(i);case"round":return Math.round(i);case"ceil":return Math.ceil(i)}return i}function i(t){const{length:e}=t;t.splice(s(0,e,"floor"),1)}t.r(e),t.d(e,{default:()=>C,glitchWrite:()=>E,glyphs:()=>u,presets:()=>p,wait:()=>r});const r=t=>new Promise((e=>setTimeout((()=>e(t)),t)));function n(t,e){const s=()=>t()?e().then(s):Promise.resolve();return s()}function h(t,e=!0){return"number"==typeof t?t:s(...t,e?"round":void 0)}const o=(t=.5)=>Math.random()<t,l=t=>({value:t}),a=t=>[...t].map(l),g="(&#?[0-9a-zA-Z]{2,6};)|(<style.+?>.+?</style>|<script.+?>.+?<\/script>|<(?:!|/?[a-zA-Z]+).*?/?>)";function c(t){const e=new RegExp(g,"g");return t.replace(e,"")}const u={nier:"一二三四五六七八九十百千上下左右中大小月日年早木林山川土空田天生花草虫犬人名女男子目耳口手足見音力気円入出立休先夕本文字学校村町森正水火玉王石竹糸貝車金雨赤青白数多少万半形太細広長点丸交光角計直線矢弱強高同親母父姉兄弟妹自友体毛頭顔首心時曜朝昼夜分週春夏秋冬今新古間方北南東西遠近前後内外場地国園谷野原里市京風雪雲池海岩星室戸家寺通門道話言答声聞語読書記紙画絵図工教晴思考知才理算作元食肉馬牛魚鳥羽鳴麦米茶色黄黒来行帰歩走止活店買売午汽弓回会組船明社切電毎合当台楽公引科歌刀番用何",full:"ABCDĐEFGHIJKLMNOPQRSTUVWXYZabcdđefghijklmnopqrstuvwxyzĄąĆ毿ŹźŃńóŁłАБВГҐДЂЕЁЄЖЗЅИІЇЙЈКЛЉМНЊОПРСТЋУЎФХЦЧЏШЩЪЫЬЭЮЯабвгґдђеёєжзѕиіїйјклљмнњопрстћуўфхцчџшщъыьэюяΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩαβγδεζηθικλμνξοπρστυφχψωάΆέΈέΉίϊΐΊόΌύΰϋΎΫΏĂÂÊÔƠƯăâêôơư一二三四五六七八九十百千上下左右中大小月日年早木林山川土空田天生花草虫犬人名女男子目耳口手足見音力気円入出立休先夕本文字学校村町森正水火玉王石竹糸貝車金雨赤青白数多少万半形太細広長点丸交光角計直線矢弱強高同親母父姉兄弟妹自友体毛頭顔首心時曜朝昼夜分週春夏秋冬今新古間方北南東西遠近前後内外場地国園谷野原里市京風雪雲池海岩星室戸家寺通門道話言答声聞語読書記紙画絵図工教晴思考知才理算作元食肉馬牛魚鳥羽鳴麦米茶色黄黒来行帰歩走止活店買売午汽弓回会組船明社切電毎合当台楽公引科歌刀番用何ĂÂÊÔƠƯăâêôơư1234567890‘?’“!”(%)[#]{@}/\\&<-+÷×=>$€£¥¢:;,.*•°·…±†‡æ«»¦¯—–~˜¨_øÞ¿▬▭▮▯┐└╛░▒▓○‼⁇⁈⁉‽ℴℵℶℷℸℲ℮ℯ⅁⅂⅃⅄₠₡₢₣₤₥₦₧₨₩₪₫€₭₮₯₰₱₲₳₴₵₶₷₸₹₺₻₼₽₾₿ ",letterlike:"ABCDĐEFGHIJKLMNOPQRSTUVWXYZabcdđefghijklmnopqrstuvwxyzĄąĆ毿ŹźŃńóŁłАБВГҐДЂЕЁЄЖЗЅИІЇЙЈКЛЉМНЊОПРСТЋУЎФХЦЧЏШЩЪЫЬЭЮЯабвгґдђеёєжзѕиіїйјклљмнњопрстћуўфхцчџшщъыьэюяΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩαβγδεζηθικλμνξοπρστυφχψωάΆέΈέΉίϊΐΊόΌύΰϋΎΫΏĂÂÊÔƠƯăâêôơưĂÂÊÔƠƯăâêôơư1234567890",zalgo:"̴̵̶̷̸̡̢̧̨̛̖̗̘̙̜̝̞̟̠̣̤̥̦̩̪̫̬̭̮̯̰̱̲̳̹̺̻̼͇͈͉͍͎̀́̂̃̄̅̆̇̈̉̊̋̌̍̎̏̐̑̒̓̔̽̾̿̀́͂̓̈́͆͊͋͌̕̚ͅ ͓͔͕͖͙͚͐͑͒͗͛ͣͤͥͦͧͨͩͪͫͬͭͮͯ͘͜͟͢͝͞͠͡͏҉",neo:"!<>-_\\/[]{}—=+*^?#________"},p={default:{steps:[1,8],interval:[60,170],initialDelay:[0,2e3],changeChance:.6,ghostChance:.2,maxGhosts:.2,glyphs:u.full+u.zalgo,glyphsFromString:!1,oneAtATime:!1,html:!1,fillSpace:!0,letterize:!1,startFrom:"matching"},nier:{maxGhosts:0,ghostChance:0,changeChance:.8,steps:2,interval:10,initialDelay:0,glyphs:u.nier,oneAtATime:!0,startFrom:"erase",glyphsFromString:!0},typewriter:{interval:[40,100],initialDelay:[0,0],steps:[0,1],changeChance:1,maxGhosts:0,glyphs:"",glyphsFromString:!0,oneAtATime:!0,startFrom:"erase"},terminal:{interval:[25,30],initialDelay:[0,0],steps:0,changeChance:.5,maxGhosts:0,glyphs:"",oneAtATime:!0,fillSpace:!1,glyphsFromString:!1,startFrom:"erase"},zalgo:{initialDelay:[0,3e3],interval:[10,35],steps:[0,30],maxGhosts:4.6,changeChance:.5,ghostChance:.7,glyphs:u.zalgo,glyphsFromString:!0,fillSpace:!1},neo:{glyphs:u.neo,maxGhosts:0,ghostChance:0,changeChance:1,interval:[30,100],initialDelay:[0,1300],steps:[4,7],startFrom:"previous",letterize:!0}};class d{constructor(t,e){var s,i,r,n,h,o,l,a,g,c,u,d,f;"string"==typeof e&&(e=p[e]),e||(e={}),this.steps=null!==(s=e.steps)&&void 0!==s?s:p.default.steps,this.interval=null!==(i=e.interval)&&void 0!==i?i:p.default.interval,this.initialDelay=null!==(r=e.initialDelay)&&void 0!==r?r:p.default.initialDelay,this.changeChance=null!==(n=e.changeChance)&&void 0!==n?n:p.default.changeChance,this.ghostChance=null!==(h=e.ghostChance)&&void 0!==h?h:p.default.ghostChance,this.maxGhosts=null!==(o=e.maxGhosts)&&void 0!==o?o:p.default.maxGhosts,this.glyphs=null!==(l=function(t){if(void 0===t)return;let e;return e="string"==typeof t?t:t.length?t.join(""):Array.from(t).join(""),e}(e.glyphs))&&void 0!==l?l:p.default.glyphs,this.glyphsFromString=null!==(a=e.glyphsFromString)&&void 0!==a?a:p.default.glyphsFromString,this.ghostCharset=[...this.glyphs],this.oneAtATime=null!==(g=e.oneAtATime)&&void 0!==g?g:p.default.oneAtATime,this.html=null!==(c=e.html)&&void 0!==c?c:p.default.html,this.letterize=null!==(u=e.letterize)&&void 0!==u?u:p.default.letterize,"undefined"==typeof document&&(this.letterize=!1),this.startFrom=null!==(d=e.startFrom)&&void 0!==d?d:p.default.startFrom,this.writer=t,this.space=(null!==(f=e.fillSpace)&&void 0!==f?f:p.default.fillSpace)?" ":""}get stepsLeft(){return h(this.steps)}get genInterval(){return h(this.interval)}get genInitDelay(){return h(this.initialDelay)}get genMaxGhosts(){if(Number.isInteger(this.maxGhosts))return this.maxGhosts;let t;return t=this.writer.options.html?c(this.writer.goalString).length:this.writer.goalString.length,Math.round((t||20)*this.maxGhosts)}get genGhost(){var t,e;return null!==(t=(e=this.ghostCharset)[s(0,e.length,"floor")])&&void 0!==t?t:""}setCharset(){let t=this.glyphs;this.glyphsFromString&&(t+=function(t){const e="string"==typeof t,s=[];return new Set(t).forEach((t=>s.push(t))),e?s.join(""):s}(this.writer.previousString+(this.writer.options.html?c(this.writer.goalString):this.writer.goalString))),this.ghostCharset=[...t].filter((t=>!["\t","\n","\r","\f","\v"].includes(t)))}}class f{constructor(t){this.nGhosts=0,this.isTyping=!1,this.isPaused=!1,this.finished=!1,this.writer=t,this.maxGhosts=this.writer.options.genMaxGhosts}get ghostsInLimit(){return this.nGhosts<this.maxGhosts}play(){this.isTyping=!0,this.isPaused=!1,this.finished=!1,this.toggleClass(!0),this.maxGhosts=this.writer.options.genMaxGhosts}pause(){this.isTyping=!1,this.isPaused=!0,this.toggleClass(!1)}finish(){this.isTyping=!1,this.finished=!0,this.toggleClass(!1)}toggleClass(t){const e=this.writer.htmlElement,s="gw-writing";e&&(t?((t,e)=>{t.classList.remove(e),t.offsetWidth,t.classList.add(e)})(e,s):e.classList.remove(s))}}var m=function(t,e,s,i){return new(s||(s=Promise))((function(r,n){function h(t){try{l(i.next(t))}catch(t){n(t)}}function o(t){try{l(i.throw(t))}catch(t){n(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof s?e:new s((function(t){t(e)}))).then(h,o)}l((i=i.apply(t,e||[])).next())}))};class v{constructor(t,e,s,i="",r=!1){this.ghostsBefore=[],this.ghostsAfter=[],this.stop=!1,this.isTag=!1,this.isWhitespace=!1,this.afterGlitchChance=0,this.writer=t,this.setProps(e,s,i,r),t.options.letterize&&(this.letterize={ghostsBeforeEl:document.createElement("span"),letterEl:document.createElement("span"),ghostsAfterEl:document.createElement("span")},this.letterize.ghostsBeforeEl.className="gw-ghosts",this.letterize.ghostsAfterEl.className="gw-ghosts",this.letterize.letterEl.className="gw-letter")}setProps(t,e,s="",i=!1){const{options:r}=this.writer;this.l=t,this.gl=e,this.isTag=i,this.ghostsBefore=[...s],this.stepsLeft=r.stepsLeft,i&&(this.stepsLeft=0),this.isWhitespace=(t=>["\t","\n","\r","\f","\v",""," "].includes(t))(e),this.afterGlitchChance=(r.ghostChance+r.changeChance)/3.7}reset(t,e,s="",i=!1){this.setProps(t,e,s,i),this.letterize&&(this.letterize.letterEl.className="gw-letter")}get string(){const{l:t,ghostsAfter:e,ghostsBefore:s}=this;return s.join("")+t+e.join("")}get finished(){const{l:t,gl:e,ghostsBefore:s,ghostsAfter:i}=this;return t===e&&0===s.length&&0===i.length}get interval(){let t=this.writer.options.genInterval;return this.isWhitespace&&(t/=2),t}writeToElement(){if(!this.letterize)return;const{ghostsBeforeEl:t,ghostsAfterEl:e,letterEl:s}=this.letterize;s.innerHTML=this.l,t.textContent=this.ghostsBefore.join(""),e.textContent=this.ghostsAfter.join("")}set spanElement(t){this.letterize&&(this.letterize.charEl=t,this.appendChildren())}appendChildren(){var t,e;null===(e=null===(t=this.letterize)||void 0===t?void 0:t.charEl)||void 0===e||e.append(this.letterize.ghostsBeforeEl,this.letterize.letterEl,this.letterize.ghostsAfterEl),this.writeToElement()}type(){var t,e,s;return m(this,void 0,void 0,(function*(){return!this.isTag&&(yield r(this.writer.options.genInitDelay)),yield n((()=>!this.finished&&!this.writer.state.isPaused&&!this.stop),(()=>m(this,void 0,void 0,(function*(){!this.isTag&&(yield r(this.interval));const t=this.string;this.step(),t!==this.string&&(this.writer.emiter.call("step"),this.writeToElement()),this.stepsLeft--})))),this.finished&&(null===(e=null===(t=this.letterize)||void 0===t?void 0:t.charEl)||void 0===e||e.classList.add("gw-finished"),null===(s=this.letterize)||void 0===s||s.letterEl.classList.remove("gw-glitched")),this.finished}))}step(){var t,e;if(this.stepsLeft>0&&this.l!==this.gl||o(this.afterGlitchChance)&&!this.isTag&&!this.isWhitespace){const{ghostChance:e,changeChance:s}=this.writer.options;o(e)&&(this.writer.state.ghostsInLimit?this.addGhost():this.removeGhost()),o(s)&&(null===(t=this.letterize)||void 0===t||t.letterEl.classList.add("gw-glitched"),this.l=this.writer.options.genGhost)}else this.finished||(null===(e=this.letterize)||void 0===e||e.letterEl.classList.remove("gw-glitched"),this.l=this.gl,this.removeGhost())}addGhost(){const t=this.writer.options.genGhost;this.writer.state.nGhosts++,o()?y(this.ghostsBefore,t):y(this.ghostsAfter,t)}removeGhost(){this.writer.state.nGhosts--,o()&&this.ghostsBefore.length>0?i(this.ghostsBefore):i(this.ghostsAfter)}}function y(t,e){const{length:i}=t;t.splice(s(0,i,"floor"),0,e)}var w=function(t,e,s,i){return new(s||(s=Promise))((function(r,n){function h(t){try{l(i.next(t))}catch(t){n(t)}}function o(t){try{l(i.throw(t))}catch(t){n(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof s?e:new s((function(t){t(e)}))).then(h,o)}l((i=i.apply(t,e||[])).next())}))};class C{constructor(t,e,s,i){var r;this.charTable=[],this.goalString="",this.string="","string"==typeof t?"undefined"!=typeof document&&(this.htmlElement=null!==(r=document.querySelector(t))&&void 0!==r?r:void 0):this.htmlElement=null!=t?t:void 0,this.options=new d(this,e),this.state=new f(this),this.emiter=new class{constructor(t,e,s){this.onStepCallback=e,this.onFinishCallback=s,this.writer=t}call(t){var e,s;this.writer.updateString();const{htmlElement:i,writerData:r}=this.writer,n="finish"===t?this.writer.goalString:this.writer.string;i&&!this.writer.options.letterize&&(this.writer.options.html?i.innerHTML=n:i.textContent=n),null==i||i.setAttribute("data-gw-string",this.writer.options.html?c(n):n),"finish"===t?(this.writer.state.finish(),null===(e=this.onFinishCallback)||void 0===e||e.call(this,n,r),this.emitEvent()):null===(s=this.onStepCallback)||void 0===s||s.call(this,n,r)}emitEvent(){const{htmlElement:t,writerData:e}=this.writer;t&&"undefined"!=typeof CustomEvent&&(null==t||t.dispatchEvent(new CustomEvent("gw-finished",{detail:e})))}}(this,s,i),this.string=this.previousString}updateString(){this.string=this.charTable.map((t=>t.string)).join("")}get previousString(){var t;let e=null===(t=this.htmlElement)||void 0===t?void 0:t.textContent;return"string"!=typeof e&&(e=this.options.html?c(this.string):this.string),e=e.trim(),e}get writerData(){const{options:t,state:e,string:s}=this;return{string:s,writer:this,options:t,state:e}}write(t,e){return w(this,void 0,void 0,(function*(){return"erase"!==this.options.startFrom||(null==e?void 0:e.erase)||(yield this.write(this.genGoalStringToErase(t),{erase:!0})),this.goalString=t,this.state.nGhosts=0,this.options.setCharset(),"matching"===this.options.startFrom?this.createMatchingCharTable():this.createPreviousCharTable(),this.letterize(),this.pause(),this.play({reverse:this.options.oneAtATime&&(null==e?void 0:e.erase)})}))}add(t){return w(this,void 0,void 0,(function*(){const{previousString:e}=this;return this.write(e+t)}))}remove(t){return w(this,void 0,void 0,(function*(){const{previousString:e}=this,s=Array.from(e);return s.splice(-t),this.write(s.join(""),{erase:!0})}))}play(t){var e;return w(this,void 0,void 0,(function*(){const s=[],{charTable:i}=this,{length:r}=i;if(this.state.isTyping)return this.getWriterData("ERROR",`The writer is already typing "${this.goalString}".`);if(this.state.play(),this.options.oneAtATime){const s=null!==(e=null==t?void 0:t.reverse)&&void 0!==e&&e;let h=s?r-1:0,o=!0;const l=()=>w(this,void 0,void 0,(function*(){o=yield i[h].type(),s?h--:h++}));return yield n((()=>{return(t=h)>=0&&t<r&&o&&!this.state.isPaused;var t}),l),this.returnResult(o)}i.forEach((t=>s.push(t.type())));try{const t=(yield Promise.all(s)).every((t=>t));return this.returnResult(t)}catch(t){return this.getWriterData("ERROR","Writer encountered an error.",t)}}))}pause(){this.state.pause()}returnResult(t){return t?this.emiter.call("finish"):this.emiter.call("step"),t?this.getWriterData("SUCCESS","The writer finished typing."):this.getWriterData("ERROR","Writer failed to finish typing.")}createMatchingCharTable(){const{goalStringArray:t,previousString:e}=this,s=Math.min(Math.ceil(this.options.genMaxGhosts/2),5);let i=-1;t.forEach(((t,r)=>{i++;const n=e[i];if("tag"===t.type)return i--,void this.setChar(r,"",t);const h=""!==t.value?e.indexOf(t.value,i):-1;if(-1!==h&&h-i<=s){const s=e.substring(i,h);this.setChar(r,t.value,t,s),i=h,this.state.nGhosts+=s.length}else this.setChar(r,n||this.options.space,t)})),this.removeExtraChars(t.length)}createPreviousCharTable(){const{goalStringArray:t,previousString:e}=this;let s=-1;t.forEach(((t,i)=>{s++;const r=e[s]||this.options.space;if("tag"===t.type)return s--,void this.setChar(i,"",t);this.setChar(i,r,t)})),this.removeExtraChars(t.length)}letterize(){if(!this.options.letterize||!this.htmlElement)return;const t=this.charTable.map((({isTag:t,gl:e})=>t?e:'<span class="gw-char"></span>')).join("");this.htmlElement.innerHTML=t;const e=this.htmlElement.querySelectorAll("span.gw-char");let s=0;this.charTable.forEach((t=>{t.isTag||(t.spanElement=e[s],s++)}))}removeExtraChars(t){const{charTable:e}=this;e.splice(t,e.length-t)}setChar(t,e,s,i){const{charTable:r}=this,n=r[t];n?n.reset(e,s.value||this.options.space,i,"tag"===s.type):r.push(new v(this,e,s.value||this.options.space,i,"tag"===s.type))}get goalStringArray(){const{goalString:t,previousString:e,options:s}=this,i=s.html?function(t){const e=new RegExp(g,"g"),s=[];let i,r=0;for(;i=e.exec(t);){const n=i.index,h=e.lastIndex,o=t.slice(r,n);r=h,o&&s.push(...a(o));const l={value:i[0],type:void 0!==i[1]?"html_entity":"tag"};s.push(l)}return t.length>r&&s.push(...a(t.slice(r))),s}(t):a(t),r=Math.max(e.length-i.length,0);var n;return i.push(...a(("",n=r,new Array(n).fill("")))),i}getWriterData(t,e,s){const{writerData:i}=this;return Object.assign(Object.assign({},i),{status:t,message:e,error:s})}genGoalStringToErase(t){var e;const{previousString:s}=this;let i="";for(let r=0;r<t.length;r++){const n=t[r],h=null!==(e=s[r])&&void 0!==e?e:"";if(n!==h)break;i+=h}const r=Math.max(t.length-i.length,0);return r>0&&" "===this.options.space&&(i=i.padEnd(r+i.length," ")),i}}function E(t,e,s,i,r){return w(this,void 0,void 0,(function*(){return new C(e,s,i,r).write(t)}))}return e})()}));
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports["glitched-writer"]=e():t["glitched-writer"]=e()}(self,(function(){return(()=>{"use strict";var t={d:(e,s)=>{for(var i in s)t.o(s,i)&&!t.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:s[i]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};function s(t,e,s){const i=Math.random()*(e-t)+t;if(s)switch(s){case"floor":return Math.floor(i);case"round":return Math.round(i);case"ceil":return Math.ceil(i)}return i}t.r(e),t.d(e,{default:()=>E,glitchWrite:()=>S,glyphs:()=>p,presets:()=>d,wait:()=>n});const i=t=>t.splice(s(0,t.length,"floor"),1).length>0,n=t=>new Promise((e=>setTimeout((()=>e(t)),t)));function r(t,e){const s=()=>t()?e().then(s):Promise.resolve();return s()}const h=(t,e)=>new Array(e).fill(t);function o(t,e=!0){return"number"==typeof t?t:s(...t,e?"round":void 0)}const l=(t=.5)=>Math.random()<t,a=t=>({value:t}),g=t=>[...t].map(a),c="(&#?[0-9a-zA-Z]{2,6};)|(<style.+?>.+?</style>|<script.+?>.+?<\/script>|<(?:!|/?[a-zA-Z]+).*?/?>)";function u(t){const e=new RegExp(c,"g");return t.replace(e,"")}const p={nier:"一二三四五六七八九十百千上下左右中大小月日年早木林山川土空田天生花草虫犬人名女男子目耳口手足見音力気円入出立休先夕本文字学校村町森正水火玉王石竹糸貝車金雨赤青白数多少万半形太細広長点丸交光角計直線矢弱強高同親母父姉兄弟妹自友体毛頭顔首心時曜朝昼夜分週春夏秋冬今新古間方北南東西遠近前後内外場地国園谷野原里市京風雪雲池海岩星室戸家寺通門道話言答声聞語読書記紙画絵図工教晴思考知才理算作元食肉馬牛魚鳥羽鳴麦米茶色黄黒来行帰歩走止活店買売午汽弓回会組船明社切電毎合当台楽公引科歌刀番用何",full:"ABCDĐEFGHIJKLMNOPQRSTUVWXYZabcdđefghijklmnopqrstuvwxyzĄąĆ毿ŹźŃńóŁłАБВГҐДЂЕЁЄЖЗЅИІЇЙЈКЛЉМНЊОПРСТЋУЎФХЦЧЏШЩЪЫЬЭЮЯабвгґдђеёєжзѕиіїйјклљмнњопрстћуўфхцчџшщъыьэюяΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩαβγδεζηθικλμνξοπρστυφχψωάΆέΈέΉίϊΐΊόΌύΰϋΎΫΏĂÂÊÔƠƯăâêôơư一二三四五六七八九十百千上下左右中大小月日年早木林山川土空田天生花草虫犬人名女男子目耳口手足見音力気円入出立休先夕本文字学校村町森正水火玉王石竹糸貝車金雨赤青白数多少万半形太細広長点丸交光角計直線矢弱強高同親母父姉兄弟妹自友体毛頭顔首心時曜朝昼夜分週春夏秋冬今新古間方北南東西遠近前後内外場地国園谷野原里市京風雪雲池海岩星室戸家寺通門道話言答声聞語読書記紙画絵図工教晴思考知才理算作元食肉馬牛魚鳥羽鳴麦米茶色黄黒来行帰歩走止活店買売午汽弓回会組船明社切電毎合当台楽公引科歌刀番用何ĂÂÊÔƠƯăâêôơư1234567890‘?’“!”(%)[#]{@}/\\&<-+÷×=>$€£¥¢:;,.*•°·…±†‡æ«»¦¯—–~˜¨_øÞ¿▬▭▮▯┐└╛░▒▓○‼⁇⁈⁉‽ℴℵℶℷℸℲ℮ℯ⅁⅂⅃⅄₠₡₢₣₤₥₦₧₨₩₪₫€₭₮₯₰₱₲₳₴₵₶₷₸₹₺₻₼₽₾₿ ",letterlike:"ABCDĐEFGHIJKLMNOPQRSTUVWXYZabcdđefghijklmnopqrstuvwxyzĄąĆ毿ŹźŃńóŁłАБВГҐДЂЕЁЄЖЗЅИІЇЙЈКЛЉМНЊОПРСТЋУЎФХЦЧЏШЩЪЫЬЭЮЯабвгґдђеёєжзѕиіїйјклљмнњопрстћуўфхцчџшщъыьэюяΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩαβγδεζηθικλμνξοπρστυφχψωάΆέΈέΉίϊΐΊόΌύΰϋΎΫΏĂÂÊÔƠƯăâêôơưĂÂÊÔƠƯăâêôơư1234567890",zalgo:"̴̵̶̷̸̡̢̧̨̛̖̗̘̙̜̝̞̟̠̣̤̥̦̩̪̫̬̭̮̯̰̱̲̳̹̺̻̼͇͈͉͍͎̀́̂̃̄̅̆̇̈̉̊̋̌̍̎̏̐̑̒̓̔̽̾̿̀́͂̓̈́͆͊͋͌̕̚ͅ ͓͔͕͖͙͚͐͑͒͗͛ͣͤͥͦͧͨͩͪͫͬͭͮͯ͘͜͟͢͝͞͠͡͏҉",neo:"!<>-_\\/[]{}—=+*^?#________",uppercase:"1234567890QWERTYUIOPASDFGHJKLZXCVBNM#$%"},d={default:{steps:[1,8],interval:[60,170],initialDelay:[0,2e3],changeChance:.6,ghostChance:.2,maxGhosts:.2,glyphs:p.full+p.zalgo,glyphsFromString:!1,oneAtATime:!1,html:!1,fillSpace:!0,letterize:!1,endless:!1,startFrom:"matching"},nier:{maxGhosts:0,ghostChance:0,changeChance:.8,steps:2,interval:10,initialDelay:0,glyphs:p.nier,oneAtATime:!0,startFrom:"erase",glyphsFromString:!0},typewriter:{interval:[40,100],initialDelay:[0,0],steps:[0,1],changeChance:1,maxGhosts:0,glyphs:"",glyphsFromString:!0,oneAtATime:!0,startFrom:"erase"},terminal:{interval:[25,30],initialDelay:[0,0],steps:0,changeChance:.5,maxGhosts:0,glyphs:"",oneAtATime:!0,fillSpace:!1,glyphsFromString:!1,startFrom:"erase"},zalgo:{initialDelay:[0,3e3],interval:[10,35],steps:[0,30],maxGhosts:4.6,changeChance:.5,ghostChance:.7,glyphs:p.zalgo,glyphsFromString:!0,fillSpace:!1},neo:{glyphs:p.neo,maxGhosts:0,ghostChance:0,changeChance:1,interval:[30,100],initialDelay:[0,1300],steps:[4,7],startFrom:"previous",letterize:!0},encrypted:{glyphs:p.uppercase,maxGhosts:0,ghostChance:0,changeChance:1,interval:[50,90],initialDelay:[0,1300],steps:[5,8],startFrom:"previous",fillSpace:!1,letterize:!0}};class f{constructor(t,e){var s,i,n,r,h,o,l,a,g,c,u,p,f,m;"string"==typeof e&&(e=d[e]),e||(e={}),this.steps=null!==(s=e.steps)&&void 0!==s?s:d.default.steps,this.interval=null!==(i=e.interval)&&void 0!==i?i:d.default.interval,this.initialDelay=null!==(n=e.initialDelay)&&void 0!==n?n:d.default.initialDelay,this.changeChance=null!==(r=e.changeChance)&&void 0!==r?r:d.default.changeChance,this.ghostChance=null!==(h=e.ghostChance)&&void 0!==h?h:d.default.ghostChance,this.maxGhosts=null!==(o=e.maxGhosts)&&void 0!==o?o:d.default.maxGhosts,this.glyphs=null!==(l=function(t){if(void 0===t)return;let e;return e="string"==typeof t?t:t.length?t.join(""):Array.from(t).join(""),e}(e.glyphs))&&void 0!==l?l:d.default.glyphs,this.glyphsFromString=null!==(a=e.glyphsFromString)&&void 0!==a?a:d.default.glyphsFromString,this.ghostCharset=[...this.glyphs],this.oneAtATime=null!==(g=e.oneAtATime)&&void 0!==g?g:d.default.oneAtATime,this.html=null!==(c=e.html)&&void 0!==c?c:d.default.html,this.letterize=null!==(u=e.letterize)&&void 0!==u?u:d.default.letterize,this.endless=null!==(p=e.endless)&&void 0!==p?p:d.default.endless,"undefined"==typeof document&&(this.letterize=!1),this.startFrom=null!==(f=e.startFrom)&&void 0!==f?f:d.default.startFrom,this.writer=t,this.space=(null!==(m=e.fillSpace)&&void 0!==m?m:d.default.fillSpace)?" ":""}get stepsLeft(){return o(this.steps)}get genInterval(){return o(this.interval)}get genInitDelay(){return o(this.initialDelay)}get genMaxGhosts(){if(Number.isInteger(this.maxGhosts))return this.maxGhosts;let t;return t=this.writer.options.html?u(this.writer.goalString).length:this.writer.goalString.length,Math.round((t||20)*this.maxGhosts)}get genGhost(){var t,e;return null!==(t=(e=this.ghostCharset)[s(0,e.length,"floor")])&&void 0!==t?t:""}setCharset(){let t=this.glyphs;this.glyphsFromString&&(t+=function(t){const e="string"==typeof t,s=[];return new Set(t).forEach((t=>s.push(t))),e?s.join(""):s}(this.writer.previousString+(this.writer.options.html?u(this.writer.goalString):this.writer.goalString))),this.ghostCharset=[...t].filter((t=>!["\t","\n","\r","\f","\v"].includes(t)))}}class m{constructor(t){this.nGhosts=0,this.isTyping=!1,this.isPaused=!1,this.finished=!1,this.writer=t,this.maxGhosts=this.writer.options.genMaxGhosts}get ghostsInLimit(){return this.nGhosts<this.maxGhosts}play(){this.isTyping=!0,this.isPaused=!1,this.finished=!1,this.toggleClass(!0),this.maxGhosts=this.writer.options.genMaxGhosts}pause(){this.isTyping=!1,this.isPaused=!0,this.toggleClass(!1)}finish(){this.isTyping=!1,this.finished=!0,this.toggleClass(!1)}toggleClass(t){const e=this.writer.htmlElement,s="gw-writing";e&&(t?((t,e)=>{t.classList.remove(e),t.offsetWidth,t.classList.add(e)})(e,s):e.classList.remove(s))}}var v=function(t,e,s,i){return new(s||(s=Promise))((function(n,r){function h(t){try{l(i.next(t))}catch(t){r(t)}}function o(t){try{l(i.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof s?e:new s((function(t){t(e)}))).then(h,o)}l((i=i.apply(t,e||[])).next())}))};class y{constructor(t,e,s,i="",n=!1){this.ghostsBefore=[],this.ghostsAfter=[],this.stop=!1,this.isTag=!1,this.isWhitespace=!1,this.afterGlitchChance=0,this.writer=t,this.setProps(e,s,i,n),t.options.letterize&&(this.els={ghostsBeforeEl:document.createElement("span"),letterEl:document.createElement("span"),ghostsAfterEl:document.createElement("span")},this.els.ghostsBeforeEl.className="gw-ghosts",this.els.ghostsAfterEl.className="gw-ghosts",this.els.letterEl.className="gw-letter")}setProps(t,e,s="",i=!1){const{options:n}=this.writer;this.l=t,this.gl=e,this.isTag=i,this.ghostsBefore=[...s],this.writer.state.nGhosts+=s.length,this.stepsLeft=n.stepsLeft,i&&(this.stepsLeft=0),this.isWhitespace=(t=>["\t","\n","\r","\f","\v",""," "].includes(t))(e),this.afterGlitchChance=(n.ghostChance+n.changeChance)/3.7}reset(t,e,s="",i=!1){this.setProps(t,e,s,i),this.els&&(this.els.letterEl.className="gw-letter")}get string(){const{l:t,ghostsAfter:e,ghostsBefore:s}=this;return s.join("")+t+e.join("")}get finished(){const{l:t,gl:e,ghostsBefore:s,ghostsAfter:i}=this;return t===e&&0===s.length&&0===i.length||this.isTag}get interval(){let t=this.writer.options.genInterval;return this.isWhitespace&&(t/=2),t}writeToElement(){if(!this.els)return;const{ghostsBeforeEl:t,ghostsAfterEl:e,letterEl:s}=this.els;s.innerHTML=this.l,t.textContent=this.ghostsBefore.join(""),e.textContent=this.ghostsAfter.join("")}set spanElement(t){this.els&&(this.els.charEl=t,this.appendChildren())}appendChildren(){var t,e;null===(e=null===(t=this.els)||void 0===t?void 0:t.charEl)||void 0===e||e.append(this.els.ghostsBeforeEl,this.els.letterEl,this.els.ghostsAfterEl),this.writeToElement()}type(){var t,e,s;return v(this,void 0,void 0,(function*(){const{writer:i}=this;return this.isTag?(this.l=this.gl,i.emiter.call("step"),!0):(yield n(i.options.genInitDelay),yield r((()=>(!this.finished||i.options.endless)&&!i.state.isPaused&&!this.stop),(()=>v(this,void 0,void 0,(function*(){yield n(this.interval);const t=this.string;this.step(),t!==this.string&&(i.emiter.call("step"),this.writeToElement()),!i.options.endless&&this.stepsLeft--})))),this.finished&&(null===(e=null===(t=this.els)||void 0===t?void 0:t.charEl)||void 0===e||e.classList.add("gw-finished"),null===(s=this.els)||void 0===s||s.letterEl.classList.remove("gw-glitched")),this.finished)}))}step(){var t,e;const{writer:s}=this;if(this.stepsLeft>0&&this.l!==this.gl||l(this.afterGlitchChance)&&!this.isWhitespace||s.options.endless){const{ghostChance:e,changeChance:i}=s.options;l(e)&&(s.state.ghostsInLimit?this.addGhost():this.removeGhost()),l(i)&&(null===(t=this.els)||void 0===t||t.letterEl.classList.add("gw-glitched"),this.l=s.options.genGhost)}else this.finished||(null===(e=this.els)||void 0===e||e.letterEl.classList.remove("gw-glitched"),this.l=this.gl,this.removeGhost())}addGhost(){const t=this.writer.options.genGhost;this.writer.state.nGhosts++,l()?w(this.ghostsBefore,t):w(this.ghostsAfter,t)}removeGhost(){(l()&&this.ghostsBefore.length>0?i(this.ghostsBefore):i(this.ghostsAfter))&&this.writer.state.nGhosts--}}function w(t,e){const{length:i}=t;t.splice(s(0,i,"floor"),0,e)}var C=function(t,e,s,i){return new(s||(s=Promise))((function(n,r){function h(t){try{l(i.next(t))}catch(t){r(t)}}function o(t){try{l(i.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof s?e:new s((function(t){t(e)}))).then(h,o)}l((i=i.apply(t,e||[])).next())}))};class E{constructor(t,e,s,i){var n;this.charTable=[],this.goalString="",this.string="","string"==typeof t?"undefined"!=typeof document&&(this.htmlElement=null!==(n=document.querySelector(t))&&void 0!==n?n:void 0):this.htmlElement=null!=t?t:void 0,this.options=new f(this,e),this.state=new m(this),this.emiter=new class{constructor(t,e,s){this.onStepCallback=e,this.onFinishCallback=s,this.writer=t}call(t){var e,s;this.writer.updateString();const{htmlElement:i,writerData:n,string:r}=this.writer;i&&!this.writer.options.letterize&&(this.writer.options.html?i.innerHTML=r:i.textContent=r),null==i||i.setAttribute("data-gw-string",this.writer.options.html?u(r):r),"finish"===t?(this.writer.state.finish(),null===(e=this.onFinishCallback)||void 0===e||e.call(this,r,n),this.emitEvent()):null===(s=this.onStepCallback)||void 0===s||s.call(this,r,n)}emitEvent(){const{htmlElement:t,writerData:e}=this.writer;t&&"undefined"!=typeof CustomEvent&&(null==t||t.dispatchEvent(new CustomEvent("gw-finished",{detail:e})))}}(this,s,i),this.string=this.previousString}updateString(){this.string=this.charTable.map((t=>t.string)).join("")}get previousString(){var t;let e=null===(t=this.htmlElement)||void 0===t?void 0:t.textContent;return"string"!=typeof e&&(e=this.options.html?u(this.string):this.string),e=e.trim(),e}get writerData(){const{options:t,state:e,string:s}=this;return{string:s,writer:this,options:t,state:e}}write(t,e){return C(this,void 0,void 0,(function*(){return"erase"!==this.options.startFrom||(null==e?void 0:e.erase)||(yield this.write(this.genGoalStringToErase(t),{erase:!0})),this.goalString=t,this.state.nGhosts=0,this.options.setCharset(),"matching"===this.options.startFrom?this.createMatchingCharTable():this.createPreviousCharTable(),this.letterize(),this.pause(),this.play({reverse:this.options.oneAtATime&&(null==e?void 0:e.erase)})}))}add(t){return C(this,void 0,void 0,(function*(){const{previousString:e}=this;return this.write(e+t)}))}remove(t){return C(this,void 0,void 0,(function*(){const{previousString:e}=this,s=Array.from(e);return s.splice(-t),this.write(s.join(""),{erase:!0})}))}play(t){var e;return C(this,void 0,void 0,(function*(){const s=[],{charTable:i}=this,{length:n}=i;if(this.state.isTyping)return this.getWriterData("ERROR",`The writer is already typing "${this.goalString}".`);if(this.state.play(),this.options.oneAtATime){const s=null!==(e=null==t?void 0:t.reverse)&&void 0!==e&&e;let h=s?n-1:0,o=!0;const l=()=>C(this,void 0,void 0,(function*(){o=yield i[h].type(),s?h--:h++}));return yield r((()=>{return(t=h)>=0&&t<n&&o&&!this.state.isPaused;var t}),l),this.returnResult(o)}i.forEach((t=>s.push(t.type())));try{const t=(yield Promise.all(s)).every((t=>t));return this.returnResult(t)}catch(t){return this.getWriterData("ERROR","Writer encountered an error.",t)}}))}pause(){this.state.pause()}returnResult(t){return t?this.emiter.call("finish"):this.emiter.call("step"),t?this.getWriterData("SUCCESS","The writer finished typing."):this.getWriterData("ERROR","Writer failed to finish typing.")}createMatchingCharTable(){const{goalStringArray:t,previousString:e}=this,s=Math.min(Math.ceil(this.options.genMaxGhosts/2),5);let i=-1;t.forEach(((t,n)=>{if(i++,"tag"===t.type)return i--,void this.setChar(n,"",t);const r=""!==t.value?e.indexOf(t.value,i):-1;if(-1!==r&&r-i<=s){const s=e.substring(i,r);this.setChar(n,t.value,t,s),i=r}else this.setChar(n,e[i],t)})),this.removeExtraChars(t.length)}createPreviousCharTable(){const{goalStringArray:t,previousString:e}=this;let s=-1;t.forEach(((t,i)=>{if(s++,"tag"===t.type)return s--,void this.setChar(i,"",t);this.setChar(i,e[s],t)})),this.removeExtraChars(t.length)}letterize(){if(!this.options.letterize||!this.htmlElement)return;const t=this.charTable.map((({isTag:t,gl:e})=>t?e:'<span class="gw-char"></span>')).join("");this.htmlElement.innerHTML=t;const e=this.htmlElement.querySelectorAll("span.gw-char");let s=0;this.charTable.forEach((t=>{t.isTag||(t.spanElement=e[s],s++)}))}removeExtraChars(t){const{charTable:e}=this;e.splice(t,e.length-t)}setChar(t,e,s,i){const{charTable:n}=this,r=n[t];r?r.reset(null!=e?e:"",s.value||this.options.space,i,"tag"===s.type):n.push(new y(this,null!=e?e:"",s.value||this.options.space,i,"tag"===s.type))}get goalStringArray(){const{goalString:t,options:e,previousString:s}=this,i=e.html?function(t){const e=new RegExp(c,"g"),s=[];let i,n=0;for(;i=e.exec(t);){const r=i.index,h=e.lastIndex,o=t.slice(n,r);n=h,o&&s.push(...g(o));const l={value:i[0],type:void 0!==i[1]?"html_entity":"tag"};s.push(l)}return t.length>n&&s.push(...g(t.slice(n))),s}(t):g(t),n=Math.max(0,s.length-i.length),r=Math.ceil(n/2),o=Math.floor(n/2);return g(h("",r)).concat(i,g(h("",o)))}getWriterData(t,e,s){const{writerData:i}=this;return Object.assign(Object.assign({},i),{status:t,message:e,error:s})}genGoalStringToErase(t){var e;const{previousString:s}=this;let i="";for(let n=0;n<t.length;n++){const r=t[n],h=null!==(e=s[n])&&void 0!==e?e:"";if(r!==h)break;i+=h}const n=Math.max(t.length-i.length,0);return n>0&&" "===this.options.space&&(i=i.padEnd(n+i.length," ")),i}}function S(t,e,s,i,n){return C(this,void 0,void 0,(function*(){return new E(e,s,i,n).write(t)}))}return e})()}));
//# sourceMappingURL=index.min.map
{
"name": "glitched-writer",
"version": "2.0.17",
"version": "2.0.18",
"description": "Glitched, text writing module. Highly customizable settings. Decoding, decrypting, scrambling, and simply spelling text.",

@@ -5,0 +5,0 @@ "author": "Damian Tarnawski @thetarnav <gthetarnav@gmail.com>",

@@ -10,3 +10,3 @@ # Glitched Writer

> **A lightweight, glitched, text writing module. Highly customizable settings. Decoding, decrypting, scrambling, and simply spelling text. For web and node.**
> **A lightweight, glitched, text writing module. Highly customizable settings. Decoding, decrypting, scrambling, and simply spelling text.**

@@ -27,3 +27,3 @@ ### Features:

- Possible to write text with **html tags** in it or letterize string into many **span** elements.
- Possible to write text with **html tags** in it and letterize it into many **span** elements.

@@ -221,2 +221,28 @@ - Written fully in **Typescript**.

### Endless animation
New option "endless" let's you run the text animation until you disable that function.
This opens the door for some additional effects, like: **Show on hover** (e.g. on secret fields) or **refreshing text** to give it user attention.
```js
// SHOW ON HOVER
// First make the password scramble forever
Writer.options.endless = true
Writer.write('PASSWORD')
// And disable endless option on hover
passEl.addEventListener('mouseover', () => {
Writer.options.endless = true
})
// REFRESHING:
// let's say you already have el with text 'LOOK AT ME'
// and you want to make it pop
Writer.options.endless = true
Writer.write('LOOK AT ME')
await wait(1500)
Writer.options.endless = false
```
### Available imports

@@ -255,4 +281,6 @@

- **encrypted** - Simple Text Scramble effect, suits well displaying secret data, like passwords or card numbers.
```js
new GlitchedWriter(htmlElement, 'nier')
new GlitchedWriter(htmlElement, 'terminal')
```

@@ -267,3 +295,7 @@

new GlitchedWriter(htmlElement, presets.typewriter)
// Extend preset for your needs:
new GlitchedWriter(htmlElement, {
...presets.typewriter,
letterize: true,
})
```

@@ -291,2 +323,3 @@

fillSpace?: boolean // true
endless?: boolean // false
}

@@ -334,2 +367,4 @@ ```

- **endless** - It will make the animation endless. _But why?_ Well, you can disable this option while the animation is running _(writer.options.endless = false)_ and finish the animation.
## Links:

@@ -336,0 +371,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc