@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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@k37z3r/jbase",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.1",
|
|
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
|
|
24
|
-
"homepage": "https://github.com/k37z3r/jBase-2
|
|
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
|
|
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.
|
|
34
|
+
"url": "https://github.com/k37z3r/jBase-2.git"
|
|
35
35
|
},
|
|
36
36
|
"license": "GPL-3.0-or-later",
|
|
37
37
|
"dependencies": {
|
package/wiki/DOM-Attributes.md
CHANGED
|
@@ -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
|
```
|
package/wiki/HTTP-Requests.md
CHANGED
|
@@ -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
|
-
* `
|
|
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
|
-
* `
|
|
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
|
|
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
|
-
* `
|
|
69
|
-
* `
|
|
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
|
-

|
|
4
4
|

|
|
5
5
|

|
|
6
6
|
|
package/wiki/Quick-Start.md
CHANGED
|
@@ -83,10 +83,9 @@ $('#click-me').click(() => {
|
|
|
83
83
|
});
|
|
84
84
|
|
|
85
85
|
// Hover effect
|
|
86
|
-
$('.box')
|
|
87
|
-
() => console.log('Mouse In')
|
|
88
|
-
() => console.log('Mouse Out')
|
|
89
|
-
);
|
|
86
|
+
$('.box')
|
|
87
|
+
.mouseenter(() => console.log('Mouse In'))
|
|
88
|
+
.mouseleave(() => console.log('Mouse Out'));
|
|
90
89
|
|
|
91
90
|
```
|
|
92
91
|
|