@jsenv/plugin-toolbar 0.1.15 → 1.0.2
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/html/toolbar.html +19 -0
- package/dist/js/toolbar_core.js +49 -19
- package/dist/js/toolbar_injector.js +1 -46
- package/dist/jsenv_plugin_toolbar.js +1 -3
- package/package.json +3 -3
- package/src/client/core/ribbon_signals.js +9 -0
- package/src/client/core/toolbar_state_signals.js +3 -0
- package/src/client/toolbar.html +25 -0
- package/src/client/ui/toolbar_settings/toolbar_ribbon_setting.js +33 -0
- package/src/client/ui/toolbar_settings/toolbar_settings.js +2 -0
package/README.md
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
# @jsenv/plugin-toolbar [](https://www.npmjs.com/package/@jsenv/plugin-toolbar)
|
|
2
|
+
|
|
3
|
+
[Documentation](<https://github.com/jsenv/core/wiki/A)-Getting-started>) · [Changelog](./CHANGELOG.md)
|
package/dist/html/toolbar.html
CHANGED
|
@@ -235,6 +235,25 @@
|
|
|
235
235
|
Toggle light/dark mode on jsenv toolbar.
|
|
236
236
|
</div>
|
|
237
237
|
</div>
|
|
238
|
+
|
|
239
|
+
<div class="settings_box_item" id="ribbon_box" style="display: none">
|
|
240
|
+
<div class="category_title">
|
|
241
|
+
<svg width="20px" height="20px" viewBox="0 0 448 512">
|
|
242
|
+
<path d="M120.12 208.29c-3.88-2.9-7.77-4.35-11.65-4.35H91.03v104.47h17.45c3.88 0 7.77-1.45 11.65-4.35 3.88-2.9 5.82-7.25 5.82-13.06v-69.65c-.01-5.8-1.96-10.16-5.83-13.06zM404.1 32H43.9C19.7 32 .06 51.59 0 75.8v360.4C.06 460.41 19.7 480 43.9 480h360.2c24.21 0 43.84-19.59 43.9-43.8V75.8c-.06-24.21-19.7-43.8-43.9-43.8zM154.2 291.19c0 18.81-11.61 47.31-48.36 47.25h-46.4V172.98h47.38c35.44 0 47.36 28.46 47.37 47.28l.01 70.93zm100.68-88.66H201.6v38.42h32.57v29.57H201.6v38.41h53.29v29.57h-62.18c-11.16.29-20.44-8.53-20.72-19.69V193.7c-.27-11.15 8.56-20.41 19.71-20.69h63.19l-.01 29.52zm103.64 115.29c-13.2 30.75-36.85 24.63-47.44 0l-38.53-144.8h32.57l29.71 113.72 29.57-113.72h32.58l-38.46 144.8z"></path>
|
|
243
|
+
</svg>
|
|
244
|
+
Ribbon
|
|
245
|
+
</div>
|
|
246
|
+
<label class="switch" data-contains-hidden-input="">
|
|
247
|
+
<input id="checkbox_dark_theme" type="checkbox">
|
|
248
|
+
<div>
|
|
249
|
+
<div class="slider"></div>
|
|
250
|
+
<div class="square"></div>
|
|
251
|
+
</div>
|
|
252
|
+
</label>
|
|
253
|
+
<div class="category_subtitle">
|
|
254
|
+
Toggle dev ribbon visibility
|
|
255
|
+
</div>
|
|
256
|
+
</div>
|
|
238
257
|
</div>
|
|
239
258
|
</div>
|
|
240
259
|
</div>
|
package/dist/js/toolbar_core.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
var l$2;
|
|
2
2
|
l$2 = {
|
|
3
3
|
__e: function (n, l, u, i) {
|
|
4
|
-
for (var t,
|
|
5
|
-
if ((
|
|
4
|
+
for (var t, o, r; l = l.__;) if ((t = l.__c) && !t.__) try {
|
|
5
|
+
if ((o = t.constructor) && null != o.getDerivedStateFromError && (t.setState(o.getDerivedStateFromError(n)), r = t.__d), null != t.componentDidCatch && (t.componentDidCatch(n, i || {}), r = t.__d), r) return t.__E = t;
|
|
6
6
|
} catch (l) {
|
|
7
7
|
n = l;
|
|
8
8
|
}
|
|
@@ -50,7 +50,7 @@ l$2.__b = function (n) {
|
|
|
50
50
|
var i = (r$1 = n.__c).__H;
|
|
51
51
|
i && (u$1 === r$1 ? (i.__h = [], r$1.__h = [], i.__.forEach(function (n) {
|
|
52
52
|
n.__N && (n.__ = n.__N), n.__V = c$2, n.__N = n.i = void 0;
|
|
53
|
-
})) : (i.__h.forEach(k), i.__h.forEach(w$1), i.__h = [])), u$1 = r$1;
|
|
53
|
+
})) : (i.__h.forEach(k), i.__h.forEach(w$1), i.__h = [], t$1 = 0)), u$1 = r$1;
|
|
54
54
|
}, l$2.diffed = function (t) {
|
|
55
55
|
v$1 && v$1(t);
|
|
56
56
|
var o = t.__c;
|
|
@@ -748,24 +748,24 @@ const notifyExecutionResult = (execution, previousExecution) => {
|
|
|
748
748
|
if (previousExecution.status === "completed") {
|
|
749
749
|
notify("Broken", {
|
|
750
750
|
...notificationOptions,
|
|
751
|
-
body:
|
|
751
|
+
body: "".concat(executedFileRelativeUrl, " execution now failing.")
|
|
752
752
|
});
|
|
753
753
|
} else {
|
|
754
754
|
notify("Still failing", {
|
|
755
755
|
...notificationOptions,
|
|
756
|
-
body:
|
|
756
|
+
body: "".concat(executedFileRelativeUrl, " execution still failing.")
|
|
757
757
|
});
|
|
758
758
|
}
|
|
759
759
|
} else {
|
|
760
760
|
notify("Failing", {
|
|
761
761
|
...notificationOptions,
|
|
762
|
-
body:
|
|
762
|
+
body: "".concat(executedFileRelativeUrl, " execution failed.")
|
|
763
763
|
});
|
|
764
764
|
}
|
|
765
765
|
} else if (previousExecution && previousExecution.status === "failed") {
|
|
766
766
|
notify("Fixed", {
|
|
767
767
|
...notificationOptions,
|
|
768
|
-
body:
|
|
768
|
+
body: "".concat(executedFileRelativeUrl, " execution fixed.")
|
|
769
769
|
});
|
|
770
770
|
}
|
|
771
771
|
};
|
|
@@ -1279,7 +1279,7 @@ const renderDocumentIndexLink = () => {
|
|
|
1279
1279
|
};
|
|
1280
1280
|
|
|
1281
1281
|
const enableVariant = (rootNode, variables) => {
|
|
1282
|
-
const nodesNotMatching = Array.from(rootNode.querySelectorAll(
|
|
1282
|
+
const nodesNotMatching = Array.from(rootNode.querySelectorAll("[".concat(attributeIndicatingACondition, "]")));
|
|
1283
1283
|
nodesNotMatching.forEach(nodeNotMatching => {
|
|
1284
1284
|
const conditionAttributeValue = nodeNotMatching.getAttribute(attributeIndicatingACondition);
|
|
1285
1285
|
const matches = testCondition(conditionAttributeValue, variables);
|
|
@@ -1287,7 +1287,7 @@ const enableVariant = (rootNode, variables) => {
|
|
|
1287
1287
|
renameAttribute(nodeNotMatching, attributeIndicatingACondition, attributeIndicatingAMatch);
|
|
1288
1288
|
}
|
|
1289
1289
|
});
|
|
1290
|
-
const nodesMatching = Array.from(rootNode.querySelectorAll(
|
|
1290
|
+
const nodesMatching = Array.from(rootNode.querySelectorAll("[".concat(attributeIndicatingAMatch, "]")));
|
|
1291
1291
|
nodesMatching.forEach(nodeMatching => {
|
|
1292
1292
|
const conditionAttributeValue = nodeMatching.getAttribute(attributeIndicatingAMatch);
|
|
1293
1293
|
const matches = testCondition(conditionAttributeValue, variables);
|
|
@@ -1325,8 +1325,8 @@ const parseCondition = conditionAttributeValue => {
|
|
|
1325
1325
|
value: conditionAttributeValue.slice(colonIndex + 1)
|
|
1326
1326
|
};
|
|
1327
1327
|
};
|
|
1328
|
-
const attributeIndicatingACondition =
|
|
1329
|
-
const attributeIndicatingAMatch =
|
|
1328
|
+
const attributeIndicatingACondition = "data-when";
|
|
1329
|
+
const attributeIndicatingAMatch = "data-when-active";
|
|
1330
1330
|
const renameAttribute = (node, name, newName) => {
|
|
1331
1331
|
node.setAttribute(newName, node.getAttribute(name));
|
|
1332
1332
|
node.removeAttribute(name);
|
|
@@ -1379,10 +1379,10 @@ const computeText = ({
|
|
|
1379
1379
|
endTime
|
|
1380
1380
|
}) => {
|
|
1381
1381
|
if (status === "completed") {
|
|
1382
|
-
return
|
|
1382
|
+
return "Execution completed in ".concat(endTime - startTime, "ms");
|
|
1383
1383
|
}
|
|
1384
1384
|
if (status === "failed") {
|
|
1385
|
-
return
|
|
1385
|
+
return "Execution failed in ".concat(endTime - startTime, "ms");
|
|
1386
1386
|
}
|
|
1387
1387
|
if (status === "running") {
|
|
1388
1388
|
return "Executing...";
|
|
@@ -1468,9 +1468,9 @@ const computeTooltipText = ({
|
|
|
1468
1468
|
}) => {
|
|
1469
1469
|
const changesCount = changes.length;
|
|
1470
1470
|
if (changesCount === 1) {
|
|
1471
|
-
return
|
|
1471
|
+
return "There is <a href=\"javascript:void(0)\">1</a> change to apply";
|
|
1472
1472
|
}
|
|
1473
|
-
return
|
|
1473
|
+
return "There is <a href=\"javascript:void(0)\">".concat(changesCount, "<a> changes to apply");
|
|
1474
1474
|
};
|
|
1475
1475
|
|
|
1476
1476
|
const parentServerEvents = window.parent.__server_events__;
|
|
@@ -1546,7 +1546,7 @@ const renderToolbarAutoreloadSetting = () => {
|
|
|
1546
1546
|
};
|
|
1547
1547
|
const disableAutoreloadSetting = () => {
|
|
1548
1548
|
document.querySelector(".settings_autoreload").setAttribute("data-disabled", "true");
|
|
1549
|
-
document.querySelector(".settings_autoreload").setAttribute("title",
|
|
1549
|
+
document.querySelector(".settings_autoreload").setAttribute("title", "Autoreload not enabled on server");
|
|
1550
1550
|
document.querySelector("#toggle_autoreload").disabled = true;
|
|
1551
1551
|
};
|
|
1552
1552
|
|
|
@@ -1641,7 +1641,7 @@ const renderToolbarNotificationSetting = () => {
|
|
|
1641
1641
|
const applyNotificationNotAvailableEffects = () => {
|
|
1642
1642
|
const notifSetting = document.querySelector(".settings_notification");
|
|
1643
1643
|
notifSetting.setAttribute("data-disabled", "true");
|
|
1644
|
-
notifSetting.setAttribute("title",
|
|
1644
|
+
notifSetting.setAttribute("title", "Notification not available in the browser");
|
|
1645
1645
|
notifCheckbox.disabled = true;
|
|
1646
1646
|
};
|
|
1647
1647
|
const applyNotificationDefaultEffects = () => {
|
|
@@ -1654,7 +1654,7 @@ const applyNotificationDeniedEffects = () => {
|
|
|
1654
1654
|
applyNotificationNOTGrantedEffects();
|
|
1655
1655
|
const notifSetting = document.querySelector(".settings_notification");
|
|
1656
1656
|
notifSetting.setAttribute("data-disabled", "true");
|
|
1657
|
-
notifSetting.setAttribute("title",
|
|
1657
|
+
notifSetting.setAttribute("title", "Notification denied");
|
|
1658
1658
|
};
|
|
1659
1659
|
const applyNotificationGrantedEffects = () => {
|
|
1660
1660
|
enableVariant(document.querySelector(".notification_text"), {
|
|
@@ -1701,6 +1701,33 @@ const renderToolbarThemeSetting = () => {
|
|
|
1701
1701
|
};
|
|
1702
1702
|
};
|
|
1703
1703
|
|
|
1704
|
+
const ribbonDisplayedSignal = u(typeof stateFromLocalStorage.ribbonDisplayed === "boolean" ? stateFromLocalStorage.ribbonDisplayed : true);
|
|
1705
|
+
|
|
1706
|
+
const ribbonBox = document.querySelector("#ribbon_box");
|
|
1707
|
+
const ribbonCheckbox = ribbonBox.querySelector("input");
|
|
1708
|
+
const renderToolbarRibbonSetting = () => {
|
|
1709
|
+
const ribbonContainer = window.parent.document.querySelector("#jsenv_ribbon_container");
|
|
1710
|
+
if (ribbonContainer) {
|
|
1711
|
+
ribbonBox.style.display = "block";
|
|
1712
|
+
b(() => {
|
|
1713
|
+
const ribbonDisplayed = ribbonDisplayedSignal.value;
|
|
1714
|
+
ribbonCheckbox.checked = ribbonDisplayed;
|
|
1715
|
+
if (ribbonDisplayed) {
|
|
1716
|
+
ribbonContainer.style.display = "block";
|
|
1717
|
+
} else {
|
|
1718
|
+
ribbonContainer.style.display = "none";
|
|
1719
|
+
}
|
|
1720
|
+
});
|
|
1721
|
+
ribbonCheckbox.onchange = () => {
|
|
1722
|
+
if (ribbonCheckbox.checked) {
|
|
1723
|
+
ribbonDisplayedSignal.value = true;
|
|
1724
|
+
} else {
|
|
1725
|
+
ribbonDisplayedSignal.value = false;
|
|
1726
|
+
}
|
|
1727
|
+
};
|
|
1728
|
+
}
|
|
1729
|
+
};
|
|
1730
|
+
|
|
1704
1731
|
const renderToolbarSettings = () => {
|
|
1705
1732
|
document.querySelector("#settings_open_button").onclick = toggleSettings;
|
|
1706
1733
|
document.querySelector("#settings_close_button").onclick = toggleSettings;
|
|
@@ -1709,6 +1736,7 @@ const renderToolbarSettings = () => {
|
|
|
1709
1736
|
renderToolbarAnimationSetting();
|
|
1710
1737
|
renderToolbarNotificationSetting();
|
|
1711
1738
|
renderToolbarThemeSetting();
|
|
1739
|
+
renderToolbarRibbonSetting();
|
|
1712
1740
|
b(() => {
|
|
1713
1741
|
const settingsOpened = settingsOpenedSignal.value;
|
|
1714
1742
|
if (settingsOpened) {
|
|
@@ -1797,11 +1825,13 @@ const toolbarStateSignal = w(() => {
|
|
|
1797
1825
|
const theme = themeSignal.value;
|
|
1798
1826
|
const animationsEnabled = animationsEnabledSignal.value;
|
|
1799
1827
|
const notificationsEnabled = notificationsEnabledSignal.value;
|
|
1828
|
+
const ribbonDisplayed = ribbonDisplayedSignal.value;
|
|
1800
1829
|
return {
|
|
1801
1830
|
opened,
|
|
1802
1831
|
theme,
|
|
1803
1832
|
animationsEnabled,
|
|
1804
|
-
notificationsEnabled
|
|
1833
|
+
notificationsEnabled,
|
|
1834
|
+
ribbonDisplayed
|
|
1805
1835
|
};
|
|
1806
1836
|
});
|
|
1807
1837
|
|
|
@@ -80,52 +80,7 @@ const injectToolbar = async ({
|
|
|
80
80
|
});
|
|
81
81
|
});
|
|
82
82
|
const div = document.createElement("div");
|
|
83
|
-
div.innerHTML =
|
|
84
|
-
<div id="jsenv_toolbar_trigger" style="display:none">
|
|
85
|
-
<svg id="jsenv_toolbar_trigger_icon">
|
|
86
|
-
<use xlink:href="${jsenvLogoSvgUrl}#jsenv_logo"></use>
|
|
87
|
-
</svg>
|
|
88
|
-
<style>
|
|
89
|
-
#jsenv_toolbar_trigger {
|
|
90
|
-
display: block;
|
|
91
|
-
overflow: hidden;
|
|
92
|
-
position: fixed;
|
|
93
|
-
z-index: 1000;
|
|
94
|
-
bottom: -32px;
|
|
95
|
-
right: 20px;
|
|
96
|
-
height: 40px;
|
|
97
|
-
width: 40px;
|
|
98
|
-
padding: 0;
|
|
99
|
-
margin: 0;
|
|
100
|
-
border-radius: 5px 5px 0 0;
|
|
101
|
-
border: 1px solid rgba(0, 0, 0, 0.33);
|
|
102
|
-
border-bottom: none;
|
|
103
|
-
box-shadow: 0px 0px 6px 2px rgba(0, 0, 0, 0.46);
|
|
104
|
-
background: transparent;
|
|
105
|
-
text-align: center;
|
|
106
|
-
transition: 600ms;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
#jsenv_toolbar_trigger:hover {
|
|
110
|
-
cursor: pointer;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
#jsenv_toolbar_trigger[data-expanded] {
|
|
114
|
-
bottom: 0;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
#jsenv_toolbar_trigger_icon {
|
|
118
|
-
width: 35px;
|
|
119
|
-
height: 35px;
|
|
120
|
-
opacity: 0;
|
|
121
|
-
transition: 600ms;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
#jsenv_toolbar_trigger[data-expanded] #jsenv_toolbar_trigger_icon {
|
|
125
|
-
opacity: 1;
|
|
126
|
-
}
|
|
127
|
-
</style>
|
|
128
|
-
</div>`;
|
|
83
|
+
div.innerHTML = "\n<div id=\"jsenv_toolbar_trigger\" style=\"display:none\">\n <svg id=\"jsenv_toolbar_trigger_icon\">\n <use xlink:href=\"".concat(jsenvLogoSvgUrl, "#jsenv_logo\"></use>\n </svg>\n <style>\n #jsenv_toolbar_trigger {\n display: block;\n overflow: hidden;\n position: fixed;\n z-index: 1000;\n bottom: -32px;\n right: 20px;\n height: 40px;\n width: 40px;\n padding: 0;\n margin: 0;\n border-radius: 5px 5px 0 0;\n border: 1px solid rgba(0, 0, 0, 0.33);\n border-bottom: none;\n box-shadow: 0px 0px 6px 2px rgba(0, 0, 0, 0.46);\n background: transparent;\n text-align: center;\n transition: 600ms;\n }\n\n #jsenv_toolbar_trigger:hover {\n cursor: pointer;\n }\n\n #jsenv_toolbar_trigger[data-expanded] {\n bottom: 0;\n }\n\n #jsenv_toolbar_trigger_icon {\n width: 35px;\n height: 35px;\n opacity: 0;\n transition: 600ms;\n }\n\n #jsenv_toolbar_trigger[data-expanded] #jsenv_toolbar_trigger_icon {\n opacity: 1;\n }\n </style>\n</div>");
|
|
129
84
|
const toolbarTrigger = div.firstElementChild;
|
|
130
85
|
iframe.parentNode.appendChild(toolbarTrigger);
|
|
131
86
|
let timer;
|
|
@@ -72,9 +72,7 @@ const generateCodeToInjectToolbar = ({
|
|
|
72
72
|
animationsEnabled,
|
|
73
73
|
notificationsEnabled
|
|
74
74
|
}, null, " ");
|
|
75
|
-
return
|
|
76
|
-
|
|
77
|
-
injectToolbar(${paramsSource});`;
|
|
75
|
+
return "import { injectToolbar } from ".concat(from, "\n\ninjectToolbar(").concat(paramsSource, ");");
|
|
78
76
|
};
|
|
79
77
|
|
|
80
78
|
export { jsenvPluginToolbar };
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jsenv/plugin-toolbar",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/jsenv/core",
|
|
8
|
-
"directory": "packages/jsenv-plugin-toolbar"
|
|
8
|
+
"directory": "packages/plugins/jsenv-plugin-toolbar"
|
|
9
9
|
},
|
|
10
10
|
"publishConfig": {
|
|
11
11
|
"access": "public"
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"/src/"
|
|
27
27
|
],
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@jsenv/ast": "
|
|
29
|
+
"@jsenv/ast": "4.0.2",
|
|
30
30
|
"@preact/signals": "1.1.3"
|
|
31
31
|
},
|
|
32
32
|
"scripts": {
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { signal } from "@preact/signals";
|
|
2
|
+
|
|
3
|
+
import { stateFromLocalStorage } from "./toolbar_state_context.js";
|
|
4
|
+
|
|
5
|
+
export const ribbonDisplayedSignal = signal(
|
|
6
|
+
typeof stateFromLocalStorage.ribbonDisplayed === "boolean"
|
|
7
|
+
? stateFromLocalStorage.ribbonDisplayed
|
|
8
|
+
: true,
|
|
9
|
+
);
|
|
@@ -4,17 +4,20 @@ import { openedSignal } from "./toolbar_open_signals.js";
|
|
|
4
4
|
import { themeSignal } from "./theme_signals.js";
|
|
5
5
|
import { animationsEnabledSignal } from "./animation_signals.js";
|
|
6
6
|
import { notificationsEnabledSignal } from "./notification_signals.js";
|
|
7
|
+
import { ribbonDisplayedSignal } from "./ribbon_signals.js";
|
|
7
8
|
|
|
8
9
|
export const toolbarStateSignal = computed(() => {
|
|
9
10
|
const opened = openedSignal.value;
|
|
10
11
|
const theme = themeSignal.value;
|
|
11
12
|
const animationsEnabled = animationsEnabledSignal.value;
|
|
12
13
|
const notificationsEnabled = notificationsEnabledSignal.value;
|
|
14
|
+
const ribbonDisplayed = ribbonDisplayedSignal.value;
|
|
13
15
|
|
|
14
16
|
return {
|
|
15
17
|
opened,
|
|
16
18
|
theme,
|
|
17
19
|
animationsEnabled,
|
|
18
20
|
notificationsEnabled,
|
|
21
|
+
ribbonDisplayed,
|
|
19
22
|
};
|
|
20
23
|
});
|
package/src/client/toolbar.html
CHANGED
|
@@ -347,6 +347,31 @@
|
|
|
347
347
|
Toggle light/dark mode on jsenv toolbar.
|
|
348
348
|
</div>
|
|
349
349
|
</div>
|
|
350
|
+
|
|
351
|
+
<div
|
|
352
|
+
class="settings_box_item"
|
|
353
|
+
id="ribbon_box"
|
|
354
|
+
style="display: none"
|
|
355
|
+
>
|
|
356
|
+
<div class="category_title">
|
|
357
|
+
<svg width="20px" height="20px" viewBox="0 0 448 512">
|
|
358
|
+
<path
|
|
359
|
+
d="M120.12 208.29c-3.88-2.9-7.77-4.35-11.65-4.35H91.03v104.47h17.45c3.88 0 7.77-1.45 11.65-4.35 3.88-2.9 5.82-7.25 5.82-13.06v-69.65c-.01-5.8-1.96-10.16-5.83-13.06zM404.1 32H43.9C19.7 32 .06 51.59 0 75.8v360.4C.06 460.41 19.7 480 43.9 480h360.2c24.21 0 43.84-19.59 43.9-43.8V75.8c-.06-24.21-19.7-43.8-43.9-43.8zM154.2 291.19c0 18.81-11.61 47.31-48.36 47.25h-46.4V172.98h47.38c35.44 0 47.36 28.46 47.37 47.28l.01 70.93zm100.68-88.66H201.6v38.42h32.57v29.57H201.6v38.41h53.29v29.57h-62.18c-11.16.29-20.44-8.53-20.72-19.69V193.7c-.27-11.15 8.56-20.41 19.71-20.69h63.19l-.01 29.52zm103.64 115.29c-13.2 30.75-36.85 24.63-47.44 0l-38.53-144.8h32.57l29.71 113.72 29.57-113.72h32.58l-38.46 144.8z"
|
|
360
|
+
></path>
|
|
361
|
+
</svg>
|
|
362
|
+
Ribbon
|
|
363
|
+
</div>
|
|
364
|
+
<label class="switch" data-contains-hidden-input>
|
|
365
|
+
<input id="checkbox_dark_theme" type="checkbox" />
|
|
366
|
+
<div>
|
|
367
|
+
<div class="slider"></div>
|
|
368
|
+
<div class="square"></div>
|
|
369
|
+
</div>
|
|
370
|
+
</label>
|
|
371
|
+
<div class="category_subtitle">
|
|
372
|
+
Toggle dev ribbon visibility
|
|
373
|
+
</div>
|
|
374
|
+
</div>
|
|
350
375
|
</div>
|
|
351
376
|
</div>
|
|
352
377
|
</div>
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { effect } from "@preact/signals";
|
|
2
|
+
|
|
3
|
+
import { ribbonDisplayedSignal } from "../../core/ribbon_signals.js";
|
|
4
|
+
|
|
5
|
+
const ribbonBox = document.querySelector("#ribbon_box");
|
|
6
|
+
const ribbonCheckbox = ribbonBox.querySelector("input");
|
|
7
|
+
|
|
8
|
+
export const renderToolbarRibbonSetting = () => {
|
|
9
|
+
const ribbonContainer = window.parent.document.querySelector(
|
|
10
|
+
"#jsenv_ribbon_container",
|
|
11
|
+
);
|
|
12
|
+
if (ribbonContainer) {
|
|
13
|
+
ribbonBox.style.display = "block";
|
|
14
|
+
effect(() => {
|
|
15
|
+
const ribbonDisplayed = ribbonDisplayedSignal.value;
|
|
16
|
+
ribbonCheckbox.checked = ribbonDisplayed;
|
|
17
|
+
|
|
18
|
+
if (ribbonDisplayed) {
|
|
19
|
+
ribbonContainer.style.display = "block";
|
|
20
|
+
} else {
|
|
21
|
+
ribbonContainer.style.display = "none";
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
ribbonCheckbox.onchange = () => {
|
|
26
|
+
if (ribbonCheckbox.checked) {
|
|
27
|
+
ribbonDisplayedSignal.value = true;
|
|
28
|
+
} else {
|
|
29
|
+
ribbonDisplayedSignal.value = false;
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
};
|
|
@@ -11,6 +11,7 @@ import { renderToolbarAutoreloadSetting } from "./toolbar_autoreload_setting.js"
|
|
|
11
11
|
import { renderToolbarAnimationSetting } from "./toolbar_animation_setting.js";
|
|
12
12
|
import { renderToolbarNotificationSetting } from "./toolbar_notification_setting.js";
|
|
13
13
|
import { renderToolbarThemeSetting } from "./toolbar_theme_setting.js";
|
|
14
|
+
import { renderToolbarRibbonSetting } from "./toolbar_ribbon_setting.js";
|
|
14
15
|
|
|
15
16
|
export const renderToolbarSettings = () => {
|
|
16
17
|
document.querySelector("#settings_open_button").onclick = toggleSettings;
|
|
@@ -21,6 +22,7 @@ export const renderToolbarSettings = () => {
|
|
|
21
22
|
renderToolbarAnimationSetting();
|
|
22
23
|
renderToolbarNotificationSetting();
|
|
23
24
|
renderToolbarThemeSetting();
|
|
25
|
+
renderToolbarRibbonSetting();
|
|
24
26
|
|
|
25
27
|
effect(() => {
|
|
26
28
|
const settingsOpened = settingsOpenedSignal.value;
|