@jsenv/core 29.8.6 → 29.9.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.
Files changed (52) hide show
  1. package/README.md +1 -1
  2. package/dist/html/explorer.html +4 -3
  3. package/dist/js/autoreload.js +59 -39
  4. package/dist/js/server_events_client.js +9 -4
  5. package/dist/js/supervisor.js +4 -2
  6. package/dist/main.js +50 -2085
  7. package/package.json +2 -2
  8. package/src/build/build.js +33 -33
  9. package/src/plugins/autoreload/client/autoreload.js +57 -31
  10. package/src/plugins/autoreload/client/url_helpers.js +7 -4
  11. package/src/plugins/explorer/client/explorer.html +4 -3
  12. package/src/plugins/plugins.js +1 -1
  13. package/src/plugins/ribbon/jsenv_plugin_ribbon.js +6 -1
  14. package/src/plugins/server_events/client/connection_manager.js +8 -3
  15. package/src/plugins/supervisor/client/supervisor.js +4 -2
  16. package/src/plugins/url_resolution/jsenv_plugin_url_resolution.js +6 -2
  17. package/src/plugins/url_resolution/node_esm_resolver.js +6 -1
  18. package/dist/js/html_src_set.js +0 -20
  19. package/src/plugins/autoreload/client/autoreload_preference.js +0 -11
  20. package/src/plugins/toolbar/client/animation/toolbar_animation.js +0 -39
  21. package/src/plugins/toolbar/client/eventsource/eventsource.css +0 -83
  22. package/src/plugins/toolbar/client/eventsource/toolbar_eventsource.js +0 -57
  23. package/src/plugins/toolbar/client/execution/execution.css +0 -79
  24. package/src/plugins/toolbar/client/execution/toolbar_execution.js +0 -88
  25. package/src/plugins/toolbar/client/focus/focus.css +0 -61
  26. package/src/plugins/toolbar/client/focus/toolbar_focus.js +0 -19
  27. package/src/plugins/toolbar/client/jsenv_logo.svg +0 -140
  28. package/src/plugins/toolbar/client/notification/toolbar_notification.js +0 -181
  29. package/src/plugins/toolbar/client/responsive/overflow_menu.css +0 -61
  30. package/src/plugins/toolbar/client/responsive/toolbar_responsive.js +0 -103
  31. package/src/plugins/toolbar/client/settings/settings.css +0 -201
  32. package/src/plugins/toolbar/client/settings/toolbar_settings.js +0 -47
  33. package/src/plugins/toolbar/client/theme/jsenv_theme.css +0 -77
  34. package/src/plugins/toolbar/client/theme/light_theme.css +0 -106
  35. package/src/plugins/toolbar/client/theme/toolbar_theme.js +0 -34
  36. package/src/plugins/toolbar/client/toolbar.html +0 -457
  37. package/src/plugins/toolbar/client/toolbar_injector.js +0 -218
  38. package/src/plugins/toolbar/client/toolbar_main.css +0 -172
  39. package/src/plugins/toolbar/client/toolbar_main.js +0 -197
  40. package/src/plugins/toolbar/client/tooltip/tooltip.css +0 -61
  41. package/src/plugins/toolbar/client/tooltip/tooltip.js +0 -39
  42. package/src/plugins/toolbar/client/util/animation.js +0 -305
  43. package/src/plugins/toolbar/client/util/dom.js +0 -108
  44. package/src/plugins/toolbar/client/util/fetch_using_xhr.js +0 -400
  45. package/src/plugins/toolbar/client/util/fetching.js +0 -14
  46. package/src/plugins/toolbar/client/util/iframe_to_parent_href.js +0 -10
  47. package/src/plugins/toolbar/client/util/jsenv_logger.js +0 -28
  48. package/src/plugins/toolbar/client/util/preferences.js +0 -10
  49. package/src/plugins/toolbar/client/util/responsive.js +0 -112
  50. package/src/plugins/toolbar/client/util/util.js +0 -19
  51. package/src/plugins/toolbar/client/variant/variant.js +0 -74
  52. package/src/plugins/toolbar/jsenv_plugin_toolbar.js +0 -62
