@jsenv/plugin-toolbar 0.1.13 → 0.1.15

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.
Files changed (60) hide show
  1. package/dist/html/toolbar.html +5 -4
  2. package/dist/jsenv_plugin_toolbar.js +30 -7
  3. package/package.json +3 -3
  4. package/src/client/core/animation_actions.js +5 -5
  5. package/src/client/core/animation_effects.js +6 -6
  6. package/src/client/core/animation_signals.js +4 -4
  7. package/src/client/core/changes_actions.js +5 -5
  8. package/src/client/core/changes_signals.js +2 -2
  9. package/src/client/core/execution_actions.js +16 -16
  10. package/src/client/core/execution_effects.js +10 -10
  11. package/src/client/core/execution_signals.js +6 -6
  12. package/src/client/core/notification_actions.js +31 -31
  13. package/src/client/core/notification_context.js +2 -1
  14. package/src/client/core/notification_effects.js +6 -6
  15. package/src/client/core/notification_signals.js +5 -5
  16. package/src/client/core/parent_window_actions.js +18 -18
  17. package/src/client/core/parent_window_context.js +5 -5
  18. package/src/client/core/parent_window_effects.js +9 -9
  19. package/src/client/core/parent_window_signals.js +17 -17
  20. package/src/client/core/server_actions.js +5 -5
  21. package/src/client/core/server_effects.js +6 -6
  22. package/src/client/core/server_signals.js +7 -7
  23. package/src/client/core/settings_actions.js +5 -5
  24. package/src/client/core/settings_signals.js +2 -2
  25. package/src/client/core/theme_actions.js +5 -5
  26. package/src/client/core/theme_effects.js +5 -5
  27. package/src/client/core/theme_signals.js +4 -4
  28. package/src/client/core/toolbar_logger.js +8 -8
  29. package/src/client/core/toolbar_open_actions.js +5 -5
  30. package/src/client/core/toolbar_open_effects.js +4 -4
  31. package/src/client/core/toolbar_open_signals.js +4 -4
  32. package/src/client/core/toolbar_state_context.js +1 -1
  33. package/src/client/core/toolbar_state_effects.js +7 -7
  34. package/src/client/core/toolbar_state_signals.js +11 -11
  35. package/src/client/core/tooltip_actions.js +5 -5
  36. package/src/client/toolbar_core.js +8 -8
  37. package/src/client/toolbar_injector.js +97 -97
  38. package/src/client/ui/changes_indicator/changes_indicator.js +33 -33
  39. package/src/client/ui/document_execution_indicator/document_execution_indicator.js +28 -28
  40. package/src/client/ui/document_index_link/document_index_link.js +3 -3
  41. package/src/client/ui/server_indicator/server_indicator.js +30 -30
  42. package/src/client/ui/toolbar_close_button/toolbar_close_button.js +6 -6
  43. package/src/client/ui/toolbar_menu_overflow/toolbar_menu_overflow.js +50 -50
  44. package/src/client/ui/toolbar_opening/toolbar_opening.js +35 -35
  45. package/src/client/ui/toolbar_overlay/toolbar_overlay.js +36 -36
  46. package/src/client/ui/toolbar_settings/toolbar_animation_setting.js +13 -13
  47. package/src/client/ui/toolbar_settings/toolbar_autoreload_setting.js +19 -19
  48. package/src/client/ui/toolbar_settings/toolbar_notification_setting.js +47 -47
  49. package/src/client/ui/toolbar_settings/toolbar_settings.js +29 -29
  50. package/src/client/ui/toolbar_settings/toolbar_theme_setting.js +8 -8
  51. package/src/client/ui/toolbar_ui.js +19 -19
  52. package/src/client/ui/util/animation.js +116 -116
  53. package/src/client/ui/util/dom.js +29 -29
  54. package/src/client/ui/util/fetch_using_xhr.js +184 -184
  55. package/src/client/ui/util/fetching.js +6 -6
  56. package/src/client/ui/util/iframe_to_parent_href.js +6 -6
  57. package/src/client/ui/util/responsive.js +48 -48
  58. package/src/client/ui/util/util.js +13 -13
  59. package/src/client/ui/variant.js +27 -27
  60. package/src/jsenv_plugin_toolbar.js +55 -30
@@ -1,66 +1,66 @@
1
- import { effect } from "@preact/signals"
1
+ import { effect } from "@preact/signals";
2
2
 
