reader-mode/dist/components/index.js

371 lines
No EOL
10 KiB
JavaScript

// node_modules/@quartz-community/utils/dist/lang.js
function classNames(...classes) {
return classes.filter(Boolean).join(" ");
}
// src/i18n/locales/en-US.ts
var en_US_default = {
components: {
readerMode: {
title: "Reader mode"
}
}
};
// src/i18n/locales/ar-SA.ts
var ar_SA_default = {
components: {
readerMode: {
title: "\u0648\u0636\u0639 \u0627\u0644\u0642\u0627\u0631\u0626"
}
}
};
// src/i18n/locales/ca-ES.ts
var ca_ES_default = {
components: {
readerMode: {
title: "Mode lector"
}
}
};
// src/i18n/locales/cs-CZ.ts
var cs_CZ_default = {
components: {
readerMode: {
title: "Re\u017Eim \u010Dte\u010Dky"
}
}
};
// src/i18n/locales/de-DE.ts
var de_DE_default = {
components: {
readerMode: {
title: "Lesemodus"
}
}
};
// src/i18n/locales/en-GB.ts
var en_GB_default = {
components: {
readerMode: {
title: "Reader mode"
}
}
};
// src/i18n/locales/es-ES.ts
var es_ES_default = {
components: {
readerMode: {
title: "Modo lector"
}
}
};
// src/i18n/locales/fa-IR.ts
var fa_IR_default = {
components: {
readerMode: {
title: "\u062D\u0627\u0644\u062A \u062E\u0648\u0627\u0646\u062F\u0646"
}
}
};
// src/i18n/locales/fi-FI.ts
var fi_FI_default = {
components: {
readerMode: {
title: "Lukijatila"
}
}
};
// src/i18n/locales/fr-FR.ts
var fr_FR_default = {
components: {
readerMode: {
title: "Mode lecture"
}
}
};
// src/i18n/locales/he-IL.ts
var he_IL_default = {
components: {
readerMode: {
title: "\u05DE\u05E6\u05D1 \u05E7\u05E8\u05D9\u05D0\u05D4"
}
}
};
// src/i18n/locales/hu-HU.ts
var hu_HU_default = {
components: {
readerMode: {
title: "Olvas\xF3 m\xF3d"
}
}
};
// src/i18n/locales/id-ID.ts
var id_ID_default = {
components: {
readerMode: {
title: "Mode Pembaca"
}
}
};
// src/i18n/locales/it-IT.ts
var it_IT_default = {
components: {
readerMode: {
title: "Modalit\xE0 lettura"
}
}
};
// src/i18n/locales/ja-JP.ts
var ja_JP_default = {
components: {
readerMode: {
title: "\u30EA\u30FC\u30C0\u30FC\u30E2\u30FC\u30C9"
}
}
};
// src/i18n/locales/kk-KZ.ts
var kk_KZ_default = {
components: {
readerMode: {
title: "\u041E\u049B\u0443 \u0440\u0435\u0436\u0438\u043C\u0456"
}
}
};
// src/i18n/locales/ko-KR.ts
var ko_KR_default = {
components: {
readerMode: {
title: "\uB9AC\uB354 \uBAA8\uB4DC"
}
}
};
// src/i18n/locales/lt-LT.ts
var lt_LT_default = {
components: {
readerMode: {
title: "Modalit\xE0 lettore"
}
}
};
// src/i18n/locales/nb-NO.ts
var nb_NO_default = {
components: {
readerMode: {
title: "L\xE6semodus"
}
}
};
// src/i18n/locales/nl-NL.ts
var nl_NL_default = {
components: {
readerMode: {
title: "Leesmodus"
}
}
};
// src/i18n/locales/pl-PL.ts
var pl_PL_default = {
components: {
readerMode: {
title: "Tryb czytania"
}
}
};
// src/i18n/locales/pt-BR.ts
var pt_BR_default = {
components: {
readerMode: {
title: "Modo leitor"
}
}
};
// src/i18n/locales/ro-RO.ts
var ro_RO_default = {
components: {
readerMode: {
title: "Modul de citire"
}
}
};
// src/i18n/locales/ru-RU.ts
var ru_RU_default = {
components: {
readerMode: {
title: "\u0420\u0435\u0436\u0438\u043C \u0447\u0442\u0435\u043D\u0438\u044F"
}
}
};
// src/i18n/locales/th-TH.ts
var th_TH_default = {
components: {
readerMode: {
title: "\u0E42\u0E2B\u0E21\u0E14\u0E2D\u0E48\u0E32\u0E19"
}
}
};
// src/i18n/locales/tr-TR.ts
var tr_TR_default = {
components: {
readerMode: {
title: "Okuma modu"
}
}
};
// src/i18n/locales/uk-UA.ts
var uk_UA_default = {
components: {
readerMode: {
title: "\u0420\u0435\u0436\u0438\u043C \u0447\u0438\u0442\u0430\u043D\u043D\u044F"
}
}
};
// src/i18n/locales/vi-VN.ts
var vi_VN_default = {
components: {
readerMode: {
title: "Ch\u1EBF \u0111\u1ED9 \u0111\u1ECDc"
}
}
};
// src/i18n/locales/zh-CN.ts
var zh_CN_default = {
components: {
readerMode: {
title: "\u9605\u8BFB\u6A21\u5F0F"
}
}
};
// src/i18n/locales/zh-TW.ts
var zh_TW_default = {
components: {
readerMode: {
title: "\u95B1\u8B80\u6A21\u5F0F"
}
}
};
// src/i18n/index.ts
var locales = {
"en-US": en_US_default,
"ar-SA": ar_SA_default,
"ca-ES": ca_ES_default,
"cs-CZ": cs_CZ_default,
"de-DE": de_DE_default,
"en-GB": en_GB_default,
"es-ES": es_ES_default,
"fa-IR": fa_IR_default,
"fi-FI": fi_FI_default,
"fr-FR": fr_FR_default,
"he-IL": he_IL_default,
"hu-HU": hu_HU_default,
"id-ID": id_ID_default,
"it-IT": it_IT_default,
"ja-JP": ja_JP_default,
"kk-KZ": kk_KZ_default,
"ko-KR": ko_KR_default,
"lt-LT": lt_LT_default,
"nb-NO": nb_NO_default,
"nl-NL": nl_NL_default,
"pl-PL": pl_PL_default,
"pt-BR": pt_BR_default,
"ro-RO": ro_RO_default,
"ru-RU": ru_RU_default,
"th-TH": th_TH_default,
"tr-TR": tr_TR_default,
"uk-UA": uk_UA_default,
"vi-VN": vi_VN_default,
"zh-CN": zh_CN_default,
"zh-TW": zh_TW_default
};
function i18n(locale) {
return locales[locale] || en_US_default;
}
// src/components/scripts/readermode.inline.ts
var readermode_inline_default = 'var n=!1,o=t=>{let e=new CustomEvent("readermodechange",{detail:{mode:t}});document.dispatchEvent(e)},d=()=>{let t=()=>{n=!n;let e=n?"on":"off";document.documentElement.setAttribute("reader-mode",e),o(e)};for(let e of document.getElementsByClassName("readermode"))e.addEventListener("click",t),window.addCleanup(()=>e.removeEventListener("click",t));document.documentElement.setAttribute("reader-mode",n?"on":"off")};document.addEventListener("nav",d);document.addEventListener("render",d);\n';
// src/components/styles/readermode.scss
var readermode_default = ".readermode {\n cursor: pointer;\n padding: 0;\n position: relative;\n background: none;\n border: none;\n width: 20px;\n height: 32px;\n margin: 0;\n text-align: inherit;\n flex-shrink: 0;\n}\n.readermode svg {\n position: absolute;\n width: 20px;\n height: 20px;\n top: calc(50% - 10px);\n fill: var(--darkgray);\n stroke: var(--darkgray);\n transition: opacity 0.1s ease;\n}\n\n:root[reader-mode=on] .sidebar.left, :root[reader-mode=on] .sidebar.right {\n opacity: 0;\n transition: opacity 0.2s ease;\n}\n:root[reader-mode=on] .sidebar.left:hover, :root[reader-mode=on] .sidebar.right:hover {\n opacity: 1;\n}";
var l;
l = { __e: function(n2, l2, u3, t2) {
for (var i2, r2, o2; l2 = l2.__; ) if ((i2 = l2.__c) && !i2.__) try {
if ((r2 = i2.constructor) && null != r2.getDerivedStateFromError && (i2.setState(r2.getDerivedStateFromError(n2)), o2 = i2.__d), null != i2.componentDidCatch && (i2.componentDidCatch(n2, t2 || {}), o2 = i2.__d), o2) return i2.__E = i2;
} catch (l3) {
n2 = l3;
}
throw n2;
} }, "function" == typeof Promise ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, Math.random().toString(8);
// node_modules/preact/jsx-runtime/dist/jsxRuntime.mjs
var f2 = 0;
function u2(e2, t2, n2, o2, i2, u3) {
t2 || (t2 = {});
var a2, c2, p2 = t2;
if ("ref" in p2) for (c2 in p2 = {}, t2) "ref" == c2 ? a2 = t2[c2] : p2[c2] = t2[c2];
var l2 = { type: e2, props: p2, key: n2, ref: a2, __k: null, __: null, __b: 0, __e: null, __c: null, constructor: void 0, __v: --f2, __i: -1, __u: 0, __source: i2, __self: u3 };
if ("function" == typeof e2 && (a2 = e2.defaultProps)) for (c2 in a2) void 0 === p2[c2] && (p2[c2] = a2[c2]);
return l.vnode && l.vnode(l2), l2;
}
// src/components/ReaderMode.tsx
var ReaderMode = ({ displayClass, cfg }) => {
const title = i18n(cfg?.locale ?? "en-US").components.readerMode.title;
return /* @__PURE__ */ u2("button", { class: classNames(displayClass, "readermode"), "aria-label": title, children: /* @__PURE__ */ u2(
"svg",
{
xmlns: "http://www.w3.org/2000/svg",
xmlnsXlink: "http://www.w3.org/1999/xlink",
version: "1.1",
class: "readerIcon",
fill: "currentColor",
stroke: "currentColor",
"stroke-width": "0.2",
"stroke-linecap": "round",
"stroke-linejoin": "round",
width: "64px",
height: "64px",
viewBox: "0 0 24 24",
"aria-label": title,
children: [
/* @__PURE__ */ u2("title", { children: title }),
/* @__PURE__ */ u2("g", { transform: "translate(-1.8, -1.8) scale(1.15, 1.2)", children: /* @__PURE__ */ u2("path", { d: "M8.9891247,2.5 C10.1384702,2.5 11.2209868,2.96705384 12.0049645,3.76669482 C12.7883914,2.96705384 13.8709081,2.5 15.0202536,2.5 L18.7549359,2.5 C19.1691495,2.5 19.5049359,2.83578644 19.5049359,3.25 L19.5046891,4.004 L21.2546891,4.00457396 C21.6343849,4.00457396 21.9481801,4.28672784 21.9978425,4.6528034 L22.0046891,4.75457396 L22.0046891,20.25 C22.0046891,20.6296958 21.7225353,20.943491 21.3564597,20.9931534 L21.2546891,21 L2.75468914,21 C2.37499337,21 2.06119817,20.7178461 2.01153575,20.3517706 L2.00468914,20.25 L2.00468914,4.75457396 C2.00468914,4.37487819 2.28684302,4.061083 2.65291858,4.01142057 L2.75468914,4.00457396 L4.50368914,4.004 L4.50444233,3.25 C4.50444233,2.87030423 4.78659621,2.55650904 5.15267177,2.50684662 L5.25444233,2.5 L8.9891247,2.5 Z M4.50368914,5.504 L3.50468914,5.504 L3.50468914,19.5 L10.9478955,19.4998273 C10.4513189,18.9207296 9.73864328,18.5588115 8.96709342,18.5065584 L8.77307039,18.5 L5.25444233,18.5 C4.87474657,18.5 4.56095137,18.2178461 4.51128895,17.8517706 L4.50444233,17.75 L4.50368914,5.504 Z M19.5049359,17.75 C19.5049359,18.1642136 19.1691495,18.5 18.7549359,18.5 L15.2363079,18.5 C14.3910149,18.5 13.5994408,18.8724714 13.0614828,19.4998273 L20.5046891,19.5 L20.5046891,5.504 L19.5046891,5.504 L19.5049359,17.75 Z M18.0059359,3.999 L15.0202536,4 L14.8259077,4.00692283 C13.9889509,4.06666544 13.2254227,4.50975805 12.7549359,5.212 L12.7549359,17.777 L12.7782651,17.7601316 C13.4923805,17.2719483 14.3447024,17 15.2363079,17 L18.0059359,16.999 L18.0056891,4.798 L18.0033792,4.75457396 L18.0056891,4.71 L18.0059359,3.999 Z M8.9891247,4 L6.00368914,3.999 L6.00599909,4.75457396 L6.00599909,4.75457396 L6.00368914,4.783 L6.00368914,16.999 L8.77307039,17 C9.57551536,17 10.3461406,17.2202781 11.0128313,17.6202194 L11.2536891,17.776 L11.2536891,5.211 C10.8200889,4.56369974 10.1361548,4.13636104 9.37521067,4.02745763 L9.18347055,4.00692283 L8.9891247,4 Z" }) })
]
}
) });
};
ReaderMode.beforeDOMLoaded = readermode_inline_default;
ReaderMode.css = readermode_default;
var ReaderMode_default = (() => ReaderMode);
export { ReaderMode_default as ReaderMode };
//# sourceMappingURL=index.js.map
//# sourceMappingURL=index.js.map