@k37z3r/jbase 2.0.3 → 2.1.1
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 +18 -4
- package/README.md +1 -1
- package/dist/index.cjs +66 -24
- package/dist/index.cjs.map +2 -2
- package/dist/index.d.ts +36 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +66 -24
- package/dist/index.mjs.map +2 -2
- package/dist/jbase.browser.js +66 -24
- package/dist/jbase.browser.js.map +2 -2
- 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 +66 -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
package/CHANGELOG.md
CHANGED
|
@@ -21,19 +21,19 @@ All notable changes to this project will be documented in this file.
|
|
|
21
21
|
|
|
22
22
|
### ⚡ Performance
|
|
23
23
|
|
|
24
|
-
* **Data Module (`objects.ts`):** Optimized search algorithms in `find.first`, `find.last`, `find.key`, and `find.value`. moved query normalization (`toLowerCase()`) outside of loops to significantly reduce CPU overhead.
|
|
24
|
+
* **Data Module (`data/objects.ts`):** Optimized search algorithms in `find.first`, `find.last`, `find.key`, and `find.value`. moved query normalization (`toLowerCase()`) outside of loops to significantly reduce CPU overhead.
|
|
25
25
|
* **Effects Module:** Added server-guards (`if (!isBrowser())`) to `fade.ts`, `slide.ts`, and `vertical.ts`. Animation logic is now skipped on the server to save resources.
|
|
26
26
|
|
|
27
27
|
### 🛡️ Fixed (Stability & Logic)
|
|
28
28
|
|
|
29
29
|
* **Core (`core.ts`):** Added crash protection for invalid CSS selectors. `$(...)` now catches `DOMException` errors internally and logs a warning instead of crashing.
|
|
30
|
-
* **DOM Manipulation (`manipulation.ts`):**
|
|
30
|
+
* **DOM Manipulation (`dom/manipulation.ts`):**
|
|
31
31
|
* Rewrote `unwrap()` using a `Set` to safely handle parent removal without conflicts on sibling elements.
|
|
32
32
|
* Replaced global `window.document` usage with a `getDoc(this)` helper to prevent `ReferenceError` crashes in Node.js.
|
|
33
33
|
|
|
34
34
|
|
|
35
35
|
* **HTTP Module (`http/*.ts`):** Fixed potential crash when parsing JSON from `200 OK` responses that contain an empty body.
|
|
36
|
-
* **CSS Module (`styles.ts`):** Updated `css()` getter to access `getComputedStyle` via `el.ownerDocument` instead of global `window`.
|
|
36
|
+
* **CSS Module (`css/styles.ts`):** Updated `css()` getter to access `getComputedStyle` via `el.ownerDocument` instead of global `window`.
|
|
37
37
|
|
|
38
38
|
### 🔧 Changed & Cleaned
|
|
39
39
|
|
|
@@ -47,4 +47,18 @@ All notable changes to this project will be documented in this file.
|
|
|
47
47
|
### 🛡️ Fixed (http)
|
|
48
48
|
|
|
49
49
|
* **HTTP Module (`http/get.ts`):** Enforce GET method in get() and getText() utility. Overrides method to 'GET' if 'POST' is passed in options.
|
|
50
|
-
* **HTTP Module (`http/post.ts`):** Enforce POST method in post() utility. Overrides method to 'POST' if 'GET' is passed in options.
|
|
50
|
+
* **HTTP Module (`http/post.ts`):** Enforce POST method in post() utility. Overrides method to 'POST' if 'GET' is passed in options.
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
## [2.1.1] - 2026-02-22
|
|
54
|
+
|
|
55
|
+
### 🚀 Added (DOM Attributes)
|
|
56
|
+
|
|
57
|
+
* **Attributes Module (`dom/attributes.ts`):** Added `removeAttr()` method to safely remove HTML attributes from all elements in a selection.
|
|
58
|
+
* **Attributes Module (`dom/attributes.ts`):** Added `prop()` method for getting and setting underlying DOM properties (e.g., `checked`, `disabled`, `selectedIndex`) that don't directly map to standard HTML attributes.
|
|
59
|
+
|
|
60
|
+
### 🛡️ Fixed (CSS & HTTP)
|
|
61
|
+
|
|
62
|
+
* **CSS Module (`css/styles.ts`):** Enhanced the `css()` method to support passing an object (`Record<string, string | number>`) for setting multiple CSS properties simultaneously (e.g., `css({'background-color': 'blue', 'font-size': '14px'})`).
|
|
63
|
+
* **CSS Module (`css/styles.ts`):** Improved handling of kebab-case property names inside the `css()` method by utilizing `style.setProperty()` for greater robustness.
|
|
64
|
+
* **HTTP Module (`http/get.ts`):** Fixed a critical bug in `getText()` where it incorrectly attempted to parse the response with `JSON.parse()` instead of returning the raw text. It now safely returns the raw string/HTML as intended.
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# jBase
|
|
2
2
|
|
|
3
|
-

|
|
4
4
|

|
|
5
5
|

|
|
6
6
|

