openproject-primer_view_components 0.48.1 → 0.48.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/app/assets/javascripts/app/components/primer/open_project/zen_mode_button.d.ts +4 -0
- data/app/assets/javascripts/primer_view_components.js +1 -1
- data/app/assets/javascripts/primer_view_components.js.map +1 -1
- data/app/components/primer/open_project/zen_mode_button.d.ts +4 -0
- data/app/components/primer/open_project/zen_mode_button.js +14 -6
- data/app/components/primer/open_project/zen_mode_button.ts +18 -5
- data/lib/primer/view_components/version.rb +1 -1
- metadata +2 -2
@@ -1,9 +1,13 @@
|
|
1
1
|
declare class ZenModeButtonElement extends HTMLElement {
|
2
2
|
button: HTMLElement;
|
3
3
|
inZenMode: boolean;
|
4
|
+
constructor();
|
5
|
+
disconnectedCallback(): void;
|
6
|
+
fullscreenChangeEventHandler(): void;
|
4
7
|
dispatchZenModeStatus(): void;
|
5
8
|
private deactivateZenMode;
|
6
9
|
private activateZenMode;
|
10
|
+
changeButtonState(inZenMode: boolean): void;
|
7
11
|
performAction(): void;
|
8
12
|
}
|
9
13
|
declare global {
|
@@ -6,9 +6,18 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
6
6
|
};
|
7
7
|
import { controller, target } from '@github/catalyst';
|
8
8
|
let ZenModeButtonElement = class ZenModeButtonElement extends HTMLElement {
|
9
|
+
// eslint-disable-next-line custom-elements/no-constructor
|
9
10
|
constructor() {
|
10
|
-
super(
|
11
|
+
super();
|
11
12
|
this.inZenMode = false;
|
13
|
+
document.addEventListener('fullscreenchange', this.fullscreenChangeEventHandler.bind(this));
|
14
|
+
}
|
15
|
+
disconnectedCallback() {
|
16
|
+
document.removeEventListener('fullscreenchange', this.fullscreenChangeEventHandler.bind(this));
|
17
|
+
}
|
18
|
+
fullscreenChangeEventHandler() {
|
19
|
+
this.changeButtonState(!this.inZenMode);
|
20
|
+
this.dispatchZenModeStatus();
|
12
21
|
}
|
13
22
|
dispatchZenModeStatus() {
|
14
23
|
// Create a new custom event
|
@@ -21,19 +30,19 @@ let ZenModeButtonElement = class ZenModeButtonElement extends HTMLElement {
|
|
21
30
|
window.dispatchEvent(event);
|
22
31
|
}
|
23
32
|
deactivateZenMode() {
|
24
|
-
this.inZenMode = false;
|
25
|
-
this.button.setAttribute('aria-pressed', 'false');
|
26
33
|
if (document.exitFullscreen) {
|
27
34
|
void document.exitFullscreen();
|
28
35
|
}
|
29
36
|
}
|
30
37
|
activateZenMode() {
|
31
|
-
this.inZenMode = true;
|
32
|
-
this.button.setAttribute('aria-pressed', 'true');
|
33
38
|
if (document.documentElement.requestFullscreen) {
|
34
39
|
void document.documentElement.requestFullscreen();
|
35
40
|
}
|
36
41
|
}
|
42
|
+
changeButtonState(inZenMode) {
|
43
|
+
this.inZenMode = inZenMode;
|
44
|
+
this.button.setAttribute('aria-pressed', inZenMode.toString());
|
45
|
+
}
|
37
46
|
performAction() {
|
38
47
|
if (this.inZenMode) {
|
39
48
|
this.deactivateZenMode();
|
@@ -41,7 +50,6 @@ let ZenModeButtonElement = class ZenModeButtonElement extends HTMLElement {
|
|
41
50
|
else {
|
42
51
|
this.activateZenMode();
|
43
52
|
}
|
44
|
-
this.dispatchZenModeStatus();
|
45
53
|
}
|
46
54
|
};
|
47
55
|
__decorate([
|
@@ -5,6 +5,20 @@ class ZenModeButtonElement extends HTMLElement {
|
|
5
5
|
@target button: HTMLElement
|
6
6
|
inZenMode = false
|
7
7
|
|
8
|
+
// eslint-disable-next-line custom-elements/no-constructor
|
9
|
+
constructor() {
|
10
|
+
super()
|
11
|
+
document.addEventListener('fullscreenchange', this.fullscreenChangeEventHandler.bind(this))
|
12
|
+
}
|
13
|
+
|
14
|
+
disconnectedCallback() {
|
15
|
+
document.removeEventListener('fullscreenchange', this.fullscreenChangeEventHandler.bind(this))
|
16
|
+
}
|
17
|
+
|
18
|
+
fullscreenChangeEventHandler() {
|
19
|
+
this.changeButtonState(!this.inZenMode)
|
20
|
+
this.dispatchZenModeStatus()
|
21
|
+
}
|
8
22
|
dispatchZenModeStatus() {
|
9
23
|
// Create a new custom event
|
10
24
|
const event = new CustomEvent('zenModeToggled', {
|
@@ -17,20 +31,20 @@ class ZenModeButtonElement extends HTMLElement {
|
|
17
31
|
}
|
18
32
|
|
19
33
|
private deactivateZenMode() {
|
20
|
-
this.inZenMode = false
|
21
|
-
this.button.setAttribute('aria-pressed', 'false')
|
22
34
|
if (document.exitFullscreen) {
|
23
35
|
void document.exitFullscreen()
|
24
36
|
}
|
25
37
|
}
|
26
38
|
|
27
39
|
private activateZenMode() {
|
28
|
-
this.inZenMode = true
|
29
|
-
this.button.setAttribute('aria-pressed', 'true')
|
30
40
|
if (document.documentElement.requestFullscreen) {
|
31
41
|
void document.documentElement.requestFullscreen()
|
32
42
|
}
|
33
43
|
}
|
44
|
+
public changeButtonState(inZenMode: boolean) {
|
45
|
+
this.inZenMode = inZenMode
|
46
|
+
this.button.setAttribute('aria-pressed', inZenMode.toString())
|
47
|
+
}
|
34
48
|
|
35
49
|
public performAction() {
|
36
50
|
if (this.inZenMode) {
|
@@ -38,7 +52,6 @@ class ZenModeButtonElement extends HTMLElement {
|
|
38
52
|
} else {
|
39
53
|
this.activateZenMode()
|
40
54
|
}
|
41
|
-
this.dispatchZenModeStatus()
|
42
55
|
}
|
43
56
|
}
|
44
57
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: openproject-primer_view_components
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.48.
|
4
|
+
version: 0.48.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GitHub Open Source
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2024-10-
|
12
|
+
date: 2024-10-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: actionview
|