Performance-BaNLt-FS.js in WindPress – Tailwind CSS integration for WordPress 3.2.85, at build/assets/Performance-BaNLt-FS.js
| 1 | import { o as e } from "./rolldown-runtime-CMxvf4Kt.js"; |
| 2 | import { D as t, E as n, On as r, Yt as i, _ as a, b as o, g as s, k as c, mt as l, o as u, qt as d, rt as f, tr as p, v as m, vn as h, w as g, y as _ } from "./runtime-core.esm-bundler-Ci9kEgM7.js"; |
| 3 | import { o as v } from "./vue.runtime.esm-bundler-CWCE91rd.js"; |
| 4 | import { n as y, t as b, y as x } from "./Button-CzGEASGR.js"; |
| 5 | import { t as S } from "./Tooltip-CmrGYuQV.js"; |
| 6 | import { t as C } from "./Separator-D24uVBc5.js"; |
| 7 | import { t as w } from "./Switch-CVI4Zu3k.js"; |
| 8 | import { t as T } from "./Badge-Dw196kvM.js"; |
| 9 | import { t as E } from "./api-DL2Um68W.js"; |
| 10 | import { r as D, t as O } from "./settings-BxZvj8OA.js"; |
| 11 | import { t as k } from "./useGenerateCache-DDMxd8wD.js"; |
| 12 | import { t as A } from "./dayjs.min-hBUm6X7m.js"; |
| 13 | import { t as j } from "./FormField-CW_xTLaB.js"; |
| 14 | import { n as M, t as N } from "./PageCard-CZVt_0c7.js"; |
| 15 | var P = e(A(), 1), F = [`B`, `kB`, `MB`, `GB`, `TB`, `PB`, `EB`, `ZB`, `YB`], I = [`B`, `KiB`, `MiB`, `GiB`, `TiB`, `PiB`, `EiB`, `ZiB`, `YiB`], L = [`b`, `kbit`, `Mbit`, `Gbit`, `Tbit`, `Pbit`, `Ebit`, `Zbit`, `Ybit`], R = [`b`, `kibit`, `Mibit`, `Gibit`, `Tibit`, `Pibit`, `Eibit`, `Zibit`, `Yibit`], z = (e2, t2, n2) => { |
| 16 | let r2 = e2; |
| 17 | return typeof t2 == `string` || Array.isArray(t2) ? r2 = e2.toLocaleString(t2, n2) : (t2 === true || n2 !== void 0) && (r2 = e2.toLocaleString(void 0, n2)), r2; |
| 18 | }, B = (e2) => { |
| 19 | if (typeof e2 == `number`) return Math.log10(e2); |
| 20 | let t2 = e2.toString(10); |
| 21 | return t2.length + Math.log10(`0.${t2.slice(0, 15)}`); |
| 22 | }, V = (e2) => typeof e2 == `number` ? Math.log(e2) : B(e2) * Math.log(10), H = (e2, t2) => { |
| 23 | if (typeof e2 == `number`) return e2 / t2; |
| 24 | let n2 = e2 / BigInt(t2), r2 = e2 % BigInt(t2); |
| 25 | return Number(n2) + Number(r2) / t2; |
| 26 | }, U = (e2, t2) => { |
| 27 | if (t2 === void 0) return e2; |
| 28 | if (typeof t2 != `number` || !Number.isSafeInteger(t2) || t2 < 0) throw TypeError(`Expected fixedWidth to be a non-negative integer, got ${typeof t2}: ${t2}`); |
| 29 | return t2 === 0 ? e2 : e2.length < t2 ? e2.padStart(t2, ` `) : e2; |
| 30 | }, W = (e2) => { |
| 31 | let { minimumFractionDigits: t2, maximumFractionDigits: n2 } = e2; |
| 32 | if (!(t2 === void 0 && n2 === void 0)) return { ...t2 !== void 0 && { minimumFractionDigits: t2 }, ...n2 !== void 0 && { maximumFractionDigits: n2 }, roundingMode: `trunc` }; |
| 33 | }; |
| 34 | function G(e2, t2) { |
| 35 | if (typeof e2 != `bigint` && !Number.isFinite(e2)) throw TypeError(`Expected a finite number, got ${typeof e2}: ${e2}`); |
| 36 | t2 = { bits: false, binary: false, space: true, nonBreakingSpace: false, ...t2 }; |
| 37 | let n2 = t2.bits ? t2.binary ? R : L : t2.binary ? I : F, r2 = t2.space ? t2.nonBreakingSpace ? `\xA0` : ` ` : ``, i2 = typeof e2 == `number` ? e2 === 0 : e2 === 0n; |
| 38 | if (t2.signed && i2) return U(` 0${r2}${n2[0]}`, t2.fixedWidth); |
| 39 | let a2 = e2 < 0, o2 = a2 ? `-` : t2.signed ? `+` : ``; |
| 40 | a2 && (e2 = -e2); |
| 41 | let s2 = W(t2), c2; |
| 42 | if (e2 < 1) c2 = o2 + z(e2, t2.locale, s2) + r2 + n2[0]; |
| 43 | else { |
| 44 | let i3 = Math.min(Math.floor(t2.binary ? V(e2) / Math.log(1024) : B(e2) / 3), n2.length - 1); |
| 45 | if (e2 = H(e2, (t2.binary ? 1024 : 1e3) ** i3), !s2) { |
| 46 | let t3 = Math.max(3, Math.floor(e2).toString().length); |
| 47 | e2 = e2.toPrecision(t3); |
| 48 | } |
| 49 | let a3 = z(Number(e2), t2.locale, s2), l2 = n2[i3]; |
| 50 | c2 = o2 + a3 + r2 + l2; |
| 51 | } |
| 52 | return U(c2, t2.fixedWidth); |
| 53 | } |
| 54 | var K = { class: `shrink grid grid-cols-3 gap-3` }, q = { class: `flex items-center justify-center rounded-md p-3 font-semibold flex-1 bg-(--ui-bg-accented) hover:ring-(--ui-text)/50 hover:ring-1 has-checked:bg-[#0073e0] has-checked:text-white` }, J = { class: `flex items-center justify-center rounded-md p-3 font-semibold flex-1 bg-(--ui-bg-accented) hover:ring-(--ui-text)/50 hover:ring-1 has-checked:bg-[#0073e0] has-checked:text-white` }, Y = { class: `flex items-center justify-center rounded-md p-3 font-semibold flex-1 bg-(--ui-bg-accented) hover:ring-(--ui-text)/50 hover:ring-1 has-checked:bg-[#0073e0] has-checked:text-white` }, X = { class: `bg-muted/50 border border-default rounded-lg p-3` }, Z = { class: `flex items-start gap-2` }, Q = { class: `text-xs text-muted` }, $ = { class: `font-medium mb-1` }, ee = { class: `space-y-1` }, te = { class: `text-xs bg-elevated px-1 py-0.5 rounded font-semibold` }, ne = { class: `text-xs bg-elevated px-1 py-0.5 rounded font-semibold` }, re = { class: `text-xs bg-elevated px-1 py-0.5 rounded font-semibold` }, ie = { class: `flex gap-2 items-center` }, ae = { class: `flex gap-2 items-center` }, oe = { class: `font-semibold` }, se = { key: 0, class: `flex gap-1` }, ce = c({ __name: `Performance`, setup(e2) { |
| 55 | let c2 = E(), { generateCache: A2 } = k(), F2 = O(), I2 = D(), L2 = h({ last_generated: null, last_full_build: null, file_url: null, file_size: null }); |
| 56 | function R2() { |
| 57 | c2.get(`admin/settings/cache/index`).then((e3) => { |
| 58 | L2.value = e3.data.cache; |
| 59 | }); |
| 60 | } |
| 61 | async function z2() { |
| 62 | A2(() => { |
| 63 | R2(); |
| 64 | }); |
| 65 | } |
| 66 | f(() => { |
| 67 | R2(); |
| 68 | }); |
| 69 | let B2 = s(() => F2.virtualOptions(`performance.mode`, `hybrid`).value === `cached`); |
| 70 | return (e3, s2) => { |
| 71 | let c3 = N, f2 = j, h2 = x, E2 = C, D2 = w, O2 = y, k2 = T, A3 = b, R3 = S, V2 = M; |
| 72 | return l(), m(V2, { id: `performance`, state: {} }, { default: d(() => [t(c3, { title: e3.i18n.__(`Performance`, `windpress`), variant: `naked`, orientation: `horizontal`, class: `mb-4` }, null, 8, [`title`]), t(c3, { variant: `subtle` }, { default: d(() => [t(f2, { label: e3.i18n.__(`Rendering modes`, `windpress`), class: `flex max-sm:flex-col justify-between items-start gap-4`, ui: { container: `flex-1`, wrapper: `flex-1`, root: `rootzzz` } }, { description: d(() => [a(`p`, null, p(e3.i18n.__(`Choose the rendering strategy based on your needs.`, `windpress`)), 1)]), default: d(() => [a(`div`, K, [a(`label`, q, [i(a(`input`, { "onUpdate:modelValue": s2[0] || (s2[0] = (e4) => r(F2).virtualOptions(`performance.mode`, `hybrid`).value = e4), type: `radio`, name: `performance_mode`, value: `cached`, class: `sr-only` }, null, 512), [[v, r(F2).virtualOptions(`performance.mode`, `hybrid`).value]]), a(`span`, null, p(e3.i18n.__(`Cached`, `windpress`)), 1)]), a(`label`, J, [i(a(`input`, { "onUpdate:modelValue": s2[1] || (s2[1] = (e4) => r(F2).virtualOptions(`performance.mode`, `hybrid`).value = e4), type: `radio`, name: `performance_mode`, value: `hybrid`, class: `sr-only` }, null, 512), [[v, r(F2).virtualOptions(`performance.mode`, `hybrid`).value]]), a(`span`, null, p(e3.i18n.__(`Hybrid`, `windpress`)), 1)]), a(`label`, Y, [i(a(`input`, { "onUpdate:modelValue": s2[2] || (s2[2] = (e4) => r(F2).virtualOptions(`performance.mode`, `hybrid`).value = e4), type: `radio`, name: `performance_mode`, value: `compiler`, class: `sr-only` }, null, 512), [[v, r(F2).virtualOptions(`performance.mode`, `hybrid`).value]]), a(`span`, null, p(e3.i18n.__(`Compiler`, `windpress`)), 1)])])]), _: 1 }, 8, [`label`]), a(`div`, X, [a(`div`, Z, [t(h2, { name: `lucide:lightbulb`, class: `size-4 text-info mt-0.5 flex-shrink-0` }), a(`div`, Q, [a(`p`, $, p(r(wp.i18n.__)(`Available modes:`, `windpress`)), 1), a(`div`, ee, [a(`p`, null, [a(`code`, te, p(e3.i18n.__(`Cached`)), 1), n(` - ` + p(e3.i18n.__(`Load cached CSS when available, otherwise fallback to Compiler.`, `windpress`)), 1)]), a(`p`, null, [a(`code`, ne, p(e3.i18n.__(`Hybrid`)), 1), n(` - ` + p(e3.i18n.__(`Inline cached CSS when available, then run the Compiler to regenerate the style.`, `windpress`)), 1)]), a(`p`, null, [a(`code`, re, p(e3.i18n.__(`Compiler`)), 1), n(` - ` + p(e3.i18n.__(`Always use the Compiler to generate the style.`, `windpress`)), 1)])])])])]), t(E2), B2.value ? (l(), o(u, { key: 0 }, [t(f2, { label: e3.i18n.__(`Cached CSS loading method`, `windpress`), description: e3.i18n.__(`Load cached CSS as an inline instead of an external file.`, `windpress`), class: `flex items-center justify-between gap-4` }, { default: d(() => [t(D2, { modelValue: r(F2).virtualOptions(`performance.cache.inline_load`, false).value, "onUpdate:modelValue": s2[3] || (s2[3] = (e4) => r(F2).virtualOptions(`performance.cache.inline_load`, false).value = e4), label: e3.i18n.__(`Inline Cached CSS`, `windpress`), ui: { label: `whitespace-nowrap` }, class: `flex-row-reverse gap-2` }, null, 8, [`modelValue`, `label`])]), _: 1 }, 8, [`label`, `description`]), t(E2)], 64)) : _(``, true), r(F2).virtualOptions(`general.tailwindcss.version`, 4).value === 4 ? (l(), o(u, { key: 1 }, [t(f2, { label: e3.i18n.__(`Generate source map`, `windpress`), description: e3.i18n.__(`Generate the source map for the cached CSS file.`, `windpress`), class: `flex items-center justify-between gap-4` }, { default: d(() => [t(D2, { modelValue: r(F2).virtualOptions(`performance.cache.source_map`, false).value, "onUpdate:modelValue": s2[4] || (s2[4] = (e4) => r(F2).virtualOptions(`performance.cache.source_map`, false).value = e4), label: e3.i18n.__(`Enable Source Map`, `windpress`), ui: { label: `whitespace-nowrap` }, class: `flex-row-reverse gap-2` }, null, 8, [`modelValue`, `label`])]), _: 1 }, 8, [`label`, `description`]), t(E2)], 64)) : _(``, true), t(f2, { label: e3.i18n.__(`Generate the cached CSS`, `windpress`), class: `flex items-center justify-between gap-4` }, g({ default: d(() => [t(R3, { "delay-duration": 0, text: e3.i18n.__(`Generate the cached CSS file`, `windpress`) }, { default: d(() => [t(A3, { color: `primary`, variant: `subtle`, onClick: z2, disabled: r(I2).isBusy, loading: r(I2).isBusy && r(I2).hasTask(`settings.performance.cached_css.generate`) }, { default: d(() => [n(p(r(I2).isBusy && r(I2).hasTask(`settings.performance.cached_css.generate`) ? e3.i18n.__(`Generating...`, `windpress`) : e3.i18n.__(`Generate`, `windpress`)), 1)]), _: 1 }, 8, [`disabled`, `loading`])]), _: 1 }, 8, [`text`])]), _: 2 }, [L2.value.last_generated ? { name: `description`, fn: d(() => [a(`div`, ie, [a(`div`, ae, [a(`span`, oe, p(e3.i18n.__(`Last Generated`, `windpress`)) + `: `, 1), L2.value.file_size ? (l(), o(`span`, se, [n(p(r(P.default)(L2.value.last_generated * 1e3).format(`YYYY-MM-DD HH:mm:ss`)) + ` `, 1), t(O2, { to: L2.value.file_url, target: `_blank`, class: `underline` }, { default: d(() => [t(h2, { name: `lucide:external-link` })]), _: 1 }, 8, [`to`])])) : _(``, true)]), L2.value.file_size ? (l(), m(k2, { key: 0, color: `success`, variant: `subtle` }, { default: d(() => [n(p(r(G)(L2.value.file_size, { maximumFractionDigits: 2, space: true })), 1)]), _: 1 })) : _(``, true)])]), key: `0` } : void 0]), 1032, [`label`])]), _: 1 })]), _: 1 }); |
| 73 | }; |
| 74 | } }); |
| 75 | export { |
| 76 | ce as default |
| 77 | }; |
| 78 |