wj-elements 0.0.30 → 0.0.31
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/README.md +19 -7
- package/dist/wj-carousel.js +18 -17
- package/dist/wj-img.js +1 -1
- package/package.json +20 -3
package/README.md
CHANGED
|
@@ -1,21 +1,27 @@
|
|
|
1
1
|
# WJ Elements
|
|
2
|
-
WebJET
|
|
2
|
+
WebJET Elements is a modern set of user interface tools harnessing the power of web components designed to simplify web application development. It provides a collection of encapsulated and reusable elements that can greatly increase the efficiency and maintainability of web development projects. They offer easy integration with React and Vue.
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
Include WebJET Elements in your project using [CDN](#inštalácia-s-cdn) or install it using [npm](#inštalácia-s-npm).
|
|
5
|
+
|
|
6
|
+
Documentation: [elements.webjet](https://elements.webjet.sk/)
|
|
7
|
+
|
|
8
|
+
Source: [https://github.com/lencys/wj-elements](https://github.com/lencys/wj-elements)
|
|
9
|
+
|
|
10
|
+
Discord: [WJElements](https://discord.com/invite/b5DqKM997s)
|
|
5
11
|
|
|
6
12
|
## Inštalácia s npm
|
|
7
13
|
|
|
8
|
-
|
|
14
|
+
Using the npm package manager, you can insert Elements source files into almost any project.
|
|
9
15
|
|
|
10
|
-
|
|
16
|
+
Make sure you have Node.js installed on your computer before proceeding. To set up the environment for Elements, see these instructions.
|
|
11
17
|
|
|
12
|
-
|
|
18
|
+
Install WebJet Elements using npm:
|
|
13
19
|
|
|
14
20
|
```shell
|
|
15
21
|
$ npm install wj-elements
|
|
16
22
|
```
|
|
17
23
|
|
|
18
|
-
|
|
24
|
+
If there was a previous installation of the Ionic CLI, it will need to be uninstalled due to a package name change.
|
|
19
25
|
|
|
20
26
|
```shell
|
|
21
27
|
$ npm uninstall wj-elements
|
|
@@ -23,10 +29,16 @@ $ npm uninstall wj-elements
|
|
|
23
29
|
|
|
24
30
|
## Inštalácia s CDN
|
|
25
31
|
|
|
26
|
-
|
|
32
|
+
Use CDN and include compiled CSS and JS files of WebJET Elements in your project.
|
|
27
33
|
|
|
28
34
|
```html
|
|
29
35
|
<script type="module" src="https://cdn.jsdelivr.net/gh/lencys/wj-elements@dddb1c19734498c5b2a17f2e6ed605d0cd40d02e/wj-master.js"></script>
|
|
30
36
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/lencys/wj-elements@e5cdd8566b4acaad5c11040bfbb4e09e170074c9/style.css" />
|
|
31
37
|
```
|
|
32
38
|
|
|
39
|
+
### Basic usage
|
|
40
|
+
|
|
41
|
+
```html
|
|
42
|
+
<wj-button>Button</wj-button>
|
|
43
|
+
```
|
|
44
|
+
|
package/dist/wj-carousel.js
CHANGED
|
@@ -10,7 +10,6 @@ class Carousel extends WJElement {
|
|
|
10
10
|
constructor() {
|
|
11
11
|
super();
|
|
12
12
|
__publicField(this, "className", "Carousel");
|
|
13
|
-
this.activeSlide = 0;
|
|
14
13
|
this.slidePerPage = 1;
|
|
15
14
|
}
|
|
16
15
|
set activeSlide(value) {
|
|
@@ -48,6 +47,9 @@ class Carousel extends WJElement {
|
|
|
48
47
|
setupAttributes() {
|
|
49
48
|
this.isShadowRoot = "open";
|
|
50
49
|
}
|
|
50
|
+
beforeDraw(context, store, params) {
|
|
51
|
+
this.cloneFirstAndLastItems();
|
|
52
|
+
}
|
|
51
53
|
draw(context, store, params) {
|
|
52
54
|
let fragment = document.createDocumentFragment();
|
|
53
55
|
let native = document.createElement("div");
|
|
@@ -67,24 +69,8 @@ class Carousel extends WJElement {
|
|
|
67
69
|
native.appendChild(this.createThumbnails());
|
|
68
70
|
fragment.appendChild(native);
|
|
69
71
|
this.slides = slides;
|
|
70
|
-
this.cloneFirstAndLastItems();
|
|
71
72
|
return fragment;
|
|
72
73
|
}
|
|
73
|
-
setIntersectionObserver() {
|
|
74
|
-
this.intersectionObserver = new IntersectionObserver((entries) => {
|
|
75
|
-
entries.forEach((entry) => {
|
|
76
|
-
this.entriesMap.set(entry.target, entry);
|
|
77
|
-
});
|
|
78
|
-
}, {
|
|
79
|
-
root: this.context.querySelector(".carousel-slides"),
|
|
80
|
-
threshold: 0.5
|
|
81
|
-
});
|
|
82
|
-
this.entriesMap = /* @__PURE__ */ new Map();
|
|
83
|
-
this.records = this.intersectionObserver.takeRecords();
|
|
84
|
-
this.records.forEach((entry) => {
|
|
85
|
-
this.entriesMap.set(entry.target, entry);
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
74
|
afterDraw() {
|
|
89
75
|
this.setIntersectionObserver();
|
|
90
76
|
this.getSlidesWithClones().forEach((slide, i) => {
|
|
@@ -108,6 +94,21 @@ class Carousel extends WJElement {
|
|
|
108
94
|
}
|
|
109
95
|
});
|
|
110
96
|
}
|
|
97
|
+
setIntersectionObserver() {
|
|
98
|
+
this.intersectionObserver = new IntersectionObserver((entries) => {
|
|
99
|
+
entries.forEach((entry) => {
|
|
100
|
+
this.entriesMap.set(entry.target, entry);
|
|
101
|
+
});
|
|
102
|
+
}, {
|
|
103
|
+
root: this.context.querySelector(".carousel-slides"),
|
|
104
|
+
threshold: 0.5
|
|
105
|
+
});
|
|
106
|
+
this.entriesMap = /* @__PURE__ */ new Map();
|
|
107
|
+
this.records = this.intersectionObserver.takeRecords();
|
|
108
|
+
this.records.forEach((entry) => {
|
|
109
|
+
this.entriesMap.set(entry.target, entry);
|
|
110
|
+
});
|
|
111
|
+
}
|
|
111
112
|
goToSlide(index, behavior = "smooth", next = true) {
|
|
112
113
|
const slides = this.getSlides();
|
|
113
114
|
const slideWithClones = this.getSlidesWithClones();
|
package/dist/wj-img.js
CHANGED
|
@@ -20,7 +20,7 @@ class Img extends WJElement {
|
|
|
20
20
|
draw(context, store, params) {
|
|
21
21
|
let fragment = document.createDocumentFragment();
|
|
22
22
|
let img = document.createElement("img");
|
|
23
|
-
img.setAttribute("src", "./
|
|
23
|
+
img.setAttribute("src", "./assets/img/image-loader.gif");
|
|
24
24
|
img.classList.add("lazy-loaded-image", "lazy");
|
|
25
25
|
img.setAttribute("alt", this.alt || "");
|
|
26
26
|
this.img = img;
|
package/package.json
CHANGED
|
@@ -1,8 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wj-elements",
|
|
3
|
-
"
|
|
4
|
-
"version": "0.0.
|
|
3
|
+
"description": "WebJET Elements is a modern set of user interface tools harnessing the power of web components designed to simplify web application development.",
|
|
4
|
+
"version": "0.0.31",
|
|
5
|
+
"homepage": "https://github.com/lencys/wj-elements",
|
|
6
|
+
"author": "Lukáš Ondrejček <lukas.ondrejcek@gmail.com>",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"customElements": "dist/custom-elements.json",
|
|
9
|
+
"keywords": [
|
|
10
|
+
"Web Components",
|
|
11
|
+
"Custom Elements",
|
|
12
|
+
"UI Components",
|
|
13
|
+
"Components",
|
|
14
|
+
"Elements"
|
|
15
|
+
],
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "https://github.com/lencys/wj-elements.git"
|
|
19
|
+
},
|
|
5
20
|
"type": "module",
|
|
21
|
+
"private": false,
|
|
6
22
|
"files": [
|
|
7
23
|
"./dist"
|
|
8
24
|
],
|
|
@@ -25,8 +41,9 @@
|
|
|
25
41
|
"tinycolor2": "^1.6.0"
|
|
26
42
|
},
|
|
27
43
|
"devDependencies": {
|
|
44
|
+
"@custom-elements-manifest/analyzer": "^0.9.3",
|
|
28
45
|
"miragejs": "^0.1.48",
|
|
29
46
|
"sass": "^1.63.5",
|
|
30
47
|
"vite": "^5.1.2"
|
|
31
48
|
}
|
|
32
|
-
}
|
|
49
|
+
}
|