Skip to content

Commit 167e0a0

Browse files
authored
Merge pull request #2 from oguzhan18/added-docs
Write docs and added readme
2 parents 6b198c1 + 71cc488 commit 167e0a0

File tree

16 files changed

+197
-100
lines changed

16 files changed

+197
-100
lines changed

.DS_Store

6 KB
Binary file not shown.

README.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# HTML Attribute Manager
2+
`HtmlAttributeManager` is a JavaScript class for managing HTML elements with specific attributes.
3+
4+
## Installation
5+
````bash
6+
npm install html-attribute-manager
7+
````
8+
## Usage
9+
First, import `HtmlAttributeManager` into your JavaScript file:
10+
11+
`````bash
12+
const HtmlAttributeManager = require('html-attribute-manager');
13+
`````
14+
Then, create an instance of HtmlAttributeManager by providing an object containing attribute-function pairs:
15+
16+
````bash
17+
const attributeManager = new HtmlAttributeManager({
18+
"toggle-visibility": "toggleVisibility",
19+
"change-color": "changeColor"
20+
});
21+
````
22+
## Constructor
23+
HtmlAttributeManager(attributeName, functionName)
24+
Creates an instance of HtmlAttributeManager.
25+
26+
* attributeName (`string`): The name of the HTML attribute to search for.
27+
28+
* functionName (`string`): The name of the function to call for each matching element.
29+
30+
## Methods
31+
`handleEvent()`
32+
Finds HTML elements with the specified attribute and calls the corresponding function.
33+
`destroy()`
34+
Removes the event listener when the instance is no longer needed.
35+
## Example
36+
````javascript
37+
// Define functions
38+
window.toggleVisibility = function(element, value) {
39+
if (value === 'true') {
40+
element.style.display = 'block';
41+
} else {
42+
element.style.display = 'none';
43+
}
44+
};
45+
46+
window.changeColor = function(element, color) {
47+
element.style.color = color;
48+
};
49+
50+
// Create an instance of HtmlAttributeManager
51+
const attributeManager = new HtmlAttributeManager({
52+
"toggle-visibility": "toggleVisibility",
53+
"change-color": "changeColor"
54+
});
55+
````
56+
## Contributing
57+
Contributions are welcome! Please feel free to submit issues or pull requests on <a href="https://github.com/oguzhan18/html-attribute-manager" target="_blank">Github</a>.
58+
59+
## License
60+
This project is licensed under the MIT License - see the LICENSE file for details.

docs/.DS_Store

6 KB
Binary file not shown.

docs/README.md

Lines changed: 54 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,60 @@
1-
# JS UI Documentation
2-
Welcome to JS UI Documentation, everything you need to know about working with JS-UI CSS and related tools can be found here.
1+
# HTML Attribute Manager
2+
`HtmlAttributeManager` is a JavaScript class for managing HTML elements with specific attributes.
33

4+
## Installation
5+
````bash
6+
npm install html-attribute-manager
7+
````
8+
## Usage
9+
First, import `HtmlAttributeManager` into your JavaScript file:
410

11+
`````bash
12+
const HtmlAttributeManager = require('html-attribute-manager');
13+
`````
14+
Then, create an instance of HtmlAttributeManager by providing an object containing attribute-function pairs:
515

6-
## The JS UI
7-
JS UI is a component library that you can develop very quickly without requiring any framework. It is a general UI library. The difference from other UI libraries is that you can style your HTML code in a class just like you write CSS in classes inside any HTML tag.
8-
So how do you start? Check out our [getting started guide](/getting-started) to understand how it works and go from there.
16+
````bash
17+
const attributeManager = new HtmlAttributeManager({
18+
"toggle-visibility": "toggleVisibility",
19+
"change-color": "changeColor"
20+
});
21+
````
22+
## Constructor
23+
HtmlAttributeManager(attributeName, functionName)
24+
Creates an instance of HtmlAttributeManager.
925

