@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.
- package/dist/html/toolbar.html +5 -4
- package/dist/jsenv_plugin_toolbar.js +30 -7
- package/package.json +3 -3
- 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 +55 -30
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import { setStyles } from "./dom.js"
|
|
1
|
+
import { setStyles } from "./dom.js";
|
|
2
2
|
|
|
3
3
|
const animateFallback = () => {
|
|
4
|
-
return Promise.resolve()
|
|
5
|
-
}
|
|
4
|
+
return Promise.resolve();
|
|
5
|
+
};
|
|
6
6
|
|
|
7
7
|
const animateNative = (node, keyframes, { signal, ...options } = {}) => {
|
|
8
|
-
const animation = node.animate(keyframes, options)
|
|
8
|
+
const animation = node.animate(keyframes, options);
|
|
9
9
|
if (signal) {
|
|
10
10
|
signal.addEventListener("abort", () => {
|
|
11
|
-
animation.cancel()
|
|
12
|
-
})
|
|
11
|
+
animation.cancel();
|
|
12
|
+
});
|
|
13
13
|
}
|
|
14
14
|
return new Promise((resolve) => {
|
|
15
|
-
animation.onfinish = resolve
|
|
16
|
-
})
|
|
17
|
-
}
|
|
15
|
+
animation.onfinish = resolve;
|
|
16
|
+
});
|
|
17
|
+
};
|
|
18
18
|
|
|
19
19
|
export const canUseAnimation = () =>
|
|
20
|
-
typeof HTMLElement.prototype.animate === "function"
|
|
20
|
+
typeof HTMLElement.prototype.animate === "function";
|
|
21
21
|
|
|
22
22
|
export const animateElement = canUseAnimation()
|
|
23
23
|
? animateNative
|
|
24
|
-
: animateFallback
|
|
24
|
+
: animateFallback;
|
|
25
25
|
|
|
26
26
|
export const fadeIn = (node, options) =>
|
|
27
27
|
animateElement(
|
|
@@ -35,7 +35,7 @@ export const fadeIn = (node, options) =>
|
|
|
35
35
|
},
|
|
36
36
|
],
|
|
37
37
|
options,
|
|
38
|
-
)
|
|
38
|
+
);
|
|
39
39
|
|
|
40
40
|
export const fadeOut = (node, options) =>
|
|
41
41
|
animateElement(
|
|
@@ -49,51 +49,51 @@ export const fadeOut = (node, options) =>
|
|
|
49
49
|
},
|
|
50
50
|
],
|
|
51
51
|
options,
|
|
52
|
-
)
|
|
52
|
+
);
|
|
53
53
|
|
|
54
54
|
export const move = (fromNode, toNode, options) => {
|
|
55
|
-
const fromComputedStyle = window.getComputedStyle(fromNode)
|
|
56
|
-
const toComputedStyle = window.getComputedStyle(toNode)
|
|
55
|
+
const fromComputedStyle = window.getComputedStyle(fromNode);
|
|
56
|
+
const toComputedStyle = window.getComputedStyle(toNode);
|
|
57
57
|
// get positions of input in toolbar and aElement
|
|
58
|
-
const fromPosition = fromNode.getBoundingClientRect()
|
|
59
|
-
const toPosition = toNode.getBoundingClientRect()
|
|
58
|
+
const fromPosition = fromNode.getBoundingClientRect();
|
|
59
|
+
const toPosition = toNode.getBoundingClientRect();
|
|
60
60
|
|
|
61
61
|
// we'll do the animation in a div preventing overflow and pointer events
|
|
62
|
-
const div = document.createElement("div")
|
|
63
|
-
div.style.position = "absolute"
|
|
64
|
-
div.style.left = 0
|
|
65
|
-
div.style.top = 0
|
|
66
|
-
div.style.width = `${document.documentElement.scrollWidth}px
|
|
67
|
-
div.style.height = `${document.documentElement.scrollHeight}px
|
|
68
|
-
div.style.overflow = "hidden"
|
|
69
|
-
div.style.pointerEvents = "none"
|
|
62
|
+
const div = document.createElement("div");
|
|
63
|
+
div.style.position = "absolute";
|
|
64
|
+
div.style.left = 0;
|
|
65
|
+
div.style.top = 0;
|
|
66
|
+
div.style.width = `${document.documentElement.scrollWidth}px`;
|
|
67
|
+
div.style.height = `${document.documentElement.scrollHeight}px`;
|
|
68
|
+
div.style.overflow = "hidden";
|
|
69
|
+
div.style.pointerEvents = "none";
|
|
70
70
|
|
|
71
71
|
const documentScroll = {
|
|
72
72
|
left: window.pageXOffset || document.documentElement.scrollLeft,
|
|
73
73
|
top: window.pageYOffset || document.documentElement.scrollTop,
|
|
74
|
-
}
|
|
74
|
+
};
|
|
75
75
|
|
|
76
76
|
// clone node and style it
|
|
77
|
-
const copy = fromNode.cloneNode(true)
|
|
78
|
-
copy.style.position = "absolute"
|
|
79
|
-
copy.style.left = `${documentScroll.left + fromPosition.left}px
|
|
80
|
-
copy.style.top = `${documentScroll.top + fromPosition.top}px
|
|
81
|
-
copy.style.maxWidth = `${fromPosition.right - fromPosition.left}px
|
|
82
|
-
copy.style.overflow = toComputedStyle.overflow
|
|
83
|
-
copy.style.textOverflow = toComputedStyle.textOverflow
|
|
84
|
-
div.appendChild(copy)
|
|
85
|
-
document.body.appendChild(div)
|
|
77
|
+
const copy = fromNode.cloneNode(true);
|
|
78
|
+
copy.style.position = "absolute";
|
|
79
|
+
copy.style.left = `${documentScroll.left + fromPosition.left}px`;
|
|
80
|
+
copy.style.top = `${documentScroll.top + fromPosition.top}px`;
|
|
81
|
+
copy.style.maxWidth = `${fromPosition.right - fromPosition.left}px`;
|
|
82
|
+
copy.style.overflow = toComputedStyle.overflow;
|
|
83
|
+
copy.style.textOverflow = toComputedStyle.textOverflow;
|
|
84
|
+
div.appendChild(copy);
|
|
85
|
+
document.body.appendChild(div);
|
|
86
86
|
|
|
87
87
|
const left =
|
|
88
88
|
toPosition.left -
|
|
89
89
|
fromPosition.left -
|
|
90
|
-
(parseInt(fromComputedStyle.paddingLeft) || 0)
|
|
90
|
+
(parseInt(fromComputedStyle.paddingLeft) || 0);
|
|
91
91
|
const top =
|
|
92
92
|
toPosition.top -
|
|
93
93
|
fromPosition.top -
|
|
94
|
-
(parseInt(fromComputedStyle.paddingTop) || 0)
|
|
94
|
+
(parseInt(fromComputedStyle.paddingTop) || 0);
|
|
95
95
|
// define final position of new element and the duration
|
|
96
|
-
const translate = `translate(${left}px, ${top}px)
|
|
96
|
+
const translate = `translate(${left}px, ${top}px)`;
|
|
97
97
|
|
|
98
98
|
// animate new element
|
|
99
99
|
return animateElement(
|
|
@@ -123,9 +123,9 @@ export const move = (fromNode, toNode, options) => {
|
|
|
123
123
|
],
|
|
124
124
|
options,
|
|
125
125
|
).then(() => {
|
|
126
|
-
div.parentNode.removeChild(div)
|
|
127
|
-
})
|
|
128
|
-
}
|
|
126
|
+
div.parentNode.removeChild(div);
|
|
127
|
+
});
|
|
128
|
+
};
|
|
129
129
|
|
|
130
130
|
// the whole point of this toolbar animation wass to flight a visual imperfection when it's done by css transition.
|
|
131
131
|
// This imperfection is a white line sometimes flickering at the bottom of the page.
|
|
@@ -138,66 +138,66 @@ export const createToolbarAnimation = () => {
|
|
|
138
138
|
"#page": { paddingBottom: 0 },
|
|
139
139
|
"footer": { height: 0 },
|
|
140
140
|
"#toolbar": { visibility: "hidden" },
|
|
141
|
-
}
|
|
141
|
+
};
|
|
142
142
|
const expandedState = {
|
|
143
143
|
"#page": { paddingBottom: "40px" },
|
|
144
144
|
"footer": { height: "40px" },
|
|
145
145
|
"#toolbar": { visibility: "visible" },
|
|
146
|
-
}
|
|
146
|
+
};
|
|
147
147
|
const expandTransition = transit(collapsedState, expandedState, {
|
|
148
148
|
duration: 300,
|
|
149
|
-
})
|
|
149
|
+
});
|
|
150
150
|
|
|
151
151
|
const expand = () => {
|
|
152
|
-
expandTransition.play()
|
|
153
|
-
}
|
|
152
|
+
expandTransition.play();
|
|
153
|
+
};
|
|
154
154
|
|
|
155
155
|
const collapse = () => {
|
|
156
|
-
expandTransition.reverse()
|
|
157
|
-
}
|
|
156
|
+
expandTransition.reverse();
|
|
157
|
+
};
|
|
158
158
|
|
|
159
|
-
return { expand, collapse }
|
|
160
|
-
}
|
|
159
|
+
return { expand, collapse };
|
|
160
|
+
};
|
|
161
161
|
|
|
162
162
|
export const transit = (
|
|
163
163
|
fromState,
|
|
164
164
|
toState,
|
|
165
165
|
{ commitStyles = true, fill = "both", duration = 300 } = {},
|
|
166
166
|
) => {
|
|
167
|
-
const steps = []
|
|
167
|
+
const steps = [];
|
|
168
168
|
Object.keys(fromState).forEach((selector) => {
|
|
169
|
-
const fromStyles = {}
|
|
170
|
-
const toStyles = {}
|
|
171
|
-
const element = document.querySelector(selector)
|
|
169
|
+
const fromStyles = {};
|
|
170
|
+
const toStyles = {};
|
|
171
|
+
const element = document.querySelector(selector);
|
|
172
172
|
|
|
173
|
-
const keyframes = []
|
|
174
|
-
const fromProperties = fromState[selector]
|
|
175
|
-
const toProperties = toState[selector]
|
|
173
|
+
const keyframes = [];
|
|
174
|
+
const fromProperties = fromState[selector];
|
|
175
|
+
const toProperties = toState[selector];
|
|
176
176
|
Object.keys(fromProperties).forEach((propertyName) => {
|
|
177
|
-
const from = fromProperties[propertyName]
|
|
178
|
-
const to = toProperties[propertyName]
|
|
179
|
-
fromStyles[propertyName] = from
|
|
180
|
-
toStyles[propertyName] = to
|
|
181
|
-
})
|
|
182
|
-
keyframes.push(fromStyles, toStyles)
|
|
177
|
+
const from = fromProperties[propertyName];
|
|
178
|
+
const to = toProperties[propertyName];
|
|
179
|
+
fromStyles[propertyName] = from;
|
|
180
|
+
toStyles[propertyName] = to;
|
|
181
|
+
});
|
|
182
|
+
keyframes.push(fromStyles, toStyles);
|
|
183
183
|
|
|
184
|
-
let animation
|
|
184
|
+
let animation;
|
|
185
185
|
if (canUseAnimation()) {
|
|
186
|
-
const effect = new KeyframeEffect(element, keyframes, { fill, duration })
|
|
187
|
-
animation = new Animation(effect)
|
|
186
|
+
const effect = new KeyframeEffect(element, keyframes, { fill, duration });
|
|
187
|
+
animation = new Animation(effect);
|
|
188
188
|
} else {
|
|
189
189
|
animation = {
|
|
190
190
|
playbackRate: 1,
|
|
191
191
|
play: () => {
|
|
192
|
-
animation.onfinish()
|
|
192
|
+
animation.onfinish();
|
|
193
193
|
},
|
|
194
194
|
reverse: () => {
|
|
195
|
-
animation.playbackRate = -1
|
|
196
|
-
animation.onfinish()
|
|
195
|
+
animation.playbackRate = -1;
|
|
196
|
+
animation.onfinish();
|
|
197
197
|
},
|
|
198
198
|
finish: () => {},
|
|
199
199
|
onfinish: () => {},
|
|
200
|
-
}
|
|
200
|
+
};
|
|
201
201
|
}
|
|
202
202
|
|
|
203
203
|
steps.push({
|
|
@@ -205,8 +205,8 @@ export const transit = (
|
|
|
205
205
|
animation,
|
|
206
206
|
fromStyles,
|
|
207
207
|
toStyles,
|
|
208
|
-
})
|
|
209
|
-
})
|
|
208
|
+
});
|
|
209
|
+
});
|
|
210
210
|
|
|
211
211
|
const play = async () => {
|
|
212
212
|
await Promise.all(
|
|
@@ -214,19 +214,19 @@ export const transit = (
|
|
|
214
214
|
return new Promise((resolve) => {
|
|
215
215
|
animation.onfinish = () => {
|
|
216
216
|
if (commitStyles) {
|
|
217
|
-
setStyles(element, toStyles)
|
|
217
|
+
setStyles(element, toStyles);
|
|
218
218
|
}
|
|
219
|
-
resolve()
|
|
220
|
-
}
|
|
219
|
+
resolve();
|
|
220
|
+
};
|
|
221
221
|
if (animation.playbackRate === -1) {
|
|
222
|
-
animation.reverse()
|
|
222
|
+
animation.reverse();
|
|
223
223
|
} else {
|
|
224
|
-
animation.play()
|
|
224
|
+
animation.play();
|
|
225
225
|
}
|
|
226
|
-
})
|
|
226
|
+
});
|
|
227
227
|
}),
|
|
228
|
-
)
|
|
229
|
-
}
|
|
228
|
+
);
|
|
229
|
+
};
|
|
230
230
|
|
|
231
231
|
const reverse = async () => {
|
|
232
232
|
await Promise.all(
|
|
@@ -234,24 +234,24 @@ export const transit = (
|
|
|
234
234
|
return new Promise((resolve) => {
|
|
235
235
|
animation.onfinish = () => {
|
|
236
236
|
if (commitStyles) {
|
|
237
|
-
setStyles(element, fromStyles)
|
|
237
|
+
setStyles(element, fromStyles);
|
|
238
238
|
}
|
|
239
|
-
resolve()
|
|
240
|
-
}
|
|
241
|
-
animation.reverse()
|
|
242
|
-
})
|
|
239
|
+
resolve();
|
|
240
|
+
};
|
|
241
|
+
animation.reverse();
|
|
242
|
+
});
|
|
243
243
|
}),
|
|
244
|
-
)
|
|
245
|
-
}
|
|
244
|
+
);
|
|
245
|
+
};
|
|
246
246
|
|
|
247
247
|
const finish = async () => {
|
|
248
248
|
steps.forEach(({ animation }) => {
|
|
249
|
-
animation.finish()
|
|
250
|
-
})
|
|
251
|
-
}
|
|
249
|
+
animation.finish();
|
|
250
|
+
});
|
|
251
|
+
};
|
|
252
252
|
|
|
253
|
-
return { play, reverse, finish }
|
|
254
|
-
}
|
|
253
|
+
return { play, reverse, finish };
|
|
254
|
+
};
|
|
255
255
|
|
|
256
256
|
export const startJavaScriptAnimation = ({
|
|
257
257
|
duration = 300,
|
|
@@ -262,44 +262,44 @@ export const startJavaScriptAnimation = ({
|
|
|
262
262
|
}) => {
|
|
263
263
|
if (isNaN(duration)) {
|
|
264
264
|
// console.warn(`duration must be a number, received ${duration}`)
|
|
265
|
-
return () => {}
|
|
265
|
+
return () => {};
|
|
266
266
|
}
|
|
267
|
-
duration = parseInt(duration, 10)
|
|
268
|
-
const startMs = performance.now()
|
|
269
|
-
let currentRequestAnimationFrameId
|
|
270
|
-
let done = false
|
|
271
|
-
let rawProgress = 0
|
|
272
|
-
let progress = 0
|
|
267
|
+
duration = parseInt(duration, 10);
|
|
268
|
+
const startMs = performance.now();
|
|
269
|
+
let currentRequestAnimationFrameId;
|
|
270
|
+
let done = false;
|
|
271
|
+
let rawProgress = 0;
|
|
272
|
+
let progress = 0;
|
|
273
273
|
const handler = () => {
|
|
274
|
-
currentRequestAnimationFrameId = null
|
|
275
|
-
const nowMs = performance.now()
|
|
276
|
-
rawProgress = Math.min((nowMs - startMs) / duration, 1)
|
|
277
|
-
progress = timingFunction(rawProgress)
|
|
278
|
-
done = rawProgress === 1
|
|
274
|
+
currentRequestAnimationFrameId = null;
|
|
275
|
+
const nowMs = performance.now();
|
|
276
|
+
rawProgress = Math.min((nowMs - startMs) / duration, 1);
|
|
277
|
+
progress = timingFunction(rawProgress);
|
|
278
|
+
done = rawProgress === 1;
|
|
279
279
|
onProgress({
|
|
280
280
|
done,
|
|
281
281
|
rawProgress,
|
|
282
282
|
progress,
|
|
283
|
-
})
|
|
283
|
+
});
|
|
284
284
|
if (done) {
|
|
285
|
-
onComplete()
|
|
285
|
+
onComplete();
|
|
286
286
|
} else {
|
|
287
|
-
currentRequestAnimationFrameId = window.requestAnimationFrame(handler)
|
|
287
|
+
currentRequestAnimationFrameId = window.requestAnimationFrame(handler);
|
|
288
288
|
}
|
|
289
|
-
}
|
|
290
|
-
handler()
|
|
289
|
+
};
|
|
290
|
+
handler();
|
|
291
291
|
const stop = () => {
|
|
292
292
|
if (currentRequestAnimationFrameId) {
|
|
293
|
-
window.cancelAnimationFrame(currentRequestAnimationFrameId)
|
|
294
|
-
currentRequestAnimationFrameId = null
|
|
293
|
+
window.cancelAnimationFrame(currentRequestAnimationFrameId);
|
|
294
|
+
currentRequestAnimationFrameId = null;
|
|
295
295
|
}
|
|
296
296
|
if (!done) {
|
|
297
|
-
done = true
|
|
297
|
+
done = true;
|
|
298
298
|
onCancel({
|
|
299
299
|
rawProgress,
|
|
300
300
|
progress,
|
|
301
|
-
})
|
|
301
|
+
});
|
|
302
302
|
}
|
|
303
|
-
}
|
|
304
|
-
return stop
|
|
305
|
-
}
|
|
303
|
+
};
|
|
304
|
+
return stop;
|
|
305
|
+
};
|
|
@@ -1,57 +1,57 @@
|
|
|
1
1
|
export const getToolbarIframe = () => {
|
|
2
|
-
const iframes = Array.from(window.parent.document.querySelectorAll("iframe"))
|
|
3
|
-
return iframes.find((iframe) => iframe.contentWindow === window)
|
|
4
|
-
}
|
|
2
|
+
const iframes = Array.from(window.parent.document.querySelectorAll("iframe"));
|
|
3
|
+
return iframes.find((iframe) => iframe.contentWindow === window);
|
|
4
|
+
};
|
|
5
5
|
|
|
6
6
|
export const forceHideElement = (element) => {
|
|
7
|
-
element.setAttribute("data-force-hide", "")
|
|
8
|
-
}
|
|
7
|
+
element.setAttribute("data-force-hide", "");
|
|
8
|
+
};
|
|
9
9
|
|
|
10
10
|
export const removeForceHideElement = (element) => {
|
|
11
|
-
element.removeAttribute("data-force-hide")
|
|
12
|
-
}
|
|
11
|
+
element.removeAttribute("data-force-hide");
|
|
12
|
+
};
|
|
13
13
|
|
|
14
14
|
export const setStyles = (element, styles) => {
|
|
15
|
-
const elementStyle = element.style
|
|
15
|
+
const elementStyle = element.style;
|
|
16
16
|
const restoreStyles = Object.keys(styles).map((styleName) => {
|
|
17
|
-
let restore
|
|
17
|
+
let restore;
|
|
18
18
|
if (styleName in elementStyle) {
|
|
19
|
-
const currentStyle = elementStyle[styleName]
|
|
19
|
+
const currentStyle = elementStyle[styleName];
|
|
20
20
|
restore = () => {
|
|
21
|
-
elementStyle[styleName] = currentStyle
|
|
22
|
-
}
|
|
21
|
+
elementStyle[styleName] = currentStyle;
|
|
22
|
+
};
|
|
23
23
|
} else {
|
|
24
24
|
restore = () => {
|
|
25
|
-
delete elementStyle[styleName]
|
|
26
|
-
}
|
|
25
|
+
delete elementStyle[styleName];
|
|
26
|
+
};
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
elementStyle[styleName] = styles[styleName]
|
|
29
|
+
elementStyle[styleName] = styles[styleName];
|
|
30
30
|
|
|
31
|
-
return restore
|
|
32
|
-
})
|
|
31
|
+
return restore;
|
|
32
|
+
});
|
|
33
33
|
return () => {
|
|
34
|
-
restoreStyles.forEach((restore) => restore())
|
|
35
|
-
}
|
|
36
|
-
}
|
|
34
|
+
restoreStyles.forEach((restore) => restore());
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
37
|
|
|
38
38
|
export const setAttributes = (element, attributes) => {
|
|
39
39
|
Object.keys(attributes).forEach((name) => {
|
|
40
|
-
element.setAttribute(name, attributes[name])
|
|
41
|
-
})
|
|
42
|
-
}
|
|
40
|
+
element.setAttribute(name, attributes[name]);
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
43
|
|
|
44
44
|
export const getDocumentScroll = () => {
|
|
45
45
|
return {
|
|
46
46
|
x: document.documentElement.scrollLeft,
|
|
47
47
|
y: document.documentElement.scrollTop,
|
|
48
|
-
}
|
|
49
|
-
}
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
50
|
|
|
51
51
|
export const activateToolbarSection = (element) => {
|
|
52
|
-
element.setAttribute("data-active", "")
|
|
53
|
-
}
|
|
52
|
+
element.setAttribute("data-active", "");
|
|
53
|
+
};
|
|
54
54
|
|
|
55
55
|
export const deactivateToolbarSection = (element) => {
|
|
56
|
-
element.removeAttribute("data-active")
|
|
57
|
-
}
|
|
56
|
+
element.removeAttribute("data-active");
|
|
57
|
+
};
|