@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.
@@ -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.0.3
4
- * @homepage https://github.com/k37z3r/jBase-2.0
5
- * @author Sven Minio (https://github.com/k37z3r/jBase-2.0)
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.0)
7
+ * @copyright 2026 Sven Minio (https://github.com/k37z3r/jBase-2)
8
8
  */
9
9
  "use strict";
10
10
  (() => {
@@ -170,24 +170,46 @@
170
170
  css: () => css
171
171
  });
172
172
  function css(property, value) {
173
- if (value === void 0) {
174
- const el = this[0];
175
- if (el instanceof HTMLElement || el instanceof SVGElement) {
176
- const doc = el.ownerDocument;
177
- const win = doc ? doc.defaultView : null;
178
- if (win) {
179
- return win.getComputedStyle(el)[property];
180
- } else {
181
- return el.style[property] || "";
173
+ if (typeof property === "object" && property !== null) {
174
+ this.forEach((el) => {
175
+ if (el instanceof HTMLElement || el instanceof SVGElement) {
176
+ for (const key in property) {
177
+ if (Object.prototype.hasOwnProperty.call(property, key)) {
178
+ if (key.includes("-")) {
179
+ el.style.setProperty(key, String(property[key]));
180
+ } else {
181
+ el.style[key] = property[key];
182
+ }
183
+ }
184
+ }
182
185
  }
183
- }
184
- return "";
186
+ });
187
+ return this;
185
188
  }
186
- this.forEach((el) => {
187
- if (el instanceof HTMLElement || el instanceof SVGElement) {
188
- el.style[property] = value;
189
+ if (typeof property === "string") {
190
+ if (value === void 0) {
191
+ const el = this[0];
192
+ if (el instanceof HTMLElement || el instanceof SVGElement) {
193
+ const doc = el.ownerDocument;
194
+ const win = doc ? doc.defaultView : null;
195
+ if (win) {
196
+ return win.getComputedStyle(el).getPropertyValue(property) || win.getComputedStyle(el)[property] || "";
197
+ } else {
198
+ return el.style[property] || "";
199
+ }
200
+ }
201
+ return "";
189
202
  }
190
- });
203
+ this.forEach((el) => {
204
+ if (el instanceof HTMLElement || el instanceof SVGElement) {
205
+ if (property.includes("-")) {
206
+ el.style.setProperty(property, String(value));
207
+ } else {
208
+ el.style[property] = value;
209
+ }
210
+ }
211
+ });
212
+ }
191
213
  return this;
192
214
  }
193
215
  var init_styles = __esm({
@@ -195,7 +217,7 @@
195
217
  "use strict";
196
218
  /**
197
219
  * @file src/modules/css/styles.ts
198
- * @version 2.0.2
220
+ * @version 2.0.3
199
221
  * @since 2.0.0
200
222
  * @license GPL-3.0-or-later
201
223
  * @copyright Sven Minio 2026
@@ -576,6 +598,8 @@
576
598
  var attributes_exports = {};
577
599
  __export(attributes_exports, {
578
600
  attr: () => attr,
601
+ prop: () => prop,
602
+ removeAttr: () => removeAttr,
579
603
  val: () => val
580
604
  });
581
605
  function attr(name, value) {
@@ -603,12 +627,30 @@
603
627
  });
604
628
  return this;
605
629
  }
630
+ function removeAttr(name) {
631
+ this.forEach((el) => {
632
+ if (el instanceof Element) el.removeAttribute(name);
633
+ });
634
+ return this;
635
+ }
636
+ function prop(name, value) {
637
+ if (value === void 0) {
638
+ const el = this[0];
639
+ return el instanceof Element ? el[name] : void 0;
640
+ }
641
+ this.forEach((el) => {
642
+ if (el instanceof Element) {
643
+ el[name] = value;
644
+ }
645
+ });
646
+ return this;
647
+ }
606
648
  var init_attributes = __esm({
607
649
  "src/modules/dom/attributes.ts"() {
608
650
  "use strict";
609
651
  /**
610
652
  * @file src/modules/dom/attributes.ts
611
- * @version 2.0.2
653
+ * @version 2.1.0
612
654
  * @since 2.0.0
613
655
  * @license GPL-3.0-or-later
614
656
  * @copyright Sven Minio 2026
@@ -1707,14 +1749,14 @@
1707
1749
  throw new Error(`HTTP Error: ${response.status}`);
1708
1750
  }
1709
1751
  const text2 = await response.text();
1710
- return text2 ? JSON.parse(text2) : {};
1752
+ return text2;
1711
1753
  }
1712
1754
  var init_get = __esm({
1713
1755
  "src/modules/http/get.ts"() {
1714
1756
  "use strict";
1715
1757
  /**
1716
1758
  * @file src/modules/http/get.ts
1717
- * @version 2.0.3
1759
+ * @version 2.0.4
1718
1760
  * @since 2.0.0
1719
1761
  * @license GPL-3.0-or-later
1720
1762
  * @copyright Sven Minio 2026
@@ -1886,7 +1928,7 @@
1886
1928
  init_data();
1887
1929
  /**
1888
1930
  * @file src/index.ts
1889
- * @version 2.0.2
1931
+ * @version 2.1.1
1890
1932
  * @since 2.0.0
1891
1933
  * @license GPL-3.0-or-later
1892
1934
  * @copyright Sven Minio 2026