3
3
  import {
4
4
  executionSignal,
5
5
  executionTooltipOpenedSignal,
6
- } from "../../core/execution_signals.js"
6
+ } from "../../core/execution_signals.js";
7
7
  import {
8
8
  closeExecutionTooltip,
9
9
  openExecutionTooltip,
10
- } from "../../core/execution_actions.js"
11
- import { removeForceHideElement } from "../util/dom.js"
12
- import { enableVariant } from "../variant.js"
10
+ } from "../../core/execution_actions.js";
11
+ import { removeForceHideElement } from "../util/dom.js";
12
+ import { enableVariant } from "../variant.js";
13
13
 
14
14
  const executionIndicator = document.querySelector(
15
15
  "#document_execution_indicator",
16
- )
16
+ );
17
17
 
18
18
  export const renderDocumentExecutionIndicator = async () => {
19
19
  removeForceHideElement(
20
20
  document.querySelector("#document_execution_indicator"),
21
- )
21
+ );
22
22
  effect(() => {
23
- const execution = executionSignal.value
24
- updateExecutionIndicator(execution)
25
- })
23
+ const execution = executionSignal.value;
24
+ updateExecutionIndicator(execution);
25
+ });
26
26
  effect(() => {
27
- const executionTooltipOpened = executionTooltipOpenedSignal.value
27
+ const executionTooltipOpened = executionTooltipOpenedSignal.value;
28
28
  if (executionTooltipOpened) {
29
- executionIndicator.setAttribute("data-tooltip-visible", "")
29
+ executionIndicator.setAttribute("data-tooltip-visible", "");
30
30
  } else {
31
- executionIndicator.removeAttribute("data-tooltip-visible")
31
+ executionIndicator.removeAttribute("data-tooltip-visible");
32
32
  }
33
- })
34
- }
33
+ });
34
+ };
35
35
 
36
36
  const updateExecutionIndicator = ({ status, startTime, endTime } = {}) => {
37
- enableVariant(executionIndicator, { execution: status })
38
- const variantNode = executionIndicator.querySelector("[data-when-active]")
37
+ enableVariant(executionIndicator, { execution: status });
38
+ const variantNode = executionIndicator.querySelector("[data-when-active]");
39
39
  variantNode.querySelector("button").onclick = () => {
40
- const executionTooltipOpened = executionTooltipOpenedSignal.value
40
+ const executionTooltipOpened = executionTooltipOpenedSignal.value;
41
41
  if (executionTooltipOpened) {
42
- closeExecutionTooltip()
42
+ closeExecutionTooltip();
43
43
  } else {
44
- openExecutionTooltip()
44
+ openExecutionTooltip();
45
45
  }
46
- }
46
+ };
47
47
  variantNode.querySelector(".tooltip").textContent = computeText({
48
48
  status,
49
49
  startTime,
50
50
  endTime,
51
- })
52
- }
51
+ });
52
+ };
53
53
 
54
54
  // relative time: https://github.com/tc39/proposal-intl-relative-time/issues/118
55
55
  const computeText = ({ status, startTime, endTime }) => {
56
56
  if (status === "completed") {
57
- return `Execution completed in ${endTime - startTime}ms`
57
+ return `Execution completed in ${endTime - startTime}ms`;
58
58
  }
59
59
  if (status === "failed") {
60
- return `Execution failed in ${endTime - startTime}ms`
60
+ return `Execution failed in ${endTime - startTime}ms`;
61
61
  }
62
62
  if (status === "running") {
63
- return "Executing..."
63
+ return "Executing...";
64
64
  }
65
- return ""
66
- }
65
+ return "";
66
+ };
@@ -1,8 +1,8 @@
1
- import { setLinkHrefForParentWindow } from "../util/iframe_to_parent_href.js"
1
+ import { setLinkHrefForParentWindow } from "../util/iframe_to_parent_href.js";
2
2
 
3
3
  export const renderDocumentIndexLink = () => {
4
4
  setLinkHrefForParentWindow(
5
5
  document.querySelector("#document_index_link"),
6
6
  "/",
7
- )
8
- }
7
+ );
8
+ };
@@ -1,62 +1,62 @@
1
- import { effect } from "@preact/signals"
1
+ import { effect } from "@preact/signals";
2
2
 
