mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-11-01 16:44:23 +08:00
💋 Sync 2026-10-04 04:16:09
This commit is contained in:
1 parent
f6b2df73ec
commit
f62992fd80
745 files changed
+212416
-1173
No files matched your search
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,563 @@
|
||||
"use strict";
|
||||
"require baseclass";
|
||||
"require ui";
|
||||
"require dom";
|
||||
// WARN: generated by rsbuild - do not edit
|
||||
|
||||
// The require scope
|
||||
var __webpack_require__ = {};
|
||||
|
||||
// webpack/runtime/define_property_getters
|
||||
(() => {
|
||||
__webpack_require__.d = (exports, getters, values) => {
|
||||
var define = (defs, kind) => {
|
||||
for(var key in defs) {
|
||||
if(__webpack_require__.o(defs, key) && !__webpack_require__.o(exports, key)) {
|
||||
Object.defineProperty(exports, key, { enumerable: true, [kind]: defs[key] });
|
||||
}
|
||||
}
|
||||
};
|
||||
define(getters, "get");
|
||||
define(values, "value");
|
||||
};
|
||||
})();
|
||||
// webpack/runtime/has_own_property
|
||||
(() => {
|
||||
__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
|
||||
})();
|
||||
// webpack/runtime/make_namespace_object
|
||||
(() => {
|
||||
// define __esModule on exports
|
||||
__webpack_require__.r = (exports) => {
|
||||
if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
||||
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||||
}
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
};
|
||||
})();
|
||||
var __webpack_exports__ = {};
|
||||
// ESM COMPAT FLAG
|
||||
__webpack_require__.r(__webpack_exports__);
|
||||
|
||||
// EXPORTS
|
||||
__webpack_require__.d(__webpack_exports__, {
|
||||
main: () => (/* binding */ main)
|
||||
});
|
||||
|
||||
;// CONCATENATED MODULE: ./web/resources/fluent-defaults.ts
|
||||
const FLUENT_DEFAULTS = {
|
||||
mode: "auto",
|
||||
primary: "#0078d4",
|
||||
dark_primary: "#4da6ff",
|
||||
progressbar_font: "#2e2b60",
|
||||
dark_progressbar_font: "#d6d9e5",
|
||||
page_bg: "#fafafa",
|
||||
card_bg: "#ffffff",
|
||||
sidebar_bg: "#f3f3f3",
|
||||
dark_page_bg: "#1b1b1b",
|
||||
dark_card_bg: "#2d2d2d",
|
||||
dark_sidebar_bg: "#1f1f1f",
|
||||
font_weight: "normal",
|
||||
font_size: "14",
|
||||
border_radius: "4",
|
||||
control_height: "32",
|
||||
sidebar_width: "260",
|
||||
header_height: "48",
|
||||
login_bg: "microsoft",
|
||||
blur: "40",
|
||||
transparency: "0.8",
|
||||
blur_dark: "20",
|
||||
transparency_dark: "0.8",
|
||||
card_shadow: "small",
|
||||
transition_speed: "normal",
|
||||
custom_css: "",
|
||||
custom_select: "1",
|
||||
view_transition: "1",
|
||||
tab_animation: "1",
|
||||
prefers_reduced_motion: "1",
|
||||
loading_bar: "1",
|
||||
sticky_action_bar: "1",
|
||||
uci_changes_preview: "1",
|
||||
direction_mode: "auto",
|
||||
progressbar_text_position: "top-start"
|
||||
};
|
||||
const fluentFlagDefault = (r)=>"1" === r;
|
||||
|
||||
;// CONCATENATED MODULE: ./web/resources/view/fluent-config/shared.ts
|
||||
let shared_e = L.form;
|
||||
const omitDefaultValue = (e)=>{
|
||||
let t = e.parse.bind(e);
|
||||
e.parse = (r)=>e.isActive(r) && e.formvalue(r) === e.default ? e.isValid(r) ? (e.remove(r), Promise.resolve()) : t(r) : t(r);
|
||||
};
|
||||
const transparencySteps = [
|
||||
0,
|
||||
0.1,
|
||||
0.2,
|
||||
0.3,
|
||||
0.4,
|
||||
0.5,
|
||||
0.6,
|
||||
0.7,
|
||||
0.8,
|
||||
0.9,
|
||||
1
|
||||
];
|
||||
let shared_t = "fluent-live-preview", shared_r = /(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i, shared_a = {
|
||||
primary: {
|
||||
cssVar: "--fluent-primary",
|
||||
isDark: !1
|
||||
},
|
||||
dark_primary: {
|
||||
cssVar: "--fluent-primary",
|
||||
isDark: !0
|
||||
},
|
||||
page_bg: {
|
||||
cssVar: "--fluent-bg",
|
||||
isDark: !1
|
||||
},
|
||||
dark_page_bg: {
|
||||
cssVar: "--fluent-bg",
|
||||
isDark: !0
|
||||
},
|
||||
card_bg: {
|
||||
cssVar: "--fluent-bg-card",
|
||||
isDark: !1
|
||||
},
|
||||
dark_card_bg: {
|
||||
cssVar: "--fluent-bg-card",
|
||||
isDark: !0
|
||||
},
|
||||
sidebar_bg: {
|
||||
cssVar: "--fluent-sidebar-bg",
|
||||
isDark: !1
|
||||
},
|
||||
dark_sidebar_bg: {
|
||||
cssVar: "--fluent-sidebar-bg",
|
||||
isDark: !0
|
||||
},
|
||||
progressbar_font: {
|
||||
cssVar: "--fluent-progressbar-font-color",
|
||||
isDark: !1
|
||||
},
|
||||
dark_progressbar_font: {
|
||||
cssVar: "--fluent-progressbar-font-color",
|
||||
isDark: !0
|
||||
}
|
||||
}, shared_l = new globalThis.Map();
|
||||
const configureHexColorValue = (s, o, n = !1)=>{
|
||||
s.validate = (e, t)=>!e || shared_r.test(String(t)) || _("Expecting: %s").format(_("valid HEX color value")), s.render = (i, c, u)=>{
|
||||
let d = shared_e.Value.prototype.render.call(s, i, c, u), p = ()=>{
|
||||
let e = document.querySelector(`[id^="widget.cbid.fluent."][id$=".${o}"]`);
|
||||
e && ((e, t)=>{
|
||||
if ("true" === e.dataset.fluentColorPicker) return;
|
||||
let a = e.parentElement;
|
||||
if (!a) return;
|
||||
e.dataset.fluentColorPicker = "true", e.classList.add("fluent-color-field__text");
|
||||
let l = document.createElement("div");
|
||||
l.className = "fluent-color-field";
|
||||
let s = document.createElement("label");
|
||||
s.className = "fluent-color-swatch", s.title = _("Choose color");
|
||||
let o = document.createElement("input");
|
||||
o.type = "color", o.className = "fluent-color-swatch__input", o.setAttribute("aria-label", _("Choose color"));
|
||||
let n = document.createElement("span");
|
||||
n.className = "fluent-color-swatch__preview";
|
||||
let i = (e)=>{
|
||||
shared_r.test(e) && (o.value = e, n.style.backgroundColor = e);
|
||||
};
|
||||
i(e.value), o.addEventListener("input", ()=>{
|
||||
e.value = o.value, n.style.backgroundColor = o.value, shared_r.test(o.value) && t(o.value);
|
||||
}), e.addEventListener("input", ()=>{
|
||||
i(e.value), shared_r.test(e.value) && t(e.value);
|
||||
}), s.appendChild(o), s.appendChild(n), a.insertBefore(l, e), l.appendChild(e), l.appendChild(s);
|
||||
})(e, (e)=>((e, r)=>{
|
||||
let s = shared_a[e];
|
||||
if (!s) return;
|
||||
let o = `${s.isDark ? "dark" : "light"}|${s.cssVar}`;
|
||||
shared_l.set(o, {
|
||||
selector: s.isDark ? ':root[data-theme="dark"]' : ":root",
|
||||
cssVar: s.cssVar,
|
||||
value: r
|
||||
}), (()=>{
|
||||
let e, r = ((e = document.getElementById(shared_t)) || ((e = document.createElement("style")).id = shared_t, document.head.appendChild(e)), e), a = new globalThis.Map();
|
||||
for (let e of shared_l.values()){
|
||||
let t = a.get(e.selector) ?? [];
|
||||
t.push(`${e.cssVar}: ${e.value};`), a.set(e.selector, t);
|
||||
}
|
||||
let s = "";
|
||||
for (let [e, t] of a)s += `${e} { ${t.join(" ")} }\n`;
|
||||
r.textContent = s;
|
||||
})();
|
||||
})(o, e));
|
||||
};
|
||||
return n ? requestAnimationFrame(p) : setTimeout(p, 0), d;
|
||||
};
|
||||
};
|
||||
const createModeSubtabs = (t, r, a)=>{
|
||||
let l = t.taboption(r, shared_e.SectionValue, a, shared_e.TypedSection, "global").subsection;
|
||||
return l.anonymous = !0, l.addremove = !1, l.tab("light", _("Light mode")), l.tab("dark", _("Dark mode")), l;
|
||||
};
|
||||
|
||||
;// CONCATENATED MODULE: ./web/resources/view/fluent-config/tabs/advanced.ts
|
||||
let advanced_e = L.form;
|
||||
|
||||
|
||||
const registerAdvancedTab = (d)=>{
|
||||
d.tab("advanced", _("Advanced"), _("Adjust layout, typography, transition timing, shadows, and inject custom CSS variables or rules when the built-in controls are not enough."));
|
||||
{
|
||||
let o = d.taboption("advanced", advanced_e.Value, "font_size", _("Base font size"), _("Sets the base interface font size in pixels. Most theme text scales from this value through the Fluent CSS variables. Recommended range: 12-18px."));
|
||||
o.datatype = "range(12,18)", o.default = FLUENT_DEFAULTS.font_size, omitDefaultValue(o), o.placeholder = FLUENT_DEFAULTS.font_size;
|
||||
}
|
||||
{
|
||||
let o = d.taboption("advanced", advanced_e.Value, "sidebar_width", _("Sidebar width"), _("Width of the main navigation sidebar in pixels."));
|
||||
o.datatype = "range(200,420)", o.default = FLUENT_DEFAULTS.sidebar_width, omitDefaultValue(o), o.placeholder = FLUENT_DEFAULTS.sidebar_width;
|
||||
}
|
||||
{
|
||||
let o = d.taboption("advanced", advanced_e.Value, "header_height", _("Header height"), _("Height of the top header bar in pixels."));
|
||||
o.datatype = "range(40,96)", o.default = FLUENT_DEFAULTS.header_height, omitDefaultValue(o), o.placeholder = FLUENT_DEFAULTS.header_height;
|
||||
}
|
||||
{
|
||||
let o = d.taboption("advanced", advanced_e.ListValue, "border_radius", _("Corner radius"), _("Controls the shared Fluent corner radius tokens used by cards, buttons, inputs, and related UI surfaces."));
|
||||
o.value("0", _("Square (0px)")), o.value("2", _("Small (2px)")), o.value("4", _("Medium (4px)")), o.value("6", _("Rounded (6px)")), o.value("8", _("Large (8px)")), o.value("12", _("Extra large (12px)")), o.default = FLUENT_DEFAULTS.border_radius, omitDefaultValue(o);
|
||||
}
|
||||
{
|
||||
let o = d.taboption("advanced", advanced_e.ListValue, "card_shadow", _("Card shadow"), _("Select the shadow depth applied to themed cards and panels."));
|
||||
o.value("none", _("None")), o.value("small", _("Small")), o.value("medium", _("Medium")), o.value("large", _("Large")), o.default = FLUENT_DEFAULTS.card_shadow, omitDefaultValue(o);
|
||||
}
|
||||
{
|
||||
let o = d.taboption("advanced", advanced_e.ListValue, "transition_speed", _("Theme transition speed"), _("Controls the shared Fluent transition timing used by menu, header, and other theme animations."));
|
||||
o.value("fast", _("Fast")), o.value("normal", _("Normal")), o.value("slow", _("Slow")), o.value("none", _("Disabled")), o.default = FLUENT_DEFAULTS.transition_speed, omitDefaultValue(o);
|
||||
}
|
||||
{
|
||||
let o = d.taboption("advanced", advanced_e.TextValue, "custom_css", _("Custom CSS"), _("Optional raw CSS injected into the Fluent header template. Use this for extra --fluent-* variable overrides or page-specific tweaks that are not exposed as dedicated options."));
|
||||
o.default = FLUENT_DEFAULTS.custom_css, omitDefaultValue(o), o.rmempty = !0, o.rows = 12, o.wrap = "off", o.placeholder = ":root {\n --fluent-sidebar-width: 280px;\n --fluent-card-shadow: none;\n}";
|
||||
}
|
||||
};
|
||||
|
||||
;// CONCATENATED MODULE: ./web/resources/view/fluent-config/tabs/colors.ts
|
||||
let colors_r = L.form;
|
||||
|
||||
|
||||
const registerColorsTab = (d)=>{
|
||||
d.tab("colors", _("Colors"));
|
||||
let l = createModeSubtabs(d, "colors", "colors_mode_tabs");
|
||||
{
|
||||
let o = l.taboption("light", colors_r.Value, "primary", _("Accent color"), _("HEX color used as the primary Fluent accent when the interface is rendered in light mode."));
|
||||
o.default = FLUENT_DEFAULTS.primary, omitDefaultValue(o), configureHexColorValue(o, "primary");
|
||||
}
|
||||
{
|
||||
let o = l.taboption("light", colors_r.Value, "progressbar_font", _("Progress bar text color"), _("HEX color used for progress-bar labels while the interface is rendered in light mode."));
|
||||
o.default = FLUENT_DEFAULTS.progressbar_font, omitDefaultValue(o), configureHexColorValue(o, "progressbar_font");
|
||||
}
|
||||
{
|
||||
let o = l.taboption("light", colors_r.Value, "page_bg", _("Page background"), _("HEX color used for the main page background in light mode."));
|
||||
o.default = FLUENT_DEFAULTS.page_bg, omitDefaultValue(o), configureHexColorValue(o, "page_bg");
|
||||
}
|
||||
{
|
||||
let o = l.taboption("light", colors_r.Value, "card_bg", _("Card background"), _("HEX color used for container/card elements in light mode."));
|
||||
o.default = FLUENT_DEFAULTS.card_bg, omitDefaultValue(o), configureHexColorValue(o, "card_bg");
|
||||
}
|
||||
{
|
||||
let o = l.taboption("light", colors_r.Value, "sidebar_bg", _("Sidebar background"), _("HEX color used for the navigation sidebar in light mode."));
|
||||
o.default = FLUENT_DEFAULTS.sidebar_bg, omitDefaultValue(o), configureHexColorValue(o, "sidebar_bg");
|
||||
}
|
||||
{
|
||||
let o = l.taboption("dark", colors_r.Value, "dark_primary", _("Accent color"), _("HEX color used as the primary Fluent accent when the interface is rendered in dark mode."));
|
||||
o.default = FLUENT_DEFAULTS.dark_primary, omitDefaultValue(o), configureHexColorValue(o, "dark_primary", !0);
|
||||
}
|
||||
{
|
||||
let o = l.taboption("dark", colors_r.Value, "dark_progressbar_font", _("Progress bar text color"), _("HEX color used for progress-bar labels while the interface is rendered in dark mode."));
|
||||
o.default = FLUENT_DEFAULTS.dark_progressbar_font, omitDefaultValue(o), configureHexColorValue(o, "dark_progressbar_font", !0);
|
||||
}
|
||||
{
|
||||
let o = l.taboption("dark", colors_r.Value, "dark_page_bg", _("Page background"), _("HEX color used for the main page background in dark mode."));
|
||||
o.default = FLUENT_DEFAULTS.dark_page_bg, omitDefaultValue(o), configureHexColorValue(o, "dark_page_bg", !0);
|
||||
}
|
||||
{
|
||||
let o = l.taboption("dark", colors_r.Value, "dark_card_bg", _("Card background"), _("HEX color used for container/card elements in dark mode."));
|
||||
o.default = FLUENT_DEFAULTS.dark_card_bg, omitDefaultValue(o), configureHexColorValue(o, "dark_card_bg", !0);
|
||||
}
|
||||
{
|
||||
let o = l.taboption("dark", colors_r.Value, "dark_sidebar_bg", _("Sidebar background"), _("HEX color used for the navigation sidebar in dark mode."));
|
||||
o.default = FLUENT_DEFAULTS.dark_sidebar_bg, omitDefaultValue(o), configureHexColorValue(o, "dark_sidebar_bg", !0);
|
||||
}
|
||||
};
|
||||
|
||||
;// CONCATENATED MODULE: ./web/resources/view/fluent-config/tabs/general.ts
|
||||
let general_e = L.form;
|
||||
|
||||
|
||||
const registerGeneralTab = (l, r = !0)=>{
|
||||
l.tab("general", _("General"));
|
||||
{
|
||||
let o = l.taboption("general", general_e.ListValue, "mode", _("Color mode"));
|
||||
o.value("auto", _("Follow system")), o.value("light", _("Force light mode")), o.value("dark", _("Force dark mode")), o.default = FLUENT_DEFAULTS.mode, omitDefaultValue(o), o.description = _("Use the system/browser preference, or always render the Fluent theme in a fixed light or dark palette.");
|
||||
}
|
||||
{
|
||||
let o = l.taboption("general", general_e.ListValue, "direction_mode", _("Text direction"));
|
||||
o.value("auto", _("Automatic (Arabic/Persian locales only)")), o.value("rtl", _("Force RTL")), o.value("ltr", _("Force LTR")), o.default = FLUENT_DEFAULTS.direction_mode, omitDefaultValue(o), o.description = _("Choose the document direction for authenticated and login pages. Automatic mode resolves Arabic and Persian locale codes (ar, ar_*, ar-*, fa, fa_*, fa-*) to RTL and falls back to LTR for missing or unrecognized locales.");
|
||||
}
|
||||
{
|
||||
let o = l.taboption("general", general_e.ListValue, "font_weight", _("Navigation font weight"));
|
||||
o.value("normal", _("Normal")), o.value("600", _("Semibold")), o.default = FLUENT_DEFAULTS.font_weight, omitDefaultValue(o), o.description = _("Controls the font weight used by main navigation labels and related theme text accents.");
|
||||
}
|
||||
{
|
||||
let o = l.taboption("general", general_e.ListValue, "control_height", _("Control height"));
|
||||
o.value("32", _("Compact (32px)")), o.value("42", _("Comfortable (42px)")), o.default = FLUENT_DEFAULTS.control_height, omitDefaultValue(o), o.description = _("Applies to standard buttons, inputs, selects, and similar form controls across the theme.");
|
||||
}
|
||||
if (r) {
|
||||
let r = l.taboption("general", general_e.Flag, "custom_select", _("Use Fluent custom select dropdowns"), _("Replace native select elements with the theme's custom dropdown widget."));
|
||||
r.default = fluentFlagDefault(FLUENT_DEFAULTS.custom_select) ? r.enabled : r.disabled, omitDefaultValue(r);
|
||||
}
|
||||
{
|
||||
let r = l.taboption("general", general_e.Flag, "sticky_action_bar", _("Keep action bar visible while scrolling"), _("Keep Save, Apply, and Reset actions fixed at the bottom of the viewport while scrolling."));
|
||||
r.default = fluentFlagDefault(FLUENT_DEFAULTS.sticky_action_bar) ? r.enabled : r.disabled, omitDefaultValue(r);
|
||||
}
|
||||
{
|
||||
let o = l.taboption("general", general_e.ListValue, "progressbar_text_position", _("Progress bar text position"));
|
||||
o.value("top-start", _("Above bar, start")), o.value("bottom-start", _("Below bar, start")), o.value("top-end", _("Above bar, end")), o.value("bottom-end", _("Below bar, end")), o.default = FLUENT_DEFAULTS.progressbar_text_position, omitDefaultValue(o), o.description = _("Position of progress-bar labels relative to the bar. Start/end alignment follows the text direction (LTR or RTL).");
|
||||
}
|
||||
};
|
||||
|
||||
;// CONCATENATED MODULE: ../node_modules/.pnpm/@lazulikao+luci-types@https_685a81b9ead15f36368ce6e6ebcf4a27/node_modules/@lazulikao/luci-types/src/jsx/jsx-factory.ts
|
||||
const Fragment = Symbol.for("jsx.fragment");
|
||||
function jsx_factory_e(e, t) {
|
||||
let { children: n, ...r } = null === t || "object" != typeof t || Array.isArray(t) ? {} : t, o = function e(t, n = []) {
|
||||
for (let r of t)null != r && "boolean" != typeof r && (Array.isArray(r) ? e(r, n) : n.push(r instanceof Node ? r : String(r)));
|
||||
return n;
|
||||
}(null == n ? [] : Array.isArray(n) ? n : [
|
||||
n
|
||||
]);
|
||||
if (e === Fragment) {
|
||||
let e = document.createDocumentFragment();
|
||||
return e.append(...o), e;
|
||||
}
|
||||
if ("function" == typeof e) {
|
||||
let t = Reflect.apply(e, void 0, [
|
||||
{
|
||||
...r,
|
||||
children: o
|
||||
}
|
||||
]);
|
||||
if (!(t instanceof Node)) throw TypeError("JSX components must return a DOM Node");
|
||||
return t;
|
||||
}
|
||||
if ("string" != typeof e) throw TypeError("JSX element types must be tag names or component functions");
|
||||
let f = {}, l = {
|
||||
...r
|
||||
};
|
||||
for (let [e, t] of Object.entries(l))e.startsWith("on") && "function" == typeof t ? (f[e] = t, delete l[e]) : "boolean" == typeof t && (t ? l[e] = e : delete l[e]);
|
||||
let s = Object.keys(l).length > 0 ? o.length > 1 ? E(e, l, o) : E(e, l, o[0]) : o.length > 1 ? E(e, {}, o) : E(e, {}, o[0]);
|
||||
for (let [e, t] of Object.entries(f)){
|
||||
let n = e.slice(2).toLowerCase();
|
||||
s.addEventListener(n, t);
|
||||
}
|
||||
return s;
|
||||
}
|
||||
function jsx(t, n) {
|
||||
return jsx_factory_e(t, n);
|
||||
}
|
||||
function jsxs(t, n) {
|
||||
return jsx_factory_e(t, n);
|
||||
}
|
||||
function jsxDEV(t, n) {
|
||||
return jsx_factory_e(t, n);
|
||||
}
|
||||
|
||||
;// CONCATENATED MODULE: ../node_modules/.pnpm/@lazulikao+luci-types@https_685a81b9ead15f36368ce6e6ebcf4a27/node_modules/@lazulikao/luci-types/src/jsx/jsx-runtime.ts
|
||||
|
||||
|
||||
;// CONCATENATED MODULE: ./web/resources/view/fluent-config/tabs/login.tsx
|
||||
|
||||
let login_a = L.form, login_n = L.rpc, login_l = L.fs, login_i = L.ui, login_o = login_n.declare({
|
||||
object: "luci.fluent",
|
||||
method: "avail",
|
||||
expect: {
|
||||
avail: 0
|
||||
}
|
||||
}), login_r = login_n.declare({
|
||||
object: "luci.fluent",
|
||||
method: "remove",
|
||||
params: [
|
||||
"filename"
|
||||
],
|
||||
expect: {
|
||||
result: 0
|
||||
}
|
||||
}), login_d = login_n.declare({
|
||||
object: "luci.fluent",
|
||||
method: "rename",
|
||||
params: [
|
||||
"newname"
|
||||
],
|
||||
expect: {
|
||||
result: 0
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
let login_p = new Set([
|
||||
"jpg",
|
||||
"jpeg",
|
||||
"png",
|
||||
"gif",
|
||||
"webp",
|
||||
"mp4",
|
||||
"webm"
|
||||
]), b = (e)=>e.split(".").pop()?.toLowerCase() ?? "", m = (e)=>login_p.has(b(e)), login_f = (e)=>e >= 1048576 ? `${(e / 1024 / 1024).toFixed(1)} GiB` : e >= 1024 ? `${(e / 1024).toFixed(1)} MiB` : `${e} KiB`, h = (e, t)=>{
|
||||
if (0 !== e) throw Error(`${t} failed with code ${e}.`);
|
||||
}, v = (e, t)=>{
|
||||
dom.content(e, t);
|
||||
}, login_k = login_a.DummyValue.extend({
|
||||
renderWidget: (a, n, c)=>{
|
||||
let s = jsx("div", {
|
||||
class: "cbi-value-description fluent-bg-status",
|
||||
children: "Ready to upload or remove custom backgrounds."
|
||||
}), u = jsx("div", {
|
||||
class: "fluent-bg-hint",
|
||||
children: "Supported formats: JPG, PNG, GIF, WEBP, MP4, WEBM."
|
||||
}), g = jsx("button", {
|
||||
class: "btn cbi-button cbi-button-action",
|
||||
type: "button",
|
||||
children: "Upload background"
|
||||
}), p = jsx("div", {
|
||||
class: "fluent-bg-actions",
|
||||
children: g
|
||||
}), k = jsx("div", {
|
||||
class: "fluent-bg-list"
|
||||
}), y = (e)=>{
|
||||
v(s, [
|
||||
document.createTextNode(e)
|
||||
]);
|
||||
}, $ = ()=>login_l.list("/www/luci-static/fluent/background").catch(()=>[]).then((a)=>{
|
||||
let n = a.filter((e)=>"file" === e.type && m(String(e.name ?? ""))).sort((e, t)=>String(e.name ?? "").localeCompare(String(t.name ?? "")));
|
||||
n.length ? v(k, n.map((a)=>{
|
||||
let n, l, o, d = String(a.name ?? ""), c = jsx("button", {
|
||||
class: "btn cbi-button cbi-button-remove",
|
||||
type: "button",
|
||||
children: "Delete"
|
||||
}), s = login_i.createHandlerFn(undefined, ()=>(y(`Deleting ${d}...`), login_r(d).then((e)=>(h(e, `Deleting ${d}`), $().then(()=>{
|
||||
y(`Deleted ${d}.`);
|
||||
}))).catch((e)=>{
|
||||
y(`Failed to delete ${d}: ${e instanceof Error ? e.message : String(e)}`);
|
||||
})));
|
||||
return s && c.addEventListener("click", s), jsxs("div", {
|
||||
class: "fluent-bg-item",
|
||||
children: [
|
||||
(n = b(d), l = `/luci-static/fluent/background/${encodeURIComponent(d)}`, "mp4" === n || "webm" === n ? jsx("video", {
|
||||
class: "fluent-bg-preview fluent-bg-preview-video",
|
||||
muted: !0,
|
||||
playsInline: !0,
|
||||
preload: "metadata",
|
||||
src: l
|
||||
}) : jsx("div", {
|
||||
class: "fluent-bg-preview",
|
||||
style: `background-image:url('${l.replace(/'/g, "%27")}')`
|
||||
})),
|
||||
jsxs("div", {
|
||||
class: "fluent-bg-meta",
|
||||
children: [
|
||||
jsx("strong", {
|
||||
class: "fluent-bg-name",
|
||||
title: d,
|
||||
children: d
|
||||
}),
|
||||
jsx("span", {
|
||||
class: "fluent-bg-size",
|
||||
children: (o = Number(a.size ?? 0)) > 0 ? login_f(Math.max(1, Math.ceil(o / 1024))) : "Unknown size"
|
||||
})
|
||||
]
|
||||
}),
|
||||
jsx("div", {
|
||||
class: "fluent-bg-item-actions",
|
||||
children: c
|
||||
})
|
||||
]
|
||||
});
|
||||
})) : v(k, jsxs("div", {
|
||||
class: "fluent-bg-empty",
|
||||
children: [
|
||||
jsx("strong", {
|
||||
children: "No custom backgrounds yet"
|
||||
}),
|
||||
jsx("span", {
|
||||
children: "Upload an image or video to use it on the login page."
|
||||
})
|
||||
]
|
||||
}));
|
||||
});
|
||||
return g.addEventListener("click", ()=>{
|
||||
y("Selecting background file..."), login_i.uploadFile("/tmp/fluent_background.tmp").then((e)=>{
|
||||
let t;
|
||||
if (!e?.name) throw Error("Upload did not return a filename.");
|
||||
let a = "" !== (t = e.name.replace(/^.*[\\/]/, "").replace(/[^A-Za-z0-9._-]+/g, "-").replace(/^-+|-+$/g, "")) && "." !== t && ".." !== t && m(t) ? t : `background-${Date.now()}.jpg`;
|
||||
return y(`Saving ${a}...`), login_d(a).then((e)=>(h(e, `Saving ${a}`), $().then(()=>{
|
||||
y(`Saved ${a}.`);
|
||||
}))).catch((e)=>{
|
||||
y(`Failed to save ${a}: ${e instanceof Error ? e.message : String(e)}`);
|
||||
});
|
||||
}).catch((e)=>{
|
||||
let t = e instanceof Error ? e.message : String(e);
|
||||
t && "false" !== t ? y(`Upload failed: ${t}`) : y("Upload canceled.");
|
||||
});
|
||||
}), login_o().then((e)=>{
|
||||
y(`Ready to upload or remove custom backgrounds. Available space: ${login_f(e)}.`);
|
||||
}).catch(()=>{
|
||||
y("Ready to upload or remove custom backgrounds.");
|
||||
}), $(), jsx("div", {
|
||||
class: "fluent-bg-manager",
|
||||
children: [
|
||||
s,
|
||||
u,
|
||||
p,
|
||||
k
|
||||
]
|
||||
});
|
||||
}
|
||||
});
|
||||
const registerLoginTab = (e)=>{
|
||||
e.tab("login", _("Login page"), _("Customize the login page background, card opacity, and blur radius for light and dark modes."));
|
||||
{
|
||||
let t = e.taboption("login", login_a.ListValue, "login_bg", "Background source", "Select the background image source for the login page.");
|
||||
t.value("microsoft", "Microsoft dynamic canvas"), t.value("custom", "Custom background"), t.value("bing", "Bing daily wallpaper"), t.default = FLUENT_DEFAULTS.login_bg, omitDefaultValue(t);
|
||||
}
|
||||
e.taboption("login", login_k, "_bg_mgr", "Custom backgrounds", "Upload and manage custom background images for the login page.").depends("login_bg", "custom");
|
||||
let t = createModeSubtabs(e, "login", "login_mode_tabs");
|
||||
{
|
||||
let e = t.taboption("light", login_a.ListValue, "transparency", _("Login card opacity"), _("Opacity of the login card in light mode. 0 is fully transparent and 1 is fully opaque."));
|
||||
for (let t of transparencySteps)e.value(String(t));
|
||||
e.default = FLUENT_DEFAULTS.transparency, omitDefaultValue(e);
|
||||
}
|
||||
{
|
||||
let e = t.taboption("light", login_a.Value, "blur", _("Backdrop blur radius"), _("Blur radius in pixels behind the login card in light mode. Use 0 to disable blur."));
|
||||
e.datatype = "ufloat", e.default = FLUENT_DEFAULTS.blur, omitDefaultValue(e);
|
||||
}
|
||||
{
|
||||
let e = t.taboption("dark", login_a.ListValue, "transparency_dark", _("Login card opacity"), _("Opacity of the login card in dark mode. 0 is fully transparent and 1 is fully opaque."));
|
||||
for (let t of transparencySteps)e.value(String(t));
|
||||
e.default = FLUENT_DEFAULTS.transparency_dark, omitDefaultValue(e);
|
||||
}
|
||||
{
|
||||
let e = t.taboption("dark", login_a.Value, "blur_dark", _("Backdrop blur radius"), _("Blur radius in pixels behind the login card in dark mode. Use 0 to disable blur."));
|
||||
e.datatype = "ufloat", e.default = FLUENT_DEFAULTS.blur_dark, omitDefaultValue(e);
|
||||
}
|
||||
};
|
||||
|
||||
;// CONCATENATED MODULE: ./web/resources/view/fluent-config-lite.tsx
|
||||
let fluent_config_lite_e = L.form, fluent_config_lite_n = L.uci;
|
||||
|
||||
|
||||
|
||||
|
||||
class fluent_config_lite_l extends L.view {
|
||||
load() {
|
||||
return fluent_config_lite_n.load("fluent");
|
||||
}
|
||||
render() {
|
||||
let n = new fluent_config_lite_e.Map("fluent", _("Fluent theme settings"), _("Configure color mode, accent colors, layout sizing, login-page appearance, and advanced CSS overrides for luci-theme-fluent-lite.")), l = n.section(fluent_config_lite_e.TypedSection, "global", _("Theme settings"));
|
||||
return l.addremove = !1, l.anonymous = !0, registerGeneralTab(l, !1), registerColorsTab(l), registerLoginTab(l), registerAdvancedTab(l), n.render();
|
||||
}
|
||||
}
|
||||
const main = fluent_config_lite_l;
|
||||
|
||||
|
||||
return main;
|
||||
Reference in new issue
Block a user