@jsenv/plugin-toolbar 0.1.14 → 1.0.1
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 +3 -0
- package/dist/js/toolbar_core.js +17 -17
- package/dist/js/toolbar_injector.js +1 -46
- package/dist/jsenv_plugin_toolbar.js +1 -3
- package/package.json +2 -2
- package/src/client/core/animation_actions.js +5 -5
- package/src/client/core/animation_effects.js +6 -6
- package/src/client/core/animation_signals.js +4 -4
- package/src/client/core/changes_actions.js +5 -5
- package/src/client/core/changes_signals.js +2 -2
- package/src/client/core/execution_actions.js +16 -16
- package/src/client/core/execution_effects.js +10 -10
- package/src/client/core/execution_signals.js +6 -6
- package/src/client/core/notification_actions.js +31 -31
- package/src/client/core/notification_context.js +2 -1
- package/src/client/core/notification_effects.js +6 -6
- package/src/client/core/notification_signals.js +5 -5
- package/src/client/core/parent_window_actions.js +18 -18
- package/src/client/core/parent_window_context.js +5 -5
- package/src/client/core/parent_window_effects.js +9 -9
- package/src/client/core/parent_window_signals.js +17 -17
- package/src/client/core/server_actions.js +5 -5
- package/src/client/core/server_effects.js +6 -6
- package/src/client/core/server_signals.js +7 -7
- package/src/client/core/settings_actions.js +5 -5
- package/src/client/core/settings_signals.js +2 -2
- package/src/client/core/theme_actions.js +5 -5
- package/src/client/core/theme_effects.js +5 -5
- package/src/client/core/theme_signals.js +4 -4
- package/src/client/core/toolbar_logger.js +8 -8
- package/src/client/core/toolbar_open_actions.js +5 -5
- package/src/client/core/toolbar_open_effects.js +4 -4
- package/src/client/core/toolbar_open_signals.js +4 -4
- package/src/client/core/toolbar_state_context.js +1 -1
- package/src/client/core/toolbar_state_effects.js +7 -7
- package/src/client/core/toolbar_state_signals.js +11 -11
- package/src/client/core/tooltip_actions.js +5 -5
- package/src/client/toolbar_core.js +8 -8
- package/src/client/toolbar_injector.js +97 -97
- package/src/client/ui/changes_indicator/changes_indicator.js +33 -33
- package/src/client/ui/document_execution_indicator/document_execution_indicator.js +28 -28
- package/src/client/ui/document_index_link/document_index_link.js +3 -3
- package/src/client/ui/server_indicator/server_indicator.js +30 -30
- package/src/client/ui/toolbar_close_button/toolbar_close_button.js +6 -6
- package/src/client/ui/toolbar_menu_overflow/toolbar_menu_overflow.js +50 -50
- package/src/client/ui/toolbar_opening/toolbar_opening.js +35 -35
- package/src/client/ui/toolbar_overlay/toolbar_overlay.js +36 -36
- package/src/client/ui/toolbar_settings/toolbar_animation_setting.js +13 -13
- package/src/client/ui/toolbar_settings/toolbar_autoreload_setting.js +19 -19
- package/src/client/ui/toolbar_settings/toolbar_notification_setting.js +47 -47
- package/src/client/ui/toolbar_settings/toolbar_settings.js +29 -29
- package/src/client/ui/toolbar_settings/toolbar_theme_setting.js +8 -8
- package/src/client/ui/toolbar_ui.js +19 -19
- package/src/client/ui/util/animation.js +116 -116
- package/src/client/ui/util/dom.js +29 -29
- package/src/client/ui/util/fetch_using_xhr.js +184 -184
- package/src/client/ui/util/fetching.js +6 -6
- package/src/client/ui/util/iframe_to_parent_href.js +6 -6
- package/src/client/ui/util/responsive.js +48 -48
- package/src/client/ui/util/util.js +13 -13
- package/src/client/ui/variant.js +27 -27
- package/src/jsenv_plugin_toolbar.js +17 -17
|
@@ -1,97 +1,97 @@
|
|
|
1
|
-
import { closeAllTooltips } from "../../core/tooltip_actions.js"
|
|
1
|
+
import { closeAllTooltips } from "../../core/tooltip_actions.js";
|
|
2
2
|
import {
|
|
3
3
|
forceHideElement,
|
|
4
4
|
removeForceHideElement,
|
|
5
5
|
deactivateToolbarSection,
|
|
6
|
-
} from "../util/dom.js"
|
|
7
|
-
import { createHorizontalBreakpoint } from "../util/responsive.js"
|
|
6
|
+
} from "../util/dom.js";
|
|
7
|
+
import { createHorizontalBreakpoint } from "../util/responsive.js";
|
|
8
8
|
|
|
9
|
-
const WINDOW_SMALL_WIDTH = 420
|
|
9
|
+
const WINDOW_SMALL_WIDTH = 420;
|
|
10
10
|
|
|
11
11
|
export const initToolbarMenuOverflow = () => {
|
|
12
12
|
// apply responsive design on toolbar icons if needed + add listener on resize screen
|
|
13
13
|
// ideally we should listen breakpoint once, for now restore toolbar
|
|
14
|
-
const overflowMenuBreakpoint = createHorizontalBreakpoint(WINDOW_SMALL_WIDTH)
|
|
14
|
+
const overflowMenuBreakpoint = createHorizontalBreakpoint(WINDOW_SMALL_WIDTH);
|
|
15
15
|
const handleOverflowMenuBreakpoint = () => {
|
|
16
|
-
responsiveToolbar(overflowMenuBreakpoint)
|
|
17
|
-
}
|
|
18
|
-
handleOverflowMenuBreakpoint()
|
|
19
|
-
overflowMenuBreakpoint.changed.listen(handleOverflowMenuBreakpoint)
|
|
16
|
+
responsiveToolbar(overflowMenuBreakpoint);
|
|
17
|
+
};
|
|
18
|
+
handleOverflowMenuBreakpoint();
|
|
19
|
+
overflowMenuBreakpoint.changed.listen(handleOverflowMenuBreakpoint);
|
|
20
20
|
|
|
21
21
|
document.querySelector("#menu_overflow_button").onclick = () => {
|
|
22
22
|
if (overflowMenuIsOpened()) {
|
|
23
|
-
closeOverflowMenu()
|
|
23
|
+
closeOverflowMenu();
|
|
24
24
|
} else {
|
|
25
|
-
openOverflowMenu()
|
|
25
|
+
openOverflowMenu();
|
|
26
26
|
}
|
|
27
|
-
}
|
|
28
|
-
}
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
29
|
|
|
30
30
|
const responsiveToolbar = (overflowMenuBreakpoint) => {
|
|
31
31
|
// close all tooltips in case opened
|
|
32
|
-
closeAllTooltips()
|
|
32
|
+
closeAllTooltips();
|
|
33
33
|
// close settings box in case opened
|
|
34
|
-
deactivateToolbarSection(document.querySelector("#settings"))
|
|
34
|
+
deactivateToolbarSection(document.querySelector("#settings"));
|
|
35
35
|
|
|
36
36
|
if (overflowMenuBreakpoint.isBelow()) {
|
|
37
|
-
enableOverflow()
|
|
37
|
+
enableOverflow();
|
|
38
38
|
} else {
|
|
39
|
-
disableOverflow()
|
|
39
|
+
disableOverflow();
|
|
40
40
|
}
|
|
41
|
-
}
|
|
41
|
+
};
|
|
42
42
|
|
|
43
|
-
let moves = []
|
|
43
|
+
let moves = [];
|
|
44
44
|
|
|
45
45
|
const enableOverflow = () => {
|
|
46
46
|
// move elements from toolbar to overflow menu
|
|
47
47
|
const responsiveToolbarElements = document.querySelectorAll(
|
|
48
48
|
"[data-responsive-toolbar-element]",
|
|
49
|
-
)
|
|
50
|
-
const overflowMenu = document.querySelector("#menu_overflow")
|
|
49
|
+
);
|
|
50
|
+
const overflowMenu = document.querySelector("#menu_overflow");
|
|
51
51
|
|
|
52
52
|
// keep a placeholder element to know where to move them back
|
|
53
53
|
moves = Array.from(responsiveToolbarElements).map((element) => {
|
|
54
|
-
const placeholder = document.createElement("div")
|
|
55
|
-
placeholder.style.display = "none"
|
|
56
|
-
placeholder.setAttribute("data-placeholder", "")
|
|
57
|
-
element.parentNode.replaceChild(placeholder, element)
|
|
58
|
-
overflowMenu.appendChild(element)
|
|
59
|
-
return { element, placeholder }
|
|
60
|
-
})
|
|
54
|
+
const placeholder = document.createElement("div");
|
|
55
|
+
placeholder.style.display = "none";
|
|
56
|
+
placeholder.setAttribute("data-placeholder", "");
|
|
57
|
+
element.parentNode.replaceChild(placeholder, element);
|
|
58
|
+
overflowMenu.appendChild(element);
|
|
59
|
+
return { element, placeholder };
|
|
60
|
+
});
|
|
61
61
|
|
|
62
62
|
document
|
|
63
63
|
.querySelector("#toolbar")
|
|
64
|
-
.setAttribute("data-menu-overflow-enabled", "")
|
|
65
|
-
removeForceHideElement(document.querySelector("#menu_overflow_button"))
|
|
66
|
-
}
|
|
64
|
+
.setAttribute("data-menu-overflow-enabled", "");
|
|
65
|
+
removeForceHideElement(document.querySelector("#menu_overflow_button"));
|
|
66
|
+
};
|
|
67
67
|
|
|
68
68
|
const disableOverflow = () => {
|
|
69
69
|
// close overflow menu in case it's open & unselect toggleOverflowMenu button in case it's selected
|
|
70
|
-
closeOverflowMenu()
|
|
71
|
-
deactivateToolbarSection(document.querySelector("#menu_overflow"))
|
|
70
|
+
closeOverflowMenu();
|
|
71
|
+
deactivateToolbarSection(document.querySelector("#menu_overflow"));
|
|
72
72
|
moves.forEach(({ element, placeholder }) => {
|
|
73
|
-
placeholder.parentNode.replaceChild(element, placeholder)
|
|
74
|
-
})
|
|
75
|
-
moves = []
|
|
73
|
+
placeholder.parentNode.replaceChild(element, placeholder);
|
|
74
|
+
});
|
|
75
|
+
moves = [];
|
|
76
76
|
document
|
|
77
77
|
.querySelector("#toolbar")
|
|
78
|
-
.removeAttribute("data-menu-overflow-enabled")
|
|
79
|
-
forceHideElement(document.querySelector("#menu_overflow_button"))
|
|
80
|
-
}
|
|
78
|
+
.removeAttribute("data-menu-overflow-enabled");
|
|
79
|
+
forceHideElement(document.querySelector("#menu_overflow_button"));
|
|
80
|
+
};
|
|
81
81
|
|
|
82
82
|
const overflowMenuIsOpened = () => {
|
|
83
|
-
const toolbar = document.querySelector("#toolbar")
|
|
84
|
-
return toolbar.hasAttribute("data-menu-overflow-opened")
|
|
85
|
-
}
|
|
83
|
+
const toolbar = document.querySelector("#toolbar");
|
|
84
|
+
return toolbar.hasAttribute("data-menu-overflow-opened");
|
|
85
|
+
};
|
|
86
86
|
|
|
87
87
|
const openOverflowMenu = () => {
|
|
88
|
-
const toolbar = document.querySelector("#toolbar")
|
|
89
|
-
document.querySelector("#menu_overflow").setAttribute("data-animate", "")
|
|
90
|
-
toolbar.setAttribute("data-menu-overflow-opened", "")
|
|
91
|
-
}
|
|
88
|
+
const toolbar = document.querySelector("#toolbar");
|
|
89
|
+
document.querySelector("#menu_overflow").setAttribute("data-animate", "");
|
|
90
|
+
toolbar.setAttribute("data-menu-overflow-opened", "");
|
|
91
|
+
};
|
|
92
92
|
|
|
93
93
|
const closeOverflowMenu = () => {
|
|
94
|
-
const toolbar = document.querySelector("#toolbar")
|
|
95
|
-
toolbar.removeAttribute("data-menu-overflow-opened")
|
|
96
|
-
document.querySelector("#menu_overflow").removeAttribute("data-animate")
|
|
97
|
-
}
|
|
94
|
+
const toolbar = document.querySelector("#toolbar");
|
|
95
|
+
toolbar.removeAttribute("data-menu-overflow-opened");
|
|
96
|
+
document.querySelector("#menu_overflow").removeAttribute("data-animate");
|
|
97
|
+
};
|
|
@@ -1,73 +1,73 @@
|
|
|
1
|
-
import { effect } from "@preact/signals"
|
|
1
|
+
import { effect } from "@preact/signals";
|
|
2
2
|
|
|
3
|
-
import { closeAllTooltips } from "../../core/tooltip_actions.js"
|
|
4
|
-
import { animationsEnabledSignal } from "../../core/animation_signals.js"
|
|
5
|
-
import { openedSignal } from "../../core/toolbar_open_signals.js"
|
|
6
|
-
import { getToolbarIframe, setStyles } from "../util/dom.js"
|
|
7
|
-
import { startJavaScriptAnimation } from "../util/animation.js"
|
|
3
|
+
import { closeAllTooltips } from "../../core/tooltip_actions.js";
|
|
4
|
+
import { animationsEnabledSignal } from "../../core/animation_signals.js";
|
|
5
|
+
import { openedSignal } from "../../core/toolbar_open_signals.js";
|
|
6
|
+
import { getToolbarIframe, setStyles } from "../util/dom.js";
|
|
7
|
+
import { startJavaScriptAnimation } from "../util/animation.js";
|
|
8
8
|
|
|
9
9
|
export const initToolbarOpening = () => {
|
|
10
10
|
effect(() => {
|
|
11
|
-
const opened = openedSignal.value
|
|
11
|
+
const opened = openedSignal.value;
|
|
12
12
|
if (opened) {
|
|
13
|
-
showToolbar()
|
|
13
|
+
showToolbar();
|
|
14
14
|
} else {
|
|
15
|
-
hideToolbar()
|
|
15
|
+
hideToolbar();
|
|
16
16
|
}
|
|
17
|
-
})
|
|
18
|
-
}
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
19
|
|
|
20
|
-
let restoreToolbarIframeParentStyles = () => {}
|
|
21
|
-
let restoreToolbarIframeStyles = () => {}
|
|
20
|
+
let restoreToolbarIframeParentStyles = () => {};
|
|
21
|
+
let restoreToolbarIframeStyles = () => {};
|
|
22
22
|
|
|
23
23
|
const hideToolbar = () => {
|
|
24
|
-
closeAllTooltips()
|
|
25
|
-
restoreToolbarIframeParentStyles()
|
|
26
|
-
restoreToolbarIframeStyles()
|
|
27
|
-
document.documentElement.removeAttribute("data-toolbar-visible")
|
|
28
|
-
}
|
|
24
|
+
closeAllTooltips();
|
|
25
|
+
restoreToolbarIframeParentStyles();
|
|
26
|
+
restoreToolbarIframeStyles();
|
|
27
|
+
document.documentElement.removeAttribute("data-toolbar-visible");
|
|
28
|
+
};
|
|
29
29
|
|
|
30
30
|
// (by the way it might be cool to have the toolbar auto show when)
|
|
31
31
|
// it has something to say (being disconnected from server)
|
|
32
32
|
const showToolbar = () => {
|
|
33
|
-
const animationsEnabled = animationsEnabledSignal.peek()
|
|
34
|
-
document.documentElement.setAttribute("data-toolbar-visible", "")
|
|
33
|
+
const animationsEnabled = animationsEnabledSignal.peek();
|
|
34
|
+
document.documentElement.setAttribute("data-toolbar-visible", "");
|
|
35
35
|
|
|
36
|
-
const toolbarIframe = getToolbarIframe()
|
|
37
|
-
const toolbarIframeParent = toolbarIframe.parentNode
|
|
38
|
-
const parentWindow = window.parent
|
|
36
|
+
const toolbarIframe = getToolbarIframe();
|
|
37
|
+
const toolbarIframeParent = toolbarIframe.parentNode;
|
|
38
|
+
const parentWindow = window.parent;
|
|
39
39
|
const parentDocumentElement =
|
|
40
40
|
parentWindow.document.compatMode === "CSS1Compat"
|
|
41
41
|
? parentWindow.document.documentElement
|
|
42
|
-
: parentWindow.document.body
|
|
42
|
+
: parentWindow.document.body;
|
|
43
43
|
|
|
44
44
|
const scrollYMax =
|
|
45
|
-
parentDocumentElement.scrollHeight - parentWindow.innerHeight
|
|
46
|
-
const scrollY = parentDocumentElement.scrollTop
|
|
47
|
-
const scrollYRemaining = scrollYMax - scrollY
|
|
45
|
+
parentDocumentElement.scrollHeight - parentWindow.innerHeight;
|
|
46
|
+
const scrollY = parentDocumentElement.scrollTop;
|
|
47
|
+
const scrollYRemaining = scrollYMax - scrollY;
|
|
48
48
|
|
|
49
49
|
setStyles(toolbarIframeParent, {
|
|
50
50
|
"transition-property": "padding-bottom",
|
|
51
51
|
"transition-duration": animationsEnabled ? "300ms" : "0s",
|
|
52
|
-
})
|
|
52
|
+
});
|
|
53
53
|
// maybe we should use js animation here because we would not conflict with css
|
|
54
54
|
restoreToolbarIframeParentStyles = setStyles(toolbarIframeParent, {
|
|
55
55
|
"scroll-padding-bottom": "40px", // same here we should add 40px
|
|
56
56
|
"padding-bottom": "40px", // if there is already one we should add 40px
|
|
57
|
-
})
|
|
57
|
+
});
|
|
58
58
|
restoreToolbarIframeStyles = setStyles(toolbarIframe, {
|
|
59
59
|
height: "40px",
|
|
60
60
|
visibility: "visible",
|
|
61
|
-
})
|
|
61
|
+
});
|
|
62
62
|
|
|
63
63
|
if (scrollYRemaining < 40 && scrollYMax > 0) {
|
|
64
|
-
const scrollEnd = scrollY + 40
|
|
64
|
+
const scrollEnd = scrollY + 40;
|
|
65
65
|
startJavaScriptAnimation({
|
|
66
66
|
duration: 300,
|
|
67
67
|
onProgress: ({ progress }) => {
|
|
68
|
-
const value = scrollY + (scrollEnd - scrollY) * progress
|
|
69
|
-
parentDocumentElement.scrollTop = value
|
|
68
|
+
const value = scrollY + (scrollEnd - scrollY) * progress;
|
|
69
|
+
parentDocumentElement.scrollTop = value;
|
|
70
70
|
},
|
|
71
|
-
})
|
|
71
|
+
});
|
|
72
72
|
}
|
|
73
|
-
}
|
|
73
|
+
};
|
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
import { effect } from "@preact/signals"
|
|
1
|
+
import { effect } from "@preact/signals";
|
|
2
2
|
|
|
3
|
-
import { openedSignal } from "../../core/toolbar_open_signals.js"
|
|
4
|
-
import { settingsOpenedSignal } from "../../core/settings_signals.js"
|
|
5
|
-
import { closeSettings } from "../../core/settings_actions.js"
|
|
6
|
-
import { closeAllTooltips } from "../../core/tooltip_actions.js"
|
|
7
|
-
import { executionTooltipOpenedSignal } from "../../core/execution_signals.js"
|
|
8
|
-
import { changesTooltipOpenedSignal } from "../../core/changes_signals.js"
|
|
9
|
-
import { serverTooltipOpenedSignal } from "../../core/server_signals.js"
|
|
10
|
-
import { getToolbarIframe, setStyles } from "../util/dom.js"
|
|
3
|
+
import { openedSignal } from "../../core/toolbar_open_signals.js";
|
|
4
|
+
import { settingsOpenedSignal } from "../../core/settings_signals.js";
|
|
5
|
+
import { closeSettings } from "../../core/settings_actions.js";
|
|
6
|
+
import { closeAllTooltips } from "../../core/tooltip_actions.js";
|
|
7
|
+
import { executionTooltipOpenedSignal } from "../../core/execution_signals.js";
|
|
8
|
+
import { changesTooltipOpenedSignal } from "../../core/changes_signals.js";
|
|
9
|
+
import { serverTooltipOpenedSignal } from "../../core/server_signals.js";
|
|
10
|
+
import { getToolbarIframe, setStyles } from "../util/dom.js";
|
|
11
11
|
|
|
12
12
|
export const renderToolbarOverlay = () => {
|
|
13
|
-
const toolbarOverlay = document.querySelector("#toolbar_overlay")
|
|
13
|
+
const toolbarOverlay = document.querySelector("#toolbar_overlay");
|
|
14
14
|
toolbarOverlay.onclick = () => {
|
|
15
|
-
closeAllTooltips()
|
|
16
|
-
closeSettings()
|
|
17
|
-
}
|
|
15
|
+
closeAllTooltips();
|
|
16
|
+
closeSettings();
|
|
17
|
+
};
|
|
18
18
|
|
|
19
19
|
effect(() => {
|
|
20
20
|
if (!window.parent) {
|
|
21
21
|
// can happen while parent iframe reloads
|
|
22
|
-
return
|
|
22
|
+
return;
|
|
23
23
|
}
|
|
24
|
-
const opened = openedSignal.value
|
|
25
|
-
const settingsOpened = settingsOpenedSignal.value
|
|
26
|
-
const executionTooltipOpened = executionTooltipOpenedSignal.value
|
|
27
|
-
const changesTooltipOpened = changesTooltipOpenedSignal.value
|
|
28
|
-
const serverTooltipOpened = serverTooltipOpenedSignal.value
|
|
24
|
+
const opened = openedSignal.value;
|
|
25
|
+
const settingsOpened = settingsOpenedSignal.value;
|
|
26
|
+
const executionTooltipOpened = executionTooltipOpenedSignal.value;
|
|
27
|
+
const changesTooltipOpened = changesTooltipOpenedSignal.value;
|
|
28
|
+
const serverTooltipOpened = serverTooltipOpenedSignal.value;
|
|
29
29
|
if (!opened) {
|
|
30
|
-
return
|
|
30
|
+
return;
|
|
31
31
|
}
|
|
32
32
|
if (
|
|
33
33
|
settingsOpened ||
|
|
@@ -35,42 +35,42 @@ export const renderToolbarOverlay = () => {
|
|
|
35
35
|
changesTooltipOpened ||
|
|
36
36
|
serverTooltipOpened
|
|
37
37
|
) {
|
|
38
|
-
enableIframeOverflowOnParentWindow()
|
|
38
|
+
enableIframeOverflowOnParentWindow();
|
|
39
39
|
} else {
|
|
40
|
-
disableIframeOverflowOnParentWindow()
|
|
40
|
+
disableIframeOverflowOnParentWindow();
|
|
41
41
|
}
|
|
42
|
-
})
|
|
43
|
-
}
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
44
|
|
|
45
45
|
const enableIframeOverflowOnParentWindow = () => {
|
|
46
|
-
const iframe = getToolbarIframe()
|
|
46
|
+
const iframe = getToolbarIframe();
|
|
47
47
|
|
|
48
|
-
const transitionDuration = iframe.style.transitionDuration
|
|
48
|
+
const transitionDuration = iframe.style.transitionDuration;
|
|
49
49
|
setStyles(iframe, {
|
|
50
50
|
"height": "100%",
|
|
51
51
|
// we don't want to animate height transition
|
|
52
52
|
// but if it was enabled, we'll restore it afterwards
|
|
53
53
|
"transition-duration": "0ms",
|
|
54
|
-
})
|
|
54
|
+
});
|
|
55
55
|
if (transitionDuration) {
|
|
56
56
|
setTimeout(() => {
|
|
57
|
-
setStyles(iframe, { "transition-duration": transitionDuration })
|
|
58
|
-
})
|
|
57
|
+
setStyles(iframe, { "transition-duration": transitionDuration });
|
|
58
|
+
});
|
|
59
59
|
}
|
|
60
|
-
}
|
|
60
|
+
};
|
|
61
61
|
|
|
62
62
|
const disableIframeOverflowOnParentWindow = () => {
|
|
63
|
-
const iframe = getToolbarIframe()
|
|
64
|
-
const transitionDuration = iframe.style.transitionDuration
|
|
63
|
+
const iframe = getToolbarIframe();
|
|
64
|
+
const transitionDuration = iframe.style.transitionDuration;
|
|
65
65
|
setStyles(iframe, {
|
|
66
66
|
"height": "40px",
|
|
67
67
|
// we don't want to animate height transition
|
|
68
68
|
// but if it was enabled, we'll restore it afterwards
|
|
69
69
|
"transition-duration": "0ms",
|
|
70
|
-
})
|
|
70
|
+
});
|
|
71
71
|
if (transitionDuration) {
|
|
72
72
|
setTimeout(() => {
|
|
73
|
-
setStyles(iframe, { "transition-duration": transitionDuration })
|
|
74
|
-
})
|
|
73
|
+
setStyles(iframe, { "transition-duration": transitionDuration });
|
|
74
|
+
});
|
|
75
75
|
}
|
|
76
|
-
}
|
|
76
|
+
};
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import { effect } from "@preact/signals"
|
|
1
|
+
import { effect } from "@preact/signals";
|
|
2
2
|
|
|
3
|
-
import { animationsEnabledSignal } from "../../core/animation_signals.js"
|
|
3
|
+
import { animationsEnabledSignal } from "../../core/animation_signals.js";
|
|
4
4
|
import {
|
|
5
5
|
enableAnimations,
|
|
6
6
|
disableAnimations,
|
|
7
|
-
} from "../../core/animation_actions.js"
|
|
7
|
+
} from "../../core/animation_actions.js";
|
|
8
8
|
|
|
9
9
|
export const renderToolbarAnimationSetting = () => {
|
|
10
|
-
const animCheckbox = document.querySelector("#toggle_anims")
|
|
10
|
+
const animCheckbox = document.querySelector("#toggle_anims");
|
|
11
11
|
|
|
12
12
|
effect(() => {
|
|
13
|
-
const animationsEnabled = animationsEnabledSignal.value
|
|
14
|
-
animCheckbox.checked = animationsEnabled
|
|
15
|
-
})
|
|
13
|
+
const animationsEnabled = animationsEnabledSignal.value;
|
|
14
|
+
animCheckbox.checked = animationsEnabled;
|
|
15
|
+
});
|
|
16
16
|
animCheckbox.onchange = () => {
|
|
17
17
|
if (animCheckbox.checked) {
|
|
18
|
-
enableAnimations()
|
|
18
|
+
enableAnimations();
|
|
19
19
|
} else {
|
|
20
|
-
disableAnimations()
|
|
20
|
+
disableAnimations();
|
|
21
21
|
}
|
|
22
|
-
}
|
|
22
|
+
};
|
|
23
23
|
// enable toolbar transition only after first render
|
|
24
24
|
setTimeout(() => {
|
|
25
|
-
document.querySelector("#toolbar").setAttribute("data-animate", "")
|
|
26
|
-
})
|
|
27
|
-
}
|
|
25
|
+
document.querySelector("#toolbar").setAttribute("data-animate", "");
|
|
26
|
+
});
|
|
27
|
+
};
|
|
@@ -1,46 +1,46 @@
|
|
|
1
|
-
import { effect } from "@preact/signals"
|
|
1
|
+
import { effect } from "@preact/signals";
|
|
2
2
|
|
|
3
|
-
import { autoreloadEnabledSignal } from "../../core/parent_window_signals.js"
|
|
3
|
+
import { autoreloadEnabledSignal } from "../../core/parent_window_signals.js";
|
|
4
4
|
import {
|
|
5
5
|
disableAutoreload,
|
|
6
6
|
enableAutoreload,
|
|
7
|
-
} from "../../core/parent_window_actions.js"
|
|
7
|
+
} from "../../core/parent_window_actions.js";
|
|
8
8
|
|
|
9
9
|
export const renderToolbarAutoreloadSetting = () => {
|
|
10
|
-
const parentWindowReloader = window.parent.__reloader__
|
|
10
|
+
const parentWindowReloader = window.parent.__reloader__;
|
|
11
11
|
if (!parentWindowReloader) {
|
|
12
|
-
disableAutoreloadSetting()
|
|
13
|
-
return
|
|
12
|
+
disableAutoreloadSetting();
|
|
13
|
+
return;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
const autoreloadCheckbox = document.querySelector("#toggle_autoreload")
|
|
16
|
+
const autoreloadCheckbox = document.querySelector("#toggle_autoreload");
|
|
17
17
|
effect(() => {
|
|
18
|
-
const autoreloadEnabled = autoreloadEnabledSignal.value
|
|
18
|
+
const autoreloadEnabled = autoreloadEnabledSignal.value;
|
|
19
19
|
if (autoreloadEnabled) {
|
|
20
|
-
autoreloadCheckbox.checked = true
|
|
20
|
+
autoreloadCheckbox.checked = true;
|
|
21
21
|
} else {
|
|
22
|
-
autoreloadCheckbox.checked = false
|
|
22
|
+
autoreloadCheckbox.checked = false;
|
|
23
23
|
}
|
|
24
|
-
})
|
|
24
|
+
});
|
|
25
25
|
|
|
26
26
|
autoreloadCheckbox.onchange = () => {
|
|
27
27
|
if (autoreloadCheckbox.checked) {
|
|
28
|
-
enableAutoreload()
|
|
28
|
+
enableAutoreload();
|
|
29
29
|
} else {
|
|
30
|
-
disableAutoreload()
|
|
30
|
+
disableAutoreload();
|
|
31
31
|
}
|
|
32
|
-
}
|
|
33
|
-
}
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
34
|
|
|
35
35
|
const disableAutoreloadSetting = () => {
|
|
36
36
|
document
|
|
37
37
|
.querySelector(".settings_autoreload")
|
|
38
|
-
.setAttribute("data-disabled", "true")
|
|
38
|
+
.setAttribute("data-disabled", "true");
|
|
39
39
|
document
|
|
40
40
|
.querySelector(".settings_autoreload")
|
|
41
|
-
.setAttribute("title", `Autoreload not enabled on server`)
|
|
42
|
-
document.querySelector("#toggle_autoreload").disabled = true
|
|
43
|
-
}
|
|
41
|
+
.setAttribute("title", `Autoreload not enabled on server`);
|
|
42
|
+
document.querySelector("#toggle_autoreload").disabled = true;
|
|
43
|
+
};
|
|
44
44
|
|
|
45
45
|
// const changeLink = variantNode.querySelector(".eventsource-changes-link")
|
|
46
46
|
// changeLink.innerHTML = reloadMessageCount
|
|
@@ -1,88 +1,88 @@
|
|
|
1
|
-
import { effect } from "@preact/signals"
|
|
1
|
+
import { effect } from "@preact/signals";
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
4
|
notificationsEnabledSignal,
|
|
5
5
|
notificationPermissionSignal,
|
|
6
|
-
} from "../../core/notification_signals.js"
|
|
7
|
-
import { notificationAPIDetected } from "../../core/notification_context.js"
|
|
6
|
+
} from "../../core/notification_signals.js";
|
|
7
|
+
import { notificationAPIDetected } from "../../core/notification_context.js";
|
|
8
8
|
import {
|
|
9
9
|
enableNotifications,
|
|
10
10
|
disableNotifications,
|
|
11
11
|
requestPermission,
|
|
12
|
-
} from "../../core/notification_actions.js"
|
|
13
|
-
import { enableVariant } from "../variant.js"
|
|
12
|
+
} from "../../core/notification_actions.js";
|
|
13
|
+
import { enableVariant } from "../variant.js";
|
|
14
14
|
|
|
15
|
-
const notifCheckbox = document.querySelector("#toggle_notifs")
|
|
15
|
+
const notifCheckbox = document.querySelector("#toggle_notifs");
|
|
16
16
|
|
|
17
17
|
export const renderToolbarNotificationSetting = () => {
|
|
18
18
|
effect(() => {
|
|
19
|
-
const notificationsEnabled = notificationsEnabledSignal.value
|
|
20
|
-
notifCheckbox.checked = notificationsEnabled
|
|
21
|
-
})
|
|
19
|
+
const notificationsEnabled = notificationsEnabledSignal.value;
|
|
20
|
+
notifCheckbox.checked = notificationsEnabled;
|
|
21
|
+
});
|
|
22
22
|
|
|
23
23
|
effect(() => {
|
|
24
|
-
const notificationPermission = notificationPermissionSignal.value
|
|
24
|
+
const notificationPermission = notificationPermissionSignal.value;
|
|
25
25
|
if (!notificationAPIDetected) {
|
|
26
|
-
applyNotificationNotAvailableEffects()
|
|
27
|
-
return
|
|
26
|
+
applyNotificationNotAvailableEffects();
|
|
27
|
+
return;
|
|
28
28
|
}
|
|
29
29
|
if (notificationPermission === "default") {
|
|
30
|
-
applyNotificationDefaultEffects()
|
|
31
|
-
return
|
|
30
|
+
applyNotificationDefaultEffects();
|
|
31
|
+
return;
|
|
32
32
|
}
|
|
33
33
|
if (notificationPermission === "denied") {
|
|
34
|
-
applyNotificationDeniedEffects()
|
|
35
|
-
return
|
|
34
|
+
applyNotificationDeniedEffects();
|
|
35
|
+
return;
|
|
36
36
|
}
|
|
37
37
|
if (notificationPermission === "granted") {
|
|
38
|
-
applyNotificationGrantedEffects()
|
|
39
|
-
return
|
|
38
|
+
applyNotificationGrantedEffects();
|
|
39
|
+
return;
|
|
40
40
|
}
|
|
41
|
-
})
|
|
42
|
-
}
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
43
|
|
|
44
44
|
const applyNotificationNotAvailableEffects = () => {
|
|
45
|
-
const notifSetting = document.querySelector(".settings_notification")
|
|
46
|
-
notifSetting.setAttribute("data-disabled", "true")
|
|
45
|
+
const notifSetting = document.querySelector(".settings_notification");
|
|
46
|
+
notifSetting.setAttribute("data-disabled", "true");
|
|
47
47
|
notifSetting.setAttribute(
|
|
48
48
|
"title",
|
|
49
49
|
`Notification not available in the browser`,
|
|
50
|
-
)
|
|
51
|
-
notifCheckbox.disabled = true
|
|
52
|
-
}
|
|
50
|
+
);
|
|
51
|
+
notifCheckbox.disabled = true;
|
|
52
|
+
};
|
|
53
53
|
const applyNotificationDefaultEffects = () => {
|
|
54
|
-
applyNotificationNOTGrantedEffects()
|
|
55
|
-
const notifSetting = document.querySelector(".settings_notification")
|
|
56
|
-
notifSetting.removeAttribute("data-disabled")
|
|
57
|
-
notifSetting.removeAttribute("title")
|
|
58
|
-
}
|
|
54
|
+
applyNotificationNOTGrantedEffects();
|
|
55
|
+
const notifSetting = document.querySelector(".settings_notification");
|
|
56
|
+
notifSetting.removeAttribute("data-disabled");
|
|
57
|
+
notifSetting.removeAttribute("title");
|
|
58
|
+
};
|
|
59
59
|
const applyNotificationDeniedEffects = () => {
|
|
60
|
-
applyNotificationNOTGrantedEffects()
|
|
61
|
-
const notifSetting = document.querySelector(".settings_notification")
|
|
62
|
-
notifSetting.setAttribute("data-disabled", "true")
|
|
63
|
-
notifSetting.setAttribute("title", `Notification denied`)
|
|
64
|
-
}
|
|
60
|
+
applyNotificationNOTGrantedEffects();
|
|
61
|
+
const notifSetting = document.querySelector(".settings_notification");
|
|
62
|
+
notifSetting.setAttribute("data-disabled", "true");
|
|
63
|
+
notifSetting.setAttribute("title", `Notification denied`);
|
|
64
|
+
};
|
|
65
65
|
const applyNotificationGrantedEffects = () => {
|
|
66
66
|
enableVariant(document.querySelector(".notification_text"), {
|
|
67
67
|
notif_granted: "yes",
|
|
68
|
-
})
|
|
69
|
-
notifCheckbox.disabled = false
|
|
68
|
+
});
|
|
69
|
+
notifCheckbox.disabled = false;
|
|
70
70
|
notifCheckbox.onchange = () => {
|
|
71
71
|
if (notifCheckbox.checked) {
|
|
72
|
-
enableNotifications()
|
|
72
|
+
enableNotifications();
|
|
73
73
|
} else {
|
|
74
|
-
disableNotifications()
|
|
74
|
+
disableNotifications();
|
|
75
75
|
}
|
|
76
|
-
}
|
|
77
|
-
}
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
78
|
|
|
79
79
|
const applyNotificationNOTGrantedEffects = () => {
|
|
80
80
|
enableVariant(document.querySelector(".notification_text"), {
|
|
81
81
|
notif_granted: "no",
|
|
82
|
-
})
|
|
83
|
-
notifCheckbox.disabled = true
|
|
84
|
-
notifCheckbox.checked = false
|
|
82
|
+
});
|
|
83
|
+
notifCheckbox.disabled = true;
|
|
84
|
+
notifCheckbox.checked = false;
|
|
85
85
|
document.querySelector("a.request_notification_permission").onclick = () => {
|
|
86
|
-
requestPermission()
|
|
87
|
-
}
|
|
88
|
-
}
|
|
86
|
+
requestPermission();
|
|
87
|
+
};
|
|
88
|
+
};
|