|
package/dist/index.cjs
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.1
|
|
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;
|
|
@@ -159,24 +159,46 @@ __export(styles_exports, {
|
|
|
159
159
|
css: () => css
|
|
160
160
|
});
|
|
161
161
|
function css(property, value) {
|
|
162
|
-
if (
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
162
|
+
if (typeof property === "object" && property !== null) {
|
|
163
|
+
this.forEach((el) => {
|
|
164
|
+
if (el instanceof HTMLElement || el instanceof SVGElement) {
|
|
165
|
+
for (const key in property) {
|
|
166
|
+
if (Object.prototype.hasOwnProperty.call(property, key)) {
|
|
167
|
+
if (key.includes("-")) {
|
|
168
|
+
el.style.setProperty(key, String(property[key]));
|
|
169
|
+
} else {
|
|
170
|
+
el.style[key] = property[key];
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
171
174
|
}
|
|
172
|
-
}
|
|
173
|
-
return
|
|
175
|
+
});
|
|
176
|
+
return this;
|
|
174
177
|
}
|
|
175
|
-
|
|
176
|
-
if (
|
|
177
|
-
el
|
|
178
|
+
if (typeof property === "string") {
|
|
179
|
+
if (value === void 0) {
|
|
180
|
+
const el = this[0];
|
|
181
|
+
if (el instanceof HTMLElement || el instanceof SVGElement) {
|
|
182
|
+
const doc = el.ownerDocument;
|
|
183
|
+
const win = doc ? doc.defaultView : null;
|
|
184
|
+
if (win) {
|
|
185
|
+
return win.getComputedStyle(el).getPropertyValue(property) || win.getComputedStyle(el)[property] || "";
|
|
186
|
+
} else {
|
|
187
|
+
return el.style[property] || "";
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
return "";
|
|
178
191
|
}
|
|
179
|
-
|
|
192
|
+
this.forEach((el) => {
|
|
193
|
+
if (el instanceof HTMLElement || el instanceof SVGElement) {
|
|
194
|
+
if (property.includes("-")) {
|
|
195
|
+
el.style.setProperty(property, String(value));
|
|
196
|
+
} else {
|
|
197
|
+
el.style[property] = value;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
});
|
|
201
|
+
}
|
|
180
202
|
return this;
|
|
181
203
|
}
|
|
182
204
|
|
|
@@ -381,6 +403,8 @@ var eventMethods = {
|
|
|
381
403
|
var attributes_exports = {};
|
|
382
404
|
__export(attributes_exports, {
|
|
383
405
|
attr: () => attr,
|
|
406
|
+
prop: () => prop,
|
|
407
|
+
removeAttr: () => removeAttr,
|
|
384
408
|
val: () => val
|
|
385
409
|
});
|
|
386
410
|
function attr(name, value) {
|
|
@@ -408,6 +432,24 @@ function val(value) {
|
|
|
408
432
|
});
|
|
409
433
|
return this;
|
|
410
434
|
}
|
|
435
|
+
function removeAttr(name) {
|
|
436
|
+
this.forEach((el) => {
|
|
437
|
+
if (el instanceof Element) el.removeAttribute(name);
|
|
438
|
+
});
|
|
439
|
+
return this;
|
|
440
|
+
}
|
|
441
|
+
function prop(name, value) {
|
|
442
|
+
if (value === void 0) {
|
|
443
|
+
const el = this[0];
|
|
444
|
+
return el instanceof Element ? el[name] : void 0;
|
|
445
|
+
}
|
|
446
|
+
this.forEach((el) => {
|
|
447
|
+
if (el instanceof Element) {
|
|
448
|
+
el[name] = value;
|
|
449
|
+
}
|
|
450
|
+
});
|
|
451
|
+
return this;
|
|
452
|
+
}
|
|
411
453
|
|
|
412
454
|
// src/modules/dom/content.ts
|
|
413
455
|
var content_exports = {};
|
|
@@ -1310,7 +1352,7 @@ async function getText(url, option) {
|
|
|
1310
1352
|
throw new Error(`HTTP Error: ${response.status}`);
|
|
1311
1353
|
}
|
|
1312
1354
|
const text2 = await response.text();
|
|
1313
|
-
return text2
|
|
1355
|
+
return text2;
|
|
1314
1356
|
}
|
|
1315
1357
|
|
|
1316
1358
|
// src/modules/http/post.ts
|
|
@@ -1881,7 +1923,7 @@ var __ = init;
|
|
|
1881
1923
|
*/
|
|
1882
1924
|
/**
|
|
1883
1925
|
* @file src/modules/css/styles.ts
|
|
1884
|
-
* @version 2.0.
|
|
1926
|
+
* @version 2.0.3
|
|
1885
1927
|
* @since 2.0.0
|
|
1886
1928
|
* @license GPL-3.0-or-later
|
|
1887
1929
|
* @copyright Sven Minio 2026
|
|
@@ -2010,7 +2052,7 @@ var __ = init;
|
|
|
2010
2052
|
*/
|
|
2011
2053
|
/**
|
|
2012
2054
|
* @file src/modules/dom/attributes.ts
|
|
2013
|
-
* @version 2.0
|
|
2055
|
+
* @version 2.1.0
|
|
2014
2056
|
* @since 2.0.0
|
|
2015
2057
|
* @license GPL-3.0-or-later
|
|
2016
2058
|
* @copyright Sven Minio 2026
|
|
@@ -2163,7 +2205,7 @@ var __ = init;
|
|
|
2163
2205
|
*/
|
|
2164
2206
|
/**
|
|
2165
2207
|
* @file src/modules/http/get.ts
|
|
2166
|
-
* @version 2.0.
|
|
2208
|
+
* @version 2.0.4
|
|
2167
2209
|
* @since 2.0.0
|
|
2168
2210
|
* @license GPL-3.0-or-later
|
|
2169
2211
|
* @copyright Sven Minio 2026
|
|
@@ -2245,7 +2287,7 @@ var __ = init;
|
|
|
2245
2287
|
*/
|
|
2246
2288
|
/**
|
|
2247
2289
|
* @file src/index.ts
|
|
2248
|
-
* @version 2.
|
|
2290
|
+
* @version 2.1.1
|
|
2249
2291
|
* @since 2.0.0
|
|
2250
2292
|
* @license GPL-3.0-or-later
|
|
2251
2293
|
* @copyright Sven Minio 2026
|