vaderjs 1.0.0-rv1 → 1.0.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.
Files changed (3) hide show
  1. package/package.json +1 -1
  2. package/readme.md +101 -0
  3. package/readme.MD +0 -54
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vaderjs",
3
- "version": "1.0.0-rv1",
3
+ "version": "1.0.1",
4
4
  "description": "A Reactive Framework for Single-Page Applications (SPA)",
5
5
  "main": "vader.js",
6
6
  "scripts": {
package/readme.md ADDED
@@ -0,0 +1,101 @@
1
+ # VaderJS: A Reactive Framework for SPAs
2
+
3
+ [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/Postr-Inc/Vader.js/blob/main/LICENSE)
4
+
5
+ VaderJS is a powerful reactive framework for building Single-Page Applications (SPAs), inspired by React.js.
6
+
7
+ ## Key Features
8
+
9
+ ### Declarative Routing
10
+
11
+ ```javascript
12
+ const router = new vaderRouter('/');
13
+ router.use('/');
14
+ router.on('/test/:hello', (req) => {
15
+ console.log(req.params);
16
+ });
17
+ router.start();
18
+ ```
19
+
20
+ ### State Management
21
+
22
+ ```javascript
23
+ const [state, setState] = useState("count", initialState);
24
+ function increment(){
25
+ setState(state + 1)
26
+ }
27
+ registerFunction('increment', increment)
28
+ useEffect((state)=>{
29
+ console.log('New State for count' + state)
30
+ }[state])
31
+ <button onclick="increment()">Increment</button>
32
+ ```
33
+
34
+ ### Function Binding
35
+
36
+ ```javascript
37
+ registerFunction('login', login);
38
+ return html`<button onclick="login()">Login</button>`;
39
+ ```
40
+
41
+ ### Authentication & Authorization
42
+
43
+ ```javascript
44
+ const auth = useAuth({
45
+ rulesets: rules,
46
+ user: currentUser
47
+ });
48
+ if (auth.can('edit')) {
49
+ // Display edit button
50
+ }
51
+ ```
52
+
53
+ ### Global State Management
54
+
55
+ ```javascript
56
+ const store = createStore(initialState);
57
+ const { state, setState, subscribe } = store;
58
+ ```
59
+
60
+ ### Simplified Component Creation
61
+
62
+ ```javascript
63
+ async function myComponent(props){
64
+ return vhtml`
65
+ <div>${props.message}</div>
66
+ `
67
+ }
68
+
69
+ async function app(props){
70
+ let html = await createComponent(myComponent, {
71
+ message: 'Hello Vader'
72
+ })
73
+ return vhtml `
74
+ <div>
75
+ ${html}
76
+ </div>
77
+ `
78
+ }
79
+
80
+ ```
81
+
82
+ ## Get Started
83
+
84
+ 1. Install VaderJS:
85
+ ```sh
86
+ npm install vaderjs
87
+ ```
88
+
89
+ 2. Import components and utilities into your project.
90
+
91
+ 3. Use VaderJS features for routing, state management, auth, and more.
92
+
93
+ 4. Create dynamic SPAs with enhanced user experiences.
94
+
95
+ ## License
96
+
97
+ VaderJS is released under the MIT License. See the [LICENSE](https://github.com/Postr-Inc/Vader.js/blob/main/LICENSE) file for details.
98
+
99
+ ## Join the Community
100
+
101
+ Connect with the VaderJS community on [GitHub](https://github.com/Postr-Inc/Vader.js). Contribute, share feedback, and improve VaderJS for SPA development.
package/readme.MD DELETED
@@ -1,54 +0,0 @@
1
- # VaderJS: A Reactive Framework for Single-Page Applications (SPA)
2
-
3
- [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/Postr-Inc/Vader.js/blob/main/LICENSE) [![npm version](https://img.shields.io/npm/v/vaderjs.svg?style=flat)](https://www.npmjs.com/package/vaderjs)
4
-
5
- VaderJS is a powerful and innovative reactive framework designed to simplify the development of Single-Page Applications (SPAs). Built with inspiration from React.js, VaderJS empowers developers to create dynamic and interactive web applications by leveraging a collection of functions and utilities tailored to the SPA paradigm. This overview provides insights into the core features and functionalities of VaderJS based on the discussions and code snippets shared in this conversation.
6
-
7
- ## Key Features
8
-
9
- ### Declarative Routing
10
-
11
- VaderJS offers a declarative routing system that simplifies the navigation within your SPA. The `vaderRouter` class provides an intuitive interface for defining routes, handling errors, and managing URL parameters. By using the `start`, `get`, `use`, and `on` methods, developers can effortlessly create routes and associate them with corresponding components, enhancing the user experience through smooth navigation.
12
-
13
- ### State Management
14
-
15
- The framework includes a versatile state management solution with functions like `useState`, allowing developers to efficiently manage and update the application's state. This approach ensures that your components remain responsive to changes and user interactions. Additionally, the `useSyncStore` and `useExternalStore` hooks facilitate synchronization and management of state across different components and interactions.
16
-
17
- ### Function Binding
18
-
19
- VaderJS introduces the `registerFunction` utility, enabling seamless binding of JavaScript functions to vhtml elements within your components. This feature enhances code organization and promotes reusability by enabling developers to create functions that interact directly with the component's scope.
20
-
21
- ### Authentication and Authorization
22
-
23
- With the `useAuth` function, VaderJS provides a comprehensive authentication and authorization system. Developers can define rulesets, roles, and conditions to control user access to specific actions and components. This feature ensures that your application remains secure and grants the appropriate level of access to authorized users.
24
-
25
- ### Global State Management
26
-
27
- The framework includes the `createStore` function, which establishes a global state management solution. This centralized store allows components to subscribe to state changes and maintain synchronization throughout the application. The `useSyncStore` and `useExternalStore` hooks provide further options for accessing and manipulating global state.
28
-
29
- ### Simplified Component Creation
30
-
31
- VaderJS streamlines the process of creating components with the `createComponent` function. This utility enables developers to define component functions and props, facilitating the creation of reusable and modular UI elements.
32
-
33
- ## Get Started with VaderJS
34
-
35
- To start using VaderJS in your SPA project, follow these steps:
36
-
37
- 1. Install VaderJS from your preferred package manager:
38
- ```sh
39
- npm install vaderjs
40
- ```
41
-
42
- 2. Import the necessary components and utilities into your project files.
43
-
44
- 3. Leverage the provided classes, functions, and hooks to implement routing, state management, function binding, authentication, and more.
45
-
46
- 4. Utilize the declarative syntax and intuitive APIs to create dynamic and responsive SPAs with enhanced user experiences.
47
-
48
- ## License
49
-
50
- VaderJS is released under the MIT License. See the [LICENSE](https://github.com/Postr-Inc/Vader.js/blob/main/LICENSE) file for more details.
51
-
52
- ## Join the VaderJS Community
53
-
54
- Stay connected with the VaderJS community by following our [GitHub repository](https://github.com/Postr-Inc/Vader.js) and engaging in discussions, submitting issues, and contributing to the project's development. We welcome your feedback and contributions to make VaderJS even better for SPA development.