tiny-essentials
Version:
Collection of small, essential scripts designed to be used across various projects. These simple utilities are crafted for speed, ease of use, and versatility.
128 lines (90 loc) โข 14.2 kB
Markdown
# Documentation Menu
Welcome to the documentation! This is the central hub for exploring all available resources.
Here, you can navigate through different sections of the project. Below are the main directories:
---
## ๐ Main Directories
### 1. **`basics/`** This folder contains the core scripts we have worked on so far. Each file is a module focused on specific functionality.
- ๐ฆ **[Array](./basics/array.md)** โ A tiny utility for shuffling arrays using the FisherโYates algorithm.
- โฐ **[Clock](./basics/clock.md)** โ A versatile time utility module for calculating and formatting time durations.
- ๐ง **[ObjFilter](./basics/objFilter.md)** โ Type detection, extension, and analysis made easy with simple and extensible type validation.
* ๐งฎ **[objChecker](./basics/objChecker.md)** โ Utilities for counting keys in objects or arrays and for safely detecting plain JSON-compatible objects.
- ๐ข **[SimpleMath](./basics/simpleMath.md)** โ A collection of simple math utilities for calculations like the Rule of Three and percentages.
- โ๏ธ **[Text](./basics/text.md)** โ A utility for transforming text into title case formats, with multiple options for capitalization.
- ๐ **[AsyncReplace](./basics/asyncReplace.md)** โ Asynchronously replaces matches in a string using a regex and an async function.
- ๐ผ๏ธ **[Html](./basics/html.md)** โ Utilities for handling DOM element interactions like collision detection and basic element manipulation.
- ๐บ **[FullScreen](./basics/fullScreen.md)** โ A complete fullscreen API manager with detection, event handling, and cross-browser compatibility.
- ๐งฑ **[Collision](./basics/collision.md)** โ Full-featured rectangle collision detection system with directional analysis, depth calculation, and center offset metrics.
- ๐ต **[MediaContent](./basics/mediaContent.md)** โ A comprehensive media processing module for downloading audio, extracting rich ID3 metadata, and managing image blobs for album art.
### 2. **`libs/`**
- ๐๏ธ **[TinyPromiseQueue](./libs/TinyPromiseQueue.md)** โ A class that allows sequential execution of asynchronous tasks, supporting task delays, cancellation, and queue management.
- ๐
**[TinyLevelUp](./libs/TinyLevelUp.md)** โ A class to manage user level-up logic based on experience points, providing methods for experience validation, addition, removal, and calculation.
- ๐จ **[ColorSafeStringify](./libs/ColorSafeStringify.md)** โ A utility for applying customizable ANSI colors to JSON strings in terminal outputs, supporting presets and fine-grained type-based highlighting.
- ๐ฆ **[TinyRateLimiter](./libs/TinyRateLimiter.md)** โ A flexible per-user rate limiter supporting time windows, hit caps, and automatic cleanup of inactive users.
- ๐ **[TinyNotifyCenter](./libs/TinyNotifyCenter.md)** โ A dynamic notification center class to display, manage, and interact with notifications, supporting avatars, clickable items, HTML/text modes, and clean UI controls.
- ๐ **[TinyToastNotify](./libs/TinyToastNotify.md)** โ A lightweight toast notification system supporting positioning, timing customization, avatars, click actions, and fade-out animations.
- ๐ฅ **[TinyDragDropDetector](./libs/TinyDragDropDetector.md)** โ A lightweight drag-and-drop detector for files, handling the full drag lifecycle (`enter`, `over`, `leave`, `drop`) with CSS hover management and safe event handling on any DOM element or the full page.
- ๐ **[TinyUploadClicker](./libs/TinyUploadClicker.md)** โ A minimal utility to bind any clickable element to a hidden file input, offering full control over styling, behavior, and upload event hooks.
- ๐งฒ **[TinyDragger](./libs/TinyDragger.md)** โ A flexible drag-and-drop manager with collision detection, jail constraints, vibration feedback, visual proxies, revert-on-drop, and full custom event support.
- ๐ **[TinyDomReadyManager](./libs/TinyDomReadyManager.md)** โ A readiness manager for DOM and async conditions, supporting prioritized callbacks, custom filters, and event-based or promise-based bootstrapping.
- ๐ฃ **[TinyNotifications](./libs/TinyNotifications.md)** โ A browser notification utility with sound support, permission management, truncation logic, default icons, and enforced validation to ensure safe and predictable usage.
- ๐งฑ **[TinyHtml](./libs/TinyHtml.md)** โ A minimalist DOM utility class that offers jQuery-like methods in pure JavaScript for querying, styling, traversing, event handling, collision detection, and visibility logic โ all in a lightweight and chainable interface.
- ๐ **[TinySmartScroller](./libs/TinySmartScroller.md)** โ A smart scroll monitor that detects user scroll behavior, visibility changes, element sizes, and automatically handles scroll preservation, bottom detection, debounce, and more.
- ๐ **[TinyClipboard](./libs/TinyClipboard.md)** โ A clipboard management utility with support for modern APIs, legacy fallbacks, and custom copy handlers for text and blobs, plus flexible read operations and clipboard item filtering.
- ๐ฎ **[UltraRandomMsgGen](./libs/UltraRandomMsgGen.md)** โ A whimsical random message generator using grammar templates, word sets, emojis, and chaotic modes to craft playful text outputs.
- โ๏ธ **[TinyTextRangeEditor](./libs/TinyTextRangeEditor.md)** โ An flexible text range manipulation utility for `input` and `textarea` elements. Supports selection, cursor control, tag insertion, attribute handling, inline editing, formatting, and advanced wrap/toggle logic with optional spacing auto-completion.
- โณ **[TinyTimeout](./libs/TinyTimeout.md)** โ A dynamic timeout and delay manager with support for usage-based throttling, delay scaling, configurable decay intervals, and asynchronous polling for conditions.
- ๐ **[TinyColorConverter](./libs/TinyColorConverter.md)** โ A complete color conversion toolkit supporting hex, RGB(A), HSL(A), and integer formats, with smooth gradient generation, color parsing, and multi-format output conversion.
- ๐ฆ **[TinyLocalStorage](./libs/TinyLocalStorage.md)** โ A tiny wrapper for `localStorage` with full support for objects, arrays, `Map`, `Set`, and typed value helpers like string, number, and boolean.
- ๐ผ๏ธ **[TinyIframeEvents](./libs/TinyIframeEvents.md)** โ A structured `postMessage`-based event router for secure and reliable communication between a parent window and its embedded iframe. Supports directional filtering, origin enforcement, payload transport, and listener lifecycle.
- ๐ช **[TinyNewWinEvents](./libs/TinyNewWinEvents.md)** โ A smart, route-based `postMessage` system for structured communication between a main window and a popup (`window.open`). Includes queueing, origin enforcement, and lifecycle tracking.
- ๐ฎ **[TinyGamepad](./libs/TinyGamepad.md)** โ A flexible, professional gamepad and input manager supporting keyboard, mouse, combos, haptics, and custom input mappings.
- โจ **[TinyTextarea](./libs/TinyTextarea.md)** โ A minimal auto-expanding `<textarea>` manager with configurable row limits, extra height padding, and real-time resize/input event hooks.
- ๐ **[TinyDayNightCycle](./libs/TinyDayNightCycle.md)** โ A comprehensive day-night cycle system managing seasons, moons, time, and weather with configurable durations, phases, and dynamic weather selection.
- ๐ฏ **[TinyAdvancedRaffle](./libs/TinyAdvancedRaffle.md)** โ An advanced, seedable raffle system with weighted items, pity systems, exclusions, group management, modifiers, conditional rules, normalization modes, and JSON import/export.
- ๐ **[TinyArrayPaginator](./libs/TinyArrayPaginator.md)** โ A secure and flexible array pagination wrapper that returns paginated results along with metadata, supports filtering via predicates or object-based matching, and prevents direct modification of the source data.
- ๐ช **[TinyCookieConsent](./libs/TinyCookieConsent.md)** โ A flexible and customizable cookie consent manager that displays a consent bar, supports multiple categories, saves preferences in localStorage, allows custom renderers, and provides smooth animations for showing and hiding elements.
- ๐ฆ **[TinyInventory](./libs/TinyInventory.md)** โ A robust inventory management system with stack handling, slot management, special equipment slots, serialization, cloning, and item registry support.
- ๐ค **[TinyInventoryTrader](./libs/TinyInventoryTrader.md)** โ A trading helper for safely transferring items between two inventories with support for strict mode, slot targeting, and batch operations.
- ๐ **[TinyI18](./libs/TinyI18.md)** โ A flexible i18n manager supporting local and file modes, regex-based keys, function-based entries, string interpolation, and safe helper functions for advanced rendering.
- ๐ฎ **[TinyNeedBar](./libs/TinyNeedBar.md)** โ A versatile "need bar" system for simulating decay over time with multiple configurable factors, serialization, cloning, and full control over clamped and infinite values.
- ๐ฒ **[TinySimpleDice](./libs/TinySimpleDice.md)** โ A lightweight and flexible dice rolling utility with configurable maximum values, zero allowance, and array/Set index rolling support.
- ๐ **[TinyElementObserver](./libs/TinyElementObserver.md)** โ A DOM mutation tracking utility built on MutationObserver, with customizable detectors for handling changes, event dispatching, and lifecycle management.
- โณ **[TinyLoadingScreen](./libs/TinyLoadingScreen.md)** โ A lightweight, fully-configurable loading overlay with fade-in/out animations, custom messages (string or HTMLElement), HTML rendering option, and status-change callbacks.
- ๐จ **[TinyColorValidator](./libs/TinyColorValidator.md)** โ A comprehensive CSS color validation and parsing utility supporting HEX, HEXA, RGB, RGBA, HSL, HSLA, HWB, Lab, LCH, standard HTML color names, and special keywords, with automatic type detection and parsing.
* ๐ **[TinyTextDiffer](./libs/TinyTextDiffer.md)** โ A granular text comparison utility using the LCS algorithm to detect additions, deletions, and unchanged segments between multiple history versions, returning a clean, parseable diff structure.
* ๐ **[TinyAnalogClock](./libs/TinyAnalogClock.md)** โ A lightweight analog clock engine for managing time-based rotations, supporting custom offsets, smooth transitions, and easy binding to CSS variables rendering.
* ๐ **[TinyArrayComparator](./libs/TinyArrayComparator.md)** โ A lightweight, highly optimized JavaScript utility class designed to compare two arrays and efficiently detect which items were **added** or **deleted**.
* ๐ง **[TinyMamdaniInferenceSystem](./libs/TinyMamdaniInferenceSystem.md)** โ A implementation of a Mamdani Inference System, allowing you to model logic using trapezoidal membership functions.
* โฏ๏ธ **[TinyMediaPlayer](./libs/TinyMediaPlayer.md)** โ A universal media player architecture utilizing an adapter pattern to orchestrate multiple platform APIs, featuring robust playlist management, playback controls, and weighted random selection.
### 2.1. **`libs/TinyClassManager`**
* โ๏ธ **[TinyClassManager](./libs/TinyClassManager.md)** โ A lightweight, immutable manager designed to linearly compose a base class with multiple modular plugins, featuring automatic dependency verification and duplicate conflict protection.
* ๐ ๏ธ **[TinyPluginInliner](./libs/TinyClassManager/TinyPluginInliner.md)** โ A powerful build-time utility that inlines plugin code into a single bundle, automatically rewriting import paths and hoisting dependencies for seamless deployment.
### 3. **`fileManager/`**
* ๐ **[Main](./fileManager/main.md)** โ A Node.js file/directory utility module with support for JSON, backups, renaming, size analysis, and more.
---
## ๐ Tip Directories
### 1. **`libs/`** - ๐งฑ **[TinyHtml](./libs/TinyHtmlTips.md)** โ Usage examples and practical tips.
---
## ๐ Want to Extend These Libraries?
Did you find a class in our `libs/` that *almost* perfectly fits your needs, but you want to add your own custom features, modules, or plugins to it?
We highly recommend using **[โ๏ธ TinyClassManager](./libs/TinyClassManager.md)**! It was specifically built for this purpose. It allows you to safely and cleanly inject your own plugins into our existing classes using a linear mixin architecture, automatically handling dependencies and preventing conflicts without you ever having to touch the original source code.
---
## ๐ Usage
To get started, navigate to the appropriate directory and explore the files listed. Each script includes detailed documentation on how to use the respective functionality.
๐ For a complete overview of all available entry points and modules, please check out the [**exports**](./Exports.md) file. It provides a detailed map of the packageโs `exports` and helps you import exactly what you need.
---
## ๐ด TinyFork CLI
Want to extract only specific modules, classes, or functions into your project without carrying the whole library? We built a powerful AST-based CLI specifically for this!
๐ Discover how to use our smart tree-shaking tool by visiting the [**TinyFork CLI Documentation**](../TinyFork.md) for important usage information and commands.
---
## ๐ More Regex Goodies
Looking for practical regex examples and migration helpers?
๐ Check out the **[`Regex-Helpers`](Regex-Helpers.md)** file for a full collection of ready-to-use regex transformations!
---
## ๐ Contributing
Feel free to suggest changes, improvements, or additional features. You can fork the repository and submit a pull request!
---
## ๐ Want to Know How I Use AI in My Projects?
If you're curious about how I integrate AI into my development workflow โ including how I manage prompts, avoid context drift, and keep full control over logic and documentation โ all related guides have been moved to a dedicated documentation space.
โจ **Visit the Tiny-Essentials documentation hub here:**
๐ [https://github.com/Tiny-Essentials/.github/tree/main/docs](https://github.com/Tiny-Essentials/.github/tree/main/docs)