@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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@k37z3r/jbase",
3
- "version": "2.0.3",
3
+ "version": "2.1.2",
4
4
  "description": "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.",
5
5
  "private": false,
6
6
  "main": "./dist/index.cjs",
@@ -20,18 +20,18 @@
20
20
  "build": "npm run build:browser",
21
21
  "prepublishOnly": "npm run build"
22
22
  },
23
- "author": "Sven Minio (https://github.com/k37z3r/jBase-2.0)",
24
- "homepage": "https://github.com/k37z3r/jBase-2.0",
23
+ "author": "Sven Minio (https://github.com/k37z3r/jBase-2)",
24
+ "homepage": "https://github.com/k37z3r/jBase-2",
25
25
  "funding": {
26
26
  "type": "paypal",
27
27
  "url": "https://www.paypal.com/donate/?hosted_button_id=PAE6M49YXLHUU"
28
28
  },
29
29
  "bugs": {
30
- "url": "https://github.com/k37z3r/jBase-2.0/issues"
30
+ "url": "https://github.com/k37z3r/jBase-2/issues"
31
31
  },
32
32
  "repository": {
33
33
  "type": "git",
34
- "url": "https://github.com/k37z3r/jBase-2.0.git"
34
+ "url": "https://github.com/k37z3r/jBase-2.git"
35
35
  },
36
36
  "license": "GPL-3.0-or-later",
