@k37z3r/jbase 2.0.1 → 2.0.3
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/CHANGELOG.md +50 -0
- package/README.md +59 -43
- package/dist/browser.d.ts +5 -6
- package/dist/browser.d.ts.map +1 -1
- package/dist/core.d.ts +9 -14
- package/dist/core.d.ts.map +1 -1
- package/dist/index.cjs +577 -452
- package/dist/index.cjs.map +7 -0
- package/dist/index.d.ts +304 -603
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +575 -452
- package/dist/index.mjs.map +7 -0
- package/dist/jbase.browser.js +338 -281
- package/dist/jbase.browser.js.map +7 -0
- package/dist/jbase.min.js +3 -2
- package/dist/jbase.min.js.map +7 -0
- package/dist/modules/css/classes.d.ts +15 -29
- package/dist/modules/css/classes.d.ts.map +1 -1
- package/dist/modules/css/index.d.ts +5 -9
- package/dist/modules/css/index.d.ts.map +1 -1
- package/dist/modules/css/styles.d.ts +7 -13
- package/dist/modules/css/styles.d.ts.map +1 -1
- package/dist/modules/data/arrays.d.ts +96 -64
- package/dist/modules/data/arrays.d.ts.map +1 -1
- package/dist/modules/data/index.d.ts +5 -9
- package/dist/modules/data/index.d.ts.map +1 -1
- package/dist/modules/data/objects.d.ts +86 -54
- package/dist/modules/data/objects.d.ts.map +1 -1
- package/dist/modules/data/types.d.ts +3 -22
- package/dist/modules/data/types.d.ts.map +1 -1
- package/dist/modules/dom/attributes.d.ts +10 -19
- package/dist/modules/dom/attributes.d.ts.map +1 -1
- package/dist/modules/dom/content.d.ts +9 -17
- package/dist/modules/dom/content.d.ts.map +1 -1
- package/dist/modules/dom/index.d.ts +8 -15
- package/dist/modules/dom/index.d.ts.map +1 -1
- package/dist/modules/dom/manipulation.d.ts +41 -81
- package/dist/modules/dom/manipulation.d.ts.map +1 -1
- package/dist/modules/dom/states.d.ts +12 -23
- package/dist/modules/dom/states.d.ts.map +1 -1
- package/dist/modules/dom/traversal.d.ts +64 -127
- package/dist/modules/dom/traversal.d.ts.map +1 -1
- package/dist/modules/effects/fade.d.ts +13 -31
- package/dist/modules/effects/fade.d.ts.map +1 -1
- package/dist/modules/effects/index.d.ts +15 -23
- package/dist/modules/effects/index.d.ts.map +1 -1
- package/dist/modules/effects/slide.d.ts +13 -31
- package/dist/modules/effects/slide.d.ts.map +1 -1
- package/dist/modules/effects/types.d.ts +33 -0
- package/dist/modules/effects/types.d.ts.map +1 -0
- package/dist/modules/effects/vertical.d.ts +13 -31
- package/dist/modules/effects/vertical.d.ts.map +1 -1
- package/dist/modules/events/binding.d.ts +11 -21
- package/dist/modules/events/binding.d.ts.map +1 -1
- package/dist/modules/events/form.d.ts +18 -35
- package/dist/modules/events/form.d.ts.map +1 -1
- package/dist/modules/events/index.d.ts +9 -17
- package/dist/modules/events/index.d.ts.map +1 -1
- package/dist/modules/events/keyboard.d.ts +16 -31
- package/dist/modules/events/keyboard.d.ts.map +1 -1
- package/dist/modules/events/lifecycle.d.ts +6 -11
- package/dist/modules/events/lifecycle.d.ts.map +1 -1
- package/dist/modules/events/mouse.d.ts +30 -59
- package/dist/modules/events/mouse.d.ts.map +1 -1
- package/dist/modules/events/touch.d.ts +15 -29
- package/dist/modules/events/touch.d.ts.map +1 -1
- package/dist/modules/http/get.d.ts +18 -25
- package/dist/modules/http/get.d.ts.map +1 -1
- package/dist/modules/http/index.d.ts +11 -15
- package/dist/modules/http/index.d.ts.map +1 -1
- package/dist/modules/http/post.d.ts +13 -19
- package/dist/modules/http/post.d.ts.map +1 -1
- package/dist/server.d.ts +15 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +2246 -0
- package/dist/server.js.map +7 -0
- package/dist/types.d.ts +11 -21
- package/dist/types.d.ts.map +1 -1
- package/dist/utils.d.ts +20 -23
- package/dist/utils.d.ts.map +1 -1
- package/package.json +14 -4
- package/wiki/CSS-Classes-&-Styles.md +128 -0
- package/wiki/DATA-Utilities-(Arrays).md +332 -0
- package/wiki/DATA-Utilities-(Objects).md +263 -0
- package/wiki/DOM-Attributes.md +56 -0
- package/wiki/DOM-Content.md +48 -0
- package/wiki/DOM-Manipulation.md +272 -0
- package/wiki/DOM-States.md +73 -0
- package/wiki/DOM-Traversal.md +529 -0
- package/wiki/EFFECTS-Fade.md +76 -0
- package/wiki/EFFECTS-Slide-(horizontal).md +70 -0
- package/wiki/EFFECTS-Slide-(vertical).md +75 -0
- package/wiki/EVENTS-Bindings.md +55 -0
- package/wiki/EVENTS-Form.md +122 -0
- package/wiki/EVENTS-Keyboard.md +98 -0
- package/wiki/EVENTS-Lifecycle.md +25 -0
- package/wiki/EVENTS-Mouse.md +218 -0
- package/wiki/EVENTS-Touch.md +98 -0
- package/wiki/HTTP-Requests.md +93 -0
- package/wiki/Home.md +118 -0
- package/wiki/Installation.md +44 -0
- package/wiki/Quick-Start.md +139 -0
- package/dist/browser.js +0 -29
- package/dist/browser.js.map +0 -1
- package/dist/core.js +0 -78
- package/dist/core.js.map +0 -1
- package/dist/index.js +0 -100
- package/dist/index.js.map +0 -1
- package/dist/jbase.js +0 -1898
- package/dist/modules/css/classes.js +0 -88
- package/dist/modules/css/classes.js.map +0 -1
- package/dist/modules/css/index.js +0 -33
- package/dist/modules/css/index.js.map +0 -1
- package/dist/modules/css/styles.js +0 -49
- package/dist/modules/css/styles.js.map +0 -1
- package/dist/modules/data/arrays.js +0 -177
- package/dist/modules/data/arrays.js.map +0 -1
- package/dist/modules/data/index.js +0 -33
- package/dist/modules/data/index.js.map +0 -1
- package/dist/modules/data/objects.js +0 -168
- package/dist/modules/data/objects.js.map +0 -1
- package/dist/modules/data/types.js +0 -43
- package/dist/modules/data/types.js.map +0 -1
- package/dist/modules/dom/attributes.js +0 -69
- package/dist/modules/dom/attributes.js.map +0 -1
- package/dist/modules/dom/content.js +0 -63
- package/dist/modules/dom/content.js.map +0 -1
- package/dist/modules/dom/index.js +0 -48
- package/dist/modules/dom/index.js.map +0 -1
- package/dist/modules/dom/manipulation.js +0 -343
- package/dist/modules/dom/manipulation.js.map +0 -1
- package/dist/modules/dom/states.js +0 -89
- package/dist/modules/dom/states.js.map +0 -1
- package/dist/modules/dom/traversal.js +0 -527
- package/dist/modules/dom/traversal.js.map +0 -1
- package/dist/modules/effects/fade.js +0 -104
- package/dist/modules/effects/fade.js.map +0 -1
- package/dist/modules/effects/index.js +0 -38
- package/dist/modules/effects/index.js.map +0 -1
- package/dist/modules/effects/slide.js +0 -103
- package/dist/modules/effects/slide.js.map +0 -1
- package/dist/modules/effects/vertical.js +0 -118
- package/dist/modules/effects/vertical.js.map +0 -1
- package/dist/modules/events/binding.js +0 -60
- package/dist/modules/events/binding.js.map +0 -1
- package/dist/modules/events/form.js +0 -106
- package/dist/modules/events/form.js.map +0 -1
- package/dist/modules/events/index.js +0 -53
- package/dist/modules/events/index.js.map +0 -1
- package/dist/modules/events/keyboard.js +0 -83
- package/dist/modules/events/keyboard.js.map +0 -1
- package/dist/modules/events/lifecycle.js +0 -40
- package/dist/modules/events/lifecycle.js.map +0 -1
- package/dist/modules/events/mouse.js +0 -172
- package/dist/modules/events/mouse.js.map +0 -1
- package/dist/modules/events/touch.js +0 -74
- package/dist/modules/events/touch.js.map +0 -1
- package/dist/modules/http/get.js +0 -65
- package/dist/modules/http/get.js.map +0 -1
- package/dist/modules/http/index.js +0 -42
- package/dist/modules/http/index.js.map +0 -1
- package/dist/modules/http/post.js +0 -54
- package/dist/modules/http/post.js.map +0 -1
- package/dist/types.js +0 -15
- package/dist/types.js.map +0 -1
- package/dist/utils.js +0 -71
- package/dist/utils.js.map +0 -1
package/dist/server.js
ADDED
|
@@ -0,0 +1,2246 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @k37z3r/jbase - 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.
|
|
3
|
+
* @version 2.0.3
|
|
4
|
+
* @homepage https://github.com/k37z3r/jBase-2.0
|
|
5
|
+
* @author Sven Minio (https://github.com/k37z3r/jBase-2.0)
|
|
6
|
+
* @license GPL-3.0-or-later
|
|
7
|
+
* @copyright 2026 Sven Minio (https://github.com/k37z3r/jBase-2.0)
|
|
8
|
+
*/
|
|
9
|
+
"use strict";
|
|
10
|
+
var __defProp = Object.defineProperty;
|
|
11
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
12
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
13
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
14
|
+
var __export = (target, all) => {
|
|
15
|
+
for (var name in all)
|
|
16
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
17
|
+
};
|
|
18
|
+
var __copyProps = (to, from, except, desc) => {
|
|
19
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
20
|
+
for (let key of __getOwnPropNames(from))
|
|
21
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
22
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
23
|
+
}
|
|
24
|
+
return to;
|
|
25
|
+
};
|
|
26
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
27
|
+
|
|
28
|
+
// src/server.ts
|
|
29
|
+
var server_exports = {};
|
|
30
|
+
__export(server_exports, {
|
|
31
|
+
parseHTML: () => parseHTML2
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(server_exports);
|
|
34
|
+
var import_jsdom = require("jsdom");
|
|
35
|
+
|
|
36
|
+
// src/core.ts
|
|
37
|
+
var jBase = class extends Array {
|
|
38
|
+
selectorSource = "";
|
|
39
|
+
doc;
|
|
40
|
+
/**
|
|
41
|
+
* * Initializes a new jBase instance. Analyzes the provided selector and populates the internal array with found or created DOM elements.
|
|
42
|
+
* @param selector
|
|
43
|
+
* * The input selector (CSS selector, HTML string, DOM element, or collection).
|
|
44
|
+
*/
|
|
45
|
+
constructor(selector, context) {
|
|
46
|
+
super();
|
|
47
|
+
if (context instanceof Document) {
|
|
48
|
+
this.doc = context;
|
|
49
|
+
} else if (context && context.document) {
|
|
50
|
+
this.doc = context.document;
|
|
51
|
+
} else {
|
|
52
|
+
this.doc = typeof document !== "undefined" ? document : null;
|
|
53
|
+
}
|
|
54
|
+
if (typeof document === "undefined") {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
this.selectorSource = typeof selector === "string" ? selector : "<DOM Object/Array>";
|
|
58
|
+
if (!selector)
|
|
59
|
+
return;
|
|
60
|
+
if (selector instanceof HTMLElement || selector === document || selector === window || selector instanceof Element) {
|
|
61
|
+
this.push(selector);
|
|
62
|
+
} else if (typeof selector === "string") {
|
|
63
|
+
const trimmed = selector.trim();
|
|
64
|
+
if (trimmed.startsWith("<") && trimmed.endsWith(">")) {
|
|
65
|
+
const tempDiv = document.createElement("div");
|
|
66
|
+
tempDiv.innerHTML = trimmed;
|
|
67
|
+
this.push(...Array.from(tempDiv.children));
|
|
68
|
+
} else if (trimmed.startsWith("#") && !trimmed.includes(" ") && !trimmed.includes(".")) {
|
|
69
|
+
const el = document.getElementById(trimmed.slice(1));
|
|
70
|
+
if (el)
|
|
71
|
+
this.push(el);
|
|
72
|
+
} else if (trimmed.startsWith(".") && !trimmed.includes(" ") && !/[:\[#]/.test(trimmed)) {
|
|
73
|
+
const els = document.getElementsByClassName(trimmed.slice(1));
|
|
74
|
+
for (let i = 0; i < els.length; i++) {
|
|
75
|
+
this.push(els[i]);
|
|
76
|
+
}
|
|
77
|
+
} else if (/^[a-zA-Z0-9]+$/.test(trimmed)) {
|
|
78
|
+
const els = document.getElementsByTagName(trimmed);
|
|
79
|
+
for (let i = 0; i < els.length; i++) {
|
|
80
|
+
this.push(els[i]);
|
|
81
|
+
}
|
|
82
|
+
} else {
|
|
83
|
+
try {
|
|
84
|
+
this.push(...Array.from(document.querySelectorAll(selector)));
|
|
85
|
+
} catch (e) {
|
|
86
|
+
console.warn(`jBase: Invalid selector "${selector}"`, e);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
} else if (selector instanceof NodeList || Array.isArray(selector)) {
|
|
90
|
+
this.push(...Array.from(selector));
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* * Custom serializer for JSON.stringify. Prevents circular references and huge outputs by returning a simplified preview.
|
|
95
|
+
* @returns
|
|
96
|
+
* * A simplified object representation for debugging.
|
|
97
|
+
*/
|
|
98
|
+
toJSON() {
|
|
99
|
+
return {
|
|
100
|
+
meta: "jBase Wrapper",
|
|
101
|
+
query: this.selectorSource,
|
|
102
|
+
count: this.length,
|
|
103
|
+
preview: this.slice(0, 10).map((el) => {
|
|
104
|
+
if (el instanceof Element)
|
|
105
|
+
return el.tagName.toLowerCase();
|
|
106
|
+
return typeof el;
|
|
107
|
+
})
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
// src/modules/css/classes.ts
|
|
113
|
+
var classes_exports = {};
|
|
114
|
+
__export(classes_exports, {
|
|
115
|
+
addClass: () => addClass,
|
|
116
|
+
hasClass: () => hasClass,
|
|
117
|
+
removeClass: () => removeClass,
|
|
118
|
+
toggleClass: () => toggleClass
|
|
119
|
+
});
|
|
120
|
+
function addClass(...classNames) {
|
|
121
|
+
this.forEach((el) => {
|
|
122
|
+
if (el instanceof Element) el.classList.add(...classNames);
|
|
123
|
+
});
|
|
124
|
+
return this;
|
|
125
|
+
}
|
|
126
|
+
function removeClass(...classNames) {
|
|
127
|
+
this.forEach((el) => {
|
|
128
|
+
if (el instanceof Element) el.classList.remove(...classNames);
|
|
129
|
+
});
|
|
130
|
+
return this;
|
|
131
|
+
}
|
|
132
|
+
function toggleClass(className) {
|
|
133
|
+
this.forEach((el) => {
|
|
134
|
+
if (el instanceof Element) el.classList.toggle(className);
|
|
135
|
+
});
|
|
136
|
+
return this;
|
|
137
|
+
}
|
|
138
|
+
function hasClass(className) {
|
|
139
|
+
return this.some((el) => {
|
|
140
|
+
return el instanceof Element && el.classList.contains(className);
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
// src/modules/css/styles.ts
|
|
145
|
+
var styles_exports = {};
|
|
146
|
+
__export(styles_exports, {
|
|
147
|
+
css: () => css
|
|
148
|
+
});
|
|
149
|
+
function css(property, value) {
|
|
150
|
+
if (value === void 0) {
|
|
151
|
+
const el = this[0];
|
|
152
|
+
if (el instanceof HTMLElement || el instanceof SVGElement) {
|
|
153
|
+
const doc = el.ownerDocument;
|
|
154
|
+
const win = doc ? doc.defaultView : null;
|
|
155
|
+
if (win) {
|
|
156
|
+
return win.getComputedStyle(el)[property];
|
|
157
|
+
} else {
|
|
158
|
+
return el.style[property] || "";
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
return "";
|
|
162
|
+
}
|
|
163
|
+
this.forEach((el) => {
|
|
164
|
+
if (el instanceof HTMLElement || el instanceof SVGElement) {
|
|
165
|
+
el.style[property] = value;
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
return this;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
// src/modules/css/index.ts
|
|
172
|
+
var cssMethods = {
|
|
173
|
+
...classes_exports,
|
|
174
|
+
...styles_exports
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
// src/modules/events/binding.ts
|
|
178
|
+
var binding_exports = {};
|
|
179
|
+
__export(binding_exports, {
|
|
180
|
+
off: () => off,
|
|
181
|
+
on: () => on
|
|
182
|
+
});
|
|
183
|
+
function on(event, handler) {
|
|
184
|
+
this.forEach((el) => {
|
|
185
|
+
el.addEventListener(event, handler);
|
|
186
|
+
});
|
|
187
|
+
return this;
|
|
188
|
+
}
|
|
189
|
+
function off(event, handler) {
|
|
190
|
+
this.forEach((el) => {
|
|
191
|
+
el.removeEventListener(event, handler);
|
|
192
|
+
});
|
|
193
|
+
return this;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
// src/modules/events/mouse.ts
|
|
197
|
+
var mouse_exports = {};
|
|
198
|
+
__export(mouse_exports, {
|
|
199
|
+
click: () => click,
|
|
200
|
+
dblclick: () => dblclick,
|
|
201
|
+
mousedown: () => mousedown,
|
|
202
|
+
mouseenter: () => mouseenter,
|
|
203
|
+
mouseleave: () => mouseleave,
|
|
204
|
+
mousemove: () => mousemove,
|
|
205
|
+
mouseout: () => mouseout,
|
|
206
|
+
mouseover: () => mouseover,
|
|
207
|
+
mouseup: () => mouseup
|
|
208
|
+
});
|
|
209
|
+
function click(handler) {
|
|
210
|
+
if (handler) {
|
|
211
|
+
return this.on("click", handler);
|
|
212
|
+
} else {
|
|
213
|
+
this.forEach((el) => {
|
|
214
|
+
if (el instanceof HTMLElement) el.click();
|
|
215
|
+
});
|
|
216
|
+
return this;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
function mousemove(handler) {
|
|
220
|
+
return this.on("mousemove", handler);
|
|
221
|
+
}
|
|
222
|
+
function mouseleave(handler) {
|
|
223
|
+
return this.on("mouseleave", handler);
|
|
224
|
+
}
|
|
225
|
+
function mouseenter(handler) {
|
|
226
|
+
return this.on("mouseenter", handler);
|
|
227
|
+
}
|
|
228
|
+
function mousedown(handler) {
|
|
229
|
+
return this.on("mousedown", handler);
|
|
230
|
+
}
|
|
231
|
+
function mouseup(handler) {
|
|
232
|
+
return this.on("mouseup", handler);
|
|
233
|
+
}
|
|
234
|
+
function dblclick(handler) {
|
|
235
|
+
if (handler) {
|
|
236
|
+
return this.on("dblclick", handler);
|
|
237
|
+
} else {
|
|
238
|
+
this.forEach((el) => {
|
|
239
|
+
if (el instanceof HTMLElement) {
|
|
240
|
+
el.dispatchEvent(new MouseEvent("dblclick", {
|
|
241
|
+
bubbles: true,
|
|
242
|
+
cancelable: true,
|
|
243
|
+
view: window
|
|
244
|
+
}));
|
|
245
|
+
}
|
|
246
|
+
});
|
|
247
|
+
return this;
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
function mouseout(handler) {
|
|
251
|
+
return this.on("mouseout", handler);
|
|
252
|
+
}
|
|
253
|
+
function mouseover(handler) {
|
|
254
|
+
return this.on("mouseover", handler);
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
// src/modules/events/lifecycle.ts
|
|
258
|
+
var lifecycle_exports = {};
|
|
259
|
+
__export(lifecycle_exports, {
|
|
260
|
+
ready: () => ready
|
|
261
|
+
});
|
|
262
|
+
function ready(handler) {
|
|
263
|
+
const doc = window.document;
|
|
264
|
+
if (doc.readyState === "complete" || doc.readyState === "interactive") {
|
|
265
|
+
handler();
|
|
266
|
+
} else {
|
|
267
|
+
this.on("DOMContentLoaded", handler);
|
|
268
|
+
}
|
|
269
|
+
return this;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
// src/modules/events/keyboard.ts
|
|
273
|
+
var keyboard_exports = {};
|
|
274
|
+
__export(keyboard_exports, {
|
|
275
|
+
keydown: () => keydown,
|
|
276
|
+
keypress: () => keypress,
|
|
277
|
+
keyup: () => keyup,
|
|
278
|
+
pressedKey: () => pressedKey
|
|
279
|
+
});
|
|
280
|
+
function keydown(handler) {
|
|
281
|
+
return this.on("keydown", handler);
|
|
282
|
+
}
|
|
283
|
+
function keyup(handler) {
|
|
284
|
+
return this.on("keyup", handler);
|
|
285
|
+
}
|
|
286
|
+
function keypress(handler) {
|
|
287
|
+
return this.on("keypress", handler);
|
|
288
|
+
}
|
|
289
|
+
function pressedKey(targetKey, handler) {
|
|
290
|
+
return this.on("keydown", (e) => {
|
|
291
|
+
const event = e;
|
|
292
|
+
if (event.key.toLowerCase() === targetKey.toLowerCase()) {
|
|
293
|
+
handler(event);
|
|
294
|
+
}
|
|
295
|
+
});
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
// src/modules/events/form.ts
|
|
299
|
+
var form_exports = {};
|
|
300
|
+
__export(form_exports, {
|
|
301
|
+
blur: () => blur,
|
|
302
|
+
change: () => change,
|
|
303
|
+
focus: () => focus,
|
|
304
|
+
input: () => input,
|
|
305
|
+
submit: () => submit
|
|
306
|
+
});
|
|
307
|
+
function submit(handler) {
|
|
308
|
+
return this.on("submit", handler);
|
|
309
|
+
}
|
|
310
|
+
function change(handler) {
|
|
311
|
+
return this.on("change", handler);
|
|
312
|
+
}
|
|
313
|
+
function input(handler) {
|
|
314
|
+
return this.on("input", handler);
|
|
315
|
+
}
|
|
316
|
+
function focus(handler) {
|
|
317
|
+
if (handler) {
|
|
318
|
+
return this.on("focus", handler);
|
|
319
|
+
} else {
|
|
320
|
+
this.forEach((el) => {
|
|
321
|
+
if (el instanceof HTMLElement) el.focus();
|
|
322
|
+
});
|
|
323
|
+
return this;
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
function blur(handler) {
|
|
327
|
+
if (handler) {
|
|
328
|
+
return this.on("blur", handler);
|
|
329
|
+
} else {
|
|
330
|
+
this.forEach((el) => {
|
|
331
|
+
if (el instanceof HTMLElement) el.blur();
|
|
332
|
+
});
|
|
333
|
+
return this;
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
// src/modules/events/touch.ts
|
|
338
|
+
var touch_exports = {};
|
|
339
|
+
__export(touch_exports, {
|
|
340
|
+
touchcancel: () => touchcancel,
|
|
341
|
+
touchend: () => touchend,
|
|
342
|
+
touchmove: () => touchmove,
|
|
343
|
+
touchstart: () => touchstart
|
|
344
|
+
});
|
|
345
|
+
function touchstart(handler) {
|
|
346
|
+
return this.on("touchstart", handler);
|
|
347
|
+
}
|
|
348
|
+
function touchend(handler) {
|
|
349
|
+
return this.on("touchend", handler);
|
|
350
|
+
}
|
|
351
|
+
function touchmove(handler) {
|
|
352
|
+
return this.on("touchmove", handler);
|
|
353
|
+
}
|
|
354
|
+
function touchcancel(handler) {
|
|
355
|
+
return this.on("touchcancel", handler);
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
// src/modules/events/index.ts
|
|
359
|
+
var eventMethods = {
|
|
360
|
+
...binding_exports,
|
|
361
|
+
...mouse_exports,
|
|
362
|
+
...lifecycle_exports,
|
|
363
|
+
...keyboard_exports,
|
|
364
|
+
...form_exports,
|
|
365
|
+
...touch_exports
|
|
366
|
+
};
|
|
367
|
+
|
|
368
|
+
// src/modules/dom/attributes.ts
|
|
369
|
+
var attributes_exports = {};
|
|
370
|
+
__export(attributes_exports, {
|
|
371
|
+
attr: () => attr,
|
|
372
|
+
val: () => val
|
|
373
|
+
});
|
|
374
|
+
function attr(name, value) {
|
|
375
|
+
if (value === void 0) {
|
|
376
|
+
const el = this[0];
|
|
377
|
+
return el instanceof Element ? el.getAttribute(name) : null;
|
|
378
|
+
}
|
|
379
|
+
this.forEach((el) => {
|
|
380
|
+
if (el instanceof Element) el.setAttribute(name, value);
|
|
381
|
+
});
|
|
382
|
+
return this;
|
|
383
|
+
}
|
|
384
|
+
function val(value) {
|
|
385
|
+
if (value === void 0) {
|
|
386
|
+
const el = this[0];
|
|
387
|
+
if (el instanceof HTMLInputElement || el instanceof HTMLTextAreaElement || el instanceof HTMLSelectElement) {
|
|
388
|
+
return el.value;
|
|
389
|
+
}
|
|
390
|
+
return "";
|
|
391
|
+
}
|
|
392
|
+
this.forEach((el) => {
|
|
393
|
+
if (el instanceof HTMLInputElement || el instanceof HTMLTextAreaElement || el instanceof HTMLSelectElement) {
|
|
394
|
+
el.value = value;
|
|
395
|
+
}
|
|
396
|
+
});
|
|
397
|
+
return this;
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
// src/modules/dom/content.ts
|
|
401
|
+
var content_exports = {};
|
|
402
|
+
__export(content_exports, {
|
|
403
|
+
html: () => html,
|
|
404
|
+
text: () => text
|
|
405
|
+
});
|
|
406
|
+
function html(content) {
|
|
407
|
+
if (content === void 0) {
|
|
408
|
+
const el = this[0];
|
|
409
|
+
return el instanceof Element ? el.innerHTML : "";
|
|
410
|
+
}
|
|
411
|
+
this.forEach((el) => {
|
|
412
|
+
if (el instanceof Element) el.innerHTML = content;
|
|
413
|
+
});
|
|
414
|
+
return this;
|
|
415
|
+
}
|
|
416
|
+
function text(content) {
|
|
417
|
+
if (content === void 0) {
|
|
418
|
+
const el = this[0];
|
|
419
|
+
return el instanceof Node ? el.textContent || "" : "";
|
|
420
|
+
}
|
|
421
|
+
this.forEach((el) => {
|
|
422
|
+
if (el instanceof HTMLElement) {
|
|
423
|
+
el.textContent = content;
|
|
424
|
+
}
|
|
425
|
+
});
|
|
426
|
+
return this;
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
// src/modules/dom/manipulation.ts
|
|
430
|
+
var manipulation_exports = {};
|
|
431
|
+
__export(manipulation_exports, {
|
|
432
|
+
after: () => after,
|
|
433
|
+
append: () => append,
|
|
434
|
+
appendTo: () => appendTo,
|
|
435
|
+
before: () => before,
|
|
436
|
+
empty: () => empty,
|
|
437
|
+
insertAfter: () => insertAfter,
|
|
438
|
+
insertBefore: () => insertBefore,
|
|
439
|
+
prepend: () => prepend,
|
|
440
|
+
prependTo: () => prependTo,
|
|
441
|
+
remove: () => remove,
|
|
442
|
+
replaceWith: () => replaceWith,
|
|
443
|
+
replaceWithClone: () => replaceWithClone,
|
|
444
|
+
unwrap: () => unwrap,
|
|
445
|
+
wrap: () => wrap
|
|
446
|
+
});
|
|
447
|
+
function parseHTML(html2, doc) {
|
|
448
|
+
const tmp = doc.createElement("div");
|
|
449
|
+
tmp.innerHTML = html2.trim();
|
|
450
|
+
return tmp.firstElementChild;
|
|
451
|
+
}
|
|
452
|
+
function getDoc(collection) {
|
|
453
|
+
if (collection.length > 0 && collection[0] instanceof Element) {
|
|
454
|
+
return collection[0].ownerDocument;
|
|
455
|
+
}
|
|
456
|
+
return typeof document !== "undefined" ? document : null;
|
|
457
|
+
}
|
|
458
|
+
function normalizeToFragment(content, doc) {
|
|
459
|
+
const fragment = doc.createDocumentFragment();
|
|
460
|
+
const add2 = (item) => {
|
|
461
|
+
if (typeof item === "string") {
|
|
462
|
+
const temp = doc.createElement("div");
|
|
463
|
+
temp.innerHTML = item.trim();
|
|
464
|
+
while (temp.firstChild) {
|
|
465
|
+
fragment.appendChild(temp.firstChild);
|
|
466
|
+
}
|
|
467
|
+
} else if (item instanceof Node) {
|
|
468
|
+
fragment.appendChild(item);
|
|
469
|
+
} else if (item instanceof jBase || Array.isArray(item) || item instanceof NodeList) {
|
|
470
|
+
Array.from(item).forEach((child) => add2(child));
|
|
471
|
+
}
|
|
472
|
+
};
|
|
473
|
+
add2(content);
|
|
474
|
+
return fragment;
|
|
475
|
+
}
|
|
476
|
+
function remove() {
|
|
477
|
+
this.forEach((el) => {
|
|
478
|
+
if (el instanceof Element) el.remove();
|
|
479
|
+
});
|
|
480
|
+
return this;
|
|
481
|
+
}
|
|
482
|
+
function empty() {
|
|
483
|
+
this.forEach((el) => {
|
|
484
|
+
if (el instanceof Element) el.innerHTML = "";
|
|
485
|
+
});
|
|
486
|
+
return this;
|
|
487
|
+
}
|
|
488
|
+
function replaceWithClone() {
|
|
489
|
+
const newElements = [];
|
|
490
|
+
this.forEach((el) => {
|
|
491
|
+
if (el instanceof Element) {
|
|
492
|
+
const clone = el.cloneNode(true);
|
|
493
|
+
el.replaceWith(clone);
|
|
494
|
+
newElements.push(clone);
|
|
495
|
+
}
|
|
496
|
+
});
|
|
497
|
+
return new this.constructor(newElements);
|
|
498
|
+
}
|
|
499
|
+
function append(content) {
|
|
500
|
+
if (typeof content === "string") {
|
|
501
|
+
this.forEach((el) => {
|
|
502
|
+
if (el instanceof Element) {
|
|
503
|
+
el.insertAdjacentHTML("beforeend", content);
|
|
504
|
+
}
|
|
505
|
+
});
|
|
506
|
+
return this;
|
|
507
|
+
}
|
|
508
|
+
const doc = getDoc(this);
|
|
509
|
+
if (!doc)
|
|
510
|
+
return this;
|
|
511
|
+
const fragment = normalizeToFragment(content, doc);
|
|
512
|
+
this.forEach((el, i) => {
|
|
513
|
+
if (el instanceof Element) {
|
|
514
|
+
const contentToInsert = i < this.length - 1 ? fragment.cloneNode(true) : fragment;
|
|
515
|
+
el.appendChild(contentToInsert);
|
|
516
|
+
}
|
|
517
|
+
});
|
|
518
|
+
return this;
|
|
519
|
+
}
|
|
520
|
+
function prepend(content) {
|
|
521
|
+
if (typeof content === "string") {
|
|
522
|
+
this.forEach((el) => {
|
|
523
|
+
if (el instanceof Element) {
|
|
524
|
+
el.insertAdjacentHTML("afterbegin", content);
|
|
525
|
+
}
|
|
526
|
+
});
|
|
527
|
+
return this;
|
|
528
|
+
}
|
|
529
|
+
const doc = getDoc(this);
|
|
530
|
+
if (!doc)
|
|
531
|
+
return this;
|
|
532
|
+
const fragment = normalizeToFragment(content, doc);
|
|
533
|
+
this.forEach((el, i) => {
|
|
534
|
+
if (el instanceof Element) {
|
|
535
|
+
const contentToInsert = i < this.length - 1 ? fragment.cloneNode(true) : fragment;
|
|
536
|
+
el.prepend(contentToInsert);
|
|
537
|
+
}
|
|
538
|
+
});
|
|
539
|
+
return this;
|
|
540
|
+
}
|
|
541
|
+
function before(content) {
|
|
542
|
+
if (typeof content === "string") {
|
|
543
|
+
this.forEach((el) => {
|
|
544
|
+
if (el instanceof Element) {
|
|
545
|
+
el.insertAdjacentHTML("beforebegin", content);
|
|
546
|
+
}
|
|
547
|
+
});
|
|
548
|
+
return this;
|
|
549
|
+
}
|
|
550
|
+
const doc = getDoc(this);
|
|
551
|
+
if (!doc)
|
|
552
|
+
return this;
|
|
553
|
+
const fragment = normalizeToFragment(content, doc);
|
|
554
|
+
this.forEach((el, i) => {
|
|
555
|
+
if (el instanceof Element) {
|
|
556
|
+
const contentToInsert = i < this.length - 1 ? fragment.cloneNode(true) : fragment;
|
|
557
|
+
el.before(contentToInsert);
|
|
558
|
+
}
|
|
559
|
+
});
|
|
560
|
+
return this;
|
|
561
|
+
}
|
|
562
|
+
function after(content) {
|
|
563
|
+
if (typeof content === "string") {
|
|
564
|
+
this.forEach((el) => {
|
|
565
|
+
if (el instanceof Element) {
|
|
566
|
+
el.insertAdjacentHTML("afterend", content);
|
|
567
|
+
}
|
|
568
|
+
});
|
|
569
|
+
return this;
|
|
570
|
+
}
|
|
571
|
+
const doc = getDoc(this);
|
|
572
|
+
if (!doc)
|
|
573
|
+
return this;
|
|
574
|
+
const fragment = normalizeToFragment(content, doc);
|
|
575
|
+
this.forEach((el, i) => {
|
|
576
|
+
if (el instanceof Element) {
|
|
577
|
+
const contentToInsert = i < this.length - 1 ? fragment.cloneNode(true) : fragment;
|
|
578
|
+
el.after(contentToInsert);
|
|
579
|
+
}
|
|
580
|
+
});
|
|
581
|
+
return this;
|
|
582
|
+
}
|
|
583
|
+
function replaceWith(content) {
|
|
584
|
+
const doc = getDoc(this);
|
|
585
|
+
if (!doc)
|
|
586
|
+
return this;
|
|
587
|
+
const fragment = normalizeToFragment(content, doc);
|
|
588
|
+
this.forEach((el, i) => {
|
|
589
|
+
if (el instanceof Element) {
|
|
590
|
+
const contentToInsert = i < this.length - 1 ? fragment.cloneNode(true) : fragment;
|
|
591
|
+
el.replaceWith(contentToInsert);
|
|
592
|
+
}
|
|
593
|
+
});
|
|
594
|
+
return this;
|
|
595
|
+
}
|
|
596
|
+
function appendTo(target) {
|
|
597
|
+
const doc = getDoc(this);
|
|
598
|
+
if (!doc)
|
|
599
|
+
return this;
|
|
600
|
+
const parent2 = typeof target === "string" ? doc.querySelector(target) : target;
|
|
601
|
+
if (parent2 instanceof Element) {
|
|
602
|
+
const fragment = doc.createDocumentFragment();
|
|
603
|
+
this.forEach((el) => {
|
|
604
|
+
if (el instanceof Node) fragment.appendChild(el);
|
|
605
|
+
});
|
|
606
|
+
parent2.appendChild(fragment);
|
|
607
|
+
}
|
|
608
|
+
return this;
|
|
609
|
+
}
|
|
610
|
+
function prependTo(target) {
|
|
611
|
+
const doc = getDoc(this);
|
|
612
|
+
if (!doc)
|
|
613
|
+
return this;
|
|
614
|
+
const parent2 = typeof target === "string" ? doc.querySelector(target) : target;
|
|
615
|
+
if (parent2 instanceof Element) {
|
|
616
|
+
const fragment = doc.createDocumentFragment();
|
|
617
|
+
this.forEach((el) => {
|
|
618
|
+
if (el instanceof Node) fragment.appendChild(el);
|
|
619
|
+
});
|
|
620
|
+
parent2.prepend(fragment);
|
|
621
|
+
}
|
|
622
|
+
return this;
|
|
623
|
+
}
|
|
624
|
+
function insertBefore(target) {
|
|
625
|
+
const doc = getDoc(this);
|
|
626
|
+
if (!doc)
|
|
627
|
+
return this;
|
|
628
|
+
const targetEl = typeof target === "string" ? doc.querySelector(target) : target;
|
|
629
|
+
if (targetEl instanceof Element) {
|
|
630
|
+
const fragment = doc.createDocumentFragment();
|
|
631
|
+
this.forEach((el) => {
|
|
632
|
+
if (el instanceof Node) fragment.appendChild(el);
|
|
633
|
+
});
|
|
634
|
+
targetEl.before(fragment);
|
|
635
|
+
}
|
|
636
|
+
return this;
|
|
637
|
+
}
|
|
638
|
+
function insertAfter(target) {
|
|
639
|
+
const doc = getDoc(this);
|
|
640
|
+
if (!doc)
|
|
641
|
+
return this;
|
|
642
|
+
const targetEl = typeof target === "string" ? doc.querySelector(target) : target;
|
|
643
|
+
if (targetEl instanceof Element) {
|
|
644
|
+
const fragment = doc.createDocumentFragment();
|
|
645
|
+
this.forEach((el) => {
|
|
646
|
+
if (el instanceof Node) fragment.appendChild(el);
|
|
647
|
+
});
|
|
648
|
+
targetEl.after(fragment);
|
|
649
|
+
}
|
|
650
|
+
return this;
|
|
651
|
+
}
|
|
652
|
+
function wrap(wrapperHtml) {
|
|
653
|
+
const doc = getDoc(this);
|
|
654
|
+
if (!doc)
|
|
655
|
+
return this;
|
|
656
|
+
this.forEach((el) => {
|
|
657
|
+
if (el instanceof Element) {
|
|
658
|
+
const wrapper = parseHTML(wrapperHtml, doc);
|
|
659
|
+
if (el.parentNode) {
|
|
660
|
+
el.parentNode.insertBefore(wrapper, el);
|
|
661
|
+
}
|
|
662
|
+
wrapper.appendChild(el);
|
|
663
|
+
}
|
|
664
|
+
});
|
|
665
|
+
return this;
|
|
666
|
+
}
|
|
667
|
+
function unwrap() {
|
|
668
|
+
const doc = getDoc(this);
|
|
669
|
+
if (!doc)
|
|
670
|
+
return this;
|
|
671
|
+
const parents2 = /* @__PURE__ */ new Set();
|
|
672
|
+
this.forEach((el) => {
|
|
673
|
+
if (el instanceof Element && el.parentElement) {
|
|
674
|
+
parents2.add(el.parentElement);
|
|
675
|
+
}
|
|
676
|
+
});
|
|
677
|
+
parents2.forEach((parent2) => {
|
|
678
|
+
const fragment = doc.createDocumentFragment();
|
|
679
|
+
while (parent2.firstChild) {
|
|
680
|
+
fragment.appendChild(parent2.firstChild);
|
|
681
|
+
}
|
|
682
|
+
parent2.replaceWith(fragment);
|
|
683
|
+
});
|
|
684
|
+
return this;
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
// src/modules/dom/traversal.ts
|
|
688
|
+
var traversal_exports = {};
|
|
689
|
+
__export(traversal_exports, {
|
|
690
|
+
children: () => children,
|
|
691
|
+
closest: () => closest,
|
|
692
|
+
descendants: () => descendants,
|
|
693
|
+
descendantsUntil: () => descendantsUntil,
|
|
694
|
+
eq: () => eq,
|
|
695
|
+
filterBy: () => filterBy,
|
|
696
|
+
findAll: () => findAll,
|
|
697
|
+
first: () => first,
|
|
698
|
+
last: () => last,
|
|
699
|
+
next: () => next,
|
|
700
|
+
nextAll: () => nextAll,
|
|
701
|
+
nextSibling: () => nextSibling,
|
|
702
|
+
nextUntil: () => nextUntil,
|
|
703
|
+
not: () => not,
|
|
704
|
+
parent: () => parent,
|
|
705
|
+
parents: () => parents,
|
|
706
|
+
parentsUntil: () => parentsUntil,
|
|
707
|
+
prev: () => prev,
|
|
708
|
+
prevAll: () => prevAll,
|
|
709
|
+
prevSibling: () => prevSibling,
|
|
710
|
+
prevUntil: () => prevUntil,
|
|
711
|
+
sibling: () => sibling,
|
|
712
|
+
siblings: () => siblings
|
|
713
|
+
});
|
|
714
|
+
function closest(selector) {
|
|
715
|
+
const found = [];
|
|
716
|
+
this.forEach((el) => {
|
|
717
|
+
if (el instanceof Element) {
|
|
718
|
+
const match = el.closest(selector);
|
|
719
|
+
if (match) {
|
|
720
|
+
found.push(match);
|
|
721
|
+
}
|
|
722
|
+
}
|
|
723
|
+
});
|
|
724
|
+
const Construction = this.constructor;
|
|
725
|
+
return new Construction([...new Set(found)]);
|
|
726
|
+
}
|
|
727
|
+
function parent() {
|
|
728
|
+
const parents2 = [];
|
|
729
|
+
this.forEach((el) => {
|
|
730
|
+
if (el instanceof Element && el.parentElement) {
|
|
731
|
+
parents2.push(el.parentElement);
|
|
732
|
+
}
|
|
733
|
+
});
|
|
734
|
+
const Construction = this.constructor;
|
|
735
|
+
return new Construction([...new Set(parents2)]);
|
|
736
|
+
}
|
|
737
|
+
function children(selector) {
|
|
738
|
+
let allChildren = [];
|
|
739
|
+
this.forEach((el) => {
|
|
740
|
+
if (el instanceof Element) {
|
|
741
|
+
const kids = Array.from(el.children);
|
|
742
|
+
allChildren = allChildren.concat(kids);
|
|
743
|
+
}
|
|
744
|
+
});
|
|
745
|
+
if (selector) {
|
|
746
|
+
allChildren = allChildren.filter((child) => child.matches(selector));
|
|
747
|
+
}
|
|
748
|
+
const Construction = this.constructor;
|
|
749
|
+
return new Construction(allChildren);
|
|
750
|
+
}
|
|
751
|
+
function findAll(selector) {
|
|
752
|
+
const found = [];
|
|
753
|
+
this.forEach((el) => {
|
|
754
|
+
if (el instanceof Element || el instanceof Document) {
|
|
755
|
+
const matches = el.querySelectorAll(selector);
|
|
756
|
+
matches.forEach((m) => found.push(m));
|
|
757
|
+
}
|
|
758
|
+
});
|
|
759
|
+
const Construction = this.constructor;
|
|
760
|
+
return new Construction([...new Set(found)]);
|
|
761
|
+
}
|
|
762
|
+
function descendants() {
|
|
763
|
+
return this.findAll("*");
|
|
764
|
+
}
|
|
765
|
+
function parents(selector) {
|
|
766
|
+
const ancestors = [];
|
|
767
|
+
this.forEach((el) => {
|
|
768
|
+
if (el instanceof Element) {
|
|
769
|
+
let curr = el.parentElement;
|
|
770
|
+
while (curr) {
|
|
771
|
+
if (!selector || curr.matches(selector)) {
|
|
772
|
+
ancestors.push(curr);
|
|
773
|
+
}
|
|
774
|
+
curr = curr.parentElement;
|
|
775
|
+
}
|
|
776
|
+
}
|
|
777
|
+
});
|
|
778
|
+
const Construction = this.constructor;
|
|
779
|
+
return new Construction([...new Set(ancestors)]);
|
|
780
|
+
}
|
|
781
|
+
function parentsUntil(selector, filter) {
|
|
782
|
+
const ancestors = [];
|
|
783
|
+
this.forEach((el) => {
|
|
784
|
+
if (el instanceof Element) {
|
|
785
|
+
let curr = el.parentElement;
|
|
786
|
+
while (curr && !curr.matches(selector)) {
|
|
787
|
+
if (!filter || curr.matches(filter)) {
|
|
788
|
+
ancestors.push(curr);
|
|
789
|
+
}
|
|
790
|
+
curr = curr.parentElement;
|
|
791
|
+
}
|
|
792
|
+
}
|
|
793
|
+
});
|
|
794
|
+
const Construction = this.constructor;
|
|
795
|
+
return new Construction([...new Set(ancestors)]);
|
|
796
|
+
}
|
|
797
|
+
function descendantsUntil(untilSelector, filter) {
|
|
798
|
+
const found = [];
|
|
799
|
+
const traverse = (parent2) => {
|
|
800
|
+
const kids = parent2.children;
|
|
801
|
+
for (let i = 0; i < kids.length; i++) {
|
|
802
|
+
const child = kids[i];
|
|
803
|
+
if (child.matches(untilSelector)) {
|
|
804
|
+
continue;
|
|
805
|
+
}
|
|
806
|
+
if (!filter || child.matches(filter)) {
|
|
807
|
+
found.push(child);
|
|
808
|
+
}
|
|
809
|
+
traverse(child);
|
|
810
|
+
}
|
|
811
|
+
};
|
|
812
|
+
this.forEach((el) => {
|
|
813
|
+
if (el instanceof Element) traverse(el);
|
|
814
|
+
});
|
|
815
|
+
const Construction = this.constructor;
|
|
816
|
+
return new Construction([...new Set(found)]);
|
|
817
|
+
}
|
|
818
|
+
function next(selector) {
|
|
819
|
+
const found = [];
|
|
820
|
+
this.forEach((el) => {
|
|
821
|
+
if (el instanceof Element && el.nextElementSibling) {
|
|
822
|
+
const nextEl = el.nextElementSibling;
|
|
823
|
+
if (!selector || nextEl.matches(selector)) {
|
|
824
|
+
found.push(nextEl);
|
|
825
|
+
}
|
|
826
|
+
}
|
|
827
|
+
});
|
|
828
|
+
const Construction = this.constructor;
|
|
829
|
+
return new Construction([...new Set(found)]);
|
|
830
|
+
}
|
|
831
|
+
function prev(selector) {
|
|
832
|
+
const found = [];
|
|
833
|
+
this.forEach((el) => {
|
|
834
|
+
if (el instanceof Element && el.previousElementSibling) {
|
|
835
|
+
const prevEl = el.previousElementSibling;
|
|
836
|
+
if (!selector || prevEl.matches(selector)) {
|
|
837
|
+
found.push(prevEl);
|
|
838
|
+
}
|
|
839
|
+
}
|
|
840
|
+
});
|
|
841
|
+
const Construction = this.constructor;
|
|
842
|
+
return new Construction([...new Set(found)]);
|
|
843
|
+
}
|
|
844
|
+
function nextSibling(selector) {
|
|
845
|
+
return this.next(selector);
|
|
846
|
+
}
|
|
847
|
+
function prevSibling(selector) {
|
|
848
|
+
return this.prev(selector);
|
|
849
|
+
}
|
|
850
|
+
function sibling(selector) {
|
|
851
|
+
return this.next(selector);
|
|
852
|
+
}
|
|
853
|
+
function nextAll(selector) {
|
|
854
|
+
const found = [];
|
|
855
|
+
this.forEach((el) => {
|
|
856
|
+
if (el instanceof Element) {
|
|
857
|
+
let curr = el.nextElementSibling;
|
|
858
|
+
while (curr) {
|
|
859
|
+
if (!selector || curr.matches(selector)) {
|
|
860
|
+
found.push(curr);
|
|
861
|
+
}
|
|
862
|
+
curr = curr.nextElementSibling;
|
|
863
|
+
}
|
|
864
|
+
}
|
|
865
|
+
});
|
|
866
|
+
const Construction = this.constructor;
|
|
867
|
+
return new Construction([...new Set(found)]);
|
|
868
|
+
}
|
|
869
|
+
function prevAll(selector) {
|
|
870
|
+
const found = [];
|
|
871
|
+
this.forEach((el) => {
|
|
872
|
+
if (el instanceof Element) {
|
|
873
|
+
let curr = el.previousElementSibling;
|
|
874
|
+
while (curr) {
|
|
875
|
+
if (!selector || curr.matches(selector)) {
|
|
876
|
+
found.push(curr);
|
|
877
|
+
}
|
|
878
|
+
curr = curr.previousElementSibling;
|
|
879
|
+
}
|
|
880
|
+
}
|
|
881
|
+
});
|
|
882
|
+
const Construction = this.constructor;
|
|
883
|
+
return new Construction([...new Set(found)]);
|
|
884
|
+
}
|
|
885
|
+
function siblings(selector) {
|
|
886
|
+
const found = [];
|
|
887
|
+
this.forEach((el) => {
|
|
888
|
+
if (el instanceof Element && el.parentElement) {
|
|
889
|
+
const children2 = Array.from(el.parentElement.children);
|
|
890
|
+
children2.forEach((child) => {
|
|
891
|
+
if (child !== el) {
|
|
892
|
+
if (!selector || child.matches(selector)) {
|
|
893
|
+
found.push(child);
|
|
894
|
+
}
|
|
895
|
+
}
|
|
896
|
+
});
|
|
897
|
+
}
|
|
898
|
+
});
|
|
899
|
+
const Construction = this.constructor;
|
|
900
|
+
return new Construction([...new Set(found)]);
|
|
901
|
+
}
|
|
902
|
+
function nextUntil(untilSelector, filter) {
|
|
903
|
+
const found = [];
|
|
904
|
+
this.forEach((el) => {
|
|
905
|
+
if (el instanceof Element) {
|
|
906
|
+
let curr = el.nextElementSibling;
|
|
907
|
+
while (curr && !curr.matches(untilSelector)) {
|
|
908
|
+
if (!filter || curr.matches(filter)) {
|
|
909
|
+
found.push(curr);
|
|
910
|
+
}
|
|
911
|
+
curr = curr.nextElementSibling;
|
|
912
|
+
}
|
|
913
|
+
}
|
|
914
|
+
});
|
|
915
|
+
const Construction = this.constructor;
|
|
916
|
+
return new Construction([...new Set(found)]);
|
|
917
|
+
}
|
|
918
|
+
function prevUntil(untilSelector, filter) {
|
|
919
|
+
const found = [];
|
|
920
|
+
this.forEach((el) => {
|
|
921
|
+
if (el instanceof Element) {
|
|
922
|
+
let curr = el.previousElementSibling;
|
|
923
|
+
while (curr && !curr.matches(untilSelector)) {
|
|
924
|
+
if (!filter || curr.matches(filter)) {
|
|
925
|
+
found.push(curr);
|
|
926
|
+
}
|
|
927
|
+
curr = curr.previousElementSibling;
|
|
928
|
+
}
|
|
929
|
+
}
|
|
930
|
+
});
|
|
931
|
+
const Construction = this.constructor;
|
|
932
|
+
return new Construction([...new Set(found)]);
|
|
933
|
+
}
|
|
934
|
+
function eq(index) {
|
|
935
|
+
const len = this.length;
|
|
936
|
+
const idx = index < 0 ? len + index : index;
|
|
937
|
+
const el = this[idx];
|
|
938
|
+
const Construction = this.constructor;
|
|
939
|
+
return new Construction(el ? [el] : []);
|
|
940
|
+
}
|
|
941
|
+
function first() {
|
|
942
|
+
return this.eq(0);
|
|
943
|
+
}
|
|
944
|
+
function last() {
|
|
945
|
+
return this.eq(-1);
|
|
946
|
+
}
|
|
947
|
+
function filterBy(selectorOrFn) {
|
|
948
|
+
const found = [];
|
|
949
|
+
this.forEach((el, index) => {
|
|
950
|
+
if (el instanceof Element) {
|
|
951
|
+
if (typeof selectorOrFn === "string") {
|
|
952
|
+
if (el.matches(selectorOrFn)) {
|
|
953
|
+
found.push(el);
|
|
954
|
+
}
|
|
955
|
+
} else if (typeof selectorOrFn === "function") {
|
|
956
|
+
if (selectorOrFn.call(el, index, el)) {
|
|
957
|
+
found.push(el);
|
|
958
|
+
}
|
|
959
|
+
}
|
|
960
|
+
}
|
|
961
|
+
});
|
|
962
|
+
const Construction = this.constructor;
|
|
963
|
+
return new Construction(found);
|
|
964
|
+
}
|
|
965
|
+
function not(selectorOrFn) {
|
|
966
|
+
const found = [];
|
|
967
|
+
this.forEach((el, index) => {
|
|
968
|
+
if (el instanceof Element) {
|
|
969
|
+
if (typeof selectorOrFn === "string") {
|
|
970
|
+
if (!el.matches(selectorOrFn)) {
|
|
971
|
+
found.push(el);
|
|
972
|
+
}
|
|
973
|
+
} else if (typeof selectorOrFn === "function") {
|
|
974
|
+
if (!selectorOrFn.call(el, index, el)) {
|
|
975
|
+
found.push(el);
|
|
976
|
+
}
|
|
977
|
+
}
|
|
978
|
+
}
|
|
979
|
+
});
|
|
980
|
+
const Construction = this.constructor;
|
|
981
|
+
return new Construction(found);
|
|
982
|
+
}
|
|
983
|
+
|
|
984
|
+
// src/modules/dom/states.ts
|
|
985
|
+
var states_exports = {};
|
|
986
|
+
__export(states_exports, {
|
|
987
|
+
checked: () => checked,
|
|
988
|
+
disabled: () => disabled,
|
|
989
|
+
selected: () => selected
|
|
990
|
+
});
|
|
991
|
+
function checked(state) {
|
|
992
|
+
if (state === void 0) {
|
|
993
|
+
const el = this[0];
|
|
994
|
+
return el instanceof HTMLInputElement ? el.checked : false;
|
|
995
|
+
}
|
|
996
|
+
this.forEach((el) => {
|
|
997
|
+
if (el instanceof HTMLInputElement)
|
|
998
|
+
el.checked = state;
|
|
999
|
+
});
|
|
1000
|
+
return this;
|
|
1001
|
+
}
|
|
1002
|
+
function selected(state) {
|
|
1003
|
+
if (state === void 0) {
|
|
1004
|
+
const el = this[0];
|
|
1005
|
+
return el instanceof HTMLOptionElement ? el.selected : false;
|
|
1006
|
+
}
|
|
1007
|
+
this.forEach((el) => {
|
|
1008
|
+
if (el instanceof HTMLOptionElement)
|
|
1009
|
+
el.selected = state;
|
|
1010
|
+
});
|
|
1011
|
+
return this;
|
|
1012
|
+
}
|
|
1013
|
+
function disabled(state) {
|
|
1014
|
+
if (state === void 0) {
|
|
1015
|
+
const el = this[0];
|
|
1016
|
+
return el instanceof HTMLElement && "disabled" in el ? el.disabled : false;
|
|
1017
|
+
}
|
|
1018
|
+
this.forEach((el) => {
|
|
1019
|
+
if (el instanceof HTMLElement && "disabled" in el) {
|
|
1020
|
+
el.disabled = state;
|
|
1021
|
+
if (state)
|
|
1022
|
+
el.classList.add("disabled");
|
|
1023
|
+
else
|
|
1024
|
+
el.classList.remove("disabled");
|
|
1025
|
+
}
|
|
1026
|
+
});
|
|
1027
|
+
return this;
|
|
1028
|
+
}
|
|
1029
|
+
|
|
1030
|
+
// src/modules/dom/index.ts
|
|
1031
|
+
var domMethods = {
|
|
1032
|
+
...attributes_exports,
|
|
1033
|
+
...content_exports,
|
|
1034
|
+
...manipulation_exports,
|
|
1035
|
+
...traversal_exports,
|
|
1036
|
+
...states_exports
|
|
1037
|
+
};
|
|
1038
|
+
|
|
1039
|
+
// src/modules/effects/slide.ts
|
|
1040
|
+
var slide_exports = {};
|
|
1041
|
+
__export(slide_exports, {
|
|
1042
|
+
slideIn: () => slideIn,
|
|
1043
|
+
slideOut: () => slideOut,
|
|
1044
|
+
slideToggle: () => slideToggle
|
|
1045
|
+
});
|
|
1046
|
+
|
|
1047
|
+
// src/utils.ts
|
|
1048
|
+
function isBrowser() {
|
|
1049
|
+
return typeof window !== "undefined" && typeof window.requestAnimationFrame !== "undefined";
|
|
1050
|
+
}
|
|
1051
|
+
|
|
1052
|
+
// src/modules/effects/slide.ts
|
|
1053
|
+
function slideIn(options = {}) {
|
|
1054
|
+
if (!isBrowser())
|
|
1055
|
+
return this;
|
|
1056
|
+
const { duration = 300 } = options;
|
|
1057
|
+
this.forEach((el) => {
|
|
1058
|
+
if (el instanceof HTMLElement) {
|
|
1059
|
+
el.style.willChange = "transform";
|
|
1060
|
+
el.style.transition = `transform ${duration}ms cubic-bezier(0.4, 0.0, 0.2, 1)`;
|
|
1061
|
+
requestAnimationFrame(() => {
|
|
1062
|
+
el.style.transform = "translateX(0%)";
|
|
1063
|
+
});
|
|
1064
|
+
el.setAttribute("data-slide-state", "open");
|
|
1065
|
+
}
|
|
1066
|
+
});
|
|
1067
|
+
return this;
|
|
1068
|
+
}
|
|
1069
|
+
function slideOut(options = {}) {
|
|
1070
|
+
if (!isBrowser())
|
|
1071
|
+
return this;
|
|
1072
|
+
const { direction = "left", duration = 300 } = options;
|
|
1073
|
+
const translateValue = direction === "left" ? "-100%" : "100%";
|
|
1074
|
+
this.forEach((el) => {
|
|
1075
|
+
if (el instanceof HTMLElement) {
|
|
1076
|
+
el.style.willChange = "transform";
|
|
1077
|
+
el.style.transition = `transform ${duration}ms cubic-bezier(0.4, 0.0, 0.2, 1)`;
|
|
1078
|
+
requestAnimationFrame(() => {
|
|
1079
|
+
el.style.transform = `translateX(${translateValue})`;
|
|
1080
|
+
});
|
|
1081
|
+
el.setAttribute("data-slide-state", "closed");
|
|
1082
|
+
}
|
|
1083
|
+
});
|
|
1084
|
+
return this;
|
|
1085
|
+
}
|
|
1086
|
+
function slideToggle(options = {}) {
|
|
1087
|
+
if (!isBrowser())
|
|
1088
|
+
return this;
|
|
1089
|
+
this.forEach((el) => {
|
|
1090
|
+
if (el instanceof HTMLElement) {
|
|
1091
|
+
const state = el.getAttribute("data-slide-state");
|
|
1092
|
+
const currentTransform = el.style.transform;
|
|
1093
|
+
if (state === "open" || currentTransform === "translateX(0%)") {
|
|
1094
|
+
const wrapper = new this.constructor(el);
|
|
1095
|
+
wrapper.slideOut(options);
|
|
1096
|
+
} else {
|
|
1097
|
+
const wrapper = new this.constructor(el);
|
|
1098
|
+
wrapper.slideIn(options);
|
|
1099
|
+
}
|
|
1100
|
+
}
|
|
1101
|
+
});
|
|
1102
|
+
return this;
|
|
1103
|
+
}
|
|
1104
|
+
|
|
1105
|
+
// src/modules/effects/vertical.ts
|
|
1106
|
+
var vertical_exports = {};
|
|
1107
|
+
__export(vertical_exports, {
|
|
1108
|
+
slideDown: () => slideDown,
|
|
1109
|
+
slideToggleBox: () => slideToggleBox,
|
|
1110
|
+
slideUp: () => slideUp
|
|
1111
|
+
});
|
|
1112
|
+
function slideDown(options = {}) {
|
|
1113
|
+
if (!isBrowser())
|
|
1114
|
+
return this;
|
|
1115
|
+
const { duration = 300, displayType = "block" } = options;
|
|
1116
|
+
this.forEach((el) => {
|
|
1117
|
+
if (el instanceof HTMLElement) {
|
|
1118
|
+
if (window.getComputedStyle(el).display !== "none")
|
|
1119
|
+
return;
|
|
1120
|
+
el.style.display = displayType;
|
|
1121
|
+
const height = el.scrollHeight;
|
|
1122
|
+
el.style.height = "0px";
|
|
1123
|
+
el.style.overflow = "hidden";
|
|
1124
|
+
el.style.transition = `height ${duration}ms ease-in-out`;
|
|
1125
|
+
void el.offsetHeight;
|
|
1126
|
+
el.style.height = `${height}px`;
|
|
1127
|
+
setTimeout(() => {
|
|
1128
|
+
el.style.height = "auto";
|
|
1129
|
+
el.style.overflow = "visible";
|
|
1130
|
+
el.style.transition = "";
|
|
1131
|
+
}, duration);
|
|
1132
|
+
}
|
|
1133
|
+
});
|
|
1134
|
+
return this;
|
|
1135
|
+
}
|
|
1136
|
+
function slideUp(options = {}) {
|
|
1137
|
+
if (!isBrowser())
|
|
1138
|
+
return this;
|
|
1139
|
+
const { duration = 300 } = options;
|
|
1140
|
+
this.forEach((el) => {
|
|
1141
|
+
if (el instanceof HTMLElement) {
|
|
1142
|
+
el.style.height = `${el.scrollHeight}px`;
|
|
1143
|
+
el.style.overflow = "hidden";
|
|
1144
|
+
el.style.transition = `height ${duration}ms ease-in-out`;
|
|
1145
|
+
void el.offsetHeight;
|
|
1146
|
+
el.style.height = "0px";
|
|
1147
|
+
setTimeout(() => {
|
|
1148
|
+
el.style.display = "none";
|
|
1149
|
+
el.style.height = "";
|
|
1150
|
+
el.style.overflow = "";
|
|
1151
|
+
el.style.transition = "";
|
|
1152
|
+
}, duration);
|
|
1153
|
+
}
|
|
1154
|
+
});
|
|
1155
|
+
return this;
|
|
1156
|
+
}
|
|
1157
|
+
function slideToggleBox(options = {}) {
|
|
1158
|
+
if (!isBrowser())
|
|
1159
|
+
return this;
|
|
1160
|
+
this.forEach((el) => {
|
|
1161
|
+
if (el instanceof HTMLElement) {
|
|
1162
|
+
const display = window.getComputedStyle(el).display;
|
|
1163
|
+
const wrapper = new this.constructor(el);
|
|
1164
|
+
if (display === "none") {
|
|
1165
|
+
wrapper.slideDown(options);
|
|
1166
|
+
} else {
|
|
1167
|
+
wrapper.slideUp(options);
|
|
1168
|
+
}
|
|
1169
|
+
}
|
|
1170
|
+
});
|
|
1171
|
+
return this;
|
|
1172
|
+
}
|
|
1173
|
+
|
|
1174
|
+
// src/modules/effects/fade.ts
|
|
1175
|
+
var fade_exports = {};
|
|
1176
|
+
__export(fade_exports, {
|
|
1177
|
+
fadeIn: () => fadeIn,
|
|
1178
|
+
fadeOut: () => fadeOut,
|
|
1179
|
+
fadeToggle: () => fadeToggle
|
|
1180
|
+
});
|
|
1181
|
+
function fadeIn(options = {}) {
|
|
1182
|
+
if (!isBrowser())
|
|
1183
|
+
return this;
|
|
1184
|
+
const { duration = 300, displayType = "block" } = options;
|
|
1185
|
+
this.forEach((el) => {
|
|
1186
|
+
if (el instanceof HTMLElement) {
|
|
1187
|
+
el.style.opacity = "0";
|
|
1188
|
+
el.style.display = displayType;
|
|
1189
|
+
el.style.transition = `opacity ${duration}ms ease-in-out`;
|
|
1190
|
+
void el.offsetHeight;
|
|
1191
|
+
requestAnimationFrame(() => {
|
|
1192
|
+
el.style.opacity = "1";
|
|
1193
|
+
});
|
|
1194
|
+
setTimeout(() => {
|
|
1195
|
+
el.style.transition = "";
|
|
1196
|
+
}, duration);
|
|
1197
|
+
}
|
|
1198
|
+
});
|
|
1199
|
+
return this;
|
|
1200
|
+
}
|
|
1201
|
+
function fadeOut(options = {}) {
|
|
1202
|
+
if (!isBrowser())
|
|
1203
|
+
return this;
|
|
1204
|
+
const { duration = 300 } = options;
|
|
1205
|
+
this.forEach((el) => {
|
|
1206
|
+
if (el instanceof HTMLElement) {
|
|
1207
|
+
el.style.opacity = "1";
|
|
1208
|
+
el.style.transition = `opacity ${duration}ms ease-in-out`;
|
|
1209
|
+
void el.offsetHeight;
|
|
1210
|
+
requestAnimationFrame(() => {
|
|
1211
|
+
el.style.opacity = "0";
|
|
1212
|
+
});
|
|
1213
|
+
setTimeout(() => {
|
|
1214
|
+
el.style.display = "none";
|
|
1215
|
+
el.style.transition = "";
|
|
1216
|
+
}, duration);
|
|
1217
|
+
}
|
|
1218
|
+
});
|
|
1219
|
+
return this;
|
|
1220
|
+
}
|
|
1221
|
+
function fadeToggle(options = {}) {
|
|
1222
|
+
if (!isBrowser())
|
|
1223
|
+
return this;
|
|
1224
|
+
this.forEach((el) => {
|
|
1225
|
+
if (el instanceof HTMLElement) {
|
|
1226
|
+
const display = window.getComputedStyle(el).display;
|
|
1227
|
+
const wrapper = new this.constructor(el);
|
|
1228
|
+
if (display === "none") {
|
|
1229
|
+
wrapper.fadeIn(options);
|
|
1230
|
+
} else {
|
|
1231
|
+
wrapper.fadeOut(options);
|
|
1232
|
+
}
|
|
1233
|
+
}
|
|
1234
|
+
});
|
|
1235
|
+
return this;
|
|
1236
|
+
}
|
|
1237
|
+
|
|
1238
|
+
// src/modules/effects/index.ts
|
|
1239
|
+
var effectMethods = {
|
|
1240
|
+
...slide_exports,
|
|
1241
|
+
...vertical_exports,
|
|
1242
|
+
...fade_exports
|
|
1243
|
+
};
|
|
1244
|
+
|
|
1245
|
+
// src/modules/http/get.ts
|
|
1246
|
+
var get_exports = {};
|
|
1247
|
+
__export(get_exports, {
|
|
1248
|
+
get: () => get,
|
|
1249
|
+
getText: () => getText
|
|
1250
|
+
});
|
|
1251
|
+
async function get(url, option) {
|
|
1252
|
+
const fetchOptions = { ...option };
|
|
1253
|
+
if (fetchOptions.method?.toLowerCase() === "post") {
|
|
1254
|
+
fetchOptions.method = "GET";
|
|
1255
|
+
}
|
|
1256
|
+
if (!fetchOptions.signal) {
|
|
1257
|
+
fetchOptions.signal = AbortSignal.timeout(5e3);
|
|
1258
|
+
}
|
|
1259
|
+
const response = await fetch(url, {
|
|
1260
|
+
...fetchOptions
|
|
1261
|
+
});
|
|
1262
|
+
if (!response.ok) {
|
|
1263
|
+
throw new Error(`HTTP Error: ${response.status}`);
|
|
1264
|
+
}
|
|
1265
|
+
const text2 = await response.text();
|
|
1266
|
+
return text2 ? JSON.parse(text2) : {};
|
|
1267
|
+
}
|
|
1268
|
+
async function getText(url, option) {
|
|
1269
|
+
const fetchOptions = { ...option };
|
|
1270
|
+
if (fetchOptions.method?.toLowerCase() !== "get") {
|
|
1271
|
+
fetchOptions.method = "GET";
|
|
1272
|
+
}
|
|
1273
|
+
if (!fetchOptions.signal) {
|
|
1274
|
+
fetchOptions.signal = AbortSignal.timeout(5e3);
|
|
1275
|
+
}
|
|
1276
|
+
const response = await fetch(url, {
|
|
1277
|
+
...fetchOptions
|
|
1278
|
+
});
|
|
1279
|
+
if (!response.ok) {
|
|
1280
|
+
throw new Error(`HTTP Error: ${response.status}`);
|
|
1281
|
+
}
|
|
1282
|
+
const text2 = await response.text();
|
|
1283
|
+
return text2 ? JSON.parse(text2) : {};
|
|
1284
|
+
}
|
|
1285
|
+
|
|
1286
|
+
// src/modules/http/post.ts
|
|
1287
|
+
var post_exports = {};
|
|
1288
|
+
__export(post_exports, {
|
|
1289
|
+
post: () => post
|
|
1290
|
+
});
|
|
1291
|
+
async function post(url, body = {}, option) {
|
|
1292
|
+
const fetchOptions = { ...option };
|
|
1293
|
+
if (fetchOptions.method?.toLowerCase() !== "post") {
|
|
1294
|
+
fetchOptions.method = "post";
|
|
1295
|
+
}
|
|
1296
|
+
if (!fetchOptions.signal) {
|
|
1297
|
+
fetchOptions.signal = AbortSignal.timeout(5e3);
|
|
1298
|
+
}
|
|
1299
|
+
const response = await fetch(url, {
|
|
1300
|
+
...fetchOptions,
|
|
1301
|
+
headers: { "Content-Type": "application/json" },
|
|
1302
|
+
body: JSON.stringify(body)
|
|
1303
|
+
});
|
|
1304
|
+
if (response.status === 204) {
|
|
1305
|
+
const text3 = await response.text();
|
|
1306
|
+
return text3 ? JSON.parse(text3) : {};
|
|
1307
|
+
}
|
|
1308
|
+
if (!response.ok) {
|
|
1309
|
+
throw new Error(`HTTP Error: ${response.status}`);
|
|
1310
|
+
}
|
|
1311
|
+
const text2 = await response.text();
|
|
1312
|
+
return text2 ? JSON.parse(text2) : {};
|
|
1313
|
+
}
|
|
1314
|
+
|
|
1315
|
+
// src/modules/http/index.ts
|
|
1316
|
+
var http = {
|
|
1317
|
+
...get_exports,
|
|
1318
|
+
...post_exports
|
|
1319
|
+
};
|
|
1320
|
+
|
|
1321
|
+
// src/modules/data/arrays.ts
|
|
1322
|
+
var arrays_exports = {};
|
|
1323
|
+
__export(arrays_exports, {
|
|
1324
|
+
add: () => add,
|
|
1325
|
+
chunk: () => chunk,
|
|
1326
|
+
find: () => find,
|
|
1327
|
+
mergeArray: () => mergeArray,
|
|
1328
|
+
remove: () => remove2
|
|
1329
|
+
});
|
|
1330
|
+
function chunk(array, size) {
|
|
1331
|
+
const chunks = [];
|
|
1332
|
+
for (let i = 0; i < array.length; i += size) {
|
|
1333
|
+
chunks.push(array.slice(i, i + size));
|
|
1334
|
+
}
|
|
1335
|
+
return chunks;
|
|
1336
|
+
}
|
|
1337
|
+
function mergeArray(...arrays) {
|
|
1338
|
+
return [].concat(...arrays);
|
|
1339
|
+
}
|
|
1340
|
+
function add(array, item, index = array.length) {
|
|
1341
|
+
const copy = [...array];
|
|
1342
|
+
const idx = index < 0 ? array.length + index + 1 : index;
|
|
1343
|
+
copy.splice(idx, 0, item);
|
|
1344
|
+
return copy;
|
|
1345
|
+
}
|
|
1346
|
+
var remove2 = {
|
|
1347
|
+
/**
|
|
1348
|
+
* * Removes an element at a specific index.
|
|
1349
|
+
* @param array
|
|
1350
|
+
* * The array.
|
|
1351
|
+
* @param index
|
|
1352
|
+
* * The index (negative values allowed).
|
|
1353
|
+
*/
|
|
1354
|
+
at(array, index) {
|
|
1355
|
+
const copy = [...array];
|
|
1356
|
+
const idx = index < 0 ? array.length + index : index;
|
|
1357
|
+
if (idx >= 0 && idx < copy.length) {
|
|
1358
|
+
copy.splice(idx, 1);
|
|
1359
|
+
}
|
|
1360
|
+
return copy;
|
|
1361
|
+
},
|
|
1362
|
+
/**
|
|
1363
|
+
* * Removes the first element.
|
|
1364
|
+
* @param array
|
|
1365
|
+
* * The array.
|
|
1366
|
+
*/
|
|
1367
|
+
first(array) {
|
|
1368
|
+
return array.slice(1);
|
|
1369
|
+
},
|
|
1370
|
+
/**
|
|
1371
|
+
* * Removes the last element.
|
|
1372
|
+
* @param array
|
|
1373
|
+
* * The array.
|
|
1374
|
+
*/
|
|
1375
|
+
last(array) {
|
|
1376
|
+
return array.slice(0, -1);
|
|
1377
|
+
},
|
|
1378
|
+
/**
|
|
1379
|
+
* * Removes all elements matching a query condition.
|
|
1380
|
+
* @example
|
|
1381
|
+
* remove.byMatch(users, 'Admin', 'exact', 'role')
|
|
1382
|
+
* @param array
|
|
1383
|
+
* * The array.
|
|
1384
|
+
* @param query
|
|
1385
|
+
* * The search query.
|
|
1386
|
+
* @param mode
|
|
1387
|
+
* * The comparison mode ('exact', 'contains', 'startsWith', 'endsWith').
|
|
1388
|
+
* @param key
|
|
1389
|
+
* * (Optional) The object key if it is an array of objects.
|
|
1390
|
+
*/
|
|
1391
|
+
byMatch(array, query, mode = "exact", key) {
|
|
1392
|
+
const queryStr = String(query).toLowerCase();
|
|
1393
|
+
return array.filter((item) => {
|
|
1394
|
+
const val2 = key ? item[key] : item;
|
|
1395
|
+
const valStr = String(val2).toLowerCase();
|
|
1396
|
+
switch (mode) {
|
|
1397
|
+
case "exact":
|
|
1398
|
+
return valStr === queryStr;
|
|
1399
|
+
case "startsWith":
|
|
1400
|
+
return valStr.startsWith(queryStr);
|
|
1401
|
+
case "endsWith":
|
|
1402
|
+
return valStr.endsWith(queryStr);
|
|
1403
|
+
case "contains":
|
|
1404
|
+
return valStr.includes(queryStr);
|
|
1405
|
+
default:
|
|
1406
|
+
return false;
|
|
1407
|
+
}
|
|
1408
|
+
});
|
|
1409
|
+
}
|
|
1410
|
+
};
|
|
1411
|
+
var find = {
|
|
1412
|
+
/**
|
|
1413
|
+
* * Finds the index of the first match.
|
|
1414
|
+
* @param array
|
|
1415
|
+
* * The array.
|
|
1416
|
+
* @param query
|
|
1417
|
+
* * The search query.
|
|
1418
|
+
* @param mode
|
|
1419
|
+
* * The comparison mode ('exact', 'contains', 'startsWith', 'endsWith').
|
|
1420
|
+
* @param key
|
|
1421
|
+
* * (Optional) The object key if it is an array of objects.
|
|
1422
|
+
* @returns
|
|
1423
|
+
* * Index or -1.
|
|
1424
|
+
*/
|
|
1425
|
+
at(array, query, mode = "exact", key) {
|
|
1426
|
+
const queryStr = String(query).toLowerCase();
|
|
1427
|
+
return array.findIndex((item) => {
|
|
1428
|
+
const val2 = key ? item[key] : item;
|
|
1429
|
+
const valStr = String(val2).toLowerCase();
|
|
1430
|
+
switch (mode) {
|
|
1431
|
+
case "exact":
|
|
1432
|
+
return valStr === queryStr;
|
|
1433
|
+
case "startsWith":
|
|
1434
|
+
return valStr.startsWith(queryStr);
|
|
1435
|
+
case "endsWith":
|
|
1436
|
+
return valStr.endsWith(queryStr);
|
|
1437
|
+
case "contains":
|
|
1438
|
+
return valStr.includes(queryStr);
|
|
1439
|
+
default:
|
|
1440
|
+
return false;
|
|
1441
|
+
}
|
|
1442
|
+
});
|
|
1443
|
+
},
|
|
1444
|
+
/**
|
|
1445
|
+
* * Returns all elements matching the condition (Filter).
|
|
1446
|
+
* @param array
|
|
1447
|
+
* * The array.
|
|
1448
|
+
* @param query
|
|
1449
|
+
* * The search query.
|
|
1450
|
+
* @param mode
|
|
1451
|
+
* * The comparison mode ('exact', 'contains', 'startsWith', 'endsWith').
|
|
1452
|
+
* @param key
|
|
1453
|
+
* * (Optional) The object key if it is an array of objects.
|
|
1454
|
+
* @returns
|
|
1455
|
+
* * All matching elements or -1.
|
|
1456
|
+
*/
|
|
1457
|
+
all(array, query, mode = "exact", key) {
|
|
1458
|
+
const queryStr = String(query).toLowerCase();
|
|
1459
|
+
return array.filter((item) => {
|
|
1460
|
+
const val2 = key ? item[key] : item;
|
|
1461
|
+
const valStr = String(val2).toLowerCase();
|
|
1462
|
+
switch (mode) {
|
|
1463
|
+
case "exact":
|
|
1464
|
+
return valStr === queryStr;
|
|
1465
|
+
case "startsWith":
|
|
1466
|
+
return valStr.startsWith(queryStr);
|
|
1467
|
+
case "endsWith":
|
|
1468
|
+
return valStr.endsWith(queryStr);
|
|
1469
|
+
case "contains":
|
|
1470
|
+
return valStr.includes(queryStr);
|
|
1471
|
+
default:
|
|
1472
|
+
return false;
|
|
1473
|
+
}
|
|
1474
|
+
});
|
|
1475
|
+
},
|
|
1476
|
+
/**
|
|
1477
|
+
* * Returns the first matching element (or undefined).
|
|
1478
|
+
* @param array
|
|
1479
|
+
* * The array.
|
|
1480
|
+
* @param query
|
|
1481
|
+
* * The search query.
|
|
1482
|
+
* @param mode
|
|
1483
|
+
* * The comparison mode ('exact', 'contains', 'startsWith', 'endsWith').
|
|
1484
|
+
* @param key
|
|
1485
|
+
* * (Optional) The object key if it is an array of objects.
|
|
1486
|
+
* @returns
|
|
1487
|
+
* * Index or -1.
|
|
1488
|
+
*/
|
|
1489
|
+
first(array, query, mode = "exact", key) {
|
|
1490
|
+
const queryStr = String(query).toLowerCase();
|
|
1491
|
+
return array.find((item) => {
|
|
1492
|
+
const val2 = key ? item[key] : item;
|
|
1493
|
+
const valStr = String(val2).toLowerCase();
|
|
1494
|
+
switch (mode) {
|
|
1495
|
+
case "exact":
|
|
1496
|
+
return valStr === queryStr;
|
|
1497
|
+
case "startsWith":
|
|
1498
|
+
return valStr.startsWith(queryStr);
|
|
1499
|
+
case "endsWith":
|
|
1500
|
+
return valStr.endsWith(queryStr);
|
|
1501
|
+
case "contains":
|
|
1502
|
+
return valStr.includes(queryStr);
|
|
1503
|
+
default:
|
|
1504
|
+
return false;
|
|
1505
|
+
}
|
|
1506
|
+
});
|
|
1507
|
+
},
|
|
1508
|
+
/**
|
|
1509
|
+
* * Returns the last matching element (or undefined).
|
|
1510
|
+
* @param array
|
|
1511
|
+
* * The array.
|
|
1512
|
+
* @param query
|
|
1513
|
+
* * The search query.
|
|
1514
|
+
* @param mode
|
|
1515
|
+
* * The comparison mode ('exact', 'contains', 'startsWith', 'endsWith').
|
|
1516
|
+
* @param key
|
|
1517
|
+
* * (Optional) The object key if it is an array of objects.
|
|
1518
|
+
* @returns
|
|
1519
|
+
* * Index or -1.
|
|
1520
|
+
*/
|
|
1521
|
+
last(array, query, mode = "exact", key) {
|
|
1522
|
+
const queryStr = String(query).toLowerCase();
|
|
1523
|
+
return [...array].reverse().find((item) => {
|
|
1524
|
+
const val2 = key ? item[key] : item;
|
|
1525
|
+
const valStr = String(val2).toLowerCase();
|
|
1526
|
+
switch (mode) {
|
|
1527
|
+
case "exact":
|
|
1528
|
+
return valStr === queryStr;
|
|
1529
|
+
case "startsWith":
|
|
1530
|
+
return valStr.startsWith(queryStr);
|
|
1531
|
+
case "endsWith":
|
|
1532
|
+
return valStr.endsWith(queryStr);
|
|
1533
|
+
case "contains":
|
|
1534
|
+
return valStr.includes(queryStr);
|
|
1535
|
+
default:
|
|
1536
|
+
return false;
|
|
1537
|
+
}
|
|
1538
|
+
});
|
|
1539
|
+
},
|
|
1540
|
+
/**
|
|
1541
|
+
* * Removes all elements matching a query condition.
|
|
1542
|
+
* @example
|
|
1543
|
+
* find.byMatch(users, 'Admin', 'exact', 'role')
|
|
1544
|
+
* @param array
|
|
1545
|
+
* * The array.
|
|
1546
|
+
* @param query
|
|
1547
|
+
* * The search query.
|
|
1548
|
+
* @param mode
|
|
1549
|
+
* * The comparison mode ('exact', 'contains', 'startsWith', 'endsWith').
|
|
1550
|
+
* @param key
|
|
1551
|
+
* * (Optional) The object key if it is an array of objects.
|
|
1552
|
+
* @returns
|
|
1553
|
+
* * Index or -1.
|
|
1554
|
+
*/
|
|
1555
|
+
byMatch(array, query, mode = "exact", key) {
|
|
1556
|
+
const queryStr = String(query).toLowerCase();
|
|
1557
|
+
return array.findIndex((item) => {
|
|
1558
|
+
const val2 = key ? item[key] : item;
|
|
1559
|
+
const valStr = String(val2).toLowerCase();
|
|
1560
|
+
switch (mode) {
|
|
1561
|
+
case "exact":
|
|
1562
|
+
return valStr === queryStr;
|
|
1563
|
+
case "startsWith":
|
|
1564
|
+
return valStr.startsWith(queryStr);
|
|
1565
|
+
case "endsWith":
|
|
1566
|
+
return valStr.endsWith(queryStr);
|
|
1567
|
+
case "contains":
|
|
1568
|
+
return valStr.includes(queryStr);
|
|
1569
|
+
default:
|
|
1570
|
+
return false;
|
|
1571
|
+
}
|
|
1572
|
+
});
|
|
1573
|
+
}
|
|
1574
|
+
};
|
|
1575
|
+
|
|
1576
|
+
// src/modules/data/objects.ts
|
|
1577
|
+
var objects_exports = {};
|
|
1578
|
+
__export(objects_exports, {
|
|
1579
|
+
find: () => find2,
|
|
1580
|
+
get: () => get2,
|
|
1581
|
+
mergeObjects: () => mergeObjects,
|
|
1582
|
+
omit: () => omit,
|
|
1583
|
+
pick: () => pick,
|
|
1584
|
+
set: () => set
|
|
1585
|
+
});
|
|
1586
|
+
function mergeObjects(target, ...sources) {
|
|
1587
|
+
if (!sources.length)
|
|
1588
|
+
return target;
|
|
1589
|
+
const source = sources.shift();
|
|
1590
|
+
if (isObject(target) && isObject(source)) {
|
|
1591
|
+
for (const key in source) {
|
|
1592
|
+
if (key === "__proto__" || key === "constructor")
|
|
1593
|
+
continue;
|
|
1594
|
+
if (isObject(source[key])) {
|
|
1595
|
+
if (!target[key]) target[key] = {};
|
|
1596
|
+
mergeObjects(target[key], source[key]);
|
|
1597
|
+
} else {
|
|
1598
|
+
target[key] = source[key];
|
|
1599
|
+
}
|
|
1600
|
+
}
|
|
1601
|
+
}
|
|
1602
|
+
return mergeObjects(target, ...sources);
|
|
1603
|
+
}
|
|
1604
|
+
function pick(obj, keys) {
|
|
1605
|
+
const ret = {};
|
|
1606
|
+
keys.forEach((key) => {
|
|
1607
|
+
if (key in obj) ret[key] = obj[key];
|
|
1608
|
+
});
|
|
1609
|
+
return ret;
|
|
1610
|
+
}
|
|
1611
|
+
function omit(obj, keys) {
|
|
1612
|
+
const ret = { ...obj };
|
|
1613
|
+
keys.forEach((key) => {
|
|
1614
|
+
delete ret[key];
|
|
1615
|
+
});
|
|
1616
|
+
return ret;
|
|
1617
|
+
}
|
|
1618
|
+
function get2(obj, path) {
|
|
1619
|
+
return path.split(".").reduce((acc, part) => acc && acc[part], obj);
|
|
1620
|
+
}
|
|
1621
|
+
function set(obj, path, value) {
|
|
1622
|
+
const parts = path.split(".");
|
|
1623
|
+
let current = obj;
|
|
1624
|
+
for (let i = 0; i < parts.length - 1; i++) {
|
|
1625
|
+
const part = parts[i];
|
|
1626
|
+
if (!current[part]) current[part] = {};
|
|
1627
|
+
current = current[part];
|
|
1628
|
+
}
|
|
1629
|
+
current[parts[parts.length - 1]] = value;
|
|
1630
|
+
}
|
|
1631
|
+
var find2 = {
|
|
1632
|
+
/**
|
|
1633
|
+
* * Returns the n-th entry of an object as a [key, value] pair. Supports negative indices.
|
|
1634
|
+
* @example find.at({ a: 1, b: 2 }, 1) => ['b', 2]
|
|
1635
|
+
* @param obj
|
|
1636
|
+
* * The object to search.
|
|
1637
|
+
* @param index
|
|
1638
|
+
* * The index (0-based, negative counts from the back).
|
|
1639
|
+
* @returns
|
|
1640
|
+
* * A [key, value] tuple or undefined.
|
|
1641
|
+
*/
|
|
1642
|
+
at(obj, index) {
|
|
1643
|
+
const entries = Object.entries(obj);
|
|
1644
|
+
const idx = index < 0 ? entries.length + index : index;
|
|
1645
|
+
return entries[idx];
|
|
1646
|
+
},
|
|
1647
|
+
/**
|
|
1648
|
+
* * Finds the first entry where the key or value matches the query.
|
|
1649
|
+
* @example find.first(config, 'admin', 'exact', 'key')
|
|
1650
|
+
* @param obj
|
|
1651
|
+
* * The object to search.
|
|
1652
|
+
* @param query
|
|
1653
|
+
* * The search query.
|
|
1654
|
+
* @param mode
|
|
1655
|
+
* * The comparison mode ('exact', 'contains', 'startsWith', 'endsWith').
|
|
1656
|
+
* @param searchBy
|
|
1657
|
+
* * Whether to search by 'key' or 'value'.
|
|
1658
|
+
* @returns
|
|
1659
|
+
* * The first matching [key, value] pair or undefined.
|
|
1660
|
+
*/
|
|
1661
|
+
first(obj, query, mode = "exact", searchBy = "key") {
|
|
1662
|
+
const entries = Object.entries(obj);
|
|
1663
|
+
const queryStr = String(query).toLowerCase();
|
|
1664
|
+
return entries.find(([key, val2]) => {
|
|
1665
|
+
const target = searchBy === "key" ? key : val2;
|
|
1666
|
+
const valStr = String(target).toLowerCase();
|
|
1667
|
+
switch (mode) {
|
|
1668
|
+
case "exact":
|
|
1669
|
+
return valStr === queryStr;
|
|
1670
|
+
case "startsWith":
|
|
1671
|
+
return valStr.startsWith(queryStr);
|
|
1672
|
+
case "endsWith":
|
|
1673
|
+
return valStr.endsWith(queryStr);
|
|
1674
|
+
case "contains":
|
|
1675
|
+
return valStr.includes(queryStr);
|
|
1676
|
+
default:
|
|
1677
|
+
return false;
|
|
1678
|
+
}
|
|
1679
|
+
});
|
|
1680
|
+
},
|
|
1681
|
+
/**
|
|
1682
|
+
* * Finds the last entry where the key or value matches the query.
|
|
1683
|
+
* @example find.last(config, '.php', 'endsWith', 'key')
|
|
1684
|
+
* @param obj
|
|
1685
|
+
* * The object to search.
|
|
1686
|
+
* @param query
|
|
1687
|
+
* * The search query.
|
|
1688
|
+
* @param mode
|
|
1689
|
+
* * The comparison mode ('exact', 'contains', 'startsWith', 'endsWith').
|
|
1690
|
+
* @param searchBy
|
|
1691
|
+
* * Whether to search by 'key' or 'value'.
|
|
1692
|
+
* @returns
|
|
1693
|
+
* * The last matching [key, value] pair or undefined.
|
|
1694
|
+
*/
|
|
1695
|
+
last(obj, query, mode = "exact", searchBy = "key") {
|
|
1696
|
+
const entries = Object.entries(obj);
|
|
1697
|
+
const queryStr = String(query).toLowerCase();
|
|
1698
|
+
return [...entries].reverse().find(([key, val2]) => {
|
|
1699
|
+
const target = searchBy === "key" ? key : val2;
|
|
1700
|
+
const valStr = String(target).toLowerCase();
|
|
1701
|
+
switch (mode) {
|
|
1702
|
+
case "exact":
|
|
1703
|
+
return valStr === queryStr;
|
|
1704
|
+
case "startsWith":
|
|
1705
|
+
return valStr.startsWith(queryStr);
|
|
1706
|
+
case "endsWith":
|
|
1707
|
+
return valStr.endsWith(queryStr);
|
|
1708
|
+
case "contains":
|
|
1709
|
+
return valStr.includes(queryStr);
|
|
1710
|
+
default:
|
|
1711
|
+
return false;
|
|
1712
|
+
}
|
|
1713
|
+
});
|
|
1714
|
+
},
|
|
1715
|
+
/**
|
|
1716
|
+
* * Finds all keys matching the query.
|
|
1717
|
+
* @example find.key(config, 'api_', 'startsWith')
|
|
1718
|
+
* @param obj
|
|
1719
|
+
* * The object to search.
|
|
1720
|
+
* @param query
|
|
1721
|
+
* * The search query.
|
|
1722
|
+
* @param mode
|
|
1723
|
+
* * The comparison mode ('exact', 'contains', 'startsWith', 'endsWith').
|
|
1724
|
+
* @returns
|
|
1725
|
+
* * An array of matching keys.
|
|
1726
|
+
*/
|
|
1727
|
+
key(obj, query, mode = "exact") {
|
|
1728
|
+
const queryStr = String(query).toLowerCase();
|
|
1729
|
+
return Object.keys(obj).filter((key) => {
|
|
1730
|
+
const valStr = String(key).toLowerCase();
|
|
1731
|
+
switch (mode) {
|
|
1732
|
+
case "exact":
|
|
1733
|
+
return valStr === queryStr;
|
|
1734
|
+
case "startsWith":
|
|
1735
|
+
return valStr.startsWith(queryStr);
|
|
1736
|
+
case "endsWith":
|
|
1737
|
+
return valStr.endsWith(queryStr);
|
|
1738
|
+
case "contains":
|
|
1739
|
+
return valStr.includes(queryStr);
|
|
1740
|
+
default:
|
|
1741
|
+
return false;
|
|
1742
|
+
}
|
|
1743
|
+
});
|
|
1744
|
+
},
|
|
1745
|
+
/**
|
|
1746
|
+
* * Finds all values matching the query.
|
|
1747
|
+
* @param obj
|
|
1748
|
+
* * The object to search.
|
|
1749
|
+
* @param query
|
|
1750
|
+
* * The search query.
|
|
1751
|
+
* @param mode
|
|
1752
|
+
* * The comparison mode ('exact', 'contains', 'startsWith', 'endsWith').
|
|
1753
|
+
* @returns
|
|
1754
|
+
* * An array of matching values.
|
|
1755
|
+
*/
|
|
1756
|
+
value(obj, query, mode = "exact") {
|
|
1757
|
+
const queryStr = String(query).toLowerCase();
|
|
1758
|
+
return Object.values(obj).filter((val2) => {
|
|
1759
|
+
const valStr = String(val2).toLowerCase();
|
|
1760
|
+
switch (mode) {
|
|
1761
|
+
case "exact":
|
|
1762
|
+
return valStr === queryStr;
|
|
1763
|
+
case "startsWith":
|
|
1764
|
+
return valStr.startsWith(queryStr);
|
|
1765
|
+
case "endsWith":
|
|
1766
|
+
return valStr.endsWith(queryStr);
|
|
1767
|
+
case "contains":
|
|
1768
|
+
return valStr.includes(queryStr);
|
|
1769
|
+
default:
|
|
1770
|
+
return false;
|
|
1771
|
+
}
|
|
1772
|
+
});
|
|
1773
|
+
}
|
|
1774
|
+
};
|
|
1775
|
+
function isObject(item) {
|
|
1776
|
+
return item && typeof item === "object" && !Array.isArray(item);
|
|
1777
|
+
}
|
|
1778
|
+
|
|
1779
|
+
// src/modules/data/index.ts
|
|
1780
|
+
var data = {
|
|
1781
|
+
arr: arrays_exports,
|
|
1782
|
+
obj: objects_exports
|
|
1783
|
+
};
|
|
1784
|
+
|
|
1785
|
+
// src/index.ts
|
|
1786
|
+
Object.assign(jBase.prototype, cssMethods);
|
|
1787
|
+
Object.assign(jBase.prototype, eventMethods);
|
|
1788
|
+
Object.assign(jBase.prototype, domMethods);
|
|
1789
|
+
Object.assign(jBase.prototype, effectMethods);
|
|
1790
|
+
var bind = (window2) => {
|
|
1791
|
+
const doc = window2.document;
|
|
1792
|
+
const boundInit = (selector) => new jBase(selector, doc);
|
|
1793
|
+
Object.assign(boundInit, {
|
|
1794
|
+
fn: jBase.prototype,
|
|
1795
|
+
http,
|
|
1796
|
+
data
|
|
1797
|
+
});
|
|
1798
|
+
return boundInit;
|
|
1799
|
+
};
|
|
1800
|
+
|
|
1801
|
+
// src/server.ts
|
|
1802
|
+
function parseHTML2(html2) {
|
|
1803
|
+
const dom = new import_jsdom.JSDOM(html2);
|
|
1804
|
+
const win = dom.window;
|
|
1805
|
+
const my$ = bind(win);
|
|
1806
|
+
return {
|
|
1807
|
+
$: my$,
|
|
1808
|
+
document: win.document,
|
|
1809
|
+
window: win,
|
|
1810
|
+
html: () => dom.serialize(),
|
|
1811
|
+
close: () => win.close()
|
|
1812
|
+
};
|
|
1813
|
+
}
|
|
1814
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
1815
|
+
0 && (module.exports = {
|
|
1816
|
+
parseHTML
|
|
1817
|
+
});
|
|
1818
|
+
/**
|
|
1819
|
+
* @file src/core.ts
|
|
1820
|
+
* @version 2.0.2
|
|
1821
|
+
* @since 2.0.0
|
|
1822
|
+
* @license GPL-3.0-or-later
|
|
1823
|
+
* @copyright Sven Minio 2026
|
|
1824
|
+
* @author Sven Minio <https://sven-minio.de>
|
|
1825
|
+
* @category Core
|
|
1826
|
+
* @description
|
|
1827
|
+
* * The main jBase class. Handles the selection engine, initialization, and plugin architecture.
|
|
1828
|
+
*/
|
|
1829
|
+
/**
|
|
1830
|
+
* @file src/modules/css/classes.ts
|
|
1831
|
+
* @version 2.0.2
|
|
1832
|
+
* @since 2.0.0
|
|
1833
|
+
* @license GPL-3.0-or-later
|
|
1834
|
+
* @copyright Sven Minio 2026
|
|
1835
|
+
* @author Sven Minio <https://sven-minio.de>
|
|
1836
|
+
* @category CSS
|
|
1837
|
+
* @description
|
|
1838
|
+
* * Methods for manipulating CSS classes (add, remove, toggle, has).
|
|
1839
|
+
* @requires ../../core
|
|
1840
|
+
* * Depends on the core jBase class for type definitions.
|
|
1841
|
+
*/
|
|
1842
|
+
/**
|
|
1843
|
+
* @file src/modules/css/styles.ts
|
|
1844
|
+
* @version 2.0.2
|
|
1845
|
+
* @since 2.0.0
|
|
1846
|
+
* @license GPL-3.0-or-later
|
|
1847
|
+
* @copyright Sven Minio 2026
|
|
1848
|
+
* @author Sven Minio <https://sven-minio.de>
|
|
1849
|
+
* @category CSS
|
|
1850
|
+
* @description
|
|
1851
|
+
* * Methods for getting and setting inline CSS styles.
|
|
1852
|
+
* @requires ../../core
|
|
1853
|
+
* * Depends on the core jBase class for type definitions.
|
|
1854
|
+
*/
|
|
1855
|
+
/**
|
|
1856
|
+
* @file src/modules/css/index.ts
|
|
1857
|
+
* @version 2.0.2
|
|
1858
|
+
* @since 2.0.0
|
|
1859
|
+
* @license GPL-3.0-or-later
|
|
1860
|
+
* @copyright Sven Minio 2026
|
|
1861
|
+
* @author Sven Minio <https://sven-minio.de>
|
|
1862
|
+
* @category CSS
|
|
1863
|
+
* @description
|
|
1864
|
+
* * Central entry point for CSS operations. Aggregates class and style manipulation methods.
|
|
1865
|
+
* @requires ./classes
|
|
1866
|
+
* * Class manipulation methods (addClass, removeClass, etc.).
|
|
1867
|
+
* @requires ./styles
|
|
1868
|
+
* * Style manipulation methods (css).
|
|
1869
|
+
*/
|
|
1870
|
+
/**
|
|
1871
|
+
* @file src/modules/events/binding.ts
|
|
1872
|
+
* @version 2.0.2
|
|
1873
|
+
* @since 2.0.0
|
|
1874
|
+
* @license GPL-3.0-or-later
|
|
1875
|
+
* @copyright Sven Minio 2026
|
|
1876
|
+
* @author Sven Minio <https://sven-minio.de>
|
|
1877
|
+
* @category Events
|
|
1878
|
+
* @description
|
|
1879
|
+
* * Core event binding methods (on, off, trigger). Handles event registration and removal.
|
|
1880
|
+
* @requires ../../core
|
|
1881
|
+
* * Depends on the core jBase class for type definitions.
|
|
1882
|
+
*/
|
|
1883
|
+
/**
|
|
1884
|
+
* @file src/modules/events/mouse.ts
|
|
1885
|
+
* @version 2.0.2
|
|
1886
|
+
* @since 2.0.0
|
|
1887
|
+
* @license GPL-3.0-or-later
|
|
1888
|
+
* @copyright Sven Minio 2026
|
|
1889
|
+
* @author Sven Minio <https://sven-minio.de>
|
|
1890
|
+
* @category Events
|
|
1891
|
+
* @description
|
|
1892
|
+
* * Methods for handling mouse events (click, dblclick, hover, mouseenter, mouseleave).
|
|
1893
|
+
* @requires ../../core
|
|
1894
|
+
* * Depends on the core jBase class for type definitions.
|
|
1895
|
+
*/
|
|
1896
|
+
/**
|
|
1897
|
+
* @file src/modules/events/lifecycle.ts
|
|
1898
|
+
* @version 2.0.2
|
|
1899
|
+
* @since 2.0.0
|
|
1900
|
+
* @license GPL-3.0-or-later
|
|
1901
|
+
* @copyright Sven Minio 2026
|
|
1902
|
+
* @author Sven Minio <https://sven-minio.de>
|
|
1903
|
+
* @category Events
|
|
1904
|
+
* @description
|
|
1905
|
+
* * Methods for handling DOM lifecycle events (e.g., ready).
|
|
1906
|
+
* @requires ../../core
|
|
1907
|
+
* * Depends on the core jBase class for type definitions.
|
|
1908
|
+
*/
|
|
1909
|
+
/**
|
|
1910
|
+
* @file src/modules/events/keyboard.ts
|
|
1911
|
+
* @version 2.0.2
|
|
1912
|
+
* @since 2.0.0
|
|
1913
|
+
* @license GPL-3.0-or-later
|
|
1914
|
+
* @copyright Sven Minio 2026
|
|
1915
|
+
* @author Sven Minio <https://sven-minio.de>
|
|
1916
|
+
* @category Events
|
|
1917
|
+
* @description
|
|
1918
|
+
* * Methods for handling keyboard events (keydown, keyup, keypress).
|
|
1919
|
+
* @requires ../../core
|
|
1920
|
+
* * Depends on the core jBase class for type definitions.
|
|
1921
|
+
*/
|
|
1922
|
+
/**
|
|
1923
|
+
* @file src/modules/events/form.ts
|
|
1924
|
+
* @version 2.0.2
|
|
1925
|
+
* @since 2.0.0
|
|
1926
|
+
* @license GPL-3.0-or-later
|
|
1927
|
+
* @copyright Sven Minio 2026
|
|
1928
|
+
* @author Sven Minio <https://sven-minio.de>
|
|
1929
|
+
* @category Events
|
|
1930
|
+
* @description
|
|
1931
|
+
* * Methods for handling form events (submit, change, focus, blur, input).
|
|
1932
|
+
* @requires ../../core
|
|
1933
|
+
* * Depends on the core jBase class for type definitions.
|
|
1934
|
+
*/
|
|
1935
|
+
/**
|
|
1936
|
+
* @file src/modules/events/touch.ts
|
|
1937
|
+
* @version 2.0.2
|
|
1938
|
+
* @since 2.0.0
|
|
1939
|
+
* @license GPL-3.0-or-later
|
|
1940
|
+
* @copyright Sven Minio 2026
|
|
1941
|
+
* @author Sven Minio <https://sven-minio.de>
|
|
1942
|
+
* @category Events
|
|
1943
|
+
* @description
|
|
1944
|
+
* * Methods for handling touch events (touchstart, touchend, touchmove).
|
|
1945
|
+
* @requires ../../core
|
|
1946
|
+
* * Depends on the core jBase class for type definitions.
|
|
1947
|
+
*/
|
|
1948
|
+
/**
|
|
1949
|
+
* @file src/modules/events/index.ts
|
|
1950
|
+
* @version 2.0.2
|
|
1951
|
+
* @since 2.0.0
|
|
1952
|
+
* @license GPL-3.0-or-later
|
|
1953
|
+
* @copyright Sven Minio 2026
|
|
1954
|
+
* @author Sven Minio <https://sven-minio.de>
|
|
1955
|
+
* @category Events
|
|
1956
|
+
* @description
|
|
1957
|
+
* * Central entry point for event handling. Aggregates binding, mouse, lifecycle, keyboard, form, and touch events.
|
|
1958
|
+
* @requires ./binding
|
|
1959
|
+
* * General event binding (on, off).
|
|
1960
|
+
* @requires ./mouse
|
|
1961
|
+
* * Mouse interaction events (click, hover, etc.).
|
|
1962
|
+
* @requires ./lifecycle
|
|
1963
|
+
* * DOM lifecycle events (ready).
|
|
1964
|
+
* @requires ./keyboard
|
|
1965
|
+
* * Keyboard interaction events (keydown, keyup).
|
|
1966
|
+
* @requires ./form
|
|
1967
|
+
* * Form handling events (submit, change, input).
|
|
1968
|
+
* @requires ./touch
|
|
1969
|
+
* * Touch interaction events.
|
|
1970
|
+
*/
|
|
1971
|
+
/**
|
|
1972
|
+
* @file src/modules/dom/attributes.ts
|
|
1973
|
+
* @version 2.0.2
|
|
1974
|
+
* @since 2.0.0
|
|
1975
|
+
* @license GPL-3.0-or-later
|
|
1976
|
+
* @copyright Sven Minio 2026
|
|
1977
|
+
* @author Sven Minio <https://sven-minio.de>
|
|
1978
|
+
* @category DOM
|
|
1979
|
+
* @description
|
|
1980
|
+
* * Methods for getting and setting HTML attributes and properties (attr, data, val).
|
|
1981
|
+
* @requires ../../core
|
|
1982
|
+
* * Depends on the core jBase class for type definitions.
|
|
1983
|
+
*/
|
|
1984
|
+
/**
|
|
1985
|
+
* @file src/modules/dom/content.ts
|
|
1986
|
+
* @version 2.0.2
|
|
1987
|
+
* @since 2.0.0
|
|
1988
|
+
* @license GPL-3.0-or-later
|
|
1989
|
+
* @copyright Sven Minio 2026
|
|
1990
|
+
* @author Sven Minio <https://sven-minio.de>
|
|
1991
|
+
* @category DOM
|
|
1992
|
+
* @description
|
|
1993
|
+
* * Methods for getting and setting element content (html, text, empty, replaceWith).
|
|
1994
|
+
* @requires ../../core
|
|
1995
|
+
* * Depends on the core jBase class for type definitions.
|
|
1996
|
+
*/
|
|
1997
|
+
/**
|
|
1998
|
+
* @file src/modules/dom/manipulation.ts
|
|
1999
|
+
* @version 2.0.2
|
|
2000
|
+
* @since 2.0.0
|
|
2001
|
+
* @license GPL-3.0-or-later
|
|
2002
|
+
* @copyright Sven Minio 2026
|
|
2003
|
+
* @author Sven Minio <https://sven-minio.de>
|
|
2004
|
+
* @category DOM
|
|
2005
|
+
* @description
|
|
2006
|
+
* * Methods for inserting, moving, and removing elements (append, prepend, remove).
|
|
2007
|
+
* @requires ../../core
|
|
2008
|
+
* * Depends on the core jBase class for type definitions.
|
|
2009
|
+
*/
|
|
2010
|
+
/**
|
|
2011
|
+
* @file src/modules/dom/traversal.ts
|
|
2012
|
+
* @version 2.0.2
|
|
2013
|
+
* @since 2.0.0
|
|
2014
|
+
* @license GPL-3.0-or-later
|
|
2015
|
+
* @copyright Sven Minio 2026
|
|
2016
|
+
* @author Sven Minio <https://sven-minio.de>
|
|
2017
|
+
* @category DOM
|
|
2018
|
+
* @description
|
|
2019
|
+
* * Methods for navigating the DOM tree (find, parent, children, siblings).
|
|
2020
|
+
* @requires ../../core
|
|
2021
|
+
* * Depends on the core jBase class for type definitions.
|
|
2022
|
+
*/
|
|
2023
|
+
/**
|
|
2024
|
+
* @file src/modules/dom/states.ts
|
|
2025
|
+
* @version 2.0.2
|
|
2026
|
+
* @since 2.0.0
|
|
2027
|
+
* @license GPL-3.0-or-later
|
|
2028
|
+
* @copyright Sven Minio 2026
|
|
2029
|
+
* @author Sven Minio <https://sven-minio.de>
|
|
2030
|
+
* @category DOM
|
|
2031
|
+
* @description
|
|
2032
|
+
* * Methods for checking element states (e.g., visibility, checked, disabled).
|
|
2033
|
+
* @requires ../../core
|
|
2034
|
+
* * Depends on the core jBase class for type definitions.
|
|
2035
|
+
*/
|
|
2036
|
+
/**
|
|
2037
|
+
* @file src/modules/dom/index.ts
|
|
2038
|
+
* @version 2.0.2
|
|
2039
|
+
* @since 2.0.0
|
|
2040
|
+
* @license GPL-3.0-or-later
|
|
2041
|
+
* @copyright Sven Minio 2026
|
|
2042
|
+
* @author Sven Minio <https://sven-minio.de>
|
|
2043
|
+
* @category DOM
|
|
2044
|
+
* @description
|
|
2045
|
+
* * Central entry point for DOM operations. Aggregates methods for attributes, content, manipulation, traversal, and states.
|
|
2046
|
+
* @requires ./attributes
|
|
2047
|
+
* * Attribute and value manipulation.
|
|
2048
|
+
* @requires ./content
|
|
2049
|
+
* * Content handling (html, text).
|
|
2050
|
+
* @requires ./manipulation
|
|
2051
|
+
* * DOM manipulation (append, remove, etc.).
|
|
2052
|
+
* @requires ./traversal
|
|
2053
|
+
* * Tree traversal (find, parent, children).
|
|
2054
|
+
* @requires ./states
|
|
2055
|
+
* * State checks (checked, disabled).
|
|
2056
|
+
*/
|
|
2057
|
+
/**
|
|
2058
|
+
* @file src/utils.ts
|
|
2059
|
+
* @version 2.0.2
|
|
2060
|
+
* @since 2.0.0
|
|
2061
|
+
* @license GPL-3.0-or-later
|
|
2062
|
+
* @copyright Sven Minio 2026
|
|
2063
|
+
* @author Sven Minio <https://sven-minio.de>
|
|
2064
|
+
* @category Utilities
|
|
2065
|
+
* @description
|
|
2066
|
+
* * General utility functions and helpers (e.g., debounce, throttle, type checks).
|
|
2067
|
+
*/
|
|
2068
|
+
/**
|
|
2069
|
+
* @file src/modules/effects/slide.ts
|
|
2070
|
+
* @version 2.0.2
|
|
2071
|
+
* @since 2.0.0
|
|
2072
|
+
* @license GPL-3.0-or-later
|
|
2073
|
+
* @copyright Sven Minio 2026
|
|
2074
|
+
* @author Sven Minio <https://sven-minio.de>
|
|
2075
|
+
* @category Effects
|
|
2076
|
+
* @description
|
|
2077
|
+
* * Methods for horizontal sliding effects (slideIn, slideOut, slideToggle).
|
|
2078
|
+
* @requires ../../core
|
|
2079
|
+
* * Depends on the core jBase class for type definitions.
|
|
2080
|
+
*/
|
|
2081
|
+
/**
|
|
2082
|
+
* @file src/modules/effects/vertical.ts
|
|
2083
|
+
* @version 2.0.2
|
|
2084
|
+
* @since 2.0.0
|
|
2085
|
+
* @license GPL-3.0-or-later
|
|
2086
|
+
* @copyright Sven Minio 2026
|
|
2087
|
+
* @author Sven Minio <https://sven-minio.de>
|
|
2088
|
+
* @category Effects
|
|
2089
|
+
* @description
|
|
2090
|
+
* * Methods for vertical sliding effects (slideDown, slideUp, slideToggle).
|
|
2091
|
+
* @requires ../../core
|
|
2092
|
+
* * Depends on the core jBase class for type definitions.
|
|
2093
|
+
*/
|
|
2094
|
+
/**
|
|
2095
|
+
* @file src/modules/effects/fade.ts
|
|
2096
|
+
* @version 2.0.2
|
|
2097
|
+
* @since 2.0.0
|
|
2098
|
+
* @license GPL-3.0-or-later
|
|
2099
|
+
* @copyright Sven Minio 2026
|
|
2100
|
+
* @author Sven Minio <https://sven-minio.de>
|
|
2101
|
+
* @category Effects
|
|
2102
|
+
* @description
|
|
2103
|
+
* * Methods for fading elements in and out (fadeIn, fadeOut, fadeToggle).
|
|
2104
|
+
* @requires ../../core
|
|
2105
|
+
* * Depends on the core jBase class for type definitions.
|
|
2106
|
+
*/
|
|
2107
|
+
/**
|
|
2108
|
+
* @file src/modules/effects/index.ts
|
|
2109
|
+
* @version 2.0.2
|
|
2110
|
+
* @since 2.0.0
|
|
2111
|
+
* @license GPL-3.0-or-later
|
|
2112
|
+
* @copyright Sven Minio 2026
|
|
2113
|
+
* @author Sven Minio <https://sven-minio.de>
|
|
2114
|
+
* @category Effects
|
|
2115
|
+
* @description
|
|
2116
|
+
* * Central entry point for visual effects. Aggregates slide, fade, and vertical animation modules.
|
|
2117
|
+
* @requires ./slide
|
|
2118
|
+
* * Horizontal slide effects (slideIn, slideOut).
|
|
2119
|
+
* @requires ./vertical
|
|
2120
|
+
* * Vertical slide effects / Accordion (slideDown, slideUp).
|
|
2121
|
+
* @requires ./fade
|
|
2122
|
+
* * Opacity fade effects (fadeIn, fadeOut).
|
|
2123
|
+
*/
|
|
2124
|
+
/**
|
|
2125
|
+
* @file src/modules/http/get.ts
|
|
2126
|
+
* @version 2.0.3
|
|
2127
|
+
* @since 2.0.0
|
|
2128
|
+
* @license GPL-3.0-or-later
|
|
2129
|
+
* @copyright Sven Minio 2026
|
|
2130
|
+
* @author Sven Minio <https://sven-minio.de>
|
|
2131
|
+
* @category HTTP
|
|
2132
|
+
* @description
|
|
2133
|
+
* * Abstraction for HTTP GET requests.
|
|
2134
|
+
* @requires ../../core
|
|
2135
|
+
* * Depends on the core jBase class for type definitions.
|
|
2136
|
+
*/
|
|
2137
|
+
/**
|
|
2138
|
+
* @file src/modules/http/post.ts
|
|
2139
|
+
* @version 2.0.3
|
|
2140
|
+
* @since 2.0.2
|
|
2141
|
+
* @license GPL-3.0-or-later
|
|
2142
|
+
* @copyright Sven Minio 2026
|
|
2143
|
+
* @author Sven Minio <https://sven-minio.de>
|
|
2144
|
+
* @category HTTP
|
|
2145
|
+
* * @description
|
|
2146
|
+
* * Abstraction for HTTP POST requests.
|
|
2147
|
+
* @requires ../../core
|
|
2148
|
+
* * Depends on the core jBase class for type definitions.
|
|
2149
|
+
*/
|
|
2150
|
+
/**
|
|
2151
|
+
* @file src/modules/http/index.ts
|
|
2152
|
+
* @version 2.0.2
|
|
2153
|
+
* @since 2.0.0
|
|
2154
|
+
* @license GPL-3.0-or-later
|
|
2155
|
+
* @copyright Sven Minio 2026
|
|
2156
|
+
* @author Sven Minio <https://sven-minio.de>
|
|
2157
|
+
* @category HTTP
|
|
2158
|
+
* @description
|
|
2159
|
+
* * Central entry point for HTTP requests. Aggregates GET and POST methods.
|
|
2160
|
+
* @requires ./get
|
|
2161
|
+
* * HTTP GET methods (get, getText).
|
|
2162
|
+
* @requires ./post
|
|
2163
|
+
* * HTTP POST methods.
|
|
2164
|
+
*/
|
|
2165
|
+
/**
|
|
2166
|
+
* @file src/modules/data/arrays.ts
|
|
2167
|
+
* @version 2.0.2
|
|
2168
|
+
* @since 2.0.0
|
|
2169
|
+
* @license GPL-3.0-or-later
|
|
2170
|
+
* @copyright Sven Minio 2026
|
|
2171
|
+
* @author Sven Minio <https://sven-minio.de>
|
|
2172
|
+
* @category Data
|
|
2173
|
+
* @description
|
|
2174
|
+
* * Utility functions for array manipulation and data processing.
|
|
2175
|
+
* @requires ./types
|
|
2176
|
+
* * Depends on types.
|
|
2177
|
+
*/
|
|
2178
|
+
/**
|
|
2179
|
+
* @file src/modules/data/objects.ts
|
|
2180
|
+
* @version 2.0.2
|
|
2181
|
+
* @since 2.0.0
|
|
2182
|
+
* @license GPL-3.0-or-later
|
|
2183
|
+
* @copyright Sven Minio 2026
|
|
2184
|
+
* @author Sven Minio <https://sven-minio.de>
|
|
2185
|
+
* @category Data
|
|
2186
|
+
* @description
|
|
2187
|
+
* * Utility functions for object manipulation (e.g., deep merging, extension).
|
|
2188
|
+
* @requires ./types
|
|
2189
|
+
* * Depends on types.
|
|
2190
|
+
*/
|
|
2191
|
+
/**
|
|
2192
|
+
* @file src/modules/data/index.ts
|
|
2193
|
+
* @version 2.0.2
|
|
2194
|
+
* @since 2.0.0
|
|
2195
|
+
* * @license GPL-3.0-or-later
|
|
2196
|
+
* @copyright Sven Minio 2026
|
|
2197
|
+
* @author Sven Minio <https://sven-minio.de>
|
|
2198
|
+
* @category Data
|
|
2199
|
+
* @description
|
|
2200
|
+
* * Central entry point for data manipulation modules. Aggregates array and object utilities.
|
|
2201
|
+
* @requires ./arrays
|
|
2202
|
+
* * Array manipulation methods.
|
|
2203
|
+
* @requires ./objects
|
|
2204
|
+
* * Object manipulation methods.
|
|
2205
|
+
*/
|
|
2206
|
+
/**
|
|
2207
|
+
* @file src/index.ts
|
|
2208
|
+
* @version 2.0.2
|
|
2209
|
+
* @since 2.0.0
|
|
2210
|
+
* @license GPL-3.0-or-later
|
|
2211
|
+
* @copyright Sven Minio 2026
|
|
2212
|
+
* @author Sven Minio <https://sven-minio.de>
|
|
2213
|
+
* @category Entry Point
|
|
2214
|
+
* @description
|
|
2215
|
+
* * Main library entry point. Aggregates Core, Types, Utils, and all functional modules into a single export.
|
|
2216
|
+
* @requires ./core
|
|
2217
|
+
* * Core class logic and inheritance.
|
|
2218
|
+
* @requires ./types
|
|
2219
|
+
* * TypeScript type definitions and interfaces.
|
|
2220
|
+
* @requires ./utils
|
|
2221
|
+
* * Helper functions (throttle, debounce).
|
|
2222
|
+
* @requires ./modules/css
|
|
2223
|
+
* * Style manipulation methods.
|
|
2224
|
+
* @requires ./modules/events
|
|
2225
|
+
* * Event handling logic.
|
|
2226
|
+
* @requires ./modules/dom
|
|
2227
|
+
* * DOM traversal and manipulation.
|
|
2228
|
+
* @requires ./modules/effects
|
|
2229
|
+
* * Visual effects and animations.
|
|
2230
|
+
* @requires ./modules/http
|
|
2231
|
+
* * HTTP client for AJAX requests.
|
|
2232
|
+
* @requires ./modules/data
|
|
2233
|
+
* * Data structure utilities.
|
|
2234
|
+
*/
|
|
2235
|
+
/**
|
|
2236
|
+
* @file src/index.ts
|
|
2237
|
+
* @version 2.0.2
|
|
2238
|
+
* @since 2.0.0
|
|
2239
|
+
* @license GPL-3.0-or-later
|
|
2240
|
+
* @copyright Sven Minio 2026
|
|
2241
|
+
* @author Sven Minio <https://sven-minio.de>
|
|
2242
|
+
* @category Entry Point
|
|
2243
|
+
* @description
|
|
2244
|
+
* * Server-Side Rendering (SSR) utilities using JSDOM.
|
|
2245
|
+
*/
|
|
2246
|
+
//# sourceMappingURL=server.js.map
|