{ "version": 3, "sources": ["../src/utils.ts", "../src/core.ts", "../src/modules/css/classes.ts", "../src/modules/css/styles.ts", "../src/modules/css/index.ts", "../src/modules/events/binding.ts", "../src/modules/events/mouse.ts", "../src/modules/events/lifecycle.ts", "../src/modules/events/keyboard.ts", "../src/modules/events/form.ts", "../src/modules/events/touch.ts", "../src/modules/events/index.ts", "../src/modules/dom/attributes.ts", "../src/modules/dom/content.ts", "../src/modules/http/get.ts", "../src/modules/dom/manipulation.ts", "../src/modules/dom/traversal.ts", "../src/modules/dom/states.ts", "../src/modules/dom/index.ts", "../src/modules/effects/slide.ts", "../src/modules/effects/vertical.ts", "../src/modules/effects/fade.ts", "../src/modules/effects/index.ts", "../src/modules/http/post.ts", "../src/modules/http/upload.ts", "../src/modules/http/index.ts", "../src/modules/data/arrays.ts", "../src/modules/data/objects.ts", "../src/modules/data/index.ts", "../src/index.ts"], "sourcesContent": ["/**\r\n * @file src/utils.ts\r\n * @version 2.2.0\r\n * @since 2.0.0\r\n * @license GPL-3.0-or-later\r\n * @copyright Sven Minio 2026\r\n * @author Sven Minio \r\n * @category Utilities\r\n * @description\r\n * * General utility functions and helpers (e.g., debounce, throttle, type checks).\r\n */\r\n\r\n/**\r\n * * Creates a throttled version of the provided function. The function is executed at most once within the specified time interval, regardless of how often it is called.\r\n * Use case: Performance optimization for high-frequency events (e.g., Scroll, Resize, Mousemove).\r\n * @example const throttledScroll = throttle(() => { console.log('Scroll event'); }, 200); => Creates a throttled scroll event handler that logs at most once every 200 milliseconds.\r\n * @template T The type of the original function.\r\n * @param func The function to be throttled.\r\n * @param limit The time interval in milliseconds during which at most one execution is permitted.\r\n * @returns A new function that throttles calls.\r\n */\r\nexport function throttle any>(func: T, limit: number): (...args: Parameters) => void {\r\n let inThrottle: boolean;\r\n return function(this: any, ...args: Parameters) {\r\n const context = this;\r\n if (!inThrottle) {\r\n func.apply(context, args);\r\n inThrottle = true;\r\n setTimeout(() => inThrottle = false, limit);\r\n }\r\n };\r\n}\r\n\r\n/**\r\n * * Creates a debounced version of the provided function. Execution is delayed until `delay` milliseconds have passed since the last invocation.\r\n * Use case: Waiting for user input (e.g., Live Search, Validation) to avoid unnecessary calculations.\r\n * @example const debouncedInput = debounce(() => { console.log('Input event'); }, 300); => Creates a debounced input event handler that logs only after the user has stopped typing for 300 milliseconds.\r\n * @template T The type of the original function.\r\n * @param func The function to be debounced.\r\n * @param delay The waiting time in milliseconds after the last call.\r\n * @returns A new function that delays execution.\r\n */\r\nexport function debounce any>(func: T, delay: number): (...args: Parameters) => void {\r\n let timer: ReturnType;\r\n return function(this: any, ...args: Parameters) {\r\n clearTimeout(timer);\r\n timer = setTimeout(() => func.apply(this, args), delay);\r\n };\r\n}\r\n\r\n/**\r\n * * Checks if the code is running in a browser environment.\r\n * * Verifies the existence of `window` and `requestAnimationFrame` to ensure animation support.\r\n * * Used to safely guard DOM-dependent logic (Effects, Events) during Server-Side Rendering (SSR).\r\n * @example const isBrowserEnv = isBrowser(); => Checks if the code is running in a browser environment.\r\n * @returns `true` if running in a browser with animation support, otherwise `false`.\r\n */\r\nexport function isBrowser(): boolean {\r\n return typeof window !== 'undefined' && typeof window.requestAnimationFrame !== 'undefined';\r\n}\r\n\r\n/**\r\n * * A generic iterator function, which can be used to seamlessly iterate over both objects and arrays.\r\n * * Arrays and array-like objects with a length property are iterated by numeric index.\r\n * * Objects are iterated via their named properties.\r\n * * Returning 'false' in the callback breaks the loop early.\r\n * @example each([1, 2, 3], (index, value) => { console.log(index, value); }) => Logs the index and value of each item in the array.\r\n * @example each({ a: 1, b: 2 }, (key, value) => { console.log(key, value); }) => Logs the key and value of each property in the object.\r\n * @template T The type of the items in the collection.\r\n * @param collection The array, array-like object, or plain object to iterate over.\r\n * @param callback The function that will be executed on every object.\r\n */\r\nexport function each(collection: T[] | ArrayLike | Record, callback: (this: T, indexOrKey: any, value: T) => boolean | void): collection is T[] | ArrayLike | Record {\r\n const isArrayLike = Array.isArray(collection) || (collection && typeof collection === 'object' && 'length' in collection && typeof (collection as any).length === 'number');\r\n if (isArrayLike) {\r\n const arr = collection as ArrayLike;\r\n for (let i = 0, len = arr.length; i < len; i++) {\r\n if (callback.call(arr[i], i, arr[i]) === false) {\r\n break;\r\n }\r\n }\r\n } else {\r\n const obj = collection as Record;\r\n for (const key in obj) {\r\n if (Object.prototype.hasOwnProperty.call(obj, key)) {\r\n if (callback.call(obj[key], key, obj[key]) === false) {\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n return collection as any;\r\n}\r\n\r\n/**\r\n * * Internal Helper: Sanitizes an HTML string by removing dangerous attributes.\r\n * * Strips inline event handlers and javascript: protocols to mitigate XSS.\r\n * @param htmlStr The raw HTML string.\r\n * @returns The sanitized HTML string.\r\n */\r\nexport function sanitizeDangerousAttributes(htmlStr: string): string {\r\n let cleanStr = htmlStr.replace(/on\\w+\\s*=\\s*(['\"])(?:(?!\\1).)*\\1/gi, '');\r\n cleanStr = cleanStr.replace(/(href|action)\\s*=\\s*(['\"])\\s*javascript\\s*:[\\s\\S]*?\\2/gi, '');\r\n return cleanStr;\r\n}", "/**\r\n * @file src/core.ts\r\n * @version 2.2.0\r\n * @since 2.0.0\r\n * @license GPL-3.0-or-later\r\n * @copyright Sven Minio 2026\r\n * @author Sven Minio \r\n * @category Core\r\n * @description\r\n * * The main jBase class. Handles the selection engine, initialization, and plugin architecture.\r\n * @requires ./types\r\n * * Type definitions for the core class and its methods.\r\n */\r\n\r\nimport { JBaseElement, JBaseInput } from './types';\r\nimport { sanitizeDangerousAttributes } from './utils';\r\n\r\n/**\r\n * * The core class of the framework, inheriting from the native Array class. Acts as a wrapper around DOM elements and enables chainable methods (Fluent Interface).\r\n */\r\nexport class jBase extends Array {\r\n /**\r\n * * The original selector string or input type used to create this instance.\r\n */\r\n public selectorSource: string = '';\r\n\r\n /**\r\n * * The document context this instance is bound to (supports SSR via jsdom).\r\n */\r\n public doc: Document;\r\n\r\n /**\r\n * * Initializes a new jBase instance. Analyzes the provided selector and populates the internal array with found or created DOM elements.\r\n * @param selector The input selector (CSS selector, HTML string, DOM element, or collection).\r\n * @param context An optional specific Document or Window context (essential for SSR).\r\n */\r\n constructor(selector?: JBaseInput, context?: Document | Window) {\r\n super();\r\n\r\n if (context instanceof Document) {\r\n this.doc = context;\r\n } else if (context && (context as Window).document) {\r\n this.doc = (context as Window).document;\r\n } else {\r\n this.doc = (typeof document !== 'undefined') ? document : (null as any);\r\n }\r\n if (typeof document === 'undefined') {\r\n return;\r\n }\r\n this.selectorSource = typeof selector === 'string' ? selector : '';\r\n \r\n if (!selector)\r\n return;\r\n\r\n if (selector instanceof HTMLElement || selector === document || selector === window || selector instanceof Element) {\r\n this.push(selector);\r\n }\r\n else if (typeof selector === 'string') {\r\n const trimmed = selector.trim();\r\n if (trimmed.startsWith('<') && trimmed.endsWith('>')) {\r\n const tempDiv = this.doc.createElement('div');\r\n tempDiv.innerHTML = sanitizeDangerousAttributes(trimmed);\r\n this.push(...Array.from(tempDiv.children));\r\n }\r\n else if (trimmed.startsWith('#') && !trimmed.includes(' ') && !trimmed.includes('.')) {\r\n const el = this.doc.getElementById(trimmed.slice(1));\r\n if (el)\r\n this.push(el);\r\n }\r\n else if (trimmed.startsWith('.') && !trimmed.includes(' ') && !/[:\\[#]/.test(trimmed)) {\r\n const els = this.doc.getElementsByClassName(trimmed.slice(1));\r\n for (let i = 0; i < els.length; i++) {\r\n this.push(els[i] as HTMLElement);\r\n }\r\n }\r\n else if (/^[a-zA-Z0-9]+$/.test(trimmed)) {\r\n const els = this.doc.getElementsByTagName(trimmed);\r\n for (let i = 0; i < els.length; i++) {\r\n this.push(els[i] as HTMLElement);\r\n }\r\n }\r\n else {\r\n try {\r\n this.push(...Array.from(this.doc.querySelectorAll(selector)));\r\n } catch (e) {\r\n console.warn(`jBase: Invalid selector \"${selector}\"`, e);\r\n }\r\n }\r\n }\r\n else if (selector instanceof NodeList || Array.isArray(selector)) {\r\n this.push(...Array.from(selector as ArrayLike));\r\n }\r\n }\r\n\r\n /**\r\n * * Custom serializer for JSON.stringify. Prevents circular references and huge outputs by returning a simplified preview.\r\n * @example toJson() => { meta: 'jBase Wrapper', query: '#myId', count: 1, preview: ['div'] }\r\n * @returns A simplified object representation for debugging.\r\n */\r\n toJSON() {\r\n return {\r\n meta: 'jBase Wrapper',\r\n query: this.selectorSource,\r\n count: this.length,\r\n preview: this.slice(0, 10).map(el => {\r\n if (el instanceof Element)\r\n return el.tagName.toLowerCase();\r\n return typeof el;\r\n })\r\n };\r\n }\r\n\r\n /**\r\n * * High-performance iteration over matched elements.\r\n * * Returning 'false' in the callback breaks the loop early.\r\n * @example each((el, index) => { console.log(el); if (index === 5) return false; }) => Logs the first 6 matched elements to the console.\r\n * @param callback The function to execute for each element. Context (`this`) is set to the current element.\r\n * @returns The current jBase instance for chaining.\r\n */\r\n each(callback: (this: JBaseElement, el: JBaseElement, index: number) => boolean | void): this {\r\n for (let i = 0, len = this.length; i < len; i++) {\r\n if (callback.call(this[i], this[i], i) === false) {\r\n break;\r\n }\r\n }\r\n return this;\r\n }\r\n}", "/**\r\n * @file src/modules/css/classes.ts\r\n * @version 2.0.3\r\n * @since 2.0.0\r\n * @license GPL-3.0-or-later\r\n * @copyright Sven Minio 2026\r\n * @author Sven Minio \r\n * @category CSS\r\n * @description\r\n * * Methods for manipulating CSS classes (add, remove, toggle, has).\r\n * @requires ../../core\r\n * * Depends on the core jBase class for type definitions.\r\n */\r\n\r\nimport { jBase } from '../../core';\r\n\r\n/**\r\n * * Adds one or more CSS classes to each element in the collection.\r\n * @example addClass('active', 'highlight') => Adds the 'active' and 'highlight' classes to all matched elements.\r\n * @param classNames One or more class names to be added\r\n * @returns The current jBase instance for method chaining\r\n */\r\nexport function addClass(this: jBase, ...classNames: string[]): jBase {\r\n this.each(function(el) {\r\n if (el instanceof Element) el.classList.add(...classNames);\r\n });\r\n return this;\r\n}\r\n\r\n/**\r\n * * Removes one or more CSS classes from each element in the collection.\r\n * @example removeClass('active', 'highlight') => Removes the 'active' and 'highlight' classes from all matched elements.\r\n * @param classNames One or more class names to be removed\r\n * @returns The current jBase instance for method chaining\r\n */\r\nexport function removeClass(this: jBase, ...classNames: string[]): jBase {\r\n this.each(function(el) {\r\n if (el instanceof Element) el.classList.remove(...classNames);\r\n });\r\n return this;\r\n}\r\n\r\n/**\r\n * * Toggles a CSS class (adds if missing, removes if present) for each element.\r\n * @example toggleClass('active') => Toggles the 'active' class on all matched elements.\r\n * @param className The class name to toggle.\r\n * @returns The current jBase instance for method chaining.\r\n */\r\nexport function toggleClass(this: jBase, className: string): jBase {\r\n this.each(function(el) {\r\n if (el instanceof Element) el.classList.toggle(className);\r\n });\r\n return this;\r\n}\r\n\r\n/**\r\n * * Checks if at least one element in the collection has the specified class.\r\n * @example hasClass('active') => Returns true if at least one matched element has the 'active' class, otherwise false.\r\n * @param className The class name to check for.\r\n * @returns True if the class exists on at least one element, otherwise false.\r\n */\r\nexport function hasClass(this: jBase, className: string): boolean {\r\n return this.some(el => {\r\n return (el instanceof Element) && el.classList.contains(className);\r\n });\r\n}", "/**\r\n * @file src/modules/css/styles.ts\r\n * @version 2.0.4\r\n * @since 2.0.0\r\n * @license GPL-3.0-or-later\r\n * @copyright Sven Minio 2026\r\n * @author Sven Minio \r\n * @category CSS\r\n * @description\r\n * * Methods for getting and setting inline CSS styles.\r\n * @requires ../../core\r\n * * Depends on the core jBase class for type definitions.\r\n */\r\n\r\nimport { jBase } from '../../core';\r\n\r\n/**\r\n * * Gets a CSS property value from the first element or sets one/multiple CSS properties for all elements.\r\n * @example css('color', 'red') => Sets the 'color' style to 'red' for all matched elements.\r\n * @example css({ color: 'red', backgroundColor: 'blue' }) => Sets multiple styles for all matched elements.\r\n * @example css('color') => Returns the computed 'color' value of the first matched element.\r\n * @param property A CSS property name as a string, or an object of property-value pairs to set multiple styles.\r\n * @param value (Optional) The value to set if `property` is a string. If undefined and `property` is a string, acts as a getter.\r\n * @returns The CSS value as a string when reading, or the jBase instance when writing.\r\n */\r\nexport function css(this: jBase, property: string | Record, value?: string | number): string | jBase {\r\n if (typeof property === 'object' && property !== null) {\r\n this.each(function(el) {\r\n if (el instanceof HTMLElement || el instanceof SVGElement) {\r\n for (const key in property) {\r\n if (Object.prototype.hasOwnProperty.call(property, key)) {\r\n if (key.includes('-')) {\r\n el.style.setProperty(key, String(property[key]));\r\n } else {\r\n (el.style as any)[key] = property[key];\r\n }\r\n }\r\n }\r\n }\r\n });\r\n return this;\r\n }\r\n if (typeof property === 'string') {\r\n if (value === undefined) {\r\n const el = this[0];\r\n if (el instanceof HTMLElement || el instanceof SVGElement) {\r\n const doc = el.ownerDocument;\r\n const win = doc ? doc.defaultView : null;\r\n if (win) {\r\n return win.getComputedStyle(el).getPropertyValue(property) || win.getComputedStyle(el)[property as any] || '';\r\n } else {\r\n return (el.style as any)[property] || '';\r\n }\r\n }\r\n return '';\r\n }\r\n this.each(function(el) {\r\n if (el instanceof HTMLElement || el instanceof SVGElement) {\r\n if (property.includes('-')) {\r\n el.style.setProperty(property, String(value));\r\n } else {\r\n (el.style as any)[property] = value;\r\n }\r\n }\r\n });\r\n }\r\n\r\n return this;\r\n}", "/**\r\n * @file src/modules/css/index.ts\r\n * @version 2.0.3\r\n * @since 2.0.0\r\n * @license GPL-3.0-or-later\r\n * @copyright Sven Minio 2026\r\n * @author Sven Minio \r\n * @category CSS\r\n * @description\r\n * * Central entry point for CSS operations. Aggregates class and style manipulation methods.\r\n * @requires ./classes\r\n * * Class manipulation methods (addClass, removeClass, etc.).\r\n * @requires ./styles\r\n * * Style manipulation methods (css).\r\n */\r\n\r\nimport * as classMethods from './classes';\r\nimport * as styleMethods from './styles';\r\n\r\n/**\r\n * * Aggregation of all CSS methods. This object bundles functions for class manipulation and style manipulation. It is exported to extend the jBase prototype centrally via Object.assign.\r\n */\r\nexport const cssMethods = {\r\n ...classMethods,\r\n ...styleMethods\r\n};", "/**\r\n * @file src/modules/events/binding.ts\r\n * @version 2.1.0\r\n * @since 2.0.0\r\n * @license GPL-3.0-or-later\r\n * @copyright Sven Minio 2026\r\n * @author Sven Minio \r\n * @category Events\r\n * @description\r\n * * Core event binding methods (on, off, trigger). Handles event registration and removal.\r\n * @requires ../../core\r\n * * Depends on the core jBase class for type definitions.\r\n * @requires ../../utils\r\n * * Uses utility functions for iteration and environment checks.\r\n */\r\n\r\nimport { each } from '../../utils';\r\nimport { jBase } from '../../core';\r\n\r\nconst JB_EVENTS = '__jb_events';\r\n\r\n/**\r\n * * Attaches an event handler function for one or more events to the selected elements.\r\n * * This core method handles dynamic event delegation and allows passing custom data.\r\n * @example on('click', handler) => Binds a click event handler to all matched elements.\r\n * @example on('click', '.btn', handler) => Binds a click event handler to all current and future elements matching '.btn' within the matched elements.\r\n * @example on('click', { key: 'value' }, handler) => Binds a click event handler and passes custom data to the event object.\r\n * @param events One or more space-separated event types (e.g., 'click', 'mouseenter mouseleave').\r\n * @param selectorOrDataOrHandler A CSS selector string for delegation, custom data, or the callback function.\r\n * @param dataOrHandler Custom data to pass to `event.data`, or the callback function.\r\n * @param handlerOrUndefined The callback function to execute when the event is triggered.\r\n * @returns The current jBase instance for method chaining.\r\n */\r\nexport function on(this: jBase, events: string, selectorOrDataOrHandler: any, dataOrHandler?: any, handlerOrUndefined?: any): jBase {\r\n let selector: string | undefined;\r\n let data: any;\r\n let handler: Function;\r\n if (typeof selectorOrDataOrHandler === 'string') {\r\n selector = selectorOrDataOrHandler;\r\n if (typeof dataOrHandler === 'function') {\r\n handler = dataOrHandler;\r\n } else {\r\n data = dataOrHandler;\r\n handler = handlerOrUndefined;\r\n }\r\n } else if (typeof selectorOrDataOrHandler === 'function') {\r\n handler = selectorOrDataOrHandler;\r\n } else {\r\n data = selectorOrDataOrHandler;\r\n handler = dataOrHandler;\r\n }\r\n if (!handler) return this;\r\n const eventTypes = events.split(' ');\r\n this.each(function (el) {\r\n if (!(el instanceof EventTarget)) return;\r\n const registry = (el as any)[JB_EVENTS] || ((el as any)[JB_EVENTS] = []);\r\n each(eventTypes, function(_index, eventType) {\r\n const wrappedHandler = function (e: Event) {\r\n let targetContext: EventTarget = el;\r\n if (selector) {\r\n const target = e.target instanceof Element ? e.target : (e.target as Node)?.parentElement;\r\n const match = (target instanceof Element && target.closest) ? target.closest(selector) : null;\r\n if (!match || !(el as Element).contains(match)) {\r\n return; \r\n }\r\n targetContext = match;\r\n }\r\n if (data !== undefined) {\r\n (e as any).data = data;\r\n }\r\n handler.call(targetContext, e);\r\n };\r\n registry.push({\r\n type: eventType,\r\n original: handler,\r\n wrapped: wrappedHandler,\r\n selector: selector\r\n });\r\n el.addEventListener(eventType, wrappedHandler);\r\n });\r\n });\r\n return this;\r\n}\r\n\r\n/**\r\n * * Removes an event handler previously attached with `.on()`.\r\n * * Can remove all handlers for an event, or specific ones by selector or handler reference.\r\n * @example off('click') => Removes all click handlers from the matched elements.\r\n * @example off('click', '.btn') => Removes all click handlers that were delegated to '.btn' within the matched elements.\r\n * @example off('click', handler) => Removes the specific click handler function from the matched elements.\r\n * @example off('click', '.btn', handler) => Removes the specific click handler function that was delegated to '.btn' within the matched elements.\r\n * @param events One or more space-separated event types (e.g., 'click').\r\n * @param selectorOrHandler A CSS selector string originally used for delegation, or the specific handler function.\r\n * @param handlerOrUndefined The specific handler function to remove.\r\n * @returns The current jBase instance for method chaining.\r\n */\r\nexport function off(this: jBase, events: string, selectorOrHandler?: any, handlerOrUndefined?: any): jBase {\r\n let selector: string | undefined;\r\n let handler: Function | undefined;\r\n if (typeof selectorOrHandler === 'string') {\r\n selector = selectorOrHandler;\r\n handler = handlerOrUndefined;\r\n } else if (typeof selectorOrHandler === 'function') {\r\n handler = selectorOrHandler;\r\n }\r\n const eventTypes = events.split(' ');\r\n this.each(function (el) {\r\n if (!(el instanceof EventTarget)) return;\r\n const registry = (el as any)[JB_EVENTS];\r\n if (!registry) return;\r\n each(eventTypes, function(_index, eventType) {\r\n for (let i = registry.length - 1; i >= 0; i--) {\r\n const record = registry[i];\r\n const matchType = record.type === eventType;\r\n const matchSelector = selector ? record.selector === selector : true;\r\n const matchHandler = handler ? record.original === handler : true;\r\n if (matchType && matchSelector && matchHandler) {\r\n el.removeEventListener(eventType, record.wrapped);\r\n registry.splice(i, 1);\r\n }\r\n }\r\n });\r\n });\r\n return this;\r\n}\r\n\r\n/**\r\n * * Attaches an event handler that will be executed at most once per element and event type.\r\n * * Automatically unbinds itself after the first execution. Supports event delegation and custom data.\r\n * @example once('click', handler) => Binds a click event handler that executes only once for all matched elements.\r\n * @example once('click', '.btn', handler) => Binds a click event handler that executes only once for all current and future elements matching '.btn' within the matched elements.\r\n * @example once('click', { key: 'value' }, handler) => Binds a click event handler that executes only once and passes custom data to the event object.\r\n * @param events One or more space-separated event types.\r\n * @param selectorOrDataOrHandler A CSS selector string for delegation, custom data, or the callback function.\r\n * @param dataOrHandler Custom data to pass to `event.data`, or the callback function.\r\n * @param handlerOrUndefined The callback function to execute when the event is triggered.\r\n * @returns The current jBase instance for method chaining.\r\n */\r\nexport function once(this: jBase, events: string, selectorOrDataOrHandler: any, dataOrHandler?: any, handlerOrUndefined?: any): jBase {\r\n const self = this;\r\n const handleOnce = function(this: any, e: any) {\r\n self.off(events, selectorOrDataOrHandler, handleOnce);\r\n let realHandler: Function;\r\n if (typeof selectorOrDataOrHandler === 'function') {\r\n realHandler = selectorOrDataOrHandler;\r\n } else if (typeof dataOrHandler === 'function') {\r\n realHandler = dataOrHandler;\r\n } else {\r\n realHandler = handlerOrUndefined;\r\n }\r\n return realHandler.apply(this, arguments);\r\n };\r\n if (typeof selectorOrDataOrHandler === 'string') {\r\n if (typeof dataOrHandler === 'function') {\r\n return this.on(events, selectorOrDataOrHandler, handleOnce);\r\n } else {\r\n return this.on(events, selectorOrDataOrHandler, dataOrHandler, handleOnce);\r\n }\r\n } else if (typeof selectorOrDataOrHandler === 'function') {\r\n return this.on(events, handleOnce);\r\n } else {\r\n return this.on(events, selectorOrDataOrHandler, handleOnce);\r\n }\r\n}\r\n\r\n/**\r\n * * Triggers an event on each element in the collection.\r\n * @example trigger('customEvent') => Triggers 'customEvent' on all matched elements.\r\n * @example trigger('customEvent', { key: 'value' }) => Triggers 'customEvent' on all matched elements and passes custom data to the event object.\r\n * @example trigger('click') => Programmatically triggers a click event on all matched elements.\r\n * @example trigger('click', { key: 'value' }) => Programmatically triggers a click event on all matched elements and passes custom data to the event object.\r\n * @param eventName The name of the event to trigger.\r\n * @param data Optional data to pass to the event (accessible via event.detail).\r\n */\r\nexport function trigger(this: jBase, eventName: string, data?: any): jBase {\r\n return this.each(function(el) {\r\n if (!(el instanceof EventTarget)) return;\r\n const event = new CustomEvent(eventName, {\r\n bubbles: true,\r\n cancelable: true,\r\n detail: data\r\n });\r\n el.dispatchEvent(event);\r\n });\r\n}", "/**\r\n * @file src/modules/events/mouse.ts\r\n * @version 2.1.0\r\n * @since 2.0.0\r\n * @license GPL-3.0-or-later\r\n * @copyright Sven Minio 2026\r\n * @author Sven Minio \r\n * @category Events\r\n * @description\r\n * * Methods for handling mouse events (click, dblclick, hover, mouseenter, mouseleave).\r\n * @requires ../../core\r\n * * Depends on the core jBase class for type definitions.\r\n */\r\n\r\nimport { jBase } from '../../core';\r\n\r\n/**\r\n * * Binds an event handler to the \"click\" JavaScript event, or triggers that event on an element.\r\n * * If no handler is provided, it programmatically triggers a native click on all matched elements.\r\n * @example click(handler) => Binds a click event handler to all matched elements.\r\n * @example click() => Programmatically triggers a click event on all matched elements.\r\n * @param handler (Optional) A function to execute each time the click event is triggered.\r\n * @returns The current jBase instance for method chaining.\r\n */\r\nexport function click(this: jBase, handler?: (event: Event) => void): jBase {\r\n if (handler) {\r\n return this.on('click', handler);\r\n } else {\r\n this.each(function(el) {\r\n if (el instanceof HTMLElement) el.click();\r\n });\r\n return this;\r\n }\r\n}\r\n\r\n/**\r\n * * Binds an event handler to the 'mousemove' event. Fires continuously while the pointer moves inside the element.\r\n * @example mousemove(handler) => Binds a mousemove event handler to all matched elements.\r\n * @param handler The callback function.\r\n * @returns The current jBase instance.\r\n */\r\nexport function mousemove(this: jBase, handler: (event: MouseEvent) => void): jBase {\r\n return this.on('mousemove', handler as EventListener);\r\n}\r\n\r\n/**\r\n * * Binds an event handler to the 'mouseleave' event. Fires when the pointer leaves the element (does not bubble).\r\n * @example mouseleave(handler) => Binds a mouseleave event handler to all matched elements.\r\n * @param handler The callback function.\r\n * @returns The current jBase instance.\r\n */\r\nexport function mouseleave(this: jBase, handler: (event: MouseEvent) => void): jBase {\r\n return this.on('mouseleave', handler as EventListener);\r\n}\r\n\r\n/**\r\n * * Binds an event handler to the 'mouseenter' event. Fires when the pointer enters the element (does not bubble).\r\n * @example mouseenter(handler) => Binds a mouseenter event handler to all matched elements.\r\n * @param handler The callback function.\r\n * @returns The current jBase instance.\r\n */\r\nexport function mouseenter(this: jBase, handler: (event: MouseEvent) => void): jBase {\r\n return this.on('mouseenter', handler as EventListener);\r\n}\r\n\r\n/**\r\n * * Binds an event handler to the 'mousedown' event. Fires as soon as a mouse button is pressed over the element.\r\n * @example mousedown(handler) => Binds a mousedown event handler to all matched elements.\r\n * @param handler The callback function.\r\n * @returns The current jBase instance.\r\n */\r\nexport function mousedown(this: jBase, handler: (event: MouseEvent) => void): jBase {\r\n return this.on('mousedown', handler as EventListener);\r\n}\r\n\r\n/**\r\n * * Binds an event handler to the 'mouseup' event. Fires when a mouse button is released over the element.\r\n * @example mouseup(handler) => Binds a mouseup event handler to all matched elements.\r\n * @param handler The callback function.\r\n * @returns The current jBase instance.\r\n */\r\nexport function mouseup(this: jBase, handler: (event: MouseEvent) => void): jBase {\r\n return this.on('mouseup', handler as EventListener);\r\n}\r\n\r\n/**\r\n * * Binds an event handler to the 'dblclick' event or triggers it manually.\r\n * @example dblclick(handler) => Binds a dblclick event handler to all matched elements.\r\n * @param handler (Optional) The callback function.\r\n * @returns The current jBase instance.\r\n */\r\nexport function dblclick(this: jBase, handler?: (event: MouseEvent) => void): jBase {\r\n if (handler) {\r\n return this.on('dblclick', handler as EventListener);\r\n } else {\r\n this.each(function(el) {\r\n if (el instanceof HTMLElement) {\r\n el.dispatchEvent(new MouseEvent('dblclick', {\r\n bubbles: true,\r\n cancelable: true,\r\n view: window\r\n }));\r\n }\r\n });\r\n return this;\r\n }\r\n}\r\n\r\n/**\r\n * * Binds an event handler to the 'mouseout' event. Fires when the pointer leaves the element OR one of its children (bubbles).\r\n * @example mouseout(handler) => Binds a mouseout event handler to all matched elements.\r\n * @param handler The callback function.\r\n * @returns The current jBase instance.\r\n */\r\nexport function mouseout(this: jBase, handler: (event: MouseEvent) => void): jBase {\r\n return this.on('mouseout', handler as EventListener);\r\n}\r\n\r\n/**\r\n * * Binds an event handler to the 'mouseover' event. Fires when the pointer enters the element OR one of its children (bubbles).\r\n * @example mouseover(handler) => Binds a mouseover event handler to all matched elements.\r\n * @param handler The callback function.\r\n * @returns The current jBase instance.\r\n */\r\nexport function mouseover(this: jBase, handler: (event: MouseEvent) => void): jBase {\r\n return this.on('mouseover', handler as EventListener);\r\n}\r\n\r\n/**\r\n * * Binds two handlers to the matched elements, to be executed when the mouse pointer enters and leaves the elements.\r\n * * This is a highly convenient shorthand for chaining `.mouseenter()` and `.mouseleave()`.\r\n * @example hover(handlerIn, handlerOut) => Binds handlerIn to mouseenter and handlerOut to mouseleave for all matched elements.\r\n * @param handlerIn A function to execute when the mouse pointer enters the element.\r\n * @param handlerOut A function to execute when the mouse pointer leaves the element.\r\n * @returns The current jBase instance for method chaining.\r\n */\r\nexport function hover(this: jBase, handlerIn: (event: MouseEvent) => void, handlerOut: (event: MouseEvent) => void): jBase {\r\n return this.mouseenter(handlerIn).mouseleave(handlerOut);\r\n}", "/**\r\n * @file src/modules/events/lifecycle.ts\r\n * @version 2.0.3\r\n * @since 2.0.0\r\n * @license GPL-3.0-or-later\r\n * @copyright Sven Minio 2026\r\n * @author Sven Minio \r\n * @category Events\r\n * @description\r\n * * Methods for handling DOM lifecycle events (e.g., ready).\r\n * @requires ../../core\r\n * * Depends on the core jBase class for type definitions.\r\n */\r\n\r\nimport { jBase } from '../../core';\r\n\r\n/**\r\n * * Executes the handler as soon as the DOM is fully loaded and parsed. If the document is already ready (readyState 'interactive' or 'complete'), the handler executes immediately to avoid race conditions.\r\n * @example ready(handler) => Binds a handler to execute when the DOM is ready.\r\n * @param handler The callback function to execute when the DOM is ready.\r\n * @returns The current jBase instance for method chaining.\r\n */\r\nexport function ready(this: jBase, handler: () => void): jBase {\r\n const doc = window.document;\r\n if (doc.readyState === 'complete' || doc.readyState === 'interactive') {\r\n handler();\r\n } else {\r\n this.on('DOMContentLoaded', handler);\r\n }\r\n return this;\r\n}", "/**\r\n * @file src/modules/events/keyboard.ts\r\n * @version 2.0.3\r\n * @since 2.0.0\r\n * @license GPL-3.0-or-later\r\n * @copyright Sven Minio 2026\r\n * @author Sven Minio \r\n * @category Events\r\n * @description\r\n * * Methods for handling keyboard events (keydown, keyup, keypress).\r\n * @requires ../../core\r\n * * Depends on the core jBase class for type definitions.\r\n */\r\n\r\nimport { jBase } from '../../core';\r\n\r\n/**\r\n * * Binds an event handler to the 'keydown' event. Fires immediately when a key is pressed (repeats if held).\r\n * @example keydown(handler) => Binds a keydown event handler to all matched elements.\r\n * @param handler The callback function receiving the KeyboardEvent.\r\n * @returns The current jBase instance for method chaining.\r\n */\r\nexport function keydown(this: jBase, handler: (event: KeyboardEvent) => void): jBase {\r\n return this.on('keydown', handler as EventListener);\r\n}\r\n\r\n/**\r\n * * Binds an event handler to the 'keyup' event. Fires when a key is released.\r\n * @example keyup(handler) => Binds a keyup event handler to all matched elements.\r\n * @param handler The callback function receiving the KeyboardEvent.\r\n * @returns The current jBase instance for method chaining.\r\n */\r\nexport function keyup(this: jBase, handler: (event: KeyboardEvent) => void): jBase {\r\n return this.on('keyup', handler as EventListener);\r\n}\r\n\r\n/**\r\n * * Binds an event handler to the 'keypress' event. Deprecated in modern standards.\r\n * @deprecated Use keydown or input instead.\r\n * @param handler The callback function receiving the KeyboardEvent.\r\n * @returns The current jBase instance for method chaining.\r\n */\r\nexport function keypress(this: jBase, handler: (event: KeyboardEvent) => void): jBase {\r\n return this.on('keypress', handler as EventListener);\r\n}\r\n\r\n/**\r\n * * Binds an event handler for a specific key (case-insensitive).\r\n * @example pressedKey('Enter', handler) => Binds a handler that executes when the Enter key is pressed on any matched element.\r\n * @param targetKey The key to react to (e.g., 'm', 'Enter', 'Escape').\r\n * @param handler The callback function.\r\n * @returns The current jBase instance.\r\n */\r\nexport function pressedKey(this: jBase, targetKey: string, handler: (event: KeyboardEvent) => void): jBase {\r\n return this.on('keydown', (e: Event) => {\r\n const event = e as KeyboardEvent;\r\n if (event.key.toLowerCase() === targetKey.toLowerCase()) {\r\n handler(event);\r\n }\r\n });\r\n}", "/**\r\n * @file src/modules/events/form.ts\r\n * @version 2.0.3\r\n * @since 2.0.0\r\n * @license GPL-3.0-or-later\r\n * @copyright Sven Minio 2026\r\n * @author Sven Minio \r\n * @category Events\r\n * @description\r\n * * Methods for handling form events (submit, change, focus, blur, input).\r\n * @requires ../../core\r\n * * Depends on the core jBase class for type definitions.\r\n */\r\n\r\nimport { jBase } from '../../core';\r\n\r\n/**\r\n * * Registers an event handler for the 'submit' event. Triggered when a form is submitted.\r\n * @example submit(handler) => Binds a submit event handler to all matched forms.\r\n * @param handler The function to execute when the event occurs.\r\n * @returns The current jBase instance for chaining.\r\n */\r\nexport function submit(this: jBase, handler: (event: SubmitEvent) => void): jBase {\r\n return this.on('submit', handler as EventListener);\r\n}\r\n\r\n/**\r\n * * Registers an event handler for the 'change' event. Triggered when the value of an element (,