10-
> Got a great use case for us to demo right here? Submit it to us on [message](https://www.jengal.com)!
26+
* attributeName (`string`): The name of the HTML attribute to search for.
27+
28+
* functionName (`string`): The name of the function to call for each matching element.
1129

30+
## Methods
31+
`handleEvent()`
32+
Finds HTML elements with the specified attribute and calls the corresponding function.
33+
`destroy()`
34+
Removes the event listener when the instance is no longer needed.
35+
## Example
36+
````javascript
37+
// Define functions
38+
window.toggleVisibility = function(element, value) {
39+
if (value === 'true') {
40+
element.style.display = 'block';
41+
} else {
42+
element.style.display = 'none';
43+
}
44+
};
1245

46+
window.changeColor = function(element, color) {
47+
element.style.color = color;
48+
};
49+
50+
// Create an instance of HtmlAttributeManager
51+
const attributeManager = new HtmlAttributeManager({
52+
"toggle-visibility": "toggleVisibility",
53+
"change-color": "changeColor"
54+
});
55+
````
56+
## Contributing
57+
Contributions are welcome! Please feel free to submit issues or pull requests on <a href="https://github.com/oguzhan18/html-attribute-manager" target="_blank">Github</a>.
58+
59+
## License
60+
This project is licensed under the MIT License - see the LICENSE file for details.

docs/_coverpage.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11

2-
<span><img width="200" src="images/logo.png"></span>
2+
<span><svg width="256px" height="256px" viewBox="-1.26 -1.26 20.52 20.52" xmlns="http://www.w3.org/2000/svg" mirror-in-rtl="true" fill="#000000" stroke="#000000" transform="rotate(0)" stroke-width="0.45"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round" stroke="#CCCCCC" stroke-width="0.18"></g><g id="SVGRepo_iconCarrier"> <path fill="#f0f0f0" d="M12.6 0H1.4A1.417 1.417 0 0 0 0 1.43v15.14A1.417 1.417 0 0 0 1.4 18h11.2a1.355 1.355 0 0 0 .2-.02A4.992 4.992 0 0 1 13 8a5.468 5.468 0 0 1 1 .1V1.43A1.417 1.417 0 0 0 12.6 0zM5 12H3a1 1 0 0 1 0-2h2a1 1 0 0 1 0 2zm3-4H3a1 1 0 0 1 0-2h5a1 1 0 0 1 0 2zm3-4H3.03a1 1 0 0 1 0-2H11a1 1 0 0 1 0 2z"></path> <path fill="#f0f0f0" d="M12.89 14.55a.993.993 0 0 1-.44 1.34.934.934 0 0 1-.45.11.98.98 0 0 1-.89-.55l-1-2a.965.965 0 0 1 0-.89c.01-.03.03-.06.04-.09l.96-1.92a1 1 0 1 1 1.78.9L12.12 13zM17.89 13.44l-1 2.01A.98.98 0 0 1 16 16a1.05 1.05 0 0 1-.45-.1 1.007 1.007 0 0 1-.44-1.35l.77-1.55-.77-1.55a1 1 0 1 1 1.78-.9l.96 1.91.04.09a.965.965 0 0 1 0 .89z"></path> </g></svg></span>
33

44
[//]: # (# <span style="color:black; font-weight:800;">JS UI <small>1.0.0</small></span> )
55
<span>
6-
Powerful, extensible, and feature-packed frontend toolkit. Build and customize with Sass, utilize prebuilt grid system and components, and bring projects to life with powerful JavaScript plugins.
6+
Get rid of framework dependency now. HTML attribute manager system, where we can create and manage HTML attributes with HAT, is completely up to your discretion.
77
</span>
88

99

10-
[GitHub](https://github.com/#)
11-
[Get Started](/layout-property/js-slider)
10+
[GitHub](https://github.com/oguzhan18/html-attribute-manager)
11+
[Get Started](/layout-property/html-attribute-manager)

docs/_footer.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
**JS UI** Documentation 2024 - [Visit our repo](https://github.com/#)
2+
**JS UI** Documentation 2024 - [Visit our repo](https://github.com/oguzhan18/html-attribute-manager)

docs/_sidebar.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
* Getting Started
2-
* [Getting Started](/getting-started/getting-started)
3-
* Library
4-
* [JS Slider](/layout-property/js-slider)
2+
* [Installation](/getting-started/getting-started)
3+
* Usage
4+
* [Usage](/layout-property/html-attribute-manager)
Lines changed: 6 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,16 @@
1-
# Let's Add to Our Project
1+
# HTML Attribute Manager
22

3-
There are 2 different methods when using Glasses UI. The first method is to install it as a package and take advantage
4-
of the internal files. The second method is to use the library codes from CDN in html.
3+
HtmlAttributeManager is a JavaScript class for managing HTML elements with specific attributes.
54

6-
## CDN Usage and Project creation.
75

8-
```html
6+
## Installation
97

10-
<html>
11-
<head>
12-
<link rel="stylesheet" crossorigin="anonymous" href="
13-
https://glasses-ui.vercel.app/styles.88fede6400456408.css">
14-
</head>
15-
<body>
16-
17-
</body>
18-
</html>
19-
```
20-
21-
You are now ready to create your first app with `CDN`. Create a `(HTML)` project and add the following code
22-
23-
24-
> If you paste the upload code into a (`.html`) file
25-
> '`<body></body>`, you can use it any way you want. If you have a (HTML) file and you want to add it, you can use it by
26-
> pasting directly (`<link rel="stylesheet" crossorigin="anonymous"`
27-
> `href="https://glasses-ui.vercel.app/styles.88fede6400456408.css">`) .
28-
29-
### Installing and using NPM.
8+
To use HTML Attribute Manager, you can install it via npm:
309

3110
```bash
32-
npm i glasses-ui
11+
npm install html-attribute-manager
3312
```
3413

35-
* NodeJS and NPM - install latest LTS
36-
* Yarn - run `[sudo] npm i -g yarn` if it is not already installed
37-
* Run the `npm` command above in the `NodeJS` based framework project you want to use.
38-
39-
## Running the application
40-
14+
You can include `npmjs` in your project as you wish and use it in any javascript framework.
4115

42-
Below I will explain how you can install and use Glasses UI in a newly created Angular project.
4316

44-
* The first step, is to install Angular CLI `npm install -g @angular/cli`
45-
* The second step, is to create a new angular project. `ng new glasses-ui-user-guide`
46-
> `[glasses-ui-user-guid]` you can give any project name you want to the field.
47-
* The third step is in the `styles.scss` or styles.css file in the src folder in your created angular project.
48-
`@import 'glasses-ui/style';`
49-
If you add the code, you can use `Glasses UI` library in the whole project.
50-
<br>
51-
<br>
52-
I showed you how to download the library in Angular framework and import it into the project. However, you can use it easily by importing it into your (html) or (css) file in the framework you want.
53-
<br>
54-
<br>
55-

docs/images/.DS_Store

6 KB
Binary file not shown.

docs/images/logo.png

-170 KB
Loading

0 commit comments

Comments
 (0)