nodality 1.0.0-beta.20 → 1.0.0-beta.22
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/LICENSE +21 -0
- package/README.md +108 -0
- package/layout/text.js +1 -1
- package/package.json +2 -2
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) [year] [fullname]
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
# nodality
|
|
2
|
+
Simple UI JS library using node-based approach.
|
|
3
|
+
|
|
4
|
+
## Installation
|
|
5
|
+
|
|
6
|
+
The easiest way to get up and running is to use **npm**:
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
npm create nodality@latest my-app
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## Tutorial
|
|
15
|
+
## Step 1
|
|
16
|
+
|
|
17
|
+
Define an array of elements you want to display in your user interface:
|
|
18
|
+
|
|
19
|
+
```js
|
|
20
|
+
let elements = [
|
|
21
|
+
{
|
|
22
|
+
type: "h1",
|
|
23
|
+
text: "Hello"
|
|
24
|
+
}
|
|
25
|
+
];
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## Step 2
|
|
31
|
+
|
|
32
|
+
Define an array of nodes that will adjust the behaviour of the element.
|
|
33
|
+
This particular node will add the **stroked text** effect:
|
|
34
|
+
|
|
35
|
+
```js
|
|
36
|
+
let nodes = [
|
|
37
|
+
{
|
|
38
|
+
op: "blast"
|
|
39
|
+
}
|
|
40
|
+
];
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## Step 3
|
|
46
|
+
|
|
47
|
+
Add the `nodes` array using the `.nodes()` modifier, and use the `.set()` method to mount the result of the code to the website.
|
|
48
|
+
Use the `code: true` option to also display the source code of the elements:
|
|
49
|
+
|
|
50
|
+
```js
|
|
51
|
+
new Des()
|
|
52
|
+
.nodes(nodes)
|
|
53
|
+
.add(elements)
|
|
54
|
+
.set({
|
|
55
|
+
mount: "#mount",
|
|
56
|
+
code: true
|
|
57
|
+
});
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Also define a `<div>` with `id="#mount"` that will serve as a root element to render the UI.
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## Everything Together
|
|
65
|
+
|
|
66
|
+
Here is the complete working code which uses CDN for convenient testing.
|
|
67
|
+
|
|
68
|
+
```html
|
|
69
|
+
|
|
70
|
+
<!-- div for mounting the result -->
|
|
71
|
+
<div id="#mount"></div>
|
|
72
|
+
|
|
73
|
+
<script type="module">
|
|
74
|
+
import {Des} from "https://www.unpkg.com/nodality@1.0.0-beta.4/dist/index.esm.js";
|
|
75
|
+
|
|
76
|
+
let elements = [
|
|
77
|
+
{
|
|
78
|
+
type: "h1",
|
|
79
|
+
text: "Hello"
|
|
80
|
+
}
|
|
81
|
+
];
|
|
82
|
+
|
|
83
|
+
let nodes = [
|
|
84
|
+
{
|
|
85
|
+
op: "blast"
|
|
86
|
+
}
|
|
87
|
+
];
|
|
88
|
+
|
|
89
|
+
new Des()
|
|
90
|
+
.nodes(nodes)
|
|
91
|
+
.add(elements)
|
|
92
|
+
.set({
|
|
93
|
+
mount: "#mount",
|
|
94
|
+
code: true
|
|
95
|
+
});
|
|
96
|
+
</script>
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
## Result
|
|
102
|
+
<img src="https://nodalityjs.github.io/assets/images/image-2601c982f747c8e3977a2d588f61e040.png">
|
|
103
|
+
|
|
104
|
+
After running this code:
|
|
105
|
+
|
|
106
|
+
- You will see an `<h1>` element on the screen.
|
|
107
|
+
- When the user resizes the window and hits the **400–600px** breakpoint, a **stroke effect** will appear on the text, thanks to the `blast` modifier.
|
|
108
|
+
- The **resulting code** of the UI will also be displayed below the rendered element.
|
package/layout/text.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nodality",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.22",
|
|
4
4
|
"description": "A lightweight library for declarative UI elements.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.esm.js",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"scripts": {
|
|
19
19
|
"build": "webpack --config webpack.config.js",
|
|
20
20
|
"test": "jest",
|
|
21
|
-
|
|
21
|
+
"postpublish": "git add . && git commit -m \"release: v$npm_package_version\" && git tag v$npm_package_version && git push --set-upstream origin main && git push origin v$npm_package_version"
|
|
22
22
|
},
|
|
23
23
|
"jest": {
|
|
24
24
|
"testEnvironment": "jsdom",
|