@k37z3r/jbase 2.0.3 → 2.1.2
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 +25 -4
- package/README.md +1 -1
- package/dist/browser.d.ts +2 -3
- package/dist/browser.d.ts.map +1 -1
- package/dist/index.cjs +72 -25
- package/dist/index.cjs.map +2 -2
- package/dist/index.d.ts +132 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +72 -25
- package/dist/index.mjs.map +2 -2
- package/dist/jbase.browser.js +538 -31
- package/dist/jbase.browser.js.map +3 -3
- package/dist/jbase.min.js +5 -5
- package/dist/jbase.min.js.map +3 -3
- package/dist/modules/css/index.d.ts +1 -1
- package/dist/modules/css/styles.d.ts +6 -6
- package/dist/modules/css/styles.d.ts.map +1 -1
- package/dist/modules/dom/attributes.d.ts +20 -1
- package/dist/modules/dom/attributes.d.ts.map +1 -1
- package/dist/modules/dom/index.d.ts +2 -0
- package/dist/modules/dom/index.d.ts.map +1 -1
- package/dist/modules/http/get.d.ts +2 -2
- package/dist/modules/http/get.d.ts.map +1 -1
- package/dist/modules/http/index.d.ts +1 -1
- package/dist/server.js +74 -24
- package/dist/server.js.map +2 -2
- package/package.json +5 -5
- package/wiki/DOM-Attributes.md +56 -2
- package/wiki/HTTP-Requests.md +11 -14
- package/wiki/Home.md +1 -1
- package/wiki/Quick-Start.md +3 -4
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
* * Aggregation of all CSS methods. This object bundles functions for class manipulation and style manipulation. It is exported to extend the jBase prototype centrally via Object.assign.
|
|
18
18
|
*/
|
|
19
19
|
export declare const cssMethods: {
|
|
20
|
-
css(this: import("../..").JBaseClass, property: string, value?: string | number): string | import("../..").JBaseClass;
|
|
20
|
+
css(this: import("../..").JBaseClass, property: string | Record<string, string | number>, value?: string | number): string | import("../..").JBaseClass;
|
|
21
21
|
addClass(this: import("../..").JBaseClass, ...classNames: string[]): import("../..").JBaseClass;
|
|
22
22
|
removeClass(this: import("../..").JBaseClass, ...classNames: string[]): import("../..").JBaseClass;
|
|
23
23
|
toggleClass(this: import("../..").JBaseClass, className: string): import("../..").JBaseClass;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @file src/modules/css/styles.ts
|
|
3
|
-
* @version 2.0.
|
|
3
|
+
* @version 2.0.3
|
|
4
4
|
* @since 2.0.0
|
|
5
5
|
* @license GPL-3.0-or-later
|
|
6
6
|
* @copyright Sven Minio 2026
|
|
@@ -13,13 +13,13 @@
|
|
|
13
13
|
*/
|
|
14
14
|
import { jBase } from '../../core';
|
|
15
15
|
/**
|
|
16
|
-
* *
|
|
16
|
+
* * Gets a CSS property value from the first element or sets one/multiple CSS properties for all elements.
|
|
17
17
|
* @param property
|
|
18
|
-
* *
|
|
18
|
+
* * A CSS property name as a string, or an object of property-value pairs to set multiple styles.
|
|
19
19
|
* @param value
|
|
20
|
-
* * (Optional) The value to set. If undefined
|
|
20
|
+
* * (Optional) The value to set if `property` is a string. If undefined and `property` is a string, acts as a getter.
|
|
21
21
|
* @returns
|
|
22
|
-
* * The
|
|
22
|
+
* * The CSS value as a string when reading, or the jBase instance when writing.
|
|
23
23
|
*/
|
|
24
|
-
export declare function css(this: jBase, property: string, value?: string | number): string | jBase;
|
|
24
|
+
export declare function css(this: jBase, property: string | Record<string, string | number>, value?: string | number): string | jBase;
|
|
25
25
|
//# sourceMappingURL=styles.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/modules/css/styles.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC;;;;;;;;GAQG;AACH,wBAAgB,GAAG,CAAC,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,KAAK,
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/modules/css/styles.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC;;;;;;;;GAQG;AACH,wBAAgB,GAAG,CAAC,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,KAAK,CA4C5H"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @file src/modules/dom/attributes.ts
|
|
3
|
-
* @version 2.0
|
|
3
|
+
* @version 2.1.0
|
|
4
4
|
* @since 2.0.0
|
|
5
5
|
* @license GPL-3.0-or-later
|
|
6
6
|
* @copyright Sven Minio 2026
|
|
@@ -30,4 +30,23 @@ export declare function attr(this: jBase, name: string, value?: string): string
|
|
|
30
30
|
* * The current value as a string when reading, or the jBase instance when writing.
|
|
31
31
|
*/
|
|
32
32
|
export declare function val(this: jBase, value?: string): string | jBase;
|
|
33
|
+
/**
|
|
34
|
+
* * Removes an attribute from all elements in the selection.
|
|
35
|
+
* @param name
|
|
36
|
+
* * The name of the attribute to remove (e.g., 'disabled', 'readonly').
|
|
37
|
+
* @returns
|
|
38
|
+
* * The jBase instance for chaining.
|
|
39
|
+
*/
|
|
40
|
+
export declare function removeAttr(this: jBase, name: string): jBase;
|
|
41
|
+
/**
|
|
42
|
+
* * Gets a property from the first element or sets it for all elements in the selection.
|
|
43
|
+
* * Useful for DOM properties that don't directly map to HTML attributes (like 'checked' or 'selectedIndex').
|
|
44
|
+
* @param name
|
|
45
|
+
* * The name of the property (e.g., 'checked', 'disabled').
|
|
46
|
+
* @param value
|
|
47
|
+
* * (Optional) The value to set. If undefined, acts as a getter.
|
|
48
|
+
* @returns
|
|
49
|
+
* * The property value when reading, or the jBase instance when writing.
|
|
50
|
+
*/
|
|
51
|
+
export declare function prop(this: jBase, name: string, value?: any): any | jBase;
|
|
33
52
|
//# sourceMappingURL=attributes.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attributes.d.ts","sourceRoot":"","sources":["../../../src/modules/dom/attributes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC;;;;;;;;GAQG;AACH,wBAAgB,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,KAAK,CAUrF;AAED;;;;;;GAMG;AACH,wBAAgB,GAAG,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,KAAK,CAe/D"}
|
|
1
|
+
{"version":3,"file":"attributes.d.ts","sourceRoot":"","sources":["../../../src/modules/dom/attributes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC;;;;;;;;GAQG;AACH,wBAAgB,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,KAAK,CAUrF;AAED;;;;;;GAMG;AACH,wBAAgB,GAAG,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,KAAK,CAe/D;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,GAAG,KAAK,CAK3D;AAED;;;;;;;;;GASG;AACH,wBAAgB,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,GAAG,GAAG,GAAG,GAAG,KAAK,CAYxE"}
|
|
@@ -67,5 +67,7 @@ export declare const domMethods: {
|
|
|
67
67
|
text(this: import("../..").JBaseClass, content?: string): string | import("../..").JBaseClass;
|
|
68
68
|
attr(this: import("../..").JBaseClass, name: string, value?: string): string | null | import("../..").JBaseClass;
|
|
69
69
|
val(this: import("../..").JBaseClass, value?: string): string | import("../..").JBaseClass;
|
|
70
|
+
removeAttr(this: import("../..").JBaseClass, name: string): import("../..").JBaseClass;
|
|
71
|
+
prop(this: import("../..").JBaseClass, name: string, value?: any): any | import("../..").JBaseClass;
|
|
70
72
|
};
|
|
71
73
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/modules/dom/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAQH;;GAEG;AACH,eAAO,MAAM,UAAU
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/modules/dom/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAQH;;GAEG;AACH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAMtB,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @file src/modules/http/get.ts
|
|
3
|
-
* @version 2.0.
|
|
3
|
+
* @version 2.0.4
|
|
4
4
|
* @since 2.0.0
|
|
5
5
|
* @license GPL-3.0-or-later
|
|
6
6
|
* @copyright Sven Minio 2026
|
|
@@ -36,5 +36,5 @@ export declare function get<T>(url: string, option?: RequestInit): Promise<T>;
|
|
|
36
36
|
* @throws
|
|
37
37
|
* * Error if HTTP status is not in success range (200-299).
|
|
38
38
|
*/
|
|
39
|
-
export declare function getText<T>(url: string, option?: RequestInit): Promise<T>;
|
|
39
|
+
export declare function getText<T = string>(url: string, option?: RequestInit): Promise<T>;
|
|
40
40
|
//# sourceMappingURL=get.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get.d.ts","sourceRoot":"","sources":["../../../src/modules/http/get.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH;;;;;;;;;;;;GAYG;AACH,wBAAsB,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,CAAC,CAAC,CAgB1E;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,OAAO,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"get.d.ts","sourceRoot":"","sources":["../../../src/modules/http/get.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH;;;;;;;;;;;;GAYG;AACH,wBAAsB,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,CAAC,CAAC,CAgB1E;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,OAAO,CAAC,CAAC,GAAG,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,CAAC,CAAC,CAoBvF"}
|
|
@@ -28,6 +28,6 @@
|
|
|
28
28
|
export declare const http: {
|
|
29
29
|
post<T>(url: string, body?: any, option?: RequestInit): Promise<T>;
|
|
30
30
|
get<T>(url: string, option?: RequestInit): Promise<T>;
|
|
31
|
-
getText<T>(url: string, option?: RequestInit): Promise<T>;
|
|
31
|
+
getText<T = string>(url: string, option?: RequestInit): Promise<T>;
|
|
32
32
|
};
|
|
33
33
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/server.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
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.
|
|
4
|
-
* @homepage https://github.com/k37z3r/jBase-2
|
|
5
|
-
* @author Sven Minio (https://github.com/k37z3r/jBase-2
|
|
3
|
+
* @version 2.1.2
|
|
4
|
+
* @homepage https://github.com/k37z3r/jBase-2
|
|
5
|
+
* @author Sven Minio (https://github.com/k37z3r/jBase-2)
|
|
6
6
|
* @license GPL-3.0-or-later
|
|
7
|
-
* @copyright 2026 Sven Minio (https://github.com/k37z3r/jBase-2
|
|
7
|
+
* @copyright 2026 Sven Minio (https://github.com/k37z3r/jBase-2)
|
|
8
8
|
*/
|
|
9
9
|
"use strict";
|
|
10
10
|
var __defProp = Object.defineProperty;
|
|
@@ -147,24 +147,46 @@ __export(styles_exports, {
|
|
|
147
147
|
css: () => css
|
|
148
148
|
});
|
|
149
149
|
function css(property, value) {
|
|
150
|
-
if (
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
150
|
+
if (typeof property === "object" && property !== null) {
|
|
151
|
+
this.forEach((el) => {
|
|
152
|
+
if (el instanceof HTMLElement || el instanceof SVGElement) {
|
|
153
|
+
for (const key in property) {
|
|
154
|
+
if (Object.prototype.hasOwnProperty.call(property, key)) {
|
|
155
|
+
if (key.includes("-")) {
|
|
156
|
+
el.style.setProperty(key, String(property[key]));
|
|
157
|
+
} else {
|
|
158
|
+
el.style[key] = property[key];
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
159
162
|
}
|
|
160
|
-
}
|
|
161
|
-
return
|
|
163
|
+
});
|
|
164
|
+
return this;
|
|
162
165
|
}
|
|
163
|
-
|
|
164
|
-
if (
|
|
165
|
-
el
|
|
166
|
+
if (typeof property === "string") {
|
|
167
|
+
if (value === void 0) {
|
|
168
|
+
const el = this[0];
|
|
169
|
+
if (el instanceof HTMLElement || el instanceof SVGElement) {
|
|
170
|
+
const doc = el.ownerDocument;
|
|
171
|
+
const win = doc ? doc.defaultView : null;
|
|
172
|
+
if (win) {
|
|
173
|
+
return win.getComputedStyle(el).getPropertyValue(property) || win.getComputedStyle(el)[property] || "";
|
|
174
|
+
} else {
|
|
175
|
+
return el.style[property] || "";
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
return "";
|
|
166
179
|
}
|
|
167
|
-
|
|
180
|
+
this.forEach((el) => {
|
|
181
|
+
if (el instanceof HTMLElement || el instanceof SVGElement) {
|
|
182
|
+
if (property.includes("-")) {
|
|
183
|
+
el.style.setProperty(property, String(value));
|
|
184
|
+
} else {
|
|
185
|
+
el.style[property] = value;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
});
|
|
189
|
+
}
|
|
168
190
|
return this;
|
|
169
191
|
}
|
|
170
192
|
|
|
@@ -369,6 +391,8 @@ var eventMethods = {
|
|
|
369
391
|
var attributes_exports = {};
|
|
370
392
|
__export(attributes_exports, {
|
|
371
393
|
attr: () => attr,
|
|
394
|
+
prop: () => prop,
|
|
395
|
+
removeAttr: () => removeAttr,
|
|
372
396
|
val: () => val
|
|
373
397
|
});
|
|
374
398
|
function attr(name, value) {
|
|
@@ -396,6 +420,24 @@ function val(value) {
|
|
|
396
420
|
});
|
|
397
421
|
return this;
|
|
398
422
|
}
|
|
423
|
+
function removeAttr(name) {
|
|
424
|
+
this.forEach((el) => {
|
|
425
|
+
if (el instanceof Element) el.removeAttribute(name);
|
|
426
|
+
});
|
|
427
|
+
return this;
|
|
428
|
+
}
|
|
429
|
+
function prop(name, value) {
|
|
430
|
+
if (value === void 0) {
|
|
431
|
+
const el = this[0];
|
|
432
|
+
return el instanceof Element ? el[name] : void 0;
|
|
433
|
+
}
|
|
434
|
+
this.forEach((el) => {
|
|
435
|
+
if (el instanceof Element) {
|
|
436
|
+
el[name] = value;
|
|
437
|
+
}
|
|
438
|
+
});
|
|
439
|
+
return this;
|
|
440
|
+
}
|
|
399
441
|
|
|
400
442
|
// src/modules/dom/content.ts
|
|
401
443
|
var content_exports = {};
|
|
@@ -1280,7 +1322,7 @@ async function getText(url, option) {
|
|
|
1280
1322
|
throw new Error(`HTTP Error: ${response.status}`);
|
|
1281
1323
|
}
|
|
1282
1324
|
const text2 = await response.text();
|
|
1283
|
-
return text2
|
|
1325
|
+
return text2;
|
|
1284
1326
|
}
|
|
1285
1327
|
|
|
1286
1328
|
// src/modules/http/post.ts
|
|
@@ -1787,6 +1829,14 @@ Object.assign(jBase.prototype, cssMethods);
|
|
|
1787
1829
|
Object.assign(jBase.prototype, eventMethods);
|
|
1788
1830
|
Object.assign(jBase.prototype, domMethods);
|
|
1789
1831
|
Object.assign(jBase.prototype, effectMethods);
|
|
1832
|
+
var initFn = (selector) => {
|
|
1833
|
+
return new jBase(selector);
|
|
1834
|
+
};
|
|
1835
|
+
var init = Object.assign(initFn, {
|
|
1836
|
+
http,
|
|
1837
|
+
data,
|
|
1838
|
+
fn: jBase.prototype
|
|
1839
|
+
});
|
|
1790
1840
|
var bind = (window2) => {
|
|
1791
1841
|
const doc = window2.document;
|
|
1792
1842
|
const boundInit = (selector) => new jBase(selector, doc);
|
|
@@ -1841,7 +1891,7 @@ function parseHTML2(html2) {
|
|
|
1841
1891
|
*/
|
|
1842
1892
|
/**
|
|
1843
1893
|
* @file src/modules/css/styles.ts
|
|
1844
|
-
* @version 2.0.
|
|
1894
|
+
* @version 2.0.3
|
|
1845
1895
|
* @since 2.0.0
|
|
1846
1896
|
* @license GPL-3.0-or-later
|
|
1847
1897
|
* @copyright Sven Minio 2026
|
|
@@ -1970,7 +2020,7 @@ function parseHTML2(html2) {
|
|
|
1970
2020
|
*/
|
|
1971
2021
|
/**
|
|
1972
2022
|
* @file src/modules/dom/attributes.ts
|
|
1973
|
-
* @version 2.0
|
|
2023
|
+
* @version 2.1.0
|
|
1974
2024
|
* @since 2.0.0
|
|
1975
2025
|
* @license GPL-3.0-or-later
|
|
1976
2026
|
* @copyright Sven Minio 2026
|
|
@@ -2123,7 +2173,7 @@ function parseHTML2(html2) {
|
|
|
2123
2173
|
*/
|
|
2124
2174
|
/**
|
|
2125
2175
|
* @file src/modules/http/get.ts
|
|
2126
|
-
* @version 2.0.
|
|
2176
|
+
* @version 2.0.4
|
|
2127
2177
|
* @since 2.0.0
|
|
2128
2178
|
* @license GPL-3.0-or-later
|
|
2129
2179
|
* @copyright Sven Minio 2026
|
|
@@ -2205,7 +2255,7 @@ function parseHTML2(html2) {
|
|
|
2205
2255
|
*/
|
|
2206
2256
|
/**
|
|
2207
2257
|
* @file src/index.ts
|
|
2208
|
-
* @version 2.
|
|
2258
|
+
* @version 2.1.2
|
|
2209
2259
|
* @since 2.0.0
|
|
2210
2260
|
* @license GPL-3.0-or-later
|
|
2211
2261
|
* @copyright Sven Minio 2026
|