@k37z3r/jbase 2.0.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.
Files changed (136) hide show
  1. package/LICENSE +621 -0
  2. package/README.md +124 -0
  3. package/dist/browser.d.ts +30 -0
  4. package/dist/browser.d.ts.map +1 -0
  5. package/dist/browser.js +29 -0
  6. package/dist/browser.js.map +1 -0
  7. package/dist/core.d.ts +42 -0
  8. package/dist/core.d.ts.map +1 -0
  9. package/dist/core.js +78 -0
  10. package/dist/core.js.map +1 -0
  11. package/dist/index.cjs +2150 -0
  12. package/dist/index.d.ts +1158 -0
  13. package/dist/index.d.ts.map +1 -0
  14. package/dist/index.js +100 -0
  15. package/dist/index.js.map +1 -0
  16. package/dist/index.mjs +2118 -0
  17. package/dist/jbase.browser.js +1906 -0
  18. package/dist/jbase.js +1898 -0
  19. package/dist/jbase.min.js +9 -0
  20. package/dist/modules/css/classes.d.ts +61 -0
  21. package/dist/modules/css/classes.d.ts.map +1 -0
  22. package/dist/modules/css/classes.js +88 -0
  23. package/dist/modules/css/classes.js.map +1 -0
  24. package/dist/modules/css/index.d.ts +30 -0
  25. package/dist/modules/css/index.d.ts.map +1 -0
  26. package/dist/modules/css/index.js +33 -0
  27. package/dist/modules/css/index.js.map +1 -0
  28. package/dist/modules/css/styles.d.ts +31 -0
  29. package/dist/modules/css/styles.d.ts.map +1 -0
  30. package/dist/modules/css/styles.js +49 -0
  31. package/dist/modules/css/styles.js.map +1 -0
  32. package/dist/modules/data/arrays.d.ts +131 -0
  33. package/dist/modules/data/arrays.d.ts.map +1 -0
  34. package/dist/modules/data/arrays.js +177 -0
  35. package/dist/modules/data/arrays.js.map +1 -0
  36. package/dist/modules/data/index.d.ts +29 -0
  37. package/dist/modules/data/index.d.ts.map +1 -0
  38. package/dist/modules/data/index.js +33 -0
  39. package/dist/modules/data/index.js.map +1 -0
  40. package/dist/modules/data/objects.d.ts +108 -0
  41. package/dist/modules/data/objects.d.ts.map +1 -0
  42. package/dist/modules/data/objects.js +168 -0
  43. package/dist/modules/data/objects.js.map +1 -0
  44. package/dist/modules/data/types.d.ts +35 -0
  45. package/dist/modules/data/types.d.ts.map +1 -0
  46. package/dist/modules/data/types.js +43 -0
  47. package/dist/modules/data/types.js.map +1 -0
  48. package/dist/modules/dom/attributes.d.ts +42 -0
  49. package/dist/modules/dom/attributes.d.ts.map +1 -0
  50. package/dist/modules/dom/attributes.js +69 -0
  51. package/dist/modules/dom/attributes.js.map +1 -0
  52. package/dist/modules/dom/content.d.ts +39 -0
  53. package/dist/modules/dom/content.d.ts.map +1 -0
  54. package/dist/modules/dom/content.js +63 -0
  55. package/dist/modules/dom/content.js.map +1 -0
  56. package/dist/modules/dom/index.d.ts +78 -0
  57. package/dist/modules/dom/index.d.ts.map +1 -0
  58. package/dist/modules/dom/index.js +48 -0
  59. package/dist/modules/dom/index.js.map +1 -0
  60. package/dist/modules/dom/manipulation.d.ts +159 -0
  61. package/dist/modules/dom/manipulation.d.ts.map +1 -0
  62. package/dist/modules/dom/manipulation.js +343 -0
  63. package/dist/modules/dom/manipulation.js.map +1 -0
  64. package/dist/modules/dom/states.d.ts +50 -0
  65. package/dist/modules/dom/states.d.ts.map +1 -0
  66. package/dist/modules/dom/states.js +89 -0
  67. package/dist/modules/dom/states.js.map +1 -0
  68. package/dist/modules/dom/traversal.d.ts +246 -0
  69. package/dist/modules/dom/traversal.d.ts.map +1 -0
  70. package/dist/modules/dom/traversal.js +527 -0
  71. package/dist/modules/dom/traversal.js.map +1 -0
  72. package/dist/modules/effects/fade.d.ts +58 -0
  73. package/dist/modules/effects/fade.d.ts.map +1 -0
  74. package/dist/modules/effects/fade.js +104 -0
  75. package/dist/modules/effects/fade.js.map +1 -0
  76. package/dist/modules/effects/index.d.ts +40 -0
  77. package/dist/modules/effects/index.d.ts.map +1 -0
  78. package/dist/modules/effects/index.js +38 -0
  79. package/dist/modules/effects/index.js.map +1 -0
  80. package/dist/modules/effects/slide.d.ts +58 -0
  81. package/dist/modules/effects/slide.d.ts.map +1 -0
  82. package/dist/modules/effects/slide.js +103 -0
  83. package/dist/modules/effects/slide.js.map +1 -0
  84. package/dist/modules/effects/vertical.d.ts +58 -0
  85. package/dist/modules/effects/vertical.d.ts.map +1 -0
  86. package/dist/modules/effects/vertical.js +118 -0
  87. package/dist/modules/effects/vertical.js.map +1 -0
  88. package/dist/modules/events/binding.d.ts +47 -0
  89. package/dist/modules/events/binding.d.ts.map +1 -0
  90. package/dist/modules/events/binding.js +60 -0
  91. package/dist/modules/events/binding.js.map +1 -0
  92. package/dist/modules/events/form.d.ts +72 -0
  93. package/dist/modules/events/form.d.ts.map +1 -0
  94. package/dist/modules/events/form.js +106 -0
  95. package/dist/modules/events/form.js.map +1 -0
  96. package/dist/modules/events/index.d.ts +62 -0
  97. package/dist/modules/events/index.d.ts.map +1 -0
  98. package/dist/modules/events/index.js +53 -0
  99. package/dist/modules/events/index.js.map +1 -0
  100. package/dist/modules/events/keyboard.d.ts +65 -0
  101. package/dist/modules/events/keyboard.d.ts.map +1 -0
  102. package/dist/modules/events/keyboard.js +83 -0
  103. package/dist/modules/events/keyboard.js.map +1 -0
  104. package/dist/modules/events/lifecycle.d.ts +28 -0
  105. package/dist/modules/events/lifecycle.d.ts.map +1 -0
  106. package/dist/modules/events/lifecycle.js +40 -0
  107. package/dist/modules/events/lifecycle.js.map +1 -0
  108. package/dist/modules/events/mouse.d.ts +120 -0
  109. package/dist/modules/events/mouse.d.ts.map +1 -0
  110. package/dist/modules/events/mouse.js +172 -0
  111. package/dist/modules/events/mouse.js.map +1 -0
  112. package/dist/modules/events/touch.d.ts +61 -0
  113. package/dist/modules/events/touch.d.ts.map +1 -0
  114. package/dist/modules/events/touch.js +74 -0
  115. package/dist/modules/events/touch.js.map +1 -0
  116. package/dist/modules/http/get.d.ts +47 -0
  117. package/dist/modules/http/get.d.ts.map +1 -0
  118. package/dist/modules/http/get.js +65 -0
  119. package/dist/modules/http/get.js.map +1 -0
  120. package/dist/modules/http/index.d.ts +37 -0
  121. package/dist/modules/http/index.d.ts.map +1 -0
  122. package/dist/modules/http/index.js +42 -0
  123. package/dist/modules/http/index.js.map +1 -0
  124. package/dist/modules/http/post.d.ts +36 -0
  125. package/dist/modules/http/post.d.ts.map +1 -0
  126. package/dist/modules/http/post.js +54 -0
  127. package/dist/modules/http/post.js.map +1 -0
  128. package/dist/types.d.ts +61 -0
  129. package/dist/types.d.ts.map +1 -0
  130. package/dist/types.js +15 -0
  131. package/dist/types.js.map +1 -0
  132. package/dist/utils.d.ts +51 -0
  133. package/dist/utils.d.ts.map +1 -0
  134. package/dist/utils.js +71 -0
  135. package/dist/utils.js.map +1 -0
  136. package/package.json +58 -0