@@ -1,103 +0,0 @@
1
- import {
2
- forceHideElement,
3
- removeForceHideElement,
4
- deactivateToolbarSection,
5
- } from "../util/dom.js"
6
- import { createHorizontalBreakpoint } from "../util/responsive.js"
7
- import { hideTooltip } from "../tooltip/tooltip.js"
8
-
9
- const WINDOW_SMALL_WIDTH = 420
10
-
11
- export const makeToolbarResponsive = () => {
12
- // apply responsive design on toolbar icons if needed + add listener on resize screen
13
- // ideally we should listen breakpoint once, for now restore toolbar
14
- const overflowMenuBreakpoint = createHorizontalBreakpoint(WINDOW_SMALL_WIDTH)
15
- const handleOverflowMenuBreakpoint = () => {
16
- responsiveToolbar(overflowMenuBreakpoint)
17
- }
18
- handleOverflowMenuBreakpoint()
19
- overflowMenuBreakpoint.changed.listen(handleOverflowMenuBreakpoint)
20
-
21
- // overflow menu
22
- document.querySelector("#overflow-menu-button").onclick = () =>
23
- toggleOverflowMenu()
24
- }
25
-
26
- const responsiveToolbar = (overflowMenuBreakpoint) => {
27
- // close all tooltips in case opened
28
- hideTooltip(document.querySelector("#eventsource-indicator"))
29
- hideTooltip(document.querySelector("#execution-indicator"))
30
- // close settings box in case opened
31
- deactivateToolbarSection(document.querySelector("#settings"))
32
-
33
- if (overflowMenuBreakpoint.isBelow()) {
34
- enableOverflow()
35
- } else {
36
- disableOverflow()
37
- }
38
- }
39
-
40
- let moves = []
41
-
42
- const enableOverflow = () => {
43
- // move elements from toolbar to overflow menu
44
- const responsiveToolbarElements = document.querySelectorAll(
45
- "[data-responsive-toolbar-element]",
46
- )
47
- const overflowMenu = document.querySelector("#overflow-menu")
48
-
49
- // keep a placeholder element to know where to move them back
50
- moves = Array.from(responsiveToolbarElements).map((element) => {
51
- const placeholder = document.createElement("div")
52
- placeholder.style.display = "none"
53
- placeholder.setAttribute("data-placeholder", "")
54
- element.parentNode.replaceChild(placeholder, element)
55
- overflowMenu.appendChild(element)
56
- return { element, placeholder }
57
- })
58
-
59
- document
60
- .querySelector("#toolbar")
61
- .setAttribute("data-overflow-menu-enabled", "")
62
- removeForceHideElement(document.querySelector("#overflow-menu-button"))
63
- }
64
-
65
- const disableOverflow = () => {
66
- // close overflow menu in case it's open & unselect toggleOverflowMenu button in case it's selected
67
- hideOverflowMenu()
68
- deactivateToolbarSection(document.querySelector("#overflow-menu"))
69
- moves.forEach(({ element, placeholder }) => {
70
- placeholder.parentNode.replaceChild(element, placeholder)
71
- })
72
- moves = []
73
-
74
- document
75
- .querySelector("#toolbar")
76
- .removeAttribute("data-overflow-menu-enabled")
77
- forceHideElement(document.querySelector("#overflow-menu-button"))
78
- }
79
-
80
- const toggleOverflowMenu = () => {
81
- if (overflowMenuIsVisible()) {
82
- hideOverflowMenu()
83
- } else {
84
- showOverflowMenu()
85
- }
86
- }
87
-
88
- const overflowMenuIsVisible = () => {
89
- const toolbar = document.querySelector("#toolbar")
90
- return toolbar.hasAttribute("data-overflow-menu-visible")
91
- }
92
-
93
- const showOverflowMenu = () => {
94
- const toolbar = document.querySelector("#toolbar")
95
- document.querySelector("#overflow-menu").setAttribute("data-animate", "")
96
- toolbar.setAttribute("data-overflow-menu-visible", "")
97
- }
98
-
99
- const hideOverflowMenu = () => {
100
- const toolbar = document.querySelector("#toolbar")
101
- toolbar.removeAttribute("data-overflow-menu-visible")
102
- document.querySelector("#overflow-menu").removeAttribute("data-animate")
103
- }
@@ -1,201 +0,0 @@
1
- #settings-button {
2
- position: relative;
3
- }
4
-
5
- #settings-button[data-warning] svg {
6
- fill: #cb5909;
7
- }
8
-
9
- #settings-button[data-warning] svg:hover {
10
- fill: darkorange !important;
11
- }
12
-
13
- #settings-box {
14
- display: none;
15
- position: absolute;
16
- bottom: 40px;
17
- right: 0;
18
- text-align: center;
19
- padding: 17px;
20
- font-size: 14px;
21
- color: #fff;
22
- background-color: #030713;
23
- border-radius: 5px 5px 0 0;
24
- min-width: 250px;
25
- min-height: 150px;
26
- z-index: -1;
27
- }
28
-
29
- [data-active] #settings-box {
30
- display: block;
31
- animation: comeUp ease 0.3s;
32
- }
33
-
34
- @keyframes comeUp {
35
- 0% {
36
- opacity: 0;
37
- transform: translate(0, 90px);
38
- }
39
- 100% {
40
- opacity: 1;
41
- transform: translate(0, 0);
42
- }
43
- }
44
-
45
- #settings-box-body {
46
- text-align: left;
47
- padding: 18px 0;
48
- max-height: 80vh;
49
- overflow: auto;
50
- width: 100vw;
51
- display: flex;
52
- justify-content: center;
53
- }
54
-
55
- .settings-box-items-wrapper {
56
- max-width: 700px;
57
- display: flex;
58
- flex-wrap: wrap;
59
- justify-content: center;
60
- }
61
-
62
- .settings-box-item {
63
- padding: 15px;
64
- background: #0c111b;
65
- width: 250px;
66
- margin: 9px 18px;
67
- }
68
-
69
- #settings-box-header .settings-icon {
70
- fill: none;
71
- stroke: #24b1b0;
72
- stroke-width: 2;
73
- margin-right: 10px;
74
- width: 22px;
75
- height: 22px;
76
- position: relative;
77
- top: 4px;
78
- }
79
-
80
- #settings-box h3 {
81
- display: inline-block;
82
- font-size: 20px;
83
- margin: 10px 0;
84
- color: #24b1b0;
85
- }
86
-
87
- #button-close-settings {
88
- float: right;
89
- fill: #24b1b0;
90
- }
91
-
92
- #button-close-settings:hover {
93
- opacity: 0.6;
94
- }
95
-
96
- label {
97
- color: #a9a8a8;
98
- font-size: 14px;
99
- padding-bottom: 3px;
100
- display: block;
101
- }
102
-
103
- #settings-box .category-title {
104
- color: #24b1b0;
105
- font-size: 16px;
106
- display: inline-block;
107
- margin-bottom: 15px;
108
- margin-top: 4px;
109
- }
110
-
111
- #settings-box .category-title svg {
112
- fill: currentColor;
113
- vertical-align: top;
114
- margin-right: 5px;
115
- width: 18px;
116
- height: 18px;
117
- }
118
-
119
- #settings-box .category-subtitle {
120
- color: #a9a8a8;
121
- font-size: 14px;
122
- max-width: 220px;
123
- }
124
-
125
- /* checkbox switch */
126
- .switch {
127
- position: relative;
128
- float: right;
129
- width: 3.5em;
130
- height: 2em;
131
- padding: 0;
132
- cursor: pointer;
133
- }
134
- .switch input {
135
- position: absolute;
136
- opacity: 0;
137
- width: 0;
138
- height: 0;
139
- }
140
- .switch .slider {
141
- position: absolute;
142
- vertical-align: middle;
143
- height: 0.3em;
144
- left: 0.5em;
145
- right: 0.5em;
146
- top: 50%;
147
- margin-top: -0.15em;
148
- background-color: #4c4c4c;
149
- transition: 0.4s;
150
- border-radius: 0.15em;
151
- }
152
- .switch .square {
153
- position: absolute;
154
- content: "";
155
- height: 1em;
156
- width: 1em;
157
- left: 0.5em;
158
- top: 50%;
159
- margin-top: -0.5em;
160
- background-color: #4c4c4c;
161
- color: #030713;
162
- transition: 0.4s;
163
- border-radius: 0.15em;
164
- }
165
- .switch input + * {
166
- position: relative;
167
- width: 100%;
168
- height: 100%;
169
-
170
- /* It's important to have a border (event transparent)
171
- To be able to apply an outline to this element later*/
172
- border-width: 1px;
173
- border-color: transparent;
174
- border-style: solid;
175
- }
176
- .switch input:checked + * .slider {
177
- background-color: #24b1b0;
178
- }
179
- .switch input:checked + * .square {
180
- transform: translateX(1.6em);
181
- background-color: #24b1b0;
182
- }
183
-
184
- .settings-box-item[data-disabled] {
185
- background-color: rgba(12, 17, 27, 0.4);
186
- cursor: default;
187
- }
188
- .settings-box-item[data-disabled] .category-title,
189
- .settings-box-item[data-disabled] .switch,
190
- .settings-box-item[data-disabled] .category-subtitle {
191
- opacity: 0.4;
192
- }
193
- .settings-box-item[data-disabled] .category-title span {
194
- text-decoration: line-through;
195
- }
196
- .settings-box-item[data-disabled] .category-subtitle {
197
- text-decoration: line-through;
198
- }
199
- .settings-box-item[data-disabled] .switch {
200
- cursor: default;
201
- }
@@ -1,47 +0,0 @@
1
- import {
2
- toolbarSectionIsActive,
3
- deactivateToolbarSection,
4
- activateToolbarSection,
5
- updateIframeOverflowOnParentWindow,
6
- } from "../util/dom.js"
7
- import { enableVariant } from "../variant/variant.js"
8
-
9
- export const renderToolbarSettings = () => {
10
- document.querySelector("#settings-button").onclick = toggleSettings
11
- document.querySelector("#button-close-settings").onclick = toggleSettings
12
- disableWarningStyle()
13
- }
14
-
15
- const toggleSettings = () => {
16
- if (settingsAreVisible()) {
17
- hideSettings()
18
- } else {
19
- showSettings()
20
- }
21
- }
22
-
23
- export const enableWarningStyle = () => {
24
- enableVariant(document.querySelector("#settings-button"), {
25
- has_warning: "yes",
26
- })
27
- }
28
-
29
- export const disableWarningStyle = () => {
30
- enableVariant(document.querySelector("#settings-button"), {
31
- has_warning: "no",
32
- })
33
- }
34
-
35
- export const settingsAreVisible = () => {
36
- return toolbarSectionIsActive(document.querySelector(`#settings`))
37
- }
38
-
39
- export const hideSettings = () => {
40
- deactivateToolbarSection(document.querySelector(`#settings`))
41
- updateIframeOverflowOnParentWindow()
42
- }
43
-
44
- export const showSettings = () => {
45
- activateToolbarSection(document.querySelector(`#settings`))
46
- updateIframeOverflowOnParentWindow()
47
- }
@@ -1,77 +0,0 @@
1
- /* icons */
2
- html[data-theme="jsenv"] .iconToolbar {
3
- fill: #de5600;
4
- }
5
- html[data-theme="jsenv"] .iconToolbar:hover {
6
- fill: #9a5300 !important;
7
- }
8
-
9
- /* loaders */
10
- html[data-theme="jsenv"] #loader-icon {
11
- color: #404040;
12
- }
13
-
14
- /* settings */
15
- html[data-theme="jsenv"] #settings-box,
16
- html[data-theme="jsenv"] #settings[data-active] button {
17
- background: #f7931e;
18
- }
19
- html[data-theme="jsenv"] .settings-box-item {
20
- background: #ffa641;
21
- }
22
- html[data-theme="jsenv"] #settings-box-header .settings-icon {
23
- stroke: #076570;
24
- }
25
- html[data-theme="jsenv"] #button-close-settings {
26
- fill: #076570;
27
- }
28
- html[data-theme="jsenv"] #settings-box h3,
29
- html[data-theme="jsenv"] #settings-box .category-title {
30
- color: #076570;
31
- }
32
- html[data-theme="jsenv"] #settings-box .category-title svg {
33
- fill: #076570;
34
- }
35
- html[data-theme="jsenv"] #settings-box .category-subtitle {
36
- color: #076570;
37
- }
38
- html[data-theme="jsenv"] label {
39
- color: #002e33;
40
- }
41
- html[data-theme="jsenv"] input:checked + .slider,
42
- html[data-theme="jsenv"] .switch input:checked + .slider:before {
43
- background-color: #de5600;
44
- }
45
- html[data-theme="jsenv"] .switch .slider,
46
- html[data-theme="jsenv"] .switch .slider:before {
47
- background-color: grey;
48
- }
49
-
50
- /* tooltips */
51
- html[data-theme="jsenv"] .tooltip {
52
- background-color: #ffd390;
53
- color: #884900;
54
- }
55
- html[data-theme="jsenv"] .tooltipAction {
56
- border-color: #884900;
57
- }
58
- html[data-theme="jsenv"] .tooltipAction a {
59
- color: #884900;
60
- }
61
- html[data-theme="jsenv"] .tooltipIcon {
62
- fill: #884900;
63
- }
64
- html[data-theme="jsenv"] .tooltip::after {
65
- border-color: #ffd390 transparent transparent transparent;
66
- }
67
-
68
- /* page file list */
69
- html[data-theme="jsenv"] h2 {
70
- color: orange;
71
- }
72
- html[data-theme="jsenv"] #fileIconSvgConfig {
73
- fill: orange;
74
- }
75
- html[data-theme="jsenv"] #explorables h2 span {
76
- color: #24b1b0;
77
- }
@@ -1,106 +0,0 @@
1
- /* general */
2
- html[data-theme="light"] #toolbar {
3
- background: #e8eff3;
4
- }
5
-
6
- /* icons */
7
- html[data-theme="light"] .iconToolbar {
8
- fill: #404040;
9
- }
10
- html[data-theme="light"] .iconToolbar:hover {
11
- fill: #757575 !important;
12
- }
13
-
14
- /* loaders */
15
- html[data-theme="light"] #loader-icon {
16
- color: #404040;
17
- }
18
-
19
- /* settings */
20
- html[data-theme="light"] #settings-box,
21
- html[data-theme="light"] #settings[data-active] button {
22
- background: #87acd3;
23
- }
24
- html[data-theme="light"] .settings-box-item {
25
- background: #97b9da;
26
- }
27
- html[data-theme="light"] #settings-box-header .settings-icon {
28
- stroke: #076570;
29
- }
30
- html[data-theme="light"] #button-close-settings {
31
- fill: #076570;
32
- }
33
- html[data-theme="light"] #settings-box h3,
34
- html[data-theme="light"] #settings-box .category-title {
35
- color: #076570;
36
- }
37
- html[data-theme="light"] #settings-box .category-title svg {
38
- fill: #076570;
39
- }
40
- html[data-theme="light"] #settings-box .category-subtitle {
41
- color: #5d5d5d;
42
- }
43
- html[data-theme="light"] label {
44
- color: #002e33;
45
- }
46
- html[data-theme="light"] .switch input + * .slider,
47
- html[data-theme="light"] .switch input + * .square {
48
- background-color: grey;
49
- }
50
- html[data-theme="light"] .switch input:checked + * .slider,
51
- html[data-theme="light"] .switch input:checked + * .square {
52
- background-color: #076570;
53
- }
54
-
55
- /* tooltips */
56
- html[data-theme="light"] .tooltip {
57
- background-color: rgb(138, 145, 154);
58
- color: #fff;
59
- }
60
- html[data-theme="light"] .tooltipAction {
61
- border-color: #fff;
62
- }
63
- html[data-theme="light"] .tooltip::after {
64
- border-color: rgb(138, 145, 154) transparent transparent transparent;
65
- }
66
-
67
- /* overflow menu */
68
- html[data-theme="light"] #overflow-menu-button {
69
- background: #e8eff3;
70
- }
71
- html[data-theme="light"]
72
- #toolbar[data-overflow-menu-visible]
73
- #overflow-menu-button {
74
- background: #a5a9ad;
75
- }
76
- html[data-theme="light"] #overflow-menu {
77
- background: #dfe4e7;
78
- }
79
-
80
- /* page file list */
81
- html[data-theme="light"] h2,
82
- html[data-theme="light"] h4 {
83
- color: #076570;
84
- }
85
- html[data-theme="light"] #fileIconSvgConfig {
86
- fill: #076570;
87
- }
88
- html[data-theme="light"] #explorables h2 span {
89
- color: #ff8d00;
90
- }
91
- html[data-theme="light"] article[data-page="file-list"],
92
- html[data-theme="light"] #file-list-link[data-active] a {
93
- background: #bbd5ea;
94
- }
95
- html[data-theme="light"] #explorables fieldset input:checked + * {
96
- color: #ff8d00;
97
- background: #bbd5ea;
98
- }
99
- html[data-theme="light"] #explorables #explorables-header,
100
- html[data-theme="light"] #explorables fieldset label input + * {
101
- background: #ddf0ff;
102
- }
103
- html[data-theme="light"] .execution-link {
104
- background: #ddf0ff;
105
- color: #076570;
106
- }
@@ -1,34 +0,0 @@
1
- import { createPreference } from "../util/preferences.js"
2
-
3
- const DARK_THEME = "dark"
4
- const LIGHT_THEME = "light"
5
- const themePreference = createPreference("theme")
6
-
7
- export const renderToolbarTheme = () => {
8
- const theme = getThemePreference()
9
- const checkbox = document.querySelector("#checkbox-dark-theme")
10
- checkbox.checked = theme === DARK_THEME
11
- setTheme(theme)
12
- checkbox.onchange = () => {
13
- if (checkbox.checked) {
14
- setThemePreference(DARK_THEME)
15
- setTheme(DARK_THEME)
16
- } else {
17
- setThemePreference(LIGHT_THEME)
18
- setTheme(LIGHT_THEME)
19
- }
20
- }
21
- }
22
-
23
- const getThemePreference = () => {
24
- return themePreference.has() ? themePreference.get() : DARK_THEME
25
- }
26
-
27
- const setThemePreference = (value) => {
28
- themePreference.set(value)
29
- setTheme(value)
30
- }
31
-
32
- const setTheme = (theme) => {
33
- document.querySelector("html").setAttribute("data-theme", theme)
34
- }