@chocolatey-software/docs 2.0.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.
- package/LICENSE +201 -0
- package/README.md +9 -0
- package/dist/configs/eslint.config.mjs +125 -0
- package/dist/css/docs.css +58974 -0
- package/dist/css/docs.min.css +31 -0
- package/dist/partials/CollapsingRightSidebarContent.astro +111 -0
- package/dist/partials/GlobalNavigation.astro +41 -0
- package/dist/partials/GoogleTag.astro +8 -0
- package/dist/partials/SocialMedia.astro +79 -0
- package/dist/partials/SvgStyles.astro +12 -0
- package/dist/partials/TermsContent.astro +500 -0
- package/dist/partials/TermsLastUpdated.astro +1 -0
- package/dist/partials/TermsToc.astro +38 -0
- package/dist/partials/ThemeToggle.astro +31 -0
- package/dist/scripts/docs.js +14524 -0
- package/dist/scripts/docs.min.js +52 -0
- package/dist/scripts/theme-toggle.js +65 -0
- package/dist/scripts/theme-toggle.min.js +1 -0
- package/package.json +34 -0
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
(() => {
|
|
2
|
+
// src/scripts/packages/theme-toggle.js
|
|
3
|
+
(() => {
|
|
4
|
+
"use strict";
|
|
5
|
+
const getStoredTheme = () => localStorage.getItem("theme");
|
|
6
|
+
const setStoredTheme = (theme) => localStorage.setItem("theme", theme);
|
|
7
|
+
const getPreferredTheme = () => {
|
|
8
|
+
const storedTheme = getStoredTheme();
|
|
9
|
+
if (storedTheme) {
|
|
10
|
+
return storedTheme;
|
|
11
|
+
}
|
|
12
|
+
return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
13
|
+
};
|
|
14
|
+
const setTheme = (theme) => {
|
|
15
|
+
if (theme === "auto") {
|
|
16
|
+
document.documentElement.setAttribute("data-bs-theme", window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light");
|
|
17
|
+
} else {
|
|
18
|
+
document.documentElement.setAttribute("data-bs-theme", theme);
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
setTheme(getPreferredTheme());
|
|
22
|
+
const showActiveTheme = (theme, focus = false) => {
|
|
23
|
+
const themeSwitchers = document.querySelectorAll(".dropdown-theme");
|
|
24
|
+
for (const themeSwitcher of themeSwitchers) {
|
|
25
|
+
const themeSwitcherBtns = themeSwitcher.querySelectorAll(".dropdown-toggle");
|
|
26
|
+
const btnToActive = themeSwitcher.querySelector(`[data-bs-theme-value="${theme}"]`);
|
|
27
|
+
const svgOfActiveBtn = btnToActive.querySelector("i[data-ct-theme-icon]").getAttribute("data-ct-theme-icon");
|
|
28
|
+
themeSwitcher.querySelectorAll("[data-bs-theme-value]").forEach((element) => {
|
|
29
|
+
element.classList.remove("active");
|
|
30
|
+
element.setAttribute("aria-pressed", "false");
|
|
31
|
+
});
|
|
32
|
+
btnToActive.classList.add("active");
|
|
33
|
+
btnToActive.setAttribute("aria-pressed", "true");
|
|
34
|
+
const themeSwitcherLabel = `Theme Switcher (${btnToActive.dataset.bsThemeValue})`;
|
|
35
|
+
for (const btn of themeSwitcherBtns) {
|
|
36
|
+
btn.setAttribute("aria-label", themeSwitcherLabel);
|
|
37
|
+
btn.querySelector(".theme-icon-active i").className = "";
|
|
38
|
+
btn.querySelector(".theme-icon-active i").classList.add("fa-solid", svgOfActiveBtn);
|
|
39
|
+
}
|
|
40
|
+
if (focus) {
|
|
41
|
+
themeSwitcher.focus();
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change", () => {
|
|
46
|
+
const storedTheme = getStoredTheme();
|
|
47
|
+
if (storedTheme !== "light" && storedTheme !== "dark") {
|
|
48
|
+
setTheme(getPreferredTheme());
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
window.addEventListener("DOMContentLoaded", () => {
|
|
52
|
+
showActiveTheme(getPreferredTheme());
|
|
53
|
+
document.querySelectorAll("[data-bs-theme-value]").forEach((toggle) => {
|
|
54
|
+
toggle.addEventListener("click", () => {
|
|
55
|
+
const theme = toggle.getAttribute("data-bs-theme-value");
|
|
56
|
+
setStoredTheme(theme);
|
|
57
|
+
setTheme(theme);
|
|
58
|
+
showActiveTheme(theme, true);
|
|
59
|
+
const event = new Event("themeChanged");
|
|
60
|
+
document.dispatchEvent(event);
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
})();
|
|
65
|
+
})();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(()=>{(()=>{"use strict";let n=()=>localStorage.getItem("theme"),h=e=>localStorage.setItem("theme",e),s=()=>{let e=n();return e||(window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light")},o=e=>{e==="auto"?document.documentElement.setAttribute("data-bs-theme",window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"):document.documentElement.setAttribute("data-bs-theme",e)};o(s());let i=(e,c=!1)=>{let d=document.querySelectorAll(".dropdown-theme");for(let r of d){let m=r.querySelectorAll(".dropdown-toggle"),a=r.querySelector(`[data-bs-theme-value="${e}"]`),l=a.querySelector("i[data-ct-theme-icon]").getAttribute("data-ct-theme-icon");r.querySelectorAll("[data-bs-theme-value]").forEach(t=>{t.classList.remove("active"),t.setAttribute("aria-pressed","false")}),a.classList.add("active"),a.setAttribute("aria-pressed","true");let u=`Theme Switcher (${a.dataset.bsThemeValue})`;for(let t of m)t.setAttribute("aria-label",u),t.querySelector(".theme-icon-active i").className="",t.querySelector(".theme-icon-active i").classList.add("fa-solid",l);c&&r.focus()}};window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",()=>{let e=n();e!=="light"&&e!=="dark"&&o(s())}),window.addEventListener("DOMContentLoaded",()=>{i(s()),document.querySelectorAll("[data-bs-theme-value]").forEach(e=>{e.addEventListener("click",()=>{let c=e.getAttribute("data-bs-theme-value");h(c),o(c),i(c,!0);let d=new Event("themeChanged");document.dispatchEvent(d)})})})})();})();
|
package/package.json
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@chocolatey-software/docs",
|
|
3
|
+
"version": "2.0.0",
|
|
4
|
+
"description": "Chocolatey Software theme assets for use on docs.chocolatey.org.",
|
|
5
|
+
"author": "Chocolatey Software (https://chocolatey.org/)",
|
|
6
|
+
"homepage": "https://github.com/chocolatey/choco-theme/blob/main/packages/docs#readme",
|
|
7
|
+
"license": "Apache-2.0",
|
|
8
|
+
"publishConfig": {
|
|
9
|
+
"registry": "https://registry.npmjs.org/",
|
|
10
|
+
"access": "public"
|
|
11
|
+
},
|
|
12
|
+
"devDependencies": {
|
|
13
|
+
"@types/anchor-js": "^5",
|
|
14
|
+
"@types/bootstrap": "^5.2.10",
|
|
15
|
+
"@types/jquery": "^3",
|
|
16
|
+
"@types/prismjs": "^1"
|
|
17
|
+
},
|
|
18
|
+
"dependencies": {
|
|
19
|
+
"@docsearch/css": "^3.9.0",
|
|
20
|
+
"@docsearch/js": "^3.9.0",
|
|
21
|
+
"@fortawesome/fontawesome-free": "^7.0.0",
|
|
22
|
+
"anchor-js": "^5.0.0",
|
|
23
|
+
"bootstrap": "^5.3.7",
|
|
24
|
+
"clipboard": "^2.0.11",
|
|
25
|
+
"jquery": "^3.7.1",
|
|
26
|
+
"prismjs": "^1.30.0"
|
|
27
|
+
},
|
|
28
|
+
"files": [
|
|
29
|
+
"LICENSE",
|
|
30
|
+
"package.json",
|
|
31
|
+
"README.md",
|
|
32
|
+
"dist/"
|
|
33
|
+
]
|
|
34
|
+
}
|