@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.
@@ -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.2
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
- * * Sets or gets the value of a style property for the selected elements.
16
+ * * Gets a CSS property value from the first element or sets one/multiple CSS properties for all elements.
17
17
  * @param property
18
- * * The CSS property name (camelCase).
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, the method acts as a getter.
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 computed style value (string) if acting as a getter, or the current jBase instance if setting.
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,CAoB1F"}
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.2
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAMtB,CAAC"}
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
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,CAgB9E"}
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.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
  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 (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] || "";
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
- this.forEach((el) => {
164
- if (el instanceof HTMLElement || el instanceof SVGElement) {
165
- el.style[property] = value;
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 ? JSON.parse(text2) : {};
1325
+ return text2;
1284
1326
  }
1285
1327
 
1286
1328
  // src/modules/http/post.ts
@@ -1841,7 +1883,7 @@ function parseHTML2(html2) {
1841
1883
  */
1842
1884
  /**
1843
1885
  * @file src/modules/css/styles.ts
1844
- * @version 2.0.2
1886
+ * @version 2.0.3
1845
1887
  * @since 2.0.0
1846
1888
  * @license GPL-3.0-or-later
1847
1889
  * @copyright Sven Minio 2026
@@ -1970,7 +2012,7 @@ function parseHTML2(html2) {
1970
2012
  */
1971
2013
  /**
1972
2014
  * @file src/modules/dom/attributes.ts
1973
- * @version 2.0.2
2015
+ * @version 2.1.0
1974
2016
  * @since 2.0.0
1975
2017
  * @license GPL-3.0-or-later
1976
2018
  * @copyright Sven Minio 2026
@@ -2123,7 +2165,7 @@ function parseHTML2(html2) {
2123
2165
  */
2124
2166
  /**
2125
2167
  * @file src/modules/http/get.ts
2126
- * @version 2.0.3
2168
+ * @version 2.0.4
2127
2169
  * @since 2.0.0
2128
2170
  * @license GPL-3.0-or-later
2129
2171
  * @copyright Sven Minio 2026
@@ -2205,7 +2247,7 @@ function parseHTML2(html2) {
2205
2247
  */
2206
2248
  /**
2207
2249
  * @file src/index.ts
2208
- * @version 2.0.2
2250
+ * @version 2.1.1
2209
2251
  * @since 2.0.0
2210
2252
  * @license GPL-3.0-or-later
2211
2253
  * @copyright Sven Minio 2026