3
3
  import {
4
4
  serverConnectionSignal,
5
5
  serverTooltipOpenedSignal,
6
- } from "../../core/server_signals.js"
6
+ } from "../../core/server_signals.js";
7
7
  import {
8
8
  openServerTooltip,
9
9
  closeServerTooltip,
10
- } from "../../core/server_actions.js"
11
- import { removeForceHideElement } from "../util/dom.js"
12
- import { enableVariant } from "../variant.js"
10
+ } from "../../core/server_actions.js";
11
+ import { removeForceHideElement } from "../util/dom.js";
12
+ import { enableVariant } from "../variant.js";
13
13
 
14
- const parentServerEvents = window.parent.__server_events__
15
- const serverEvents = window.__server_events__
16
- const serverIndicator = document.querySelector("#server_indicator")
14
+ const parentServerEvents = window.parent.__server_events__;
15
+ const serverEvents = window.__server_events__;
16
+ const serverIndicator = document.querySelector("#server_indicator");
17
17
 
18
18
  export const renderServerIndicator = () => {
19
- removeForceHideElement(document.querySelector("#server_indicator"))
19
+ removeForceHideElement(document.querySelector("#server_indicator"));
20
20
  effect(() => {
21
- const serverConnection = serverConnectionSignal.value
22
- updateServerIndicator(serverConnection)
23
- })
21
+ const serverConnection = serverConnectionSignal.value;
22
+ updateServerIndicator(serverConnection);
23
+ });
24
24
  effect(() => {
25
- const serverTooltipOpened = serverTooltipOpenedSignal.value
25
+ const serverTooltipOpened = serverTooltipOpenedSignal.value;
26
26
  if (serverTooltipOpened) {
27
- serverIndicator.setAttribute("data-tooltip-visible", "")
27
+ serverIndicator.setAttribute("data-tooltip-visible", "");
28
28
  } else {
29
- serverIndicator.removeAttribute("data-tooltip-visible")
29
+ serverIndicator.removeAttribute("data-tooltip-visible");
30
30
  }
31
- })
32
- }
31
+ });
32
+ };
33
33
 
34
34
  const updateServerIndicator = (connectionState) => {
35
- enableVariant(serverIndicator, { connectionState })
35
+ enableVariant(serverIndicator, { connectionState });
36
36
  const variantNode = document.querySelector(
37
37
  "#server_indicator > [data-when-active]",
38
- )
38
+ );
39
39
  variantNode.querySelector("button").onclick = () => {
40
- const serverTooltipOpened = serverTooltipOpenedSignal.value
40
+ const serverTooltipOpened = serverTooltipOpenedSignal.value;
41
41
  if (serverTooltipOpened) {
42
- closeServerTooltip()
42
+ closeServerTooltip();
43
43
  } else {
44
- openServerTooltip()
44
+ openServerTooltip();
45
45
  }
46
- }
46
+ };
47
47
  if (connectionState === "connecting") {
48
48
  variantNode.querySelector("a").onclick = () => {
49
49
  if (parentServerEvents) {
50
- parentServerEvents.disconnect()
50
+ parentServerEvents.disconnect();
51
51
  }
52
- serverEvents.disconnect()
53
- }
52
+ serverEvents.disconnect();
53
+ };
54
54
  } else if (connectionState === "closed") {
55
55
  variantNode.querySelector("a").onclick = () => {
56
56
  if (parentServerEvents) {
57
- parentServerEvents.connect()
57
+ parentServerEvents.connect();
58
58
  }
59
- serverEvents.connect()
60
- }
59
+ serverEvents.connect();
60
+ };
61
61
  }
62
- }
62
+ };
@@ -1,5 +1,5 @@
1
- import { openedSignal } from "../../core/toolbar_open_signals.js"
2
- import { openToolbar, closeToolbar } from "../../core/toolbar_open_actions.js"
1
+ import { openedSignal } from "../../core/toolbar_open_signals.js";
2
+ import { openToolbar, closeToolbar } from "../../core/toolbar_open_actions.js";
3
3
 
4
4
  export const renderToolbarCloseButton = () => {
5
5
  // if user click enter or space quickly while closing toolbar
@@ -7,9 +7,9 @@ export const renderToolbarCloseButton = () => {
7
7
  // that's why I used toggleToolbar and not hideToolbar
8
8
  document.querySelector("#toolbar_close_button").onclick = () => {
9
9
  if (openedSignal.value) {
10
- closeToolbar()
10
+ closeToolbar();
11
11
  } else {
12
- openToolbar()
12
+ openToolbar();
13
13
  }
14
- }
15
- }
14
+ };
15
+ };
@@ -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
+ };