@@ -0,0 +1,36 @@
1
+ /**
2
+ * @file src/modules/http/post.ts
3
+ * @version 2.0.0
4
+ * @since 2.0.0
5
+ * @license GPL-3.0-or-later
6
+ * @copyright Sven Minio 2026
7
+ * @author Sven Minio <https://sven-minio.de>
8
+ * @category HTTP
9
+ * * @description
10
+ * * 🇬🇧: Abstraction for HTTP POST requests.
11
+ * * 🇩🇪: Abstraktion für HTTP POST-Anfragen.
12
+ * @requires ../../core
13
+ * * 🇬🇧: Depends on the core jBase class for type definitions.
14
+ * * 🇩🇪: Hängt von der Core-jBase-Klasse für Typ-Definitionen ab.
15
+ */
16
+ /**
17
+ * * 🇬🇧: Performs an asynchronous HTTP POST request to the specified URL. Automatically sets the 'Content-Type' header to 'application/json' and serializes the body.
18
+ * * 🇩🇪: Führt einen asynchronen HTTP POST-Request an die angegebene URL durch. Setzt automatisch den 'Content-Type'-Header auf 'application/json' und serialisiert den Body.
19
+ * @template T
20
+ * * 🇬🇧: The expected response type (Generic).
21
+ * * 🇩🇪: Der erwartete Rückgabetyp der Antwort (Generic).
22
+ * @param url
23
+ * * 🇬🇧: The target URL for the request.
24
+ * * 🇩🇪: Die Ziel-URL für den Request.
25
+ * @param body
26
+ * * 🇬🇧: The data to send (automatically JSON serialized). Default is {}.
27
+ * * 🇩🇪: Die zu sendenden Daten (werden automatisch JSON-serialisiert). Standard ist {}.
28
+ * @returns
29
+ * * 🇬🇧: A Promise resolving with the deserialized JSON response of type T.
30
+ * * 🇩🇪: Ein Promise, das mit der deserialisierten JSON-Antwort vom Typ T aufgelöst wird.
31
+ * @throws
32
+ * * 🇬🇧: Error if the HTTP status code is not in the range 200-299.
33
+ * * 🇩🇪: Error, wenn der HTTP-Statuscode nicht im Bereich 200-299 liegt.
34
+ */
35
+ export declare function post<T>(url: string, body?: any): Promise<T>;
36
+ //# sourceMappingURL=post.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"post.d.ts","sourceRoot":"","sources":["../../../src/modules/http/post.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAsB,IAAI,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,GAAE,GAAQ,GAAG,OAAO,CAAC,CAAC,CAAC,CAkBrE"}
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ /**
3
+ * @file src/modules/http/post.ts
4
+ * @version 2.0.0
5
+ * @since 2.0.0
6
+ * @license GPL-3.0-or-later
7
+ * @copyright Sven Minio 2026
8
+ * @author Sven Minio <https://sven-minio.de>
9
+ * @category HTTP
10
+ * * @description
11
+ * * 🇬🇧: Abstraction for HTTP POST requests.
12
+ * * 🇩🇪: Abstraktion für HTTP POST-Anfragen.
13
+ * @requires ../../core
14
+ * * 🇬🇧: Depends on the core jBase class for type definitions.
15
+ * * 🇩🇪: Hängt von der Core-jBase-Klasse für Typ-Definitionen ab.
16
+ */
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.post = post;
19
+ /**
20
+ * * 🇬🇧: Performs an asynchronous HTTP POST request to the specified URL. Automatically sets the 'Content-Type' header to 'application/json' and serializes the body.
21
+ * * 🇩🇪: Führt einen asynchronen HTTP POST-Request an die angegebene URL durch. Setzt automatisch den 'Content-Type'-Header auf 'application/json' und serialisiert den Body.
22
+ * @template T
23
+ * * 🇬🇧: The expected response type (Generic).
24
+ * * 🇩🇪: Der erwartete Rückgabetyp der Antwort (Generic).
25
+ * @param url
26
+ * * 🇬🇧: The target URL for the request.
27
+ * * 🇩🇪: Die Ziel-URL für den Request.
28
+ * @param body
29
+ * * 🇬🇧: The data to send (automatically JSON serialized). Default is {}.
30
+ * * 🇩🇪: Die zu sendenden Daten (werden automatisch JSON-serialisiert). Standard ist {}.
31
+ * @returns
32
+ * * 🇬🇧: A Promise resolving with the deserialized JSON response of type T.
33
+ * * 🇩🇪: Ein Promise, das mit der deserialisierten JSON-Antwort vom Typ T aufgelöst wird.
34
+ * @throws
35
+ * * 🇬🇧: Error if the HTTP status code is not in the range 200-299.
36
+ * * 🇩🇪: Error, wenn der HTTP-Statuscode nicht im Bereich 200-299 liegt.
37
+ */
38
+ async function post(url, body = {}) {
39
+ const response = await fetch(url, {
40
+ method: 'POST',
41
+ headers: { 'Content-Type': 'application/json' },
42
+ body: JSON.stringify(body)
43
+ });
44
+ // Handle HTTP 204 (No Content):
45
+ // Prevents SyntaxError because response.json() fails on empty body.
46
+ if (response.status === 204) {
47
+ return {};
48
+ }
49
+ if (!response.ok) {
50
+ throw new Error(`HTTP Error: ${response.status}`);
51
+ }
52
+ return await response.json();
53
+ }
54
+ //# sourceMappingURL=post.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"post.js","sourceRoot":"","sources":["../../../src/modules/http/post.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;AAqBH,oBAkBC;AArCD;;;;;;;;;;;;;;;;;;GAkBG;AACI,KAAK,UAAU,IAAI,CAAI,GAAW,EAAE,OAAY,EAAE;IACrD,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE;QAC9B,MAAM,EAAE,MAAM;QACd,OAAO,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE;QAC/C,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;KAC7B,CAAC,CAAC;IAEH,gCAAgC;IAChC,oEAAoE;IACpE,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;QAC1B,OAAO,EAAO,CAAC;IACnB,CAAC;IAED,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CAAC,eAAe,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;IACtD,CAAC;IAED,OAAO,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;AACjC,CAAC"}
@@ -0,0 +1,61 @@
1
+ /**
2
+ * @file src/types.ts
3
+ * @version 2.0.0
4
+ * @since 2.0.0
5
+ * @license GPL-3.0-or-later
6
+ * @copyright Sven Minio 2026
7
+ * @author Sven Minio <https://sven-minio.de>
8
+ * @category Types
9
+ * @description
10
+ * * 🇬🇧: Central type definitions, interfaces, and aliases for the jBase library.
11
+ * * 🇩🇪: Zentrale Typ-Definitionen, Interfaces und Aliase für die jBase-Bibliothek.
12
+ */
13
+ /**
14
+ * * 🇬🇧: Represents the basic DOM elements managed by a jBase instance. Includes standard HTML elements, the Document, the Window object, and generic elements (e.g., SVG).
15
+ * * 🇩🇪: Repräsentiert die grundlegenden DOM-Elemente, die von einer jBase-Instanz verwaltet werden können. Umfasst Standard-HTML-Elemente, das Dokument, das Window-Objekt sowie generische Elemente (z.B. SVG).
16
+ */
17
+ export type JBaseElement = HTMLElement | Document | Window | Element;
18
+ /**
19
+ * * 🇬🇧: Union type for all valid inputs to the main selector function $(...). Accepts CSS selectors (string), single DOM elements, NodeLists, Arrays, or null/undefined.
20
+ * * 🇩🇪: Union Type für alle gültigen Eingabewerte der Haupt-Selektorfunktion $(...). Akzeptiert CSS-Selektoren (string), einzelne DOM-Elemente, NodeLists, Arrays oder null/undefined.
21
+ */
22
+ export type JBaseInput = string | JBaseElement | NodeList | JBaseElement[] | null | undefined;
23
+ /**
24
+ * * 🇬🇧: Extracts valid CSS property names from the native CSSStyleDeclaration. Excludes methods (like setProperty) and numeric indices to ensure type safety and autocomplete.
25
+ * * 🇩🇪: Extrahiert ausschließlich die gültigen CSS-Eigenschaftsnamen aus der nativen CSSStyleDeclaration. Methoden (wie setProperty) und numerische Indizes werden ausgeschlossen, um Typ-Sicherheit zu gewährleisten.
26
+ */
27
+ export type JBaseCSSProperty = Exclude<keyof CSSStyleDeclaration, 'length' | 'parentRule' | 'getPropertyPriority' | 'getPropertyValue' | 'item' | 'removeProperty' | 'setProperty' | number>;
28
+ /**
29
+ * * 🇬🇧: Extended event map linking native DOM events with framework-specific custom events. Serves as the base for generics in .on() and .off() to infer correct event types.
30
+ * * 🇩🇪: Erweiterte Event-Map, die native DOM-Events mit Framework-spezifischen Custom-Events verknüpft. Dient als Basis für Generics in .on() und .off(), um den korrekten Event-Typ abzuleiten.
31
+ */
32
+ export interface JBaseEventMap extends HTMLElementEventMap {
33
+ /**
34
+ * * 🇬🇧: Fired when the framework and DOM are fully initialized.
35
+ * * 🇩🇪: Wird ausgelöst, wenn das Framework und DOM vollständig initialisiert sind.
36
+ */
37
+ 'jbase:ready': CustomEvent;
38
+ }
39
+ /**
40
+ * * 🇬🇧: Generic type for event handlers. Allows TypeScript to infer the 'event' parameter type based on the event name (K).
41
+ * * 🇩🇪: Generischer Typ für Event-Handler. Ermöglicht TypeScript, den Typ des 'event'-Parameters basierend auf dem Event-Namen (K) automatisch zu bestimmen.
42
+ */
43
+ export type JBaseEventHandler<K extends keyof JBaseEventMap> = (event: JBaseEventMap[K]) => void;
44
+ /**
45
+ * * 🇬🇧: Fallback type for generic event handlers where the specific event type is unknown.
46
+ * * 🇩🇪: Fallback-Typ für generische Event-Handler, wenn der spezifische Event-Typ nicht bekannt ist.
47
+ */
48
+ export type GenericEventHandler = (event: Event) => void;
49
+ /**
50
+ * * 🇬🇧: Standardized interface for API responses in the http module.
51
+ * * 🇩🇪: Standardisierte Schnittstelle für API-Antworten des http-Moduls.
52
+ * @template T
53
+ * * 🇬🇧: The expected type of the data payload.
54
+ * * 🇩🇪: Der Typ der erwarteten Nutzdaten.
55
+ */
56
+ export interface ApiResponse<T = any> {
57
+ success: boolean;
58
+ data?: T;
59
+ error?: string;
60
+ }
61
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH;;;GAGG;AACH,MAAM,MAAM,YAAY,GAAG,WAAW,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAC;AAErE;;;GAGG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,YAAY,GAAG,QAAQ,GAAG,YAAY,EAAE,GAAG,IAAI,GAAG,SAAS,CAAC;AAE9F;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GAAG,OAAO,CAAC,MAAM,mBAAmB,EAAE,QAAQ,GAAG,YAAY,GAAG,qBAAqB,GAAG,kBAAkB,GAAG,MAAM,GAAG,gBAAgB,GAAG,aAAa,GAAG,MAAM,CAAC,CAAC;AAE7L;;;GAGG;AACH,MAAM,WAAW,aAAc,SAAQ,mBAAmB;IACtD;;;OAGG;IACH,aAAa,EAAE,WAAW,CAAC;CAC9B;AAED;;;GAGG;AACH,MAAM,MAAM,iBAAiB,CAAC,CAAC,SAAS,MAAM,aAAa,IAAI,CAAC,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC;AAEjG;;;GAGG;AACH,MAAM,MAAM,mBAAmB,GAAG,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;AAEzD;;;;;;GAMG;AACH,MAAM,WAAW,WAAW,CAAC,CAAC,GAAG,GAAG;IAChC,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,CAAC,CAAC;IACT,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB"}
package/dist/types.js ADDED
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ /**
3
+ * @file src/types.ts
4
+ * @version 2.0.0
5
+ * @since 2.0.0
6
+ * @license GPL-3.0-or-later
7
+ * @copyright Sven Minio 2026
8
+ * @author Sven Minio <https://sven-minio.de>
9
+ * @category Types
10
+ * @description
11
+ * * 🇬🇧: Central type definitions, interfaces, and aliases for the jBase library.
12
+ * * 🇩🇪: Zentrale Typ-Definitionen, Interfaces und Aliase für die jBase-Bibliothek.
13
+ */
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG"}
@@ -0,0 +1,51 @@
1
+ /**
2
+ * @file src/utils.ts
3
+ * @version 2.0.0
4
+ * @since 2.0.0
5
+ * @license GPL-3.0-or-later
6
+ * @copyright Sven Minio 2026
7
+ * @author Sven Minio <https://sven-minio.de>
8
+ * @category Utilities
9
+ * @description
10
+ * * 🇬🇧: General utility functions and helpers (e.g., debounce, throttle, type checks).
11
+ * * 🇩🇪: Allgemeine Hilfsfunktionen und Helfer (z.B. debounce, throttle, Typ-Prüfungen).
12
+ */
13
+ /**
14
+ * * 🇬🇧: 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.
15
+ * Use case: Performance optimization for high-frequency events (e.g., Scroll, Resize, Mousemove).
16
+ * * 🇩🇪: Erstellt eine gedrosselte (throttled) Version der übergebenen Funktion. Die Funktion wird höchstens einmal innerhalb des angegebenen Zeitintervalls ausgeführt, unabhängig davon, wie oft sie aufgerufen wird.
17
+ * Einsatzgebiet: Performance-Optimierung bei hochfrequenten Events (z.B. Scroll, Resize, Mousemove).
18
+ * @template T
19
+ * * 🇬🇧: The type of the original function.
20
+ * * 🇩🇪: Der Typ der ursprünglichen Funktion.
21
+ * @param func
22
+ * * 🇬🇧: The function to be throttled.
23
+ * * 🇩🇪: Die Funktion, die gedrosselt werden soll.
24
+ * @param limit
25
+ * * 🇬🇧: The time interval in milliseconds during which at most one execution is permitted.
26
+ * * 🇩🇪: Das Zeitintervall in Millisekunden, in dem höchstens eine Ausführung erlaubt ist.
27
+ * @returns
28
+ * * 🇬🇧: A new function that throttles calls.
29
+ * * 🇩🇪: Eine neue Funktion, die die Aufrufe drosselt.
30
+ */
31
+ export declare function throttle<T extends (...args: any[]) => any>(func: T, limit: number): (...args: Parameters<T>) => void;
32
+ /**
33
+ * * 🇬🇧: Creates a debounced version of the provided function. Execution is delayed until `delay` milliseconds have passed since the last invocation.
34
+ * Use case: Waiting for user input (e.g., Live Search, Validation) to avoid unnecessary calculations.
35
+ * * 🇩🇪: Erstellt eine entprellte (debounced) Version der übergebenen Funktion. Die Ausführung der Funktion wird verzögert, bis `delay` Millisekunden verstrichen sind, ohne dass ein neuer Aufruf erfolgt ist.
36
+ * Einsatzgebiet: Warten auf Benutzereingaben (z.B. Live-Suche, Validierung) zur Vermeidung unnötiger Berechnungen.
37
+ * @template T
38
+ * * 🇬🇧: The type of the original function.
39
+ * * 🇩🇪: Der Typ der ursprünglichen Funktion.
40
+ * @param func
41
+ * * 🇬🇧: The function to be debounced.
42
+ * * 🇩🇪: Die Funktion, die entprellt werden soll.
43
+ * @param delay
44
+ * * 🇬🇧: The waiting time in milliseconds after the last call.
45
+ * * 🇩🇪: Die Wartezeit in Millisekunden nach dem letzten Aufruf.
46
+ * @returns
47
+ * * 🇬🇧: A new function that delays execution.
48
+ * * 🇩🇪: Eine neue Funktion, die die Ausführung verzögert.
49
+ */
50
+ export declare function debounce<T extends (...args: any[]) => any>(func: T, delay: number): (...args: Parameters<T>) => void;
51
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,QAAQ,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,GAAG,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,KAAK,IAAI,CAUpH;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,QAAQ,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,GAAG,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,KAAK,IAAI,CAMpH"}
package/dist/utils.js ADDED
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+ /**
3
+ * @file src/utils.ts
4
+ * @version 2.0.0
5
+ * @since 2.0.0
6
+ * @license GPL-3.0-or-later
7
+ * @copyright Sven Minio 2026
8
+ * @author Sven Minio <https://sven-minio.de>
9
+ * @category Utilities
10
+ * @description
11
+ * * 🇬🇧: General utility functions and helpers (e.g., debounce, throttle, type checks).
12
+ * * 🇩🇪: Allgemeine Hilfsfunktionen und Helfer (z.B. debounce, throttle, Typ-Prüfungen).
13
+ */
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.throttle = throttle;
16
+ exports.debounce = debounce;
17
+ /**
18
+ * * 🇬🇧: 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.
19
+ * Use case: Performance optimization for high-frequency events (e.g., Scroll, Resize, Mousemove).
20
+ * * 🇩🇪: Erstellt eine gedrosselte (throttled) Version der übergebenen Funktion. Die Funktion wird höchstens einmal innerhalb des angegebenen Zeitintervalls ausgeführt, unabhängig davon, wie oft sie aufgerufen wird.
21
+ * Einsatzgebiet: Performance-Optimierung bei hochfrequenten Events (z.B. Scroll, Resize, Mousemove).
22
+ * @template T
23
+ * * 🇬🇧: The type of the original function.
24
+ * * 🇩🇪: Der Typ der ursprünglichen Funktion.
25
+ * @param func
26
+ * * 🇬🇧: The function to be throttled.
27
+ * * 🇩🇪: Die Funktion, die gedrosselt werden soll.
28
+ * @param limit
29
+ * * 🇬🇧: The time interval in milliseconds during which at most one execution is permitted.
30
+ * * 🇩🇪: Das Zeitintervall in Millisekunden, in dem höchstens eine Ausführung erlaubt ist.
31
+ * @returns
32
+ * * 🇬🇧: A new function that throttles calls.
33
+ * * 🇩🇪: Eine neue Funktion, die die Aufrufe drosselt.
34
+ */
35
+ function throttle(func, limit) {
36
+ let inThrottle;
37
+ return function (...args) {
38
+ const context = this;
39
+ if (!inThrottle) {
40
+ func.apply(context, args);
41
+ inThrottle = true;
42
+ setTimeout(() => inThrottle = false, limit);
43
+ }
44
+ };
45
+ }
46
+ /**
47
+ * * 🇬🇧: Creates a debounced version of the provided function. Execution is delayed until `delay` milliseconds have passed since the last invocation.
48
+ * Use case: Waiting for user input (e.g., Live Search, Validation) to avoid unnecessary calculations.
49
+ * * 🇩🇪: Erstellt eine entprellte (debounced) Version der übergebenen Funktion. Die Ausführung der Funktion wird verzögert, bis `delay` Millisekunden verstrichen sind, ohne dass ein neuer Aufruf erfolgt ist.
50
+ * Einsatzgebiet: Warten auf Benutzereingaben (z.B. Live-Suche, Validierung) zur Vermeidung unnötiger Berechnungen.
51
+ * @template T
52
+ * * 🇬🇧: The type of the original function.
53
+ * * 🇩🇪: Der Typ der ursprünglichen Funktion.
54
+ * @param func
55
+ * * 🇬🇧: The function to be debounced.
56
+ * * 🇩🇪: Die Funktion, die entprellt werden soll.
57
+ * @param delay
58
+ * * 🇬🇧: The waiting time in milliseconds after the last call.
59
+ * * 🇩🇪: Die Wartezeit in Millisekunden nach dem letzten Aufruf.
60
+ * @returns
61
+ * * 🇬🇧: A new function that delays execution.
62
+ * * 🇩🇪: Eine neue Funktion, die die Ausführung verzögert.
63
+ */
64
+ function debounce(func, delay) {
65
+ let timer;
66
+ return function (...args) {
67
+ clearTimeout(timer);
68
+ timer = setTimeout(() => func.apply(this, args), delay);
69
+ };
70
+ }
71
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG;;AAoBH,4BAUC;AAoBD,4BAMC;AAtDD;;;;;;;;;;;;;;;;;GAiBG;AACH,SAAgB,QAAQ,CAAoC,IAAO,EAAE,KAAa;IAC9E,IAAI,UAAmB,CAAC;IACxB,OAAO,UAAoB,GAAG,IAAmB;QAC7C,MAAM,OAAO,GAAG,IAAI,CAAC;QACrB,IAAI,CAAC,UAAU,EAAE,CAAC;YACd,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;YAC1B,UAAU,GAAG,IAAI,CAAC;YAClB,UAAU,CAAC,GAAG,EAAE,CAAC,UAAU,GAAG,KAAK,EAAE,KAAK,CAAC,CAAC;QAChD,CAAC;IACL,CAAC,CAAC;AACN,CAAC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,SAAgB,QAAQ,CAAoC,IAAO,EAAE,KAAa;IAC9E,IAAI,KAAoC,CAAC;IACzC,OAAO,UAAoB,GAAG,IAAmB;QAC7C,YAAY,CAAC,KAAK,CAAC,CAAC;QACpB,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,KAAK,CAAC,CAAC;IAC5D,CAAC,CAAC;AACN,CAAC"}
package/package.json ADDED
@@ -0,0 +1,58 @@
1
+ {
2
+ "name": "@k37z3r/jbase",
3
+ "version": "2.0.0",
4
+ "description": "A modern micro-framework for the web: jBase offers the familiar syntax of classic DOM libraries, but without their baggage. Fully typed, modular, and optimized for modern browser engines.",
5
+ "private": false,
6
+ "main": "./dist/index.cjs",
7
+ "module": "./dist/index.mjs",
8
+ "browser": "./dist/jbase.min.js",
9
+ "types": "dist/index.d.ts",
10
+ "files": [
11
+ "dist",
12
+ "README.md",
13
+ "LICENSE"
14
+ ],
15
+ "scripts": {
16
+ "build:ts": "tsc",
17
+ "build:browser": "node build.js",
18
+ "build": "npm run build:browser",
19
+ "prepublishOnly": "npm run build"
20
+ },
21
+ "author": "Sven Minio (https://github.com/k37z3r/jBase-2.0)",
22
+ "homepage": "https://github.com/k37z3r/jBase-2.0",
23
+ "funding": {
24
+ "type": "paypal",
25
+ "url": "https://www.paypal.com/donate/?hosted_button_id=PAE6M49YXLHUU"
26
+ },
27
+ "bugs": {
28
+ "url": "https://github.com/k37z3r/jBase-2.0/issues"
29
+ },
30
+ "repository": {
31
+ "type": "git",
32
+ "url": "https://github.com/k37z3r/jBase-2.0.git"
33
+ },
34
+ "license": "GPL-3.0-or-later",
35
+ "dependencies": {
36
+ "tslib": "^2.8.1"
37
+ },
38
+ "devDependencies": {
39
+ "@types/node": "^22.0.0",
40
+ "esbuild": "^0.27.2",
41
+ "typescript": "^5.3.3"
42
+ },
43
+ "keywords": [
44
+ "framework",
45
+ "dom",
46
+ "typescript",
47
+ "javascript",
48
+ "jbase"
49
+ ],
50
+ "type": "commonjs",
51
+ "exports": {
52
+ ".": {
53
+ "types": "./dist/index.d.ts",
54
+ "import": "./dist/index.mjs",
55
+ "require": "./dist/index.cjs"
56
+ }
57
+ }
58
+ }