@jsenv/core 29.8.5 → 29.9.0

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 (47) hide show
  1. package/README.md +1 -1
  2. package/dist/babel_helpers/iterableToArrayLimit/iterableToArrayLimit.js +21 -5
  3. package/dist/babel_helpers/iterableToArrayLimitLoose/iterableToArrayLimitLoose.js +8 -6
  4. package/dist/js/autoreload.js +1 -1
  5. package/dist/js/s.js +22 -5
  6. package/dist/js/s.js.map +9 -7
  7. package/dist/main.js +50 -2085
  8. package/package.json +8 -8
  9. package/src/build/build.js +33 -33
  10. package/src/plugins/plugins.js +1 -1
  11. package/src/plugins/ribbon/jsenv_plugin_ribbon.js +6 -1
  12. package/src/plugins/url_resolution/jsenv_plugin_url_resolution.js +6 -2
  13. package/src/plugins/url_resolution/node_esm_resolver.js +6 -1
  14. package/dist/js/html_src_set.js +0 -20
  15. package/src/plugins/toolbar/client/animation/toolbar_animation.js +0 -39
  16. package/src/plugins/toolbar/client/eventsource/eventsource.css +0 -83
  17. package/src/plugins/toolbar/client/eventsource/toolbar_eventsource.js +0 -57
  18. package/src/plugins/toolbar/client/execution/execution.css +0 -79
  19. package/src/plugins/toolbar/client/execution/toolbar_execution.js +0 -88
  20. package/src/plugins/toolbar/client/focus/focus.css +0 -61
  21. package/src/plugins/toolbar/client/focus/toolbar_focus.js +0 -19
  22. package/src/plugins/toolbar/client/jsenv_logo.svg +0 -140
  23. package/src/plugins/toolbar/client/notification/toolbar_notification.js +0 -181
  24. package/src/plugins/toolbar/client/responsive/overflow_menu.css +0 -61
  25. package/src/plugins/toolbar/client/responsive/toolbar_responsive.js +0 -103
  26. package/src/plugins/toolbar/client/settings/settings.css +0 -201
  27. package/src/plugins/toolbar/client/settings/toolbar_settings.js +0 -47
  28. package/src/plugins/toolbar/client/theme/jsenv_theme.css +0 -77
  29. package/src/plugins/toolbar/client/theme/light_theme.css +0 -106
  30. package/src/plugins/toolbar/client/theme/toolbar_theme.js +0 -34
  31. package/src/plugins/toolbar/client/toolbar.html +0 -457
  32. package/src/plugins/toolbar/client/toolbar_injector.js +0 -218
  33. package/src/plugins/toolbar/client/toolbar_main.css +0 -172
  34. package/src/plugins/toolbar/client/toolbar_main.js +0 -197
  35. package/src/plugins/toolbar/client/tooltip/tooltip.css +0 -61
  36. package/src/plugins/toolbar/client/tooltip/tooltip.js +0 -39
  37. package/src/plugins/toolbar/client/util/animation.js +0 -305
  38. package/src/plugins/toolbar/client/util/dom.js +0 -108
  39. package/src/plugins/toolbar/client/util/fetch_using_xhr.js +0 -400
  40. package/src/plugins/toolbar/client/util/fetching.js +0 -14
  41. package/src/plugins/toolbar/client/util/iframe_to_parent_href.js +0 -10
  42. package/src/plugins/toolbar/client/util/jsenv_logger.js +0 -28
  43. package/src/plugins/toolbar/client/util/preferences.js +0 -10
  44. package/src/plugins/toolbar/client/util/responsive.js +0 -112
  45. package/src/plugins/toolbar/client/util/util.js +0 -19
  46. package/src/plugins/toolbar/client/variant/variant.js +0 -74
  47. package/src/plugins/toolbar/jsenv_plugin_toolbar.js +0 -62