37
37
  "dependencies": {
@@ -1,4 +1,4 @@
1
- * [`attr`](#usage-attr) | [`val`](#usage-val)
1
+ * [`attr`](#usage-attr) | [`val`](#usage-val) | [`removeAttr`](#usage-removeattr) | [`prop`](#usage-prop)
2
2
 
3
3
  ---
4
4
 
@@ -25,7 +25,6 @@ const link = $('a.my-link').attr('href');
25
25
 
26
26
  // Set id and title
27
27
  $('.item').attr('id', 'item-1').attr('title', 'Item One');
28
-
29
28
  ```
30
29
 
31
30
  ---
@@ -52,5 +51,60 @@ const username = $('#username').val();
52
51
 
53
52
  // Set input value
54
53
  $('#username').val('NewUser');
54
+ ```
55
+
56
+ ---
57
+
58
+ ## <a id="usage-removeattr"></a>.removeAttr
59
+
60
+ **Description**
61
+ Remove an attribute from each element in the set of matched elements.
62
+
63
+ **Parameters**
64
+
65
+ * `name` (String): The name of the attribute to remove.
66
+
67
+ **Returns**
68
+
69
+ * (jBase): Current instance for chaining.
70
+
71
+ **Example**
72
+
73
+ ```javascript
74
+ // Remove disabled attribute to enable a button
75
+ $('button.submit').removeAttr('disabled');
76
+
77
+ // Remove readonly attribute from an input
78
+ $('.input-field').removeAttr('readonly');
79
+ ```
80
+
81
+ ---
82
+
83
+ ## <a id="usage-prop"></a>.prop
84
+
85
+ **Description**
86
+ Get the value of a property for the first element in the set of matched elements or set one or more properties for every matched element. This is especially useful for properties that do not map directly to HTML attributes (like `checked`, `disabled`, or `selectedIndex`).
87
+
88
+ **Parameters**
89
+
90
+ * `name` (String): The name of the property.
91
+ * `value` (Any, optional): The value to set. If omitted, the method acts as a getter.
92
+
93
+ **Returns**
94
+
95
+ * (Any): Value of the property (if getter).
96
+ * (jBase): Current instance for chaining (if setter).
97
+
98
+ **Example**
99
+
100
+ ```javascript
101
+ // Get checked state of a checkbox
102
+ const isChecked = $('#my-checkbox').prop('checked');
103
+
104
+ // Set a checkbox to checked
105
+ $('#my-checkbox').prop('checked', true);
106
+
107
+ // Set all inputs in a form to disabled
108
+ $('form input').prop('disabled', true);
55
109
 
56
110
  ```
@@ -2,15 +2,15 @@
2
2
 
3
3
  ---
4
4
 
5
- ## <a id="usage-get"></a>.get
5
+ ## <a id="usage-http-get"></a>.get
6
6
 
7
7
  **Description**
8
- Performs an asynchronous HTTP GET request. This method assumes the response is JSON and will automatically parse it.
8
+ Performs an asynchronous HTTP GET request. This method assumes the response is JSON and will automatically parse it. Includes an automatic timeout of 5000ms to avoid hanging requests.
9
9
 
10
10
  **Parameters**
11
11
 
12
12
  * `url` (String): A string containing the URL to which the request is sent.
13
- * `headers` (Object, optional): An object of additional header key/value pairs to send along with the request.
13
+ * `option` (RequestInit, optional): An optional RequestInit object to customize the fetch request (e.g., custom headers, mode). The method is strictly enforced as 'GET'.
14
14
 
15
15
  **Returns**
16
16
 
@@ -19,27 +19,26 @@ Performs an asynchronous HTTP GET request. This method assumes the response is J
19
19
  **Example**
20
20
 
21
21
  ```javascript
22
- $.http.get('https://api.example.com/users')
22
+ $.http.get('[https://api.example.com/users](https://api.example.com/users)')
23
23
  .then(data => {
24
24
  console.log('Users loaded:', data);
25
25
  })
26
26
  .catch(err => {
27
27
  console.error('Error loading users:', err);
28
28
  });
29
-
30
29
  ```
31
30
 
32
31
  ---
33
32
 
34
- ## <a id="usage-getText"></a>getText
33
+ ## <a id="usage-http-getText"></a>getText
35
34
 
36
35
  **Description**
37
- Performs an asynchronous HTTP GET request. This method expects a raw text or HTML response and does not attempt to parse it as JSON. Ideal for loading HTML templates or config files.
36
+ Performs an asynchronous HTTP GET request. This method expects a raw text or HTML response and does not attempt to parse it as JSON. Ideal for loading HTML templates (Server-Side Rendering Partials) or config files. Includes an automatic timeout of 5000ms.
38
37
 
39
38
  **Parameters**
40
39
 
41
40
  * `url` (String): A string containing the URL to which the request is sent.
42
- * `headers` (Object, optional): An object of additional header key/value pairs.
41
+ * `option` (RequestInit, optional): An optional RequestInit object to customize the fetch request. The method is strictly enforced as 'GET'.
43
42
 
44
43
  **Returns**
45
44
 
@@ -52,21 +51,20 @@ $.http.getText('/partials/footer.html')
52
51
  .then(html => {
53
52
  $('#footer-container').html(html);
54
53
  });
55
-
56
54
  ```
57
55
 
58
56
  ---
59
57
 
60
- ## <a id="usage-post"></a>post
58
+ ## <a id="usage-http-post"></a>post
61
59
 
62
60
  **Description**
63
- Performs an asynchronous HTTP POST request to submit data to a server. The data is automatically stringified to JSON, and the `Content-Type` is set to `application/json` by default (unless overridden).
61
+ Performs an asynchronous HTTP POST request to submit data to a server. The body is automatically stringified to JSON, and the `Content-Type` is set to `application/json`. Includes an automatic timeout of 5000ms.
64
62
 
65
63
  **Parameters**
66
64
 
67
65
  * `url` (String): A string containing the URL to which the request is sent.
68
- * `data` (Object): A plain object or array that is sent to the server.
69
- * `headers` (Object, optional): An object of additional header key/value pairs.
66
+ * `body` (Any, optional): The data to send to the server (automatically JSON serialized). Defaults to `{}`.
67
+ * `option` (RequestInit, optional): An optional RequestInit object to customize the fetch request. The method is strictly enforced as 'POST'.
70
68
 
71
69
  **Returns**
72
70
 
@@ -89,5 +87,4 @@ $.http.post('/api/register', payload)
89
87
  .catch(err => {
90
88
  console.error('Registration failed:', err);
91
89
  });
92
-
93
90
  ```
package/wiki/Home.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Welcome to the jBase Documentation
2
2
 
3
- ![Version](https://img.shields.io/badge/version-2.0.0-blue.svg?style=flat-square)
3
+ ![Version](https://img.shields.io/badge/version-2.1.2-blue.svg?style=flat-square)
4
4
  ![License](https://img.shields.io/badge/license-GPL--3.0-green.svg?style=flat-square)
5
5
  ![Lightweight](https://img.shields.io/badge/size-lightweight-orange.svg?style=flat-square)
6
6
 
@@ -83,10 +83,9 @@ $('#click-me').click(() => {
83
83
  });
84
84
 
85
85
  // Hover effect
86
- $('.box').hover(
87
- () => console.log('Mouse In'), // Enter
88
- () => console.log('Mouse Out') // Leave
89
- );
86
+ $('.box')
87
+ .mouseenter(() => console.log('Mouse In'))
88
+ .mouseleave(() => console.log('Mouse Out'));
90
89
 
91
90
  ```
92
91