@ilo-org/twig 0.13.0-next.1 → 0.13.0-next.2
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.
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
|
|
2
|
-
> @ilo-org/twig@0.13.0-next.
|
|
2
|
+
> @ilo-org/twig@0.13.0-next.2 build:lib /home/runner/work/designsystem/designsystem/packages/twig
|
|
3
3
|
> node importprefix.js && node importsvgs.js && pnpm output
|
|
4
4
|
|
|
5
5
|
theme prefix added
|
|
6
6
|
|
|
7
|
-
> @ilo-org/twig@0.13.0-next.
|
|
7
|
+
> @ilo-org/twig@0.13.0-next.2 output /home/runner/work/designsystem/designsystem/packages/twig
|
|
8
8
|
> node outputtwigs.js
|
|
9
9
|
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @ilo-org/twig
|
|
2
2
|
|
|
3
|
+
## 0.13.0-next.2
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 55f0c47aa: Added chained hover effect for video play button
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- ca463b9b7: added full width on mobile viewport for affected cards
|
|
12
|
+
- Updated dependencies [55f0c47aa]
|
|
13
|
+
- Updated dependencies [b976f7221]
|
|
14
|
+
- Updated dependencies [ca463b9b7]
|
|
15
|
+
- @ilo-org/styles@0.11.3-next.2
|
|
16
|
+
|
|
3
17
|
## 0.13.0-next.1
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
package/apps/storybook/main.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ilo-org/twig",
|
|
3
|
-
"version": "0.13.0-next.
|
|
3
|
+
"version": "0.13.0-next.2",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "Twig components for the ILO's Design System",
|
|
6
6
|
"main": "",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"@ilo-org/brand-assets": "0.2.0",
|
|
26
26
|
"@ilo-org/fonts": "0.1.2",
|
|
27
27
|
"@ilo-org/icons": "0.2.1",
|
|
28
|
-
"@ilo-org/styles": "0.11.3-next.
|
|
28
|
+
"@ilo-org/styles": "0.11.3-next.2",
|
|
29
29
|
"@ilo-org/themes": "0.7.0-next.0",
|
|
30
30
|
"@ilo-org/utils": "0.0.11"
|
|
31
31
|
},
|
|
@@ -70,6 +70,7 @@
|
|
|
70
70
|
"resolve-url-loader": "^3.1.5",
|
|
71
71
|
"sass-loader": "^10.4.1",
|
|
72
72
|
"storybook": "^6.5.16",
|
|
73
|
+
"storybook-addon-rtl-direction": "^0.0.19",
|
|
73
74
|
"style-loader": "^1.3.0",
|
|
74
75
|
"stylelint-scss": "^3.21.0",
|
|
75
76
|
"webpack": "^4.46.0",
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { EVENTS } from "@ilo-org/utils";
|
|
1
2
|
import videojs from "video.js";
|
|
2
3
|
|
|
3
4
|
/**
|
|
@@ -36,7 +37,11 @@ export default class Video {
|
|
|
36
37
|
* @chainable
|
|
37
38
|
*/
|
|
38
39
|
init() {
|
|
39
|
-
this.cacheDomReferences()
|
|
40
|
+
this.cacheDomReferences()
|
|
41
|
+
.start()
|
|
42
|
+
.cacheVideoReferences()
|
|
43
|
+
.setupHandlers()
|
|
44
|
+
.enable();
|
|
40
45
|
|
|
41
46
|
return this;
|
|
42
47
|
}
|
|
@@ -59,6 +64,28 @@ export default class Video {
|
|
|
59
64
|
return this;
|
|
60
65
|
}
|
|
61
66
|
|
|
67
|
+
/**
|
|
68
|
+
* Find all necessary DOM elements inside videojs
|
|
69
|
+
*
|
|
70
|
+
* @return {Object} Video A reference to the instance of the class
|
|
71
|
+
* @chainable
|
|
72
|
+
*/
|
|
73
|
+
cacheVideoReferences() {
|
|
74
|
+
/**
|
|
75
|
+
* The button for video play control
|
|
76
|
+
* @type {?Element}
|
|
77
|
+
*/
|
|
78
|
+
this.PlayButton = this.element.querySelector(".vjs-play-control");
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* The duration display
|
|
82
|
+
* @type {?Element}
|
|
83
|
+
*/
|
|
84
|
+
this.Duration = this.element.querySelector(".vjs-duration");
|
|
85
|
+
|
|
86
|
+
return this;
|
|
87
|
+
}
|
|
88
|
+
|
|
62
89
|
/**
|
|
63
90
|
* Bind event handlers with the proper context of `this`.
|
|
64
91
|
*
|
|
@@ -66,19 +93,29 @@ export default class Video {
|
|
|
66
93
|
* @chainable
|
|
67
94
|
*/
|
|
68
95
|
setupHandlers() {
|
|
96
|
+
this.onDurationHover = this.onDurationHover.bind(this);
|
|
97
|
+
|
|
69
98
|
return this;
|
|
70
99
|
}
|
|
71
100
|
|
|
72
101
|
/**
|
|
73
|
-
* Creates event listeners to
|
|
102
|
+
* Creates event listeners to fix duration hover
|
|
103
|
+
* https://github.com/international-labour-organization/designsystem/issues/521
|
|
74
104
|
*
|
|
75
|
-
* @return {Object}
|
|
105
|
+
* @return {Object} Video A reference to the instance of the class
|
|
76
106
|
* @chainable
|
|
77
107
|
*/
|
|
78
108
|
enable() {
|
|
109
|
+
if (!this.Duration) return this;
|
|
110
|
+
this.Duration.addEventListener(EVENTS.MOUSEOVER, () =>
|
|
111
|
+
this.onDurationHover(true)
|
|
112
|
+
);
|
|
113
|
+
this.Duration.addEventListener(EVENTS.MOUSEOUT, () => {
|
|
114
|
+
this.onDurationHover(false);
|
|
115
|
+
});
|
|
116
|
+
|
|
79
117
|
return this;
|
|
80
118
|
}
|
|
81
|
-
|
|
82
119
|
/**
|
|
83
120
|
* Starts up videojs
|
|
84
121
|
*
|
|
@@ -113,4 +150,21 @@ export default class Video {
|
|
|
113
150
|
|
|
114
151
|
return this;
|
|
115
152
|
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Controls duration hover
|
|
156
|
+
*
|
|
157
|
+
* @param {boolean} state - whether or not the duration is hovered
|
|
158
|
+
* @return {Object} Video A reference to the instance of the class
|
|
159
|
+
* @chainable
|
|
160
|
+
*/
|
|
161
|
+
onDurationHover(state) {
|
|
162
|
+
if (!this.PlayButton) return this;
|
|
163
|
+
const className = `${this.controlsprefix}--play--hovered`;
|
|
164
|
+
|
|
165
|
+
if (this.PlayButton.classList.contains("vjs-playing")) return this;
|
|
166
|
+
this.PlayButton.classList.toggle(className, state);
|
|
167
|
+
|
|
168
|
+
return this;
|
|
169
|
+
}
|
|
116
170
|
}
|