@@ -1,172 +0,0 @@
1
- @import "./execution/execution.css";
2
- @import "./focus/focus.css";
3
- @import "./eventsource/eventsource.css";
4
- @import "./responsive/overflow_menu.css";
5
- @import "./settings/settings.css";
6
- @import "./theme/light_theme.css";
7
- @import "./tooltip/tooltip.css";
8
-
9
- html[data-animation-disabled] * {
10
- transition: none !important;
11
- animation-duration: 0s !important;
12
- animation-delay: 0s !important;
13
- }
14
-
15
- [data-when] {
16
- display: none !important;
17
- }
18
-
19
- * {
20
- box-sizing: border-box;
21
- }
22
-
23
- html,
24
- body {
25
- margin: 0;
26
- padding: 0;
27
- }
28
-
29
- html {
30
- font-family: arial, sans;
31
- }
32
-
33
- /* global utils */
34
- [data-force-hide] {
35
- display: none !important;
36
- }
37
-
38
- #toolbar-overlay {
39
- position: fixed;
40
- left: 0;
41
- top: 0;
42
- width: 100%;
43
- height: 100%;
44
- filter: url(#better-blur);
45
- background-color: rgba(0, 0, 0, 0.2);
46
- }
47
-
48
- #toolbar {
49
- position: fixed;
50
- bottom: 0;
51
- height: 40px;
52
- width: 100%;
53
- background: #404040;
54
- }
55
-
56
- #toolbar-wrapper {
57
- display: table;
58
- width: 100%;
59
- height: 100%;
60
- }
61
-
62
- #toolbar-wrapper > * {
63
- display: table-cell;
64
- vertical-align: middle;
65
- }
66
-
67
- #toolbar button {
68
- background: none;
69
- border: none;
70
- height: 100%;
71
- padding: 0;
72
- }
73
-
74
- #toolbar button:hover {
75
- cursor: pointer;
76
- }
77
-
78
- #toolbar a:hover {
79
- cursor: pointer;
80
- }
81
-
82
- /* file and settings icons */
83
- #fileIconSvg,
84
- .settings-icon {
85
- width: 20px;
86
- }
87
-
88
- .iconToolbar {
89
- height: 40px;
90
- fill: #cecece;
91
- color: #cecece;
92
- }
93
-
94
- .iconToolbar:hover {
95
- fill: #909090 !important;
96
- }
97
-
98
- .toolbar-icon-wrapper {
99
- height: 100%;
100
- text-align: center;
101
- width: 40px;
102
- display: inline-block;
103
- }
104
-
105
- #file-list-link[data-active] a {
106
- background: #1f262c;
107
- }
108
-
109
- #file[data-active] {
110
- background: rgba(31, 38, 44, 0.72);
111
- }
112
-
113
- #settings[data-active] button {
114
- background: #030713;
115
- }
116
-
117
- /* close icon */
118
- #crossIconSvg {
119
- width: 18px;
120
- }
121
-
122
- /* re-open toolbar-trigger */
123
- #toolbar-trigger {
124
- display: block;
125
- overflow: hidden;
126
- position: absolute;
127
- bottom: -32px;
128
- right: 20px;
129
- height: 40px;
130
- width: 40px;
131
- padding: 0;
132
- border-radius: 5px 5px 0 0;
133
- border: 1px solid rgba(0, 0, 0, 0.33);
134
- border-bottom: none;
135
- box-shadow: 0px 0px 6px 2px rgba(0, 0, 0, 0.46);
136
- background: transparent;
137
- }
138
-
139
- #toolbar-trigger[data-animate] {
140
- transition: 600ms;
141
- }
142
-
143
- #toolbar-trigger #jsenvLogoSvg {
144
- width: 35px;
145
- height: 35px;
146
- opacity: 0;
147
- transition: 600ms;
148
- }
149
-
150
- html[data-toolbar-visible] #toolbar-trigger {
151
- display: none;
152
- }
153
-
154
- #toolbar-trigger:hover {
155
- cursor: pointer;
156
- }
157
-
158
- #toolbar-trigger[data-expanded] {
159
- bottom: 0;
160
- }
161
-
162
- #toolbar-trigger[data-expanded] #jsenvLogoSvg {
163
- opacity: 1;
164
- }
165
-
166
- /* #jsenvLogo {
167
- transition: 600ms;
168
- } */
169
-
170
- #toolbar a {
171
- color: inherit;
172
- }
@@ -1,197 +0,0 @@
1
- import { startJavaScriptAnimation } from "./util/animation.js"
2
- import "./focus/toolbar_focus.js"
3
- import { setLinkHrefForParentWindow } from "./util/iframe_to_parent_href.js"
4
- import {
5
- getToolbarIframe,
6
- deactivateToolbarSection,
7
- setStyles,
8
- } from "./util/dom.js"
9
- import { createPreference } from "./util/preferences.js"
10
- import { hideTooltip, hideAllTooltip } from "./tooltip/tooltip.js"
11
- import {
12
- renderToolbarSettings,
13
- hideSettings,
14
- } from "./settings/toolbar_settings.js"
15
- import { renderToolbarNotification } from "./notification/toolbar_notification.js"
16
- import { renderToolbarTheme } from "./theme/toolbar_theme.js"
17
- import { renderToolbarAnimation } from "./animation/toolbar_animation.js"
18
- import { renderExecutionInToolbar } from "./execution/toolbar_execution.js"
19
- import { initToolbarEventSource } from "./eventsource/toolbar_eventsource.js"
20
- import { makeToolbarResponsive } from "./responsive/toolbar_responsive.js"
21
-
22
- const toolbarVisibilityPreference = createPreference("toolbar")
23
-
24
- const renderToolbar = async () => {
25
- const toolbarOverlay = document.querySelector("#toolbar-overlay")
26
- toolbarOverlay.onclick = () => {
27
- hideAllTooltip()
28
- hideSettings()
29
- }
30
-
31
- const toolbarVisible = toolbarVisibilityPreference.has()
32
- ? toolbarVisibilityPreference.get()
33
- : true
34
-
35
- if (toolbarVisible) {
36
- showToolbar({ animate: false })
37
- } else {
38
- hideToolbar({ animate: false })
39
- }
40
-
41
- setLinkHrefForParentWindow(
42
- document.querySelector(".toolbar-icon-wrapper"),
43
- "/",
44
- )
45
- renderToolbarNotification()
46
- makeToolbarResponsive()
47
- renderToolbarSettings()
48
- renderToolbarAnimation()
49
- renderToolbarTheme()
50
- renderExecutionInToolbar()
51
- // this might become active but we need to detect this somehow
52
- deactivateToolbarSection(document.querySelector("#file-list-link"))
53
- initToolbarEventSource()
54
-
55
- // if user click enter or space quickly while closing toolbar
56
- // it will cancel the closing
57
- // that's why I used toggleToolbar and not hideToolbar
58
- document.querySelector("#button-close-toolbar").onclick = () =>
59
- toogleToolbar()
60
- }
61
-
62
- const toogleToolbar = () => {
63
- if (toolbarIsVisible()) {
64
- hideToolbar()
65
- } else {
66
- showToolbar()
67
- }
68
- }
69
-
70
- const toolbarIsVisible = () =>
71
- document.documentElement.hasAttribute("data-toolbar-visible")
72
-
73
- let hideToolbar = () => {
74
- // toolbar hidden by default, nothing to do to hide it by default
75
- sendEventToParent("toolbar-visibility-change", false)
76
- }
77
-
78
- // (by the way it might be cool to have the toolbar auto show when)
79
- // it has something to say (being disconnected from server)
80
- const showToolbar = ({ animate = true } = {}) => {
81
- toolbarVisibilityPreference.set(true)
82
- if (animate) {
83
- document.documentElement.setAttribute("data-toolbar-animation", "")
84
- } else {
85
- document.documentElement.removeAttribute("data-toolbar-animation")
86
- }
87
- document.documentElement.setAttribute("data-toolbar-visible", "")
88
-
89
- sendEventToParent("toolbar-visibility-change", true)
90
-
91
- const toolbarIframe = getToolbarIframe()
92
- const toolbarIframeParent = toolbarIframe.parentNode
93
- const parentWindow = window.parent
94
- const parentDocumentElement =
95
- parentWindow.document.compatMode === "CSS1Compat"
96
- ? parentWindow.document.documentElement
97
- : parentWindow.document.body
98
-
99
- const scrollYMax =
100
- parentDocumentElement.scrollHeight - parentWindow.innerHeight
101
- const scrollY = parentDocumentElement.scrollTop
102
- const scrollYRemaining = scrollYMax - scrollY
103
-
104
- setStyles(toolbarIframeParent, {
105
- "transition-property": "padding-bottom",
106
- "transition-duration": "300ms",
107
- })
108
- // maybe we should use js animation here because we would not conflict with css
109
- const restoreToolbarIframeParentStyles = setStyles(toolbarIframeParent, {
110
- "scroll-padding-bottom": "40px", // same here we should add 40px
111
- "padding-bottom": "40px", // if there is already one we should add 40px
112
- })
113
- const restoreToolbarIframeStyles = setStyles(toolbarIframe, {
114
- height: "40px",
115
- visibility: "visible",
116
- })
117
-
118
- if (scrollYRemaining < 40 && scrollYMax > 0) {
119
- const scrollEnd = scrollY + 40
120
- startJavaScriptAnimation({
121
- duration: 300,
122
- onProgress: ({ progress }) => {
123
- const value = scrollY + (scrollEnd - scrollY) * progress
124
- parentDocumentElement.scrollTop = value
125
- },
126
- })
127
- }
128
-
129
- hideToolbar = () => {
130
- restoreToolbarIframeParentStyles()
131
- restoreToolbarIframeStyles()
132
-
133
- hideTooltip(document.querySelector("#eventsource-indicator"))
134
- hideTooltip(document.querySelector("#execution-indicator"))
135
- toolbarVisibilityPreference.set(false)
136
- if (animate) {
137
- document.documentElement.setAttribute("data-toolbar-animation", "")
138
- } else {
139
- document.documentElement.removeAttribute("data-toolbar-animation")
140
- }
141
- document.documentElement.removeAttribute("data-toolbar-visible")
142
- sendEventToParent("toolbar-visibility-change", false)
143
- }
144
- }
145
-
146
- const addExternalCommandCallback = (command, callback) => {
147
- const messageEventCallback = (messageEvent) => {
148
- const { data } = messageEvent
149
- if (typeof data !== "object") {
150
- return
151
- }
152
- const { __jsenv__ } = data
153
- if (!__jsenv__) {
154
- return
155
- }
156
- if (__jsenv__.command !== command) {
157
- return
158
- }
159
- callback(...__jsenv__.args)
160
- }
161
-
162
- window.addEventListener("message", messageEventCallback)
163
- return () => {
164
- window.removeEventListener("message", messageEventCallback)
165
- }
166
- }
167
-
168
- const sendEventToParent = (name, data) => {
169
- window.parent.postMessage(
170
- {
171
- __jsenv__: {
172
- event: name,
173
- data,
174
- },
175
- },
176
- "*",
177
- )
178
- }
179
-
180
- window.toolbar = {
181
- show: showToolbar,
182
- hide: () => hideToolbar(),
183
- }
184
-
185
- // const { currentScript } = document
186
- addExternalCommandCallback("renderToolbar", ({ logs }) => {
187
- renderToolbar({
188
- logs,
189
- })
190
- })
191
- addExternalCommandCallback("showToolbar", () => {
192
- showToolbar()
193
- })
194
- addExternalCommandCallback("hideToolbar", () => {
195
- hideToolbar()
196
- })
197
- sendEventToParent("toolbar_ready")
@@ -1,61 +0,0 @@
1
- .tooltip {
2
- display: none;
3
- background-color: rgb(94, 94, 94);
4
- color: #fff;
5
- text-align: center;
6
- border-radius: 6px;
7
- position: absolute;
8
- bottom: 120%;
9
- padding: 10px;
10
- font-size: 14px;
11
- margin-left: -40px;
12
- max-width: 260px;
13
- cursor: default;
14
- }
15
-
16
- .tooltip::after {
17
- content: "";
18
- position: absolute;
19
- top: 100%;
20
- left: 60px;
21
- margin-left: -5px;
22
- border-width: 5px;
23
- border-style: solid;
24
- border-color: rgb(94, 94, 94) transparent transparent transparent;
25
- }
26
-
27
- [data-tooltip-visible] .tooltip,
28
- [data-tooltip-auto-visible] .tooltip {
29
- display: block;
30
- animation: fadeIn ease 0.4s;
31
- }
32
-
33
- @keyframes fadeIn {
34
- 0% {
35
- opacity: 0;
36
- }
37
- 100% {
38
- opacity: 1;
39
- }
40
- }
41
-
42
- .tooltipAction {
43
- display: inline-block;
44
- border: 1px solid #a0a0a0;
45
- border-radius: 3px;
46
- padding: 3px 7px;
47
- margin-top: 6px;
48
- }
49
-
50
- .tooltipAction a {
51
- vertical-align: middle;
52
- color: white;
53
- text-decoration: none;
54
- }
55
-
56
- .tooltipIcon {
57
- fill: white;
58
- width: 20px;
59
- height: 20px;
60
- vertical-align: middle;
61
- }
@@ -1,39 +0,0 @@
1
- import { updateIframeOverflowOnParentWindow } from "../util/dom.js"
2
-
3
- export const toggleTooltip = (element) => {
4
- if (element.hasAttribute("data-tooltip-visible")) {
5
- hideTooltip(element)
6
- } else {
7
- showTooltip(element)
8
- }
9
- }
10
-
11
- export const hideTooltip = (element) => {
12
- element.removeAttribute("data-tooltip-visible")
13
- element.removeAttribute("data-tooltip-auto-visible")
14
- updateIframeOverflowOnParentWindow()
15
- }
16
-
17
- export const showTooltip = (element) => {
18
- element.setAttribute("data-tooltip-visible", "")
19
- updateIframeOverflowOnParentWindow()
20
- }
21
-
22
- export const autoShowTooltip = (element) => {
23
- element.setAttribute("data-tooltip-auto-visible", "")
24
- updateIframeOverflowOnParentWindow()
25
- }
26
-
27
- export const removeAutoShowTooltip = (element) => {
28
- element.removeAttribute("data-tooltip-auto-visible")
29
- updateIframeOverflowOnParentWindow()
30
- }
31
-
32
- export const hideAllTooltip = () => {
33
- const elementsWithTooltip = Array.from(
34
- document.querySelectorAll("[data-tooltip-visible]"),
35
- )
36
- elementsWithTooltip.forEach((elementWithTooltip) => {
37
- hideTooltip(elementWithTooltip)
38
- })
39
- }