tiny-essentials 1.16.1 → 1.17.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/legacy/crypto/decrypt.cjs +1 -0
- package/dist/legacy/crypto/decrypt.d.mts +1 -0
- package/dist/legacy/crypto/decrypt.mjs +1 -0
- package/dist/legacy/crypto/encrypt.cjs +1 -0
- package/dist/legacy/crypto/encrypt.d.mts +1 -0
- package/dist/legacy/crypto/encrypt.mjs +1 -0
- package/dist/legacy/get/decimalColor.cjs +1 -0
- package/dist/legacy/get/decimalColor.d.mts +1 -0
- package/dist/legacy/get/decimalColor.mjs +1 -0
- package/dist/legacy/get/pagination.cjs +1 -0
- package/dist/legacy/get/pagination.d.mts +1 -0
- package/dist/legacy/get/pagination.mjs +1 -0
- package/dist/legacy/get/queryUrlByName.cjs +1 -0
- package/dist/legacy/get/queryUrlByName.d.mts +1 -0
- package/dist/legacy/get/queryUrlByName.mjs +1 -0
- package/dist/legacy/get/queryUrlJSON.cjs +1 -0
- package/dist/legacy/get/queryUrlJSON.d.mts +1 -0
- package/dist/legacy/get/queryUrlJSON.mjs +1 -0
- package/dist/legacy/get/super_string_filter.cjs +1 -0
- package/dist/legacy/get/super_string_filter.d.mts +1 -0
- package/dist/legacy/get/super_string_filter.mjs +1 -0
- package/dist/legacy/get/versionCheck.cjs +1 -0
- package/dist/legacy/get/versionCheck.d.mts +1 -0
- package/dist/legacy/get/versionCheck.mjs +1 -0
- package/dist/legacy/http/HTTP-1.0.cjs +2 -0
- package/dist/legacy/http/HTTP-1.0.mjs +2 -0
- package/dist/legacy/http/auth.cjs +1 -0
- package/dist/legacy/http/auth.d.mts +1 -0
- package/dist/legacy/http/auth.mjs +1 -0
- package/dist/legacy/http/check_domain.cjs +11 -0
- package/dist/legacy/http/check_domain.d.mts +3 -0
- package/dist/legacy/http/check_domain.mjs +11 -0
- package/dist/legacy/http/csrfTokenAnalyze.cjs +1 -0
- package/dist/legacy/http/csrfTokenAnalyze.d.mts +1 -0
- package/dist/legacy/http/csrfTokenAnalyze.mjs +1 -0
- package/dist/legacy/http/domainValidator.cjs +1 -0
- package/dist/legacy/http/domainValidator.d.mts +1 -0
- package/dist/legacy/http/domainValidator.mjs +1 -0
- package/dist/legacy/http/errorsCallback.cjs +1 -0
- package/dist/legacy/http/errorsCallback.d.mts +1 -0
- package/dist/legacy/http/errorsCallback.mjs +1 -0
- package/dist/legacy/http/fetch/json.cjs +1 -0
- package/dist/legacy/http/fetch/json.d.mts +1 -0
- package/dist/legacy/http/fetch/json.mjs +1 -0
- package/dist/legacy/http/fetch/text.cjs +1 -0
- package/dist/legacy/http/fetch/text.d.mts +1 -0
- package/dist/legacy/http/fetch/text.mjs +1 -0
- package/dist/legacy/http/fileCache.cjs +1 -0
- package/dist/legacy/http/fileCache.d.mts +1 -0
- package/dist/legacy/http/fileCache.mjs +1 -0
- package/dist/legacy/http/getDomainURL.cjs +1 -0
- package/dist/legacy/http/getDomainURL.d.mts +1 -0
- package/dist/legacy/http/getDomainURL.mjs +1 -0
- package/dist/legacy/http/userIP.cjs +1 -0
- package/dist/legacy/http/userIP.d.mts +1 -0
- package/dist/legacy/http/userIP.mjs +1 -0
- package/dist/legacy/libs/capitalize.cjs +1 -0
- package/dist/legacy/libs/capitalize.d.mts +1 -0
- package/dist/legacy/libs/capitalize.mjs +1 -0
- package/dist/legacy/libs/convertBytes.cjs +2 -0
- package/dist/legacy/libs/convertBytes.mjs +2 -0
- package/dist/legacy/libs/custom_module_loader.cjs +2 -0
- package/dist/legacy/libs/custom_module_loader.mjs +2 -0
- package/dist/legacy/libs/dice.cjs +2 -0
- package/dist/legacy/libs/dice.mjs +2 -0
- package/dist/legacy/libs/markdown.cjs +1 -0
- package/dist/legacy/libs/markdown.mjs +1 -0
- package/dist/legacy/libs/percentage.cjs +1 -0
- package/dist/legacy/libs/percentage.mjs +1 -0
- package/dist/legacy/libs/regex/getLetter.cjs +2 -0
- package/dist/legacy/libs/regex/getLetter.d.mts +2 -0
- package/dist/legacy/libs/regex/getLetter.mjs +2 -0
- package/dist/legacy/libs/rule3.cjs +1 -0
- package/dist/legacy/libs/rule3.mjs +1 -0
- package/dist/legacy/momentjs/getAge.cjs +1 -0
- package/dist/legacy/momentjs/getAge.d.mts +1 -0
- package/dist/legacy/momentjs/getAge.mjs +1 -0
- package/dist/legacy/momentjs/timeDuration.cjs +1 -0
- package/dist/legacy/momentjs/timeDuration.d.mts +1 -0
- package/dist/legacy/momentjs/timeDuration.mjs +1 -0
- package/dist/legacy/socket.io/antiFlood/install.cjs +1 -0
- package/dist/legacy/socket.io/antiFlood/install.d.mts +1 -0
- package/dist/legacy/socket.io/antiFlood/install.mjs +1 -0
- package/dist/legacy/socket.io/antiFlood/verify.cjs +1 -0
- package/dist/legacy/socket.io/antiFlood/verify.d.mts +1 -0
- package/dist/legacy/socket.io/antiFlood/verify.mjs +1 -0
- package/dist/legacy/socket.io/cookie-session.cjs +1 -0
- package/dist/legacy/socket.io/cookie-session.d.mts +1 -0
- package/dist/legacy/socket.io/cookie-session.mjs +1 -0
- package/dist/legacy/socket.io/discord.cjs +1 -0
- package/dist/legacy/socket.io/discord.d.mts +1 -0
- package/dist/legacy/socket.io/discord.mjs +1 -0
- package/dist/v1/TinyAfterScrollWatcher.js +49 -26
- package/dist/v1/TinyAfterScrollWatcher.min.js +1 -1
- package/dist/v1/TinyBasicsEs.js +559 -71
- package/dist/v1/TinyBasicsEs.min.js +1 -1
- package/dist/v1/TinyDragger.js +486 -47
- package/dist/v1/TinyDragger.min.js +1 -1
- package/dist/v1/TinyEssentials.js +2545 -98
- package/dist/v1/TinyEssentials.min.js +1 -1
- package/dist/v1/TinyHtml.js +486 -47
- package/dist/v1/TinyHtml.min.js +1 -1
- package/dist/v1/TinySmartScroller.js +6230 -0
- package/dist/v1/TinySmartScroller.min.js +1 -0
- package/dist/v1/TinyUploadClicker.js +1538 -72
- package/dist/v1/TinyUploadClicker.min.js +1 -1
- package/dist/v1/UltraRandomMsgGen.js +995 -0
- package/dist/v1/UltraRandomMsgGen.min.js +1 -0
- package/dist/v1/basics/html.cjs +74 -24
- package/dist/v1/basics/html.d.mts +38 -15
- package/dist/v1/basics/html.mjs +63 -20
- package/dist/v1/build/TinySmartScroller.cjs +7 -0
- package/dist/v1/build/TinySmartScroller.d.mts +3 -0
- package/dist/v1/build/TinySmartScroller.mjs +2 -0
- package/dist/v1/build/UltraRandomMsgGen.cjs +7 -0
- package/dist/v1/build/UltraRandomMsgGen.d.mts +3 -0
- package/dist/v1/build/UltraRandomMsgGen.mjs +2 -0
- package/dist/v1/index.cjs +4 -0
- package/dist/v1/index.d.mts +3 -1
- package/dist/v1/index.mjs +3 -1
- package/dist/v1/libs/TinyAfterScrollWatcher.cjs +49 -26
- package/dist/v1/libs/TinyAfterScrollWatcher.d.mts +17 -14
- package/dist/v1/libs/TinyAfterScrollWatcher.mjs +50 -24
- package/dist/v1/libs/TinyHtml.cjs +486 -47
- package/dist/v1/libs/TinyHtml.d.mts +352 -139
- package/dist/v1/libs/TinyHtml.mjs +431 -47
- package/dist/v1/libs/TinySmartScroller.cjs +976 -0
- package/dist/v1/libs/TinySmartScroller.d.mts +458 -0
- package/dist/v1/libs/TinySmartScroller.mjs +856 -0
- package/dist/v1/libs/UltraRandomMsgGen.cjs +956 -0
- package/dist/v1/libs/UltraRandomMsgGen.d.mts +390 -0
- package/dist/v1/libs/UltraRandomMsgGen.mjs +825 -0
- package/docs/v1/README.md +2 -0
- package/docs/v1/basics/html.md +17 -2
- package/docs/v1/libs/TinyAfterScrollWatcher.md +54 -4
- package/docs/v1/libs/TinyHtml.md +197 -8
- package/docs/v1/libs/TinySmartScroller.md +523 -0
- package/docs/v1/libs/UltraRandomMsgGen.md +289 -0
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(()=>{"use strict";var e={d:(n,o)=>{for(var a in o)e.o(o,a)&&!e.o(n,a)&&Object.defineProperty(n,a,{enumerable:!0,get:o[a]})},o:(e,n)=>Object.prototype.hasOwnProperty.call(e,n)},n={};e.d(n,{UltraRandomMsgGen:()=>d});const o=["lorem","ipsum","dolor","sit","amet","consectetur","adipiscing","elit","sed","do","eiusmod","tempor","incididunt","ut","labore","et","dolore","magna","aliqua"],a=["😂","🌈","🤖","💥","🐸","🍕","🦄","🧠","🧬","🚀","🫠","💫","🍩","👾","🎉","🥴","🐙","🧃","🪐","🎈","🧸","👻","🥳","🍭","💖","😺","🌮","🪅","🎮","🥓","🍮"],t=["pudding","bean","snuggle","bloop","jelly","unicorn","floof","giggle","bubble","muffin","puff","pickle","goblin","waffle","sprinkle","cupcake","fizzle","marshmallow","duckling","sock","cloud","teacup","nugget","gnome","hug","moonbean","crayon","jiggle","glitter","carrot","goober"],r=["wiggles","bounces","flies","splats","scoots","giggles","wigglesnacks","twirls","boops","pops","sings","hugs","floats","glows","flaps","mlems","dances","puddles","nomnoms","wigglejumps","sniffs","tumbles","slides","chirps","burps","sparkles","waddles","rambles","blinks","mews"],i=["fluffy","silly","yummy","squishy","wobbly","magical","tiny","sleepy","wiggly","bubbly","glittery","fuzzy","jiggly","sparkly","giggly","crunchy","goofy","soft","mushy","sweet","loopy","floaty","bonkers","chewy","ticklish","dreamy","pastel","cozy","teensy","grumbly"],s=["Boop!","Wiggle achieved.","Oops, {noun} everywhere!","Tiny {adj} {noun}, big {adj} {noun}.","Snuggle initiated with a {adj} {noun}.","{adj} vibes only, powered by {noun}.","No {noun}, no {noun}.","Bounce first, {verb} later.","Mlem. {verb}. {noun}.","{noun} go brrr and {verb}.","Why not? {noun} did. Then {noun} followed.","A {adj} {noun} just {verb} near the {adj} window.","That {adj} {noun} stole my {noun}!","Look, a {adj} {noun} trying to {verb} again!","Every {noun} deserves a {adj} nap.","The {adj} {noun} is my {adj} spirit animal.","Someone call the {noun}, it’s {verb}ing and {verb}ing again!","Don’t touch the {adj} {noun}. It {verb}s loudly.","{noun} forgot how {noun}s work and just {verb}ed.","There once was a {adj} {noun} who loved to {verb} with a {adj} {noun} all day.","Apparently, {noun}s are banned from {verb}ing and {verb}ing in the {noun} library.","That {adj} noise? Just a {noun} learning to {verb} on a {adj} {noun}.","I saw a {adj} {noun} {verb} so hard, it became a {adj} muffin.","The {adj} {noun} met a {adj} pickle and everything {verb}ed.","{noun}s are like {noun}: {adj}, unpredictable, and wiggly.","Don’t judge a {adj} {noun} by its ability to {verb}, or by its {adj} hat.","All I wanted was peace, but a {adj} {noun} with a {adj} {noun} had other plans.","One {adj} morning, a {adj} {noun} decided it was finally time to {verb}, but halfway through, it tripped on a {noun} and turned into a {adj} marshmallow.","I tried to be {adj} today, but then a {noun} {verb}ed across my {noun} and typed “asdfgh{noun}” repeatedly.","If you think you’ve seen everything, wait until a {adj} {noun} {verb}s on a {noun} wearing {adj} socks with tiny {noun}s.","No one ever believed the stories about the ancient {adj} {noun} who could {verb} with such {adj} grace that entire {noun}s turned pink out of embarrassment.","A curious {adj} {noun} wandered into a {noun} shop, not knowing that its destiny involved twelve {adj} {noun}s, one rubber {noun}, and a suspiciously quiet {adj} llama.","In a land where every {adj} {noun} was made of pudding and the sky was {adj} whipped cream, one brave {adj} {noun} set out to discover the legendary Spoon of {noun}s, facing obstacles like bouncing {noun}s, sassy {noun}s, and the Great Wobble of the {noun}.","Once upon a {adj} time, long before the {noun}s learned to {verb}, there existed a tiny {adj} {noun} who dreamed of swimming in a pool made entirely of {adj} glitter pudding while {verb}ing off-key lullabies to passing {noun}s with monocles.","The Council of {noun}s gathered in {adj} secret when the sacred {adj} {noun} started to {verb} uncontrollably, threatening the entire {adj} dessert-based civilization with spontaneous {noun} jiggles and uncontainable {noun} fits across the {noun}.","Hey... do you ever wonder if {noun}s dream of {noun}s?","Okay but hear me out: what if the {adj} {noun} could actually {verb} backwards?","Can we talk about the {noun} that just {verb}ed and vanished?","So I was talking to a {noun}, and it told me to stop being {adj}. Rude.","Not to alarm you, but there’s a {adj} {noun} behind you doing the {verb}.","Why does this {noun} keep staring at me like I owe it pudding?","Is this a safe space to admit I accidentally {verb}ed a {noun}?","I just walked into the room and someone shouted “{adj} {noun}!” — what did I miss?","Wait... we were supposed to bring a {noun}? No one told me!","Okay but what if the {adj} {noun} has feelings too?","Be honest, do I look like a {noun} that forgot how to {verb}?",'If I say "oops", do I still have to explain why the {noun} is glowing?',"I don’t know what’s going on but I brought snacks and a confused {noun}.","Do you think pudding knows it’s pudding? Just a thought.","Is this about the time I {verb}ed the {adj} {noun} by accident? Because I can explain.","Wait, are we talking about {noun}s or am I on the wrong chat again?",'What is this group even about? I just saw "pudding" and joined.',"Hi! I have no idea what’s happening but I’m here and I brought a {noun}.","I blinked and now there’s a {adj} {noun} in charge of everything.","Can someone please explain why the {noun} is floating and chanting?","Okay who gave the {noun} access to glitter and emotional support pickles?","I came for a calm discussion and now there’s a {adj} battle between {noun}s.","Not sure if I’m early, late, or inside a {noun} dream.","I was gone for 3 minutes and now someone’s riding a {noun} into the pudding realm.","This isn’t the pudding appreciation group, is it? ...oh no.","So... who summoned the {adj} {noun} this time? Be honest.","I came here for vibes and stayed for the {noun}s.","Does anyone else hear faint giggling or is that just the {adj} {noun} again?","I feel like I missed step one, two, and also three of this conversation.","All I asked was “what’s up?” and now I’m emotionally attached to a {noun}.",'Me: "I’ll be normal today." Also me: *{verb}s into a meeting riding a {adj} {noun}*','"It’s just pudding," they said. "It can’t hurt you," they said. They were wrong.',"I said one nice thing to a {noun} and now it follows me everywhere.","Can we take a moment to appreciate how the {adj} {noun} is just vibing?","Who put a tiny hat on the {noun}? Because that’s adorable.","My life has been different ever since the {noun} started {verb}ing.","Raise your hand if you’ve ever been personally attacked by a {adj} {noun}.",'"Don’t be weird," they said. So I became a {noun} instead.',"Do {noun}s have feelings? Asking for a {adj} friend.","I trusted the {noun} and all I got was a glitter-covered sock.","Plot twist: the {adj} {noun} was inside us all along.","The {adj} {noun} {verb} and {verb} all over the {adj} {noun}!","Oops! {noun}s {verb}ed into the {adj} {noun} while {verb}ing crazily.","{adj}, {adj}, and more {adj} {noun}s just {verb}ed by!","Why does the {adj} {noun} keep {verb}ing and {verb}ing without stopping?","Look! A {adj} {noun}, a {adj} {noun}, and a {noun} all {verb}ing together!","Sometimes, the {noun} just {verb}s, then {verb}s again, and never stops being {adj}.","{noun}, {noun}, and {noun} — all {verb}ing and {verb}ing in a {adj} {noun}.","I saw a {adj} {noun} {verb}, then another {noun} {verb}ing with a {adj} {noun}.","The {noun} {verb}s {verb} while the {adj} {noun} {verb}s and the {noun} just {verb}s.","Can a {adj} {noun} {verb} {verb} without a {adj} {noun} watching?","Whoa! The {adj} {noun} just {verb}ed... and then {verb}ed again!","Hey... did you see that {adj} {noun} {verb} over there?","Umm, the {noun} is {verb}ing but also {verb}ing and {verb}ing!","Lol! {noun}s {verb} so {adj}ly, it’s impossible not to giggle.",'"Hey! What’s up?" asked the {adj} {noun}, who {verb}ed loudly.','"I’m just a {adj} {noun} trying to {verb}, you know?"','"Did you see the {adj} {noun} that just {verb}ed in the pudding?"','"No way! The {noun} {verb}s better than me!"','"Wait, the {adj} {noun} said it would {verb}, but it {verb}ed instead!"',"Once upon a {adj} {noun}, a group of {adj} {noun}s {verb}ed through the {adj} forest, singing {adj} songs and eating {noun}s made of pudding.","The legend tells of a {adj} {noun} who could {verb} faster than any {noun} ever seen, leaving trails of {adj} sparkles behind.","Every day, the {adj} {noun} would {verb} around the {adj} meadow, trying to convince the {noun}s to join the grand pudding party.","No one knows why the {adj} {noun} suddenly {verb}ed and then {verb}ed again, but everyone agrees it was the cutest thing they ever saw.","In the kingdom of {adj} {noun}s, only the bravest {noun} dared to {verb} the giant pudding monster, armed with nothing but {adj} smiles and jellybeans.","{adj} {noun} {verb} {verb} {verb} {noun} {verb} {adj} {noun} {verb} {noun}!","{noun} {noun} {verb} {adj} {noun} and then {verb} {verb} the {adj} {noun}.","{verb} the {adj} {noun}, then {verb} the {noun} while {verb}ing {adj}ly.","Can the {adj} {noun} {verb} and {verb} the {adj} {noun} at the same time?","{noun} {verb} {noun} {verb}, but the {adj} {noun} {verb}s better.","Boop! The {adj} {noun} just {verb}ed in the pudding.","Bloop bloop, the {noun} is {verb}ing all over again!","Mlem mlem, a {adj} {noun} {verb}s quietly in the corner.","Splat! {noun} {verb}ed right on the {adj} {noun}.","Yum! A {adj} {noun} just {verb}ed in my mouth.","Do {noun}s really {verb} when nobody’s watching?","Why does the {adj} {noun} always {verb} at midnight?","Can a {noun} be too {adj} to {verb} properly?","Is it normal for a {adj} {noun} to {verb} three times in a row?","Who taught the {noun} to {verb} like that?","Wait, did the {adj} {noun} just {verb} itself?","I can’t believe the {noun} {verb}ed into a {adj} {noun}!","Suddenly, a {adj} {noun} appeared and started to {verb} wildly.","That {noun} was {verb}ing so {adj}ly it broke the pudding meter.","Everyone’s talking about the {adj} {noun} that {verb}ed out of nowhere."],d=class{static defaultWords=o;static defaultEmojis=a;static defaultNouns=t;static defaultVerbs=r;static defaultAdjectives=i;static defaultTemplates=s;config={minLength:10,maxLength:300,readable:!0,useEmojis:!0,includeNumbers:!0,includeSymbols:!0,allowWeirdSpacing:!1,emojiSet:[],wordSet:[],mode:"mixed",grammar:{templates:[],nouns:[],verbs:[],adjectives:[]},repeatWords:!0,emojiPlacement:"inline",line:{minLength:20,maxLength:120,emojiChance:.3}};constructor(e={}){this.symbols="!@#$%^&*()-_=+[]{}|;:,.<>?/\\~".split("");const{minLength:n,maxLength:d,readable:u,useEmojis:h,includeNumbers:l,includeSymbols:g,allowWeirdSpacing:m,emojiSet:b,wordSet:c,mode:f,grammar:v,repeatWords:p,emojiPlacement:w,paragraphs:j,line:y}=e;if(void 0!==n&&(!Number.isInteger(n)||n<1))throw new TypeError("config.minLength must be an integer >= 1");if(void 0!==d&&(!Number.isInteger(d)||d<1))throw new TypeError("config.maxLength must be an integer >= 1");if(void 0!==n&&void 0!==d&&n>d)throw new RangeError("config.minLength cannot be greater than config.maxLength");if(void 0!==u&&"boolean"!=typeof u)throw new TypeError("config.readable must be a boolean");if(void 0!==h&&"boolean"!=typeof h)throw new TypeError("config.useEmojis must be a boolean");if(void 0!==l&&"boolean"!=typeof l)throw new TypeError("config.includeNumbers must be a boolean");if(void 0!==g&&"boolean"!=typeof g)throw new TypeError("config.includeSymbols must be a boolean");if(void 0!==m&&"boolean"!=typeof m)throw new TypeError("config.allowWeirdSpacing must be a boolean");if(void 0!==b&&!Array.isArray(b))throw new TypeError("config.emojiSet must be an array of strings");if(void 0!==c&&!Array.isArray(c))throw new TypeError("config.wordSet must be an array of strings");if(void 0!==f&&!["mixed","readable","chaotic","natural"].includes(f))throw new RangeError('config.mode must be one of: "mixed", "readable", "chaotic", "natural');if(void 0!==v){if("object"!=typeof v||null===v)throw new TypeError("config.grammar must be an object");const{templates:e,nouns:n,verbs:o,adjectives:a}=v;if(void 0!==e&&!Array.isArray(e))throw new TypeError("config.grammar.templates must be an array of strings");if(void 0!==n&&!Array.isArray(n))throw new TypeError("config.grammar.nouns must be an array of strings");if(void 0!==o&&!Array.isArray(o))throw new TypeError("config.grammar.verbs must be an array of strings");if(void 0!==a&&!Array.isArray(a))throw new TypeError("config.grammar.adjectives must be an array of strings")}if(void 0!==p&&"boolean"!=typeof p)throw new TypeError("config.repeatWords must be a boolean");if(void 0!==w&&!["inline","end","none"].includes(w))throw new RangeError('config.emojiPlacement must be one of: "inline", "end", "none"');if(void 0!==j){if("object"!=typeof j)throw new TypeError("config.paragraphs must be an object or null");const{min:e,max:n}=j;if(void 0!==e&&(!Number.isInteger(e)||e<1))throw new TypeError("config.paragraphs.min must be an integer >= 1");if(void 0!==n&&(!Number.isInteger(n)||n<1))throw new TypeError("config.paragraphs.max must be an integer >= 1");if(void 0!==e&&void 0!==n&&e>n)throw new RangeError("config.paragraphs.min cannot be greater than config.paragraphs.max")}if(void 0!==y){if("object"!=typeof y||null===y)throw new TypeError("config.line must be an object");const{minLength:e,maxLength:n,emojiChance:o}=y;if(void 0!==e&&(!Number.isInteger(e)||e<1))throw new TypeError("config.line.minLength must be an integer >= 1");if(void 0!==n&&(!Number.isInteger(n)||n<1))throw new TypeError("config.line.maxLength must be an integer >= 1");if(void 0!==e&&void 0!==n&&e>n)throw new RangeError("config.line.minLength cannot be greater than config.line.maxLength");if(void 0!==o&&("number"!=typeof o||o<0||o>1))throw new RangeError("config.line.emojiChance must be a number between 0 and 1")}this.config.emojiSet=[...a],this.config.wordSet=[...o],this.config.grammar.templates=[...s],this.config.grammar.nouns=[...t],this.config.grammar.verbs=[...r],this.config.grammar.adjectives=[...i],Object.assign(this.config,e)}configure(e={}){return Object.assign(this.config,e),this}setGrammarTemplates(...e){return this.config.grammar.templates=e.flat(),this}addGrammarTemplates(...e){return this.config.grammar.templates.push(...e.flat()),this}setGrammarNouns(...e){return this.config.grammar.nouns=e.flat(),this}addGrammarNouns(...e){return this.config.grammar.nouns.push(...e.flat()),this}setGrammarVerbs(...e){return this.config.grammar.verbs=e.flat(),this}addGrammarVerbs(...e){return this.config.grammar.verbs.push(...e.flat()),this}setGrammarAdjectives(...e){return this.config.grammar.adjectives=e.flat(),this}addGrammarAdjectives(...e){return this.config.grammar.adjectives.push(...e.flat()),this}removeGrammarTemplates(...e){const n=new Set(e.flat());return this.config.grammar.templates=this.config.grammar.templates.filter((e=>!n.has(e))),this}removeGrammarNouns(...e){const n=new Set(e.flat());return this.config.grammar.nouns=this.config.grammar.nouns.filter((e=>!n.has(e))),this}removeGrammarVerbs(...e){const n=new Set(e.flat());return this.config.grammar.verbs=this.config.grammar.verbs.filter((e=>!n.has(e))),this}removeGrammarAdjectives(...e){const n=new Set(e.flat());return this.config.grammar.adjectives=this.config.grammar.adjectives.filter((e=>!n.has(e))),this}setWords(...e){return this.config.wordSet=e.flat(),this}addWords(...e){return this.config.wordSet.push(...e.flat()),this}removeWords(...e){const n=new Set(e.flat());return this.config.wordSet=this.config.wordSet.filter((e=>!n.has(e))),this}setEmojis(...e){return this.config.emojiSet=e.flat(),this}addEmojis(...e){return this.config.emojiSet.push(...e.flat()),this}removeEmojis(...e){const n=new Set(e.flat());return this.config.emojiSet=this.config.emojiSet.filter((e=>!n.has(e))),this}_getRandomItem(e){return e[Math.floor(Math.random()*e.length)]}_generateChunk(){const{wordSet:e,emojiSet:n,includeNumbers:o,includeSymbols:a,useEmojis:t,readable:r,mode:i,emojiPlacement:s}=this.config;if("natural"===i)return this._generateNaturalSentence();const d=[];return(r||"readable"===i||"mixed"===i)&&d.push(this._getRandomItem(e)),"chaotic"!==i&&"mixed"!==i||d.push(Math.random().toString(36).slice(2)),o&&d.push(Math.floor(99999*Math.random()).toString()),a&&d.push(this._getRandomItem(this.symbols)),"inline"===s&&t&&n.length&&d.push(this._getRandomItem(n)),this._getRandomItem(d)}_generateNaturalSentence(){const{templates:e,nouns:n,verbs:o,adjectives:a}=this.config.grammar;return this._getRandomItem(e).replace(/{noun}/g,(()=>this._getRandomItem(n))).replace(/{verb}/g,(()=>this._getRandomItem(o))).replace(/{adj}/g,(()=>this._getRandomItem(a)))}_generateLine(e,n){const{allowWeirdSpacing:o,repeatWords:a,readable:t,emojiSet:r,useEmojis:i,emojiPlacement:s,line:d}=this.config,u=[];for(n??=new Set;u.join(" ").length<e;){let e=this._generateChunk();!a&&n.has(e)||(n.add(e),o&&(Math.random()<.1&&(e="\n"+e),Math.random()<.1&&(e=" "+e),Math.random()<.05&&(e=e.toUpperCase())),u.push(e))}let h=u.join(t?" ":"");return"end"===s&&i&&r.length&&Math.random()<(d?.emojiChance||0)&&(h+=" "+this._getRandomItem(r)),h}_generateParagraphLines(e){const{line:n}=this.config,o=[],a=new Set;let t=0;for(;t<e;){const r=Math.floor(Math.random()*(n.maxLength-n.minLength+1)+n.minLength),i=Math.min(r,e-t);o.push(this._generateLine(i,a)),t+=i}return o}generate(){const{minLength:e,maxLength:n,paragraphs:o}=this.config,a=Math.floor(Math.random()*(n-e+1))+e;if(o&&"object"==typeof o){const e=Math.floor(Math.random()*(o.max-o.min+1))+o.min,n=Math.floor(a/e),t=[];for(let o=0;o<e;o++){const e=this._generateParagraphLines(n);t.push(e.join("\n"))}return t.join("\n\n")}return this._generateParagraphLines(a).join("\n")}};window.UltraRandomMsgGen=n.UltraRandomMsgGen})();
|
package/dist/v1/basics/html.cjs
CHANGED
|
@@ -127,20 +127,22 @@ function saveJsonFile(filename, data, spaces = 2) {
|
|
|
127
127
|
}
|
|
128
128
|
|
|
129
129
|
/**
|
|
130
|
-
*
|
|
131
|
-
*
|
|
132
|
-
* @
|
|
133
|
-
* @
|
|
134
|
-
* @
|
|
135
|
-
* @
|
|
136
|
-
* @
|
|
137
|
-
* @param {number} [options.retries=0] - Number of retry attempts (ignored if signal is provided).
|
|
138
|
-
* @param {Headers|Record<string, *>} [options.headers={}] - Additional headers.
|
|
139
|
-
* @param {AbortSignal|null} [options.signal] - External AbortSignal; disables timeout and retries.
|
|
140
|
-
* @returns {Promise<*>} Parsed JSON object.
|
|
141
|
-
* @throws {Error} Throws if fetch fails, times out, or returns invalid JSON.
|
|
130
|
+
* @typedef {Object} FetchTemplateOptions
|
|
131
|
+
* @property {string} [method="GET"] - HTTP method to use (GET, POST, etc.).
|
|
132
|
+
* @property {any} [body] - Request body (only for methods like POST, PUT).
|
|
133
|
+
* @property {number} [timeout=0] - Timeout in milliseconds (ignored if signal is provided).
|
|
134
|
+
* @property {number} [retries=0] - Number of retry attempts (ignored if signal is provided).
|
|
135
|
+
* @property {Headers|Record<string, *>} [headers={}] - Additional headers.
|
|
136
|
+
* @property {AbortSignal|null} [signal] - External AbortSignal; disables timeout and retries.
|
|
142
137
|
*/
|
|
143
|
-
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* @param {string} url - The full URL to fetch data from.
|
|
141
|
+
* @param {FetchTemplateOptions} [options] - Optional settings.
|
|
142
|
+
* @returns {Promise<Response>} Result data.
|
|
143
|
+
* @throws {Error} Throws if fetch fails, times out.
|
|
144
|
+
*/
|
|
145
|
+
async function fetchTemplate(
|
|
144
146
|
url,
|
|
145
147
|
{ method = 'GET', body, timeout = 0, retries = 0, headers = {}, signal = null } = {},
|
|
146
148
|
) {
|
|
@@ -199,17 +201,7 @@ async function fetchJson(
|
|
|
199
201
|
if (timer) clearTimeout(timer);
|
|
200
202
|
|
|
201
203
|
if (!response.ok) throw new Error(`HTTP error: ${response.status} ${response.statusText}`);
|
|
202
|
-
|
|
203
|
-
const contentType = response.headers.get('content-type') || '';
|
|
204
|
-
if (!contentType.includes('application/json'))
|
|
205
|
-
throw new Error(`Unexpected content-type: ${contentType}`);
|
|
206
|
-
|
|
207
|
-
const data = await response.json();
|
|
208
|
-
|
|
209
|
-
if (!Array.isArray(data) && !objFilter.isJsonObject(data))
|
|
210
|
-
throw new Error('Received invalid data instead of valid JSON.');
|
|
211
|
-
|
|
212
|
-
return data;
|
|
204
|
+
return response;
|
|
213
205
|
} catch (err) {
|
|
214
206
|
lastError = /** @type {Error} */ (err);
|
|
215
207
|
if (signal) break; // if an external signal came, it does not retry
|
|
@@ -223,6 +215,63 @@ async function fetchJson(
|
|
|
223
215
|
);
|
|
224
216
|
}
|
|
225
217
|
|
|
218
|
+
/**
|
|
219
|
+
* Loads and parses a JSON from a remote URL using Fetch API.
|
|
220
|
+
*
|
|
221
|
+
* @param {string} url - The full URL to fetch JSON from.
|
|
222
|
+
* @param {Object} [options] - Optional settings.
|
|
223
|
+
* @returns {Promise<any[] | Record<string | number | symbol, unknown>>} Parsed JSON object.
|
|
224
|
+
* @throws {Error} Throws if fetch fails, times out, or returns invalid JSON.
|
|
225
|
+
*/
|
|
226
|
+
async function fetchJson(url, options) {
|
|
227
|
+
return new Promise((resolve, reject) => {
|
|
228
|
+
fetchTemplate(url, options)
|
|
229
|
+
.then(async (res) => {
|
|
230
|
+
const contentType = res.headers.get('content-type') || '';
|
|
231
|
+
if (!contentType.includes('application/json'))
|
|
232
|
+
throw new Error(`Unexpected content-type: ${contentType}`);
|
|
233
|
+
|
|
234
|
+
const data = await res.json();
|
|
235
|
+
|
|
236
|
+
if (!Array.isArray(data) && !objFilter.isJsonObject(data))
|
|
237
|
+
throw new Error('Received invalid data instead of valid JSON.');
|
|
238
|
+
|
|
239
|
+
return resolve(data);
|
|
240
|
+
})
|
|
241
|
+
.catch(reject);
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
/**
|
|
246
|
+
* Loads a remote file as a Blob using Fetch API.
|
|
247
|
+
*
|
|
248
|
+
* @param {string} url - The full URL to fetch the file from.
|
|
249
|
+
* @param {Object} [options] - Optional fetch options.
|
|
250
|
+
* @param {string[]} [allowedMimeTypes] - Optional list of accepted MIME types (e.g., ['image/jpeg']).
|
|
251
|
+
* @returns {Promise<Blob>} - The fetched file as a Blob.
|
|
252
|
+
* @throws {Error} Throws if fetch fails, response is not ok, or MIME type is not allowed.
|
|
253
|
+
*/
|
|
254
|
+
async function fetchBlob(url, allowedMimeTypes, options) {
|
|
255
|
+
return new Promise((resolve, reject) => {
|
|
256
|
+
fetchTemplate(url, options)
|
|
257
|
+
.then(async (res) => {
|
|
258
|
+
const contentType = res.headers.get('content-type') || '';
|
|
259
|
+
|
|
260
|
+
if (
|
|
261
|
+
Array.isArray(allowedMimeTypes) &&
|
|
262
|
+
allowedMimeTypes.length > 0 &&
|
|
263
|
+
!allowedMimeTypes.some((type) => contentType.includes(type))
|
|
264
|
+
) {
|
|
265
|
+
throw new Error(`Blocked MIME type: ${contentType}`);
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
const data = await res.blob();
|
|
269
|
+
return resolve(data);
|
|
270
|
+
})
|
|
271
|
+
.catch(reject);
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
|
|
226
275
|
///////////////////////////////////////////////////////////////////////////////
|
|
227
276
|
|
|
228
277
|
/**
|
|
@@ -348,6 +397,7 @@ function installWindowHiddenScript({
|
|
|
348
397
|
return uninstall;
|
|
349
398
|
}
|
|
350
399
|
|
|
400
|
+
exports.fetchBlob = fetchBlob;
|
|
351
401
|
exports.fetchJson = fetchJson;
|
|
352
402
|
exports.installWindowHiddenScript = installWindowHiddenScript;
|
|
353
403
|
exports.readBase64Blob = readBase64Blob;
|
|
@@ -50,23 +50,20 @@ export function saveJsonFile(filename: string, data: any, spaces?: number): void
|
|
|
50
50
|
*
|
|
51
51
|
* @param {string} url - The full URL to fetch JSON from.
|
|
52
52
|
* @param {Object} [options] - Optional settings.
|
|
53
|
-
* @
|
|
54
|
-
* @param {any} [options.body] - Request body (only for methods like POST, PUT).
|
|
55
|
-
* @param {number} [options.timeout=0] - Timeout in milliseconds (ignored if signal is provided).
|
|
56
|
-
* @param {number} [options.retries=0] - Number of retry attempts (ignored if signal is provided).
|
|
57
|
-
* @param {Headers|Record<string, *>} [options.headers={}] - Additional headers.
|
|
58
|
-
* @param {AbortSignal|null} [options.signal] - External AbortSignal; disables timeout and retries.
|
|
59
|
-
* @returns {Promise<*>} Parsed JSON object.
|
|
53
|
+
* @returns {Promise<any[] | Record<string | number | symbol, unknown>>} Parsed JSON object.
|
|
60
54
|
* @throws {Error} Throws if fetch fails, times out, or returns invalid JSON.
|
|
61
55
|
*/
|
|
62
|
-
export function fetchJson(url: string,
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
56
|
+
export function fetchJson(url: string, options?: Object): Promise<any[] | Record<string | number | symbol, unknown>>;
|
|
57
|
+
/**
|
|
58
|
+
* Loads a remote file as a Blob using Fetch API.
|
|
59
|
+
*
|
|
60
|
+
* @param {string} url - The full URL to fetch the file from.
|
|
61
|
+
* @param {Object} [options] - Optional fetch options.
|
|
62
|
+
* @param {string[]} [allowedMimeTypes] - Optional list of accepted MIME types (e.g., ['image/jpeg']).
|
|
63
|
+
* @returns {Promise<Blob>} - The fetched file as a Blob.
|
|
64
|
+
* @throws {Error} Throws if fetch fails, response is not ok, or MIME type is not allowed.
|
|
65
|
+
*/
|
|
66
|
+
export function fetchBlob(url: string, allowedMimeTypes?: string[], options?: Object): Promise<Blob>;
|
|
70
67
|
/**
|
|
71
68
|
* Installs a script that toggles CSS classes on a given element
|
|
72
69
|
* based on the page's visibility or focus state, and optionally
|
|
@@ -88,4 +85,30 @@ export function installWindowHiddenScript({ element, hiddenClass, visibleClass,
|
|
|
88
85
|
onVisible?: (() => void) | undefined;
|
|
89
86
|
onHidden?: (() => void) | undefined;
|
|
90
87
|
}): () => void;
|
|
88
|
+
export type FetchTemplateOptions = {
|
|
89
|
+
/**
|
|
90
|
+
* - HTTP method to use (GET, POST, etc.).
|
|
91
|
+
*/
|
|
92
|
+
method?: string | undefined;
|
|
93
|
+
/**
|
|
94
|
+
* - Request body (only for methods like POST, PUT).
|
|
95
|
+
*/
|
|
96
|
+
body?: any;
|
|
97
|
+
/**
|
|
98
|
+
* - Timeout in milliseconds (ignored if signal is provided).
|
|
99
|
+
*/
|
|
100
|
+
timeout?: number | undefined;
|
|
101
|
+
/**
|
|
102
|
+
* - Number of retry attempts (ignored if signal is provided).
|
|
103
|
+
*/
|
|
104
|
+
retries?: number | undefined;
|
|
105
|
+
/**
|
|
106
|
+
* - Additional headers.
|
|
107
|
+
*/
|
|
108
|
+
headers?: Headers | Record<string, any> | undefined;
|
|
109
|
+
/**
|
|
110
|
+
* - External AbortSignal; disables timeout and retries.
|
|
111
|
+
*/
|
|
112
|
+
signal?: AbortSignal | null | undefined;
|
|
113
|
+
};
|
|
91
114
|
//# sourceMappingURL=html.d.mts.map
|
package/dist/v1/basics/html.mjs
CHANGED
|
@@ -115,20 +115,21 @@ export function saveJsonFile(filename, data, spaces = 2) {
|
|
|
115
115
|
URL.revokeObjectURL(url);
|
|
116
116
|
}
|
|
117
117
|
/**
|
|
118
|
-
*
|
|
119
|
-
*
|
|
120
|
-
* @
|
|
121
|
-
* @
|
|
122
|
-
* @
|
|
123
|
-
* @
|
|
124
|
-
* @
|
|
125
|
-
* @param {number} [options.retries=0] - Number of retry attempts (ignored if signal is provided).
|
|
126
|
-
* @param {Headers|Record<string, *>} [options.headers={}] - Additional headers.
|
|
127
|
-
* @param {AbortSignal|null} [options.signal] - External AbortSignal; disables timeout and retries.
|
|
128
|
-
* @returns {Promise<*>} Parsed JSON object.
|
|
129
|
-
* @throws {Error} Throws if fetch fails, times out, or returns invalid JSON.
|
|
118
|
+
* @typedef {Object} FetchTemplateOptions
|
|
119
|
+
* @property {string} [method="GET"] - HTTP method to use (GET, POST, etc.).
|
|
120
|
+
* @property {any} [body] - Request body (only for methods like POST, PUT).
|
|
121
|
+
* @property {number} [timeout=0] - Timeout in milliseconds (ignored if signal is provided).
|
|
122
|
+
* @property {number} [retries=0] - Number of retry attempts (ignored if signal is provided).
|
|
123
|
+
* @property {Headers|Record<string, *>} [headers={}] - Additional headers.
|
|
124
|
+
* @property {AbortSignal|null} [signal] - External AbortSignal; disables timeout and retries.
|
|
130
125
|
*/
|
|
131
|
-
|
|
126
|
+
/**
|
|
127
|
+
* @param {string} url - The full URL to fetch data from.
|
|
128
|
+
* @param {FetchTemplateOptions} [options] - Optional settings.
|
|
129
|
+
* @returns {Promise<Response>} Result data.
|
|
130
|
+
* @throws {Error} Throws if fetch fails, times out.
|
|
131
|
+
*/
|
|
132
|
+
async function fetchTemplate(url, { method = 'GET', body, timeout = 0, retries = 0, headers = {}, signal = null } = {}) {
|
|
132
133
|
if (typeof url !== 'string' ||
|
|
133
134
|
(!url.startsWith('../') &&
|
|
134
135
|
!url.startsWith('./') &&
|
|
@@ -171,13 +172,7 @@ export async function fetchJson(url, { method = 'GET', body, timeout = 0, retrie
|
|
|
171
172
|
clearTimeout(timer);
|
|
172
173
|
if (!response.ok)
|
|
173
174
|
throw new Error(`HTTP error: ${response.status} ${response.statusText}`);
|
|
174
|
-
|
|
175
|
-
if (!contentType.includes('application/json'))
|
|
176
|
-
throw new Error(`Unexpected content-type: ${contentType}`);
|
|
177
|
-
const data = await response.json();
|
|
178
|
-
if (!Array.isArray(data) && !isJsonObject(data))
|
|
179
|
-
throw new Error('Received invalid data instead of valid JSON.');
|
|
180
|
-
return data;
|
|
175
|
+
return response;
|
|
181
176
|
}
|
|
182
177
|
catch (err) {
|
|
183
178
|
lastError = /** @type {Error} */ (err);
|
|
@@ -189,6 +184,54 @@ export async function fetchJson(url, { method = 'GET', body, timeout = 0, retrie
|
|
|
189
184
|
}
|
|
190
185
|
throw new Error(`Failed to fetch JSON from "${url}"${lastError ? `: ${lastError.message}` : '.'}`);
|
|
191
186
|
}
|
|
187
|
+
/**
|
|
188
|
+
* Loads and parses a JSON from a remote URL using Fetch API.
|
|
189
|
+
*
|
|
190
|
+
* @param {string} url - The full URL to fetch JSON from.
|
|
191
|
+
* @param {Object} [options] - Optional settings.
|
|
192
|
+
* @returns {Promise<any[] | Record<string | number | symbol, unknown>>} Parsed JSON object.
|
|
193
|
+
* @throws {Error} Throws if fetch fails, times out, or returns invalid JSON.
|
|
194
|
+
*/
|
|
195
|
+
export async function fetchJson(url, options) {
|
|
196
|
+
return new Promise((resolve, reject) => {
|
|
197
|
+
fetchTemplate(url, options)
|
|
198
|
+
.then(async (res) => {
|
|
199
|
+
const contentType = res.headers.get('content-type') || '';
|
|
200
|
+
if (!contentType.includes('application/json'))
|
|
201
|
+
throw new Error(`Unexpected content-type: ${contentType}`);
|
|
202
|
+
const data = await res.json();
|
|
203
|
+
if (!Array.isArray(data) && !isJsonObject(data))
|
|
204
|
+
throw new Error('Received invalid data instead of valid JSON.');
|
|
205
|
+
return resolve(data);
|
|
206
|
+
})
|
|
207
|
+
.catch(reject);
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Loads a remote file as a Blob using Fetch API.
|
|
212
|
+
*
|
|
213
|
+
* @param {string} url - The full URL to fetch the file from.
|
|
214
|
+
* @param {Object} [options] - Optional fetch options.
|
|
215
|
+
* @param {string[]} [allowedMimeTypes] - Optional list of accepted MIME types (e.g., ['image/jpeg']).
|
|
216
|
+
* @returns {Promise<Blob>} - The fetched file as a Blob.
|
|
217
|
+
* @throws {Error} Throws if fetch fails, response is not ok, or MIME type is not allowed.
|
|
218
|
+
*/
|
|
219
|
+
export async function fetchBlob(url, allowedMimeTypes, options) {
|
|
220
|
+
return new Promise((resolve, reject) => {
|
|
221
|
+
fetchTemplate(url, options)
|
|
222
|
+
.then(async (res) => {
|
|
223
|
+
const contentType = res.headers.get('content-type') || '';
|
|
224
|
+
if (Array.isArray(allowedMimeTypes) &&
|
|
225
|
+
allowedMimeTypes.length > 0 &&
|
|
226
|
+
!allowedMimeTypes.some((type) => contentType.includes(type))) {
|
|
227
|
+
throw new Error(`Blocked MIME type: ${contentType}`);
|
|
228
|
+
}
|
|
229
|
+
const data = await res.blob();
|
|
230
|
+
return resolve(data);
|
|
231
|
+
})
|
|
232
|
+
.catch(reject);
|
|
233
|
+
});
|
|
234
|
+
}
|
|
192
235
|
///////////////////////////////////////////////////////////////////////////////
|
|
193
236
|
/**
|
|
194
237
|
* Installs a script that toggles CSS classes on a given element
|
package/dist/v1/index.cjs
CHANGED
|
@@ -25,6 +25,8 @@ var TinyNotifications = require('./libs/TinyNotifications.cjs');
|
|
|
25
25
|
var collision = require('./basics/collision.cjs');
|
|
26
26
|
var TinyHtml = require('./libs/TinyHtml.cjs');
|
|
27
27
|
var TinyAfterScrollWatcher = require('./libs/TinyAfterScrollWatcher.cjs');
|
|
28
|
+
var UltraRandomMsgGen = require('./libs/UltraRandomMsgGen.cjs');
|
|
29
|
+
var TinySmartScroller = require('./libs/TinySmartScroller.cjs');
|
|
28
30
|
|
|
29
31
|
|
|
30
32
|
|
|
@@ -129,3 +131,5 @@ exports.getElsRelativeCenterOffset = collision.getElsRelativeCenterOffset;
|
|
|
129
131
|
exports.getRectCenter = collision.getRectCenter;
|
|
130
132
|
exports.TinyHtml = TinyHtml;
|
|
131
133
|
exports.TinyAfterScrollWatcher = TinyAfterScrollWatcher;
|
|
134
|
+
exports.UltraRandomMsgGen = UltraRandomMsgGen;
|
|
135
|
+
exports.TinySmartScroller = TinySmartScroller;
|
package/dist/v1/index.d.mts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import TinySmartScroller from './libs/TinySmartScroller.mjs';
|
|
2
|
+
import UltraRandomMsgGen from './libs/UltraRandomMsgGen.mjs';
|
|
1
3
|
import TinyAfterScrollWatcher from './libs/TinyAfterScrollWatcher.mjs';
|
|
2
4
|
import TinyHtml from './libs/TinyHtml.mjs';
|
|
3
5
|
import TinyNotifications from './libs/TinyNotifications.mjs';
|
|
@@ -99,5 +101,5 @@ import { getTimeDuration } from './basics/clock.mjs';
|
|
|
99
101
|
import { shuffleArray } from './basics/array.mjs';
|
|
100
102
|
import { toTitleCase } from './basics/text.mjs';
|
|
101
103
|
import { toTitleCaseLowerFirst } from './basics/text.mjs';
|
|
102
|
-
export { TinyAfterScrollWatcher, TinyHtml, TinyNotifications, TinyDomReadyManager, TinyDragger, TinyDragDropDetector, TinyToastNotify, TinyNotifyCenter, TinyRateLimiter, ColorSafeStringify, TinyPromiseQueue, TinyLevelUp, areElsCollTop, areElsCollBottom, areElsCollLeft, areElsCollRight, areElsCollPerfTop, areElsCollPerfBottom, areElsCollPerfLeft, areElsCollPerfRight, areElsColliding, areElsPerfColliding, getElsColliding, getElsPerfColliding, getElsCollOverlap, getElsCollOverlapPos, getRectCenter, getElsRelativeCenterOffset, getElsCollDirDepth, getElsCollDetails, isInViewport, isScrolledIntoView, safeTextTrim, installWindowHiddenScript, genFibonacciSeq, isDirEmptyAsync, fileSizeAsync, dirSizeAsync, listFilesAsync, listDirsAsync, getHtmlElBorders, getHtmlElBordersWidth, getHtmlElMargin, getHtmlElPadding, getLatestBackupPath, fetchJson, readJsonBlob, readFileBlob, readBase64Blob, saveJsonFile, readJsonFile, writeJsonFile, ensureDirectory, clearDirectoryAsync, clearDirectory, fileExists, dirExists, isDirEmpty, ensureCopyFile, tryDeleteFile, writeTextFile, listFiles, listDirs, fileSize, dirSize, backupFile, restoreLatestBackup, renameFileBatch, renameFileRegex, renameFileAddPrefixSuffix, renameFileNormalizeCase, renameFilePadNumbers, documentIsFullScreen, isScreenFilled, requestFullScreen, exitFullScreen, isFullScreenMode, onFullScreenChange, offFullScreenChange, areHtmlElsColliding, isJsonObject, arraySortPositions, formatBytes, addAiMarkerShortcut, extendObjType, reorderObjTypeOrder, cloneObjTypeOrder, countObj, checkObj, objType, ruleOfThree, getSimplePerc, asyncReplace, getAge, formatCustomTimer, formatDayTimer, formatTimer, getTimeDuration, shuffleArray, toTitleCase, toTitleCaseLowerFirst };
|
|
104
|
+
export { TinySmartScroller, UltraRandomMsgGen, TinyAfterScrollWatcher, TinyHtml, TinyNotifications, TinyDomReadyManager, TinyDragger, TinyDragDropDetector, TinyToastNotify, TinyNotifyCenter, TinyRateLimiter, ColorSafeStringify, TinyPromiseQueue, TinyLevelUp, areElsCollTop, areElsCollBottom, areElsCollLeft, areElsCollRight, areElsCollPerfTop, areElsCollPerfBottom, areElsCollPerfLeft, areElsCollPerfRight, areElsColliding, areElsPerfColliding, getElsColliding, getElsPerfColliding, getElsCollOverlap, getElsCollOverlapPos, getRectCenter, getElsRelativeCenterOffset, getElsCollDirDepth, getElsCollDetails, isInViewport, isScrolledIntoView, safeTextTrim, installWindowHiddenScript, genFibonacciSeq, isDirEmptyAsync, fileSizeAsync, dirSizeAsync, listFilesAsync, listDirsAsync, getHtmlElBorders, getHtmlElBordersWidth, getHtmlElMargin, getHtmlElPadding, getLatestBackupPath, fetchJson, readJsonBlob, readFileBlob, readBase64Blob, saveJsonFile, readJsonFile, writeJsonFile, ensureDirectory, clearDirectoryAsync, clearDirectory, fileExists, dirExists, isDirEmpty, ensureCopyFile, tryDeleteFile, writeTextFile, listFiles, listDirs, fileSize, dirSize, backupFile, restoreLatestBackup, renameFileBatch, renameFileRegex, renameFileAddPrefixSuffix, renameFileNormalizeCase, renameFilePadNumbers, documentIsFullScreen, isScreenFilled, requestFullScreen, exitFullScreen, isFullScreenMode, onFullScreenChange, offFullScreenChange, areHtmlElsColliding, isJsonObject, arraySortPositions, formatBytes, addAiMarkerShortcut, extendObjType, reorderObjTypeOrder, cloneObjTypeOrder, countObj, checkObj, objType, ruleOfThree, getSimplePerc, asyncReplace, getAge, formatCustomTimer, formatDayTimer, formatTimer, getTimeDuration, shuffleArray, toTitleCase, toTitleCaseLowerFirst };
|
|
103
105
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/v1/index.mjs
CHANGED
|
@@ -23,4 +23,6 @@ import TinyNotifications from './libs/TinyNotifications.mjs';
|
|
|
23
23
|
import { areElsCollTop, areElsCollBottom, areElsCollLeft, areElsCollRight, areElsCollPerfTop, areElsCollPerfBottom, areElsCollPerfLeft, areElsCollPerfRight, areElsColliding, areElsPerfColliding, getElsColliding, getElsPerfColliding, getElsCollOverlap, getElsCollOverlapPos, getRectCenter, getElsRelativeCenterOffset, getElsCollDirDepth, getElsCollDetails, } from './basics/collision.mjs';
|
|
24
24
|
import TinyHtml from './libs/TinyHtml.mjs';
|
|
25
25
|
import TinyAfterScrollWatcher from './libs/TinyAfterScrollWatcher.mjs';
|
|
26
|
-
|
|
26
|
+
import UltraRandomMsgGen from './libs/UltraRandomMsgGen.mjs';
|
|
27
|
+
import TinySmartScroller from './libs/TinySmartScroller.mjs';
|
|
28
|
+
export { TinySmartScroller, UltraRandomMsgGen, TinyAfterScrollWatcher, TinyHtml, TinyNotifications, TinyDomReadyManager, TinyDragger, TinyDragDropDetector, TinyToastNotify, TinyNotifyCenter, TinyRateLimiter, ColorSafeStringify, TinyPromiseQueue, TinyLevelUp, areElsCollTop, areElsCollBottom, areElsCollLeft, areElsCollRight, areElsCollPerfTop, areElsCollPerfBottom, areElsCollPerfLeft, areElsCollPerfRight, areElsColliding, areElsPerfColliding, getElsColliding, getElsPerfColliding, getElsCollOverlap, getElsCollOverlapPos, getRectCenter, getElsRelativeCenterOffset, getElsCollDirDepth, getElsCollDetails, isInViewport, isScrolledIntoView, safeTextTrim, installWindowHiddenScript, genFibonacciSeq, isDirEmptyAsync, fileSizeAsync, dirSizeAsync, listFilesAsync, listDirsAsync, getHtmlElBorders, getHtmlElBordersWidth, getHtmlElMargin, getHtmlElPadding, getLatestBackupPath, fetchJson, readJsonBlob, readFileBlob, readBase64Blob, saveJsonFile, readJsonFile, writeJsonFile, ensureDirectory, clearDirectoryAsync, clearDirectory, fileExists, dirExists, isDirEmpty, ensureCopyFile, tryDeleteFile, writeTextFile, listFiles, listDirs, fileSize, dirSize, backupFile, restoreLatestBackup, renameFileBatch, renameFileRegex, renameFileAddPrefixSuffix, renameFileNormalizeCase, renameFilePadNumbers, documentIsFullScreen, isScreenFilled, requestFullScreen, exitFullScreen, isFullScreenMode, onFullScreenChange, offFullScreenChange, areHtmlElsColliding, isJsonObject, arraySortPositions, formatBytes, addAiMarkerShortcut, extendObjType, reorderObjTypeOrder, cloneObjTypeOrder, countObj, checkObj, objType, ruleOfThree, getSimplePerc, asyncReplace, getAge, formatCustomTimer, formatDayTimer, formatTimer, getTimeDuration, shuffleArray, toTitleCase, toTitleCaseLowerFirst, };
|
|
@@ -19,8 +19,8 @@ class TinyAfterScrollWatcher {
|
|
|
19
19
|
/** @type {Element|Window} */
|
|
20
20
|
#scrollTarget;
|
|
21
21
|
|
|
22
|
-
/** @type {
|
|
23
|
-
lastScrollTime =
|
|
22
|
+
/** @type {null|NodeJS.Timeout} */
|
|
23
|
+
#lastScrollTime = null;
|
|
24
24
|
|
|
25
25
|
/** @type {FnData[]} */
|
|
26
26
|
#afterScrollQueue = [];
|
|
@@ -31,6 +31,9 @@ class TinyAfterScrollWatcher {
|
|
|
31
31
|
/** @type {Set<OnScrollFunc>} */
|
|
32
32
|
#externalScrollListeners = new Set();
|
|
33
33
|
|
|
34
|
+
/** @type {Set<FnData>} */
|
|
35
|
+
#onStopListeners = new Set();
|
|
36
|
+
|
|
34
37
|
/** @type {boolean} */
|
|
35
38
|
#destroyed = false;
|
|
36
39
|
|
|
@@ -44,16 +47,20 @@ class TinyAfterScrollWatcher {
|
|
|
44
47
|
if (!(scrollTarget instanceof Element) && !(scrollTarget instanceof Window))
|
|
45
48
|
throw new TypeError('scrollTarget must be an Element or the Window object.');
|
|
46
49
|
this.#scrollTarget = scrollTarget;
|
|
50
|
+
this._checkTimer = this._checkTimer.bind(this);
|
|
47
51
|
|
|
48
|
-
this.
|
|
49
|
-
this._checkQueue = this._checkQueue.bind(this);
|
|
50
|
-
|
|
51
|
-
this.#scrollTarget.addEventListener('scroll', this._onScroll);
|
|
52
|
+
this.#scrollTarget.addEventListener('scroll', this._checkTimer);
|
|
52
53
|
this.#inactivityTime = inactivityTime;
|
|
53
|
-
|
|
54
|
-
requestAnimationFrame(this._checkQueue);
|
|
55
54
|
}
|
|
56
55
|
|
|
56
|
+
_checkTimer = () => {
|
|
57
|
+
if (this.#lastScrollTime) clearTimeout(this.#lastScrollTime);
|
|
58
|
+
this.#lastScrollTime = setTimeout(() => {
|
|
59
|
+
this.#lastScrollTime = null;
|
|
60
|
+
this.#checkQueue();
|
|
61
|
+
}, this.#inactivityTime);
|
|
62
|
+
};
|
|
63
|
+
|
|
57
64
|
/**
|
|
58
65
|
* Gets the current inactivity time in milliseconds.
|
|
59
66
|
* @returns {number}
|
|
@@ -74,29 +81,21 @@ class TinyAfterScrollWatcher {
|
|
|
74
81
|
this.#inactivityTime = value;
|
|
75
82
|
}
|
|
76
83
|
|
|
77
|
-
/**
|
|
78
|
-
* Internal handler for scroll events.
|
|
79
|
-
* Updates the last scroll timestamp.
|
|
80
|
-
* @private
|
|
81
|
-
*/
|
|
82
|
-
_onScroll() {
|
|
83
|
-
this.lastScrollTime = Date.now();
|
|
84
|
-
}
|
|
85
|
-
|
|
86
84
|
/**
|
|
87
85
|
* Continuously checks whether the user has stopped scrolling,
|
|
88
86
|
* and if so, runs all queued functions.
|
|
89
|
-
* @private
|
|
90
87
|
*/
|
|
91
|
-
|
|
88
|
+
#checkQueue() {
|
|
92
89
|
if (this.#destroyed) return;
|
|
93
|
-
|
|
90
|
+
// Runs all onStop first listeners
|
|
91
|
+
for (const fn of this.#onStopListeners) {
|
|
92
|
+
if (typeof fn === 'function') fn();
|
|
93
|
+
}
|
|
94
94
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
}
|
|
95
|
+
// Then execute the queue afterScrollQueue
|
|
96
|
+
while (this.#afterScrollQueue.length) {
|
|
97
|
+
const fn = this.#afterScrollQueue.pop();
|
|
98
|
+
if (typeof fn === 'function') fn();
|
|
100
99
|
}
|
|
101
100
|
}
|
|
102
101
|
|
|
@@ -113,6 +112,29 @@ class TinyAfterScrollWatcher {
|
|
|
113
112
|
this.#afterScrollQueue.push(fn);
|
|
114
113
|
}
|
|
115
114
|
|
|
115
|
+
/**
|
|
116
|
+
* Registers a function to run once after scrolling has stopped,
|
|
117
|
+
* before any afterScrollQueue functions.
|
|
118
|
+
*
|
|
119
|
+
* @param {FnData} fn - A function to execute after scroll stop.
|
|
120
|
+
* @throws {TypeError} If the argument is not a function.
|
|
121
|
+
*/
|
|
122
|
+
onStop(fn) {
|
|
123
|
+
if (typeof fn !== 'function') throw new TypeError('Argument must be a function.');
|
|
124
|
+
this.#onStopListeners.add(fn);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Removes a previously registered onStop function.
|
|
129
|
+
*
|
|
130
|
+
* @param {FnData} fn - The function to remove.
|
|
131
|
+
* @throws {TypeError} If the argument is not a function.
|
|
132
|
+
*/
|
|
133
|
+
offStop(fn) {
|
|
134
|
+
if (typeof fn !== 'function') throw new TypeError('Argument must be a function.');
|
|
135
|
+
this.#onStopListeners.delete(fn);
|
|
136
|
+
}
|
|
137
|
+
|
|
116
138
|
/**
|
|
117
139
|
* Registers an external scroll listener on the tracked element.
|
|
118
140
|
*
|
|
@@ -146,11 +168,12 @@ class TinyAfterScrollWatcher {
|
|
|
146
168
|
if (this.#destroyed) return;
|
|
147
169
|
this.#destroyed = true;
|
|
148
170
|
|
|
149
|
-
this.#scrollTarget.removeEventListener('scroll', this.
|
|
171
|
+
this.#scrollTarget.removeEventListener('scroll', this._checkTimer);
|
|
150
172
|
for (const fn of this.#externalScrollListeners)
|
|
151
173
|
this.#scrollTarget.removeEventListener('scroll', fn);
|
|
152
174
|
|
|
153
175
|
this.#externalScrollListeners.clear();
|
|
176
|
+
this.#onStopListeners.clear();
|
|
154
177
|
}
|
|
155
178
|
}
|
|
156
179
|
|
|
@@ -29,20 +29,7 @@ declare class TinyAfterScrollWatcher {
|
|
|
29
29
|
* @throws {TypeError} If inactivityTime is not a positive number
|
|
30
30
|
*/
|
|
31
31
|
constructor(scrollTarget?: Element | Window, inactivityTime?: number);
|
|
32
|
-
|
|
33
|
-
lastScrollTime: number;
|
|
34
|
-
/**
|
|
35
|
-
* Internal handler for scroll events.
|
|
36
|
-
* Updates the last scroll timestamp.
|
|
37
|
-
* @private
|
|
38
|
-
*/
|
|
39
|
-
private _onScroll;
|
|
40
|
-
/**
|
|
41
|
-
* Continuously checks whether the user has stopped scrolling,
|
|
42
|
-
* and if so, runs all queued functions.
|
|
43
|
-
* @private
|
|
44
|
-
*/
|
|
45
|
-
private _checkQueue;
|
|
32
|
+
_checkTimer: () => void;
|
|
46
33
|
/**
|
|
47
34
|
* Sets a new inactivity time.
|
|
48
35
|
* Must be a positive number (in milliseconds).
|
|
@@ -63,6 +50,22 @@ declare class TinyAfterScrollWatcher {
|
|
|
63
50
|
* @throws {TypeError} If the argument is not a function.
|
|
64
51
|
*/
|
|
65
52
|
doAfterScroll(fn: () => void): void;
|
|
53
|
+
lastScrollTime: number | undefined;
|
|
54
|
+
/**
|
|
55
|
+
* Registers a function to run once after scrolling has stopped,
|
|
56
|
+
* before any afterScrollQueue functions.
|
|
57
|
+
*
|
|
58
|
+
* @param {FnData} fn - A function to execute after scroll stop.
|
|
59
|
+
* @throws {TypeError} If the argument is not a function.
|
|
60
|
+
*/
|
|
61
|
+
onStop(fn: FnData): void;
|
|
62
|
+
/**
|
|
63
|
+
* Removes a previously registered onStop function.
|
|
64
|
+
*
|
|
65
|
+
* @param {FnData} fn - The function to remove.
|
|
66
|
+
* @throws {TypeError} If the argument is not a function.
|
|
67
|
+
*/
|
|
68
|
+
offStop(fn: FnData): void;
|
|
66
69
|
/**
|
|
67
70
|
* Registers an external scroll listener on the tracked element.
|
|
68
71
|
*
|