codesign

codesign enhance

  1. // ==UserScript==
  2. // @name codesign
  3. // @namespace npm/vite-plugin-monkey
  4. // @version 0.0.7
  5. // @author monkey
  6. // @description codesign enhance
  7. // @license MIT
  8. // @icon https://vitejs.dev/logo.svg
  9. // @match https://codesign.qq.com/app/design/*
  10. // @require https://cdn.jsdelivr.net/npm/vue@3.4.38/dist/vue.global.prod.js
  11. // @grant GM_addStyle
  12. // @grant GM_setClipboard
  13. // ==/UserScript==
  14.  
  15. (a=>{if(typeof GM_addStyle=="function"){GM_addStyle(a);return}const o=document.createElement("style");o.textContent=a,document.head.append(o)})(" .app-footer[data-v-332c42ac]{position:fixed;z-index:100;left:280px;bottom:15px;background-color:#000;color:#fff;padding:12px 12px 36px;border-radius:4px;display:flex;flex-direction:column;box-shadow:0 8px 12px #0000000a,0 0 4px #00000014}.app-footer[data-v-332c42ac]>div[data-v-332c42ac]{line-height:1.5;cursor:pointer}.app-footer[data-v-332c42ac]>div[data-v-332c42ac][data-v-332c42ac]:hover{color:#218ef6}.app-footer[data-v-332c42ac]>div[data-v-332c42ac][data-v-332c42ac]:active{color:#83b0fa} ");
  16.  
  17. (function (vue) {
  18. 'use strict';
  19.  
  20. const unoData = vue.ref([]);
  21. var _GM_addStyle = /* @__PURE__ */ (() => typeof GM_addStyle != "undefined" ? GM_addStyle : void 0)();
  22. var _GM_setClipboard = /* @__PURE__ */ (() => typeof GM_setClipboard != "undefined" ? GM_setClipboard : void 0)();
  23. function toCopy(text) {
  24. $nuxt.$message.success("copy: " + text);
  25. _GM_setClipboard(text);
  26. }
  27. const _export_sfc = (sfc, props) => {
  28. const target = sfc.__vccOpts || sfc;
  29. for (const [key, val] of props) {
  30. target[key] = val;
  31. }
  32. return target;
  33. };
  34. const _hoisted_1 = {
  35. key: 0,
  36. class: "app-footer"
  37. };
  38. const _hoisted_2 = ["onClick"];
  39. const _sfc_main = {
  40. __name: "App",
  41. setup(__props) {
  42. return (_ctx, _cache) => {
  43. return vue.openBlock(), vue.createElementBlock("div", null, [
  44. vue.unref(unoData).length ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [
  45. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(unoData), (item) => {
  46. return vue.openBlock(), vue.createElementBlock("div", {
  47. key: item,
  48. onClick: ($event) => vue.unref(toCopy)(item)
  49. }, vue.toDisplayString(item + " "), 9, _hoisted_2);
  50. }), 128))
  51. ])) : vue.createCommentVNode("", true)
  52. ]);
  53. };
  54. }
  55. };
  56. const App = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-332c42ac"]]);
  57. var q = /^(?:calc|clamp|min|max)\s*\(.*\)/, Ut = /^-?[0-9\.]+(px|rem|em|%|vw|vh|vmin|vmax|deg)$/;
  58. function V(t) {
  59. return q.test(t);
  60. }
  61. function l(t) {
  62. return t.split("-")[0];
  63. }
  64. function $(t) {
  65. let o = t.split("-");
  66. return o[o.length - 1];
  67. }
  68. function At(t) {
  69. return t.startsWith("url(");
  70. }
  71. function P(t) {
  72. return t.endsWith("%");
  73. }
  74. function R(t) {
  75. return /^#[0-9A-Fa-f]{2,}$/.test(t);
  76. }
  77. function b(t) {
  78. return t.startsWith("rgb");
  79. }
  80. function z(t) {
  81. return t.startsWith("hsl");
  82. }
  83. function a(t, o, r, n = "") {
  84. return V(t) || At(t) || R(t) || b(t) || z(t) || P(t) || I(t) ? r ? `-[${n}${Z(t, "all").replace(/['"]/g, "")}]` : `="[${n}${Z(t, "all").replace(/['"]/g, "")}]"` : n ? `-[${n}${o ? o(t) : t}]` : `-${o ? o(t) : t}`;
  85. }
  86. function w(t) {
  87. return typeof t == "string" && t.endsWith("%") ? t.slice(0, -1) : +t * 100;
  88. }
  89. function W(t) {
  90. return t.replace(/\s+/, " ").split(" ").join("-");
  91. }
  92. function j(t) {
  93. return t.replace(/\s+/, " ").split(" ").join("_");
  94. }
  95. var Mt = ["top", "right", "bottom", "left", "center"];
  96. function Z(t, o = "around") {
  97. return o === "pre" ? t.replace(/(^\s*)/g, "") : o === "post" ? t.replace(/(\s*$)/g, "") : o === "all" ? t.replace(/\s+/g, "") : o === "around" ? t.replace(/(^\s*)|(\s*$)/g, "") : t;
  98. }
  99. function e(t) {
  100. return t = t.replace(/\s+/, " ").replace(/\s*,\s*/g, ",").replace(/\s*\/\s*/, "/"), /rgb/.test(t) && (t = t.replace(/rgba?\(([^\)]+)\)/g, (o, r) => {
  101. let n = r.trim().split(" ");
  102. return o.replace(r, n.map((i, s) => i.endsWith(",") ? i : i + (n.length - 1 === s ? "" : ",")).join(""));
  103. })), /hsl/.test(t) && (t = t.replace(/hsla?\(([^\)]+)\)/g, (o, r) => {
  104. let n = r.trim().split(" ");
  105. return o.replace(r, n.map((i, s) => i.endsWith(",") ? i : i + (n.length - 1 === s ? "" : ",")).join(""));
  106. })), /var\([^\)]+\)/.test(t) && (t = t.replace(/var\(([^\)]+)\)/g, (o, r) => {
  107. let n = r.trim().split(" ");
  108. return o.replace(r, n.map((i, s) => i.endsWith(",") ? i : i + (n.length - 1 === s ? "" : ",")).join(""));
  109. })), t.endsWith("!important") ? [t.replace(/\s*\!important/, "").trim(), "!"] : [t.trim(), ""];
  110. }
  111. function J(t) {
  112. return t.replace(/\(\s*/g, "(").replace(/\s*\)/g, ")").replace(/\s*,\s*/g, ",");
  113. }
  114. function I(t) {
  115. return t.startsWith("var(--");
  116. }
  117. function Q(t) {
  118. return q.test(t) || Ut.test(t) || Mt.includes(t);
  119. }
  120. var S = /-webkit-|-moz-|-ms-|-o-/g;
  121. function C(t, o) {
  122. let [r, n] = e(o);
  123. return `${t[0]}${a(r, l)}${n}`;
  124. }
  125. var Pt = ["background-color", "background-attachment", "background-position"], Ht = /linear-gradient\(\s*to([\w\s]+),?([\w\(\)#%\s\.]+)?,([\w\(\)#%\s\.]+)?,?([\w#%\s\.]+)?\)$/, Bt = /linear-gradient\(\s*([^,]*),?([\w\(\)#%\s\.]+)?,([\w\(\)#%\s\.]+)?,?([\w#%\s\.]+)?\)$/, Et = /(radial|conic)-gradient\(([\w\(\)#%\s\.]+)?,([\w\(\)#%\s\.]+)?,?([\w#%\s\.]+)?\)$/, _ = "__comma__";
  126. function B(t, o) {
  127. let [r, n] = e(o);
  128. if (t === "background-size") return `bg${a(r, N, false, "length:")}${n}`;
  129. if (Pt.includes(t)) return `bg${a(r, N)}${n}`;
  130. if (["background", "background-image"].includes(t)) {
  131. if (Q(r)) return `bg${a(r, N, false, "position:")}${n}`;
  132. let i = r.replace(/rgba?\([^)]+\)/g, "temp");
  133. if (/\)\s*,/.test(i)) return `bg="[${Dt(r)}]"`;
  134. if (/^(linear)-gradient/.test(r)) {
  135. let m = r.replace(/rgba?\(([^)]+)\)/g, (f, c) => f.replace(c, c.replace(/\s*,\s*/g, _))), g = m.match(Ht);
  136. if (g) {
  137. let [f, c, d, L] = g.slice(1);
  138. return f = f.split(" ").map((F) => F[0]).join(""), f ? `bg-gradient-to-${f}${H(c, d, L)}` : H(c, d, L);
  139. }
  140. let u = m.match(Bt);
  141. return u ? `bg-gradient-linear bg-gradient-[${u[1]},${u[2].replace(/\s+/, "_").replaceAll(_, ",")},${u[3].replace(/\s+/, "_").replaceAll(_, ",")}]` : void 0;
  142. } else if (/^(radial|conic)-gradient/.test(r)) {
  143. let g = r.replace(/rgba?\(([^)]+)\)/g, (L, F) => L.replace(F, F.replace(/\s*,\s*/g, _))).match(Et);
  144. if (!g) return;
  145. let u = g[1], [f, c, d] = g.slice(2);
  146. return `bg-gradient-${u}${H(f, c, d)}`;
  147. }
  148. let s = r.match(/^rgba?\([^)]+\)$/);
  149. if (s) {
  150. let m = s[0];
  151. return `bg="${r.replace(m, `[${m}]`)}${n}"`;
  152. }
  153. let p = r.match(/^url\(["'\s\.\-_\w\/@]*\)$/);
  154. if (p) return `bg="${r.replace(p[0], `[${p[0].replace(/['"]/g, "")}]${n}`)}"`;
  155. if (r.includes(" ")) {
  156. let m = r.split(" ").map((f) => B(t, `${f}${n ? " !important" : ""}`)).join(" "), g = /bg-\[position:([^\]]*)\]/g, u = m.match(g);
  157. if (u && u.length > 1) {
  158. let f = `bg-[position:${u.map((c) => c.replace(g, "$1")).join("_")}]`;
  159. m = `${m.replace(g, "").replace(/\s+/g, " ").split(" ").filter(Boolean).concat([f]).join(" ")}`;
  160. }
  161. return m;
  162. }
  163. return `bg${a(r, N)}${n}`;
  164. }
  165. return t === "background-blend-mode" ? `bg-blend-${r}${n}` : `${Gt(t, r)}-${Ot(r)}${n}`;
  166. }
  167. function Gt(t, o) {
  168. return o.endsWith("repeat") ? "bg" : t.replace("background", "bg");
  169. }
  170. function Ot(t) {
  171. return /(border)|(content)|(padding)-box/.test(t) ? t.replace("-box", "") : t.startsWith("repeat-") ? t.replace("repeat-", "") : N(t);
  172. }
  173. function N(t) {
  174. return t.replace(/\s+/, " ").replace(" ", "-");
  175. }
  176. function H(t, o, r) {
  177. let n = "";
  178. if (o && !r && (r = o, o = ""), t) {
  179. t = t.replaceAll(_, ",");
  180. let [i, s] = t.split(" ");
  181. s ? n += ` from="${b(i) ? `[${i}]` : i} ${s}"` : i && (n += ` from="${b(i) ? `[${i}]` : i}"`);
  182. }
  183. if (o) {
  184. o = o.replaceAll(_, ",");
  185. let [i, s] = o.split(" ");
  186. s ? n += ` via="${b(i) ? `[${i}]` : i} ${s}"` : i && (n += ` via="${b(i) ? `[${i}]` : i}"`);
  187. }
  188. if (r) {
  189. r = r.replaceAll(_, ",");
  190. let [i, s] = r.split(" ");
  191. s ? n += ` to="${b(i) ? `[${i}]` : i} ${s}"` : i && (n += ` to="${b(i) ? `[${i}]` : i}"`);
  192. }
  193. return n;
  194. }
  195. var X = "__transform_to_unocss__";
  196. function Dt(t) {
  197. let o = {}, r = 0;
  198. return t = t.replace(/(rgba?|hsla?|lab|lch|hwb|color)\([\)]*\)/, (n) => (o[r++] = n, `${X}${r}}`)), t = t.split(/\)\s*,/).map((n) => `${n.replace(/\s*,\s*/g, ",").replace(/\s+/g, "_")}`).join("),"), Object.keys(o).forEach((n) => {
  199. t = t.replace(`${X}${n}}`, o[n]);
  200. }), t;
  201. }
  202. function E(t, o) {
  203. let [r, n] = e(o), i = t.split("-"), s = V(r) || I(r) ? a(r) : a(l(r));
  204. return `${i[0]}-${i[1][0]}${s}${n}`;
  205. }
  206. function Y(t, o) {
  207. let [r, n] = e(o);
  208. if (t === "font-size") return `text-${r}${n}`;
  209. if (t === "font-weight") return `font-${r}${n}`;
  210. if (t === "font-family") {
  211. let i = r.match(/ui-(\w{0,4})/);
  212. if (!i) return `font-${o}${n}`;
  213. let [s, p] = i;
  214. return `font-${p}${n}`;
  215. }
  216. return t === "font-style" ? r === "normal" ? `font-not-italic${n}` : `font-${r}${n}` : t === "font-variant-numeric" ? r === "normal" ? `normal-nums${n}` : `${r}${n}` : `font="${Kt(r)}${n}"`;
  217. }
  218. function Kt(t) {
  219. return t.split(" ").map((o) => /^[0-9]/.test(o) ? `text-${o}` : o).join(" ");
  220. }
  221. function y(t, o) {
  222. let [r, n] = e(o);
  223. return `${t}${a(r)}${n}`;
  224. }
  225. var Zt = { "margin-left": "ml", "margin-right": "mr", "margin-top": "mt", "margin-bottom": "mb", "margin-inline-start": "ms", "margin-inline-end": "me", "padding-left": "pl", "padding-right": "pr", "padding-top": "pt", "padding-bottom": "pb", "padding-inline-start": "ps", "padding-inline-end": "pe" };
  226. function G(t, o) {
  227. let [r, n] = e(o), i = Zt[t];
  228. if (i) return `${i}${a(r)}${n}`;
  229. let s = r.split(" "), p = s.length;
  230. return p === 1 ? `${t[0]}${a(s[0])}${n}` : p === 2 ? `${t[0]}x${a(s[1])}${n} ${t[0]}y${a(s[0])}${n}` : p === 3 ? `${t[0]}x${a(s[1])}${n} ${t[0]}t${a(s[0])}${n} ${t[0]}b${a(s[2])}${n}` : `${t[0]}t${a(s[0])}${n} ${t[0]}b${a(s[2])}${n} ${t[0]}l${a(s[3])}${n} ${t[0]}r${a(s[1])}${n}`;
  231. }
  232. function k(t, o) {
  233. let [r, n] = e(o);
  234. return P(o) ? `op-${r.replace("%", "")}${n}` : `op-${+r * 100}${n}`;
  235. }
  236. function tt(t, o) {
  237. let [r, n] = e(o);
  238. return `text${a(r)}${n}`;
  239. }
  240. function rt(t, o) {
  241. let [r, n] = e(o);
  242. return t === "text-decoration-line" ? r === "none" ? `no-underline${n}` : `${r}${n}` : t === "text-transform" ? r === "none" ? `normal-case${n}` : `${r}${n}` : t.startsWith("text-decoration") || t === "text-indent" ? `${t.split("-")[1]}${a(r)}${n}` : t === "text-underline-offset" ? `underline-offset-${r}${n}` : `text-${r}${n}`;
  243. }
  244. function nt(t, o) {
  245. let [r, n] = e(o);
  246. return `v-${r}${n}`;
  247. }
  248. var ot = { 1: "none", 1.25: "tight", 1.375: "snug", 1.5: "normal", 1.625: "relaxed", 2: "loose" };
  249. function et(t, o) {
  250. let [r, n] = e(o);
  251. return r in ot ? `lh-${ot[r]}${n}` : `lh${a(r)}${n}`;
  252. }
  253. var it = ["border-top", "border-right", "border-bottom", "border-left"];
  254. function st(t, o) {
  255. let [r, n] = e(o);
  256. if (t === "border-spacing") return `${t}="[${j(r)}]${n}"`;
  257. if (t === "border-color") {
  258. if (r.includes(" ")) {
  259. let i = r.split(" ").length, s = r.split(" ").map((f) => R(f) || b(f) || z(f) ? `-[${f}]` : `-${f}`), [p, m, g, u] = s;
  260. switch (i) {
  261. case 2:
  262. return `border-y${p}${n} border-x${m}${n}`;
  263. case 3:
  264. return `border-t${p}${n} border-b${g}${n} border-x${m}${n}`;
  265. case 4:
  266. return `border-t${p}${n} border-b${g}${n} border-r${m}${n} border-l${u}${n}`;
  267. }
  268. }
  269. return `border${a(r)}${n}`;
  270. }
  271. return t === "border-radius" ? V(r) || !r.includes(" ") ? `border-rd${a(r)}${n}` : `border-rd="[${j(r)}]${n}"` : it.some((i) => t.startsWith(i)) ? r.split(" ").map((i) => `border-${t.split("-")[1][0]}${a(i)}${n}`).join(" ") : t === "border-inline-end-width" ? `border-e${a(r)}${n}` : t === "border-inline-start-width" ? `border-s${a(r)}${n}` : t.startsWith("border-image") ? "" : t === "border-width" && r.includes(" ") ? r.split(" ").map((i, s) => `border-${it[s].split("-")[1][0]}${a(i)}${n}`).join(" ") : /^\d[%|(px)|(rem)]$/.test(r) || t === "border-collapse" ? `border-${r}${n}` : t === "border-width" || t === "border-style" ? `border${a(r)}${n}` : t === "border-color" ? r === "currentColor" ? `border-current${n}` : `border${a(r)}${n}` : r.split(" ").map((i) => r === "currentColor" ? `border-current${n}` : `border${a(i)}${n}`).join(" ");
  272. }
  273. function T(t, o) {
  274. let [r, n] = e(o);
  275. return r === "none" ? `hidden${n}` : r === "hidden" ? `invisible${n}` : `${r}${n}`;
  276. }
  277. function x(t, o) {
  278. let [r, n] = e(o);
  279. return `${t}-${r}${n}`;
  280. }
  281. function v(t, o) {
  282. let [r, n] = e(o);
  283. return `${t}${a(r)}${n}`;
  284. }
  285. function h(t, o) {
  286. let [r, n] = e(o);
  287. return `${l(t)}${a(r)}${n}`;
  288. }
  289. var qt = ["box-shadow", "drop-shadow"];
  290. function U(t, o) {
  291. let [r, n] = e(o);
  292. if (t.startsWith("box-decoration")) return `box-decoration-${r}${n}`;
  293. if (t === "box-sizing") return `box-${l(r)}${n}`;
  294. if (qt.includes(t)) return `shadow="[${r.split(" ").join("_")}]${n}"`;
  295. }
  296. var Jt = ["contrast", "brightness", "saturate"], Qt = ["grayscale", "invert", "sepia"];
  297. function A(t, o) {
  298. let [r, n] = e(o), [i, s, p] = r.match(/([\w-]+)\((.*)\)/);
  299. return Jt.includes(s) ? `${s}-${w(p)}${n}` : s === "drop-shadow" ? `drop-${U(s, p)}${n}` : Qt.includes(s) ? `${s}-${p.endsWith("%") ? p.slice(0, -1) : w(p)}${n}` : s === "hue-rotate" ? `${s}-${p.slice(0, -3)}${n}` : `${s}-${p}${n}`;
  300. }
  301. function at(t, o) {
  302. let [r, n] = e(o);
  303. return `backdrop-${A(t, r)}${n}`;
  304. }
  305. function mt(t, o) {
  306. let [r, n] = e(o);
  307. return t === "transform-origin" ? `origin-${W(r)}${n}` : t === "transform-style" ? `transform-${r}` : J(r).split(" ").map((i) => {
  308. let s = i.match(/([a-z]+)(3d)?([A-Z])?\((.*)\)/);
  309. if (!s) return;
  310. let [p, m, g, u, f] = s;
  311. if (u) {
  312. let c = f.replace(/,(?![^()]*\))/g, " ").split(" ");
  313. return c.length > 1 ? `${m}-${u.toLowerCase()}="${c.map((d) => I(d) ? `[${d}]` : m === "scale" ? w(d) : M(d)).join(" ")}${n}"` : `${m}="${u.toLowerCase()}-${I(c[0]) ? `[${c[0]}]` : m === "scale" ? w(c[0]) : M(c[0])}${n}"`;
  314. } else {
  315. let c = f.replace(/,(?![^()]*\))/g, " ").split(" ");
  316. return c.length > 1 ? m === "translate" ? `${m}="[${c.join(",")}]"` : `${m}="${c.map((d) => I(d) ? `[${d}]` : m === "scale" ? w(d) : M(d)).join(" ")}${n}"` : `${m}="${I(c[0]) ? `[${c[0]}]` : m === "scale" ? w(c[0]) : M(c[0])}${n}"`;
  317. }
  318. }).filter(Boolean).join(" ");
  319. }
  320. function M(t) {
  321. return t.endsWith("deg") ? t.slice(0, -3) : t;
  322. }
  323. var Xt = ["transition-delay", "transition-duration"];
  324. function pt(t, o) {
  325. let [r, n] = e(o);
  326. if (t === "transition-timing-function") return r === "linear" ? `ease-${r}${n}` : `ease="[${r}]${n}"`;
  327. if (t === "transition") return `transition="${Yt(r)}"`;
  328. if (t === "transition-property") return r.includes("color") ? `transition-color${n}` : r === "box-shadow" ? `transition-shadow${n}` : `transition-${r}${n}`;
  329. if (Xt.includes(t)) return `${t.split("-")[1]}-${r.slice(0, -2)}`;
  330. }
  331. function Yt(t) {
  332. let o = false;
  333. return t.split(" ").map((r) => /^[0-9]/.test(r) || /^\.[0-9]/.test(r) ? o ? `delay${a(r, void 0, true)}` : (o = true, `duration${a(r, void 0, true)}`) : r === "background-color" ? "colors" : r).join(" ");
  334. }
  335. function ct(t, o) {
  336. let [r, n] = e(o);
  337. return t === "justify-content" ? `justify-${$(r)}${n}` : `${t}-${$(r)}${n}`;
  338. }
  339. function ft(t, o) {
  340. let [r, n] = e(o);
  341. return `${$(t)}-${$(r)}${n}`;
  342. }
  343. var yt = ["flex-basis", "flex-grow", "flex-shrink"];
  344. function lt(t, o) {
  345. let [r, n] = e(o);
  346. if (yt.includes(t)) return `${$(t)}-${r}${n}`;
  347. if (r === "1") return `flex-1${n}`;
  348. let i = r[0];
  349. return t === "flex" && (i === "0" || i === "1") ? `flex="[${j(r)}]${n}"` : `${l(t)}-${r.replace("column", "col")}${n}`;
  350. }
  351. function ut(t, o) {
  352. let [r, n] = e(o);
  353. return r === "auto" ? `${l(t)}-${r}` : `${l(t)}="[${r}]${n}"`;
  354. }
  355. function $t(t, o) {
  356. let [r, n] = e(o);
  357. return t === "column-gap" ? `gap-x-${r}${n}` : `${t}-${r}${n}`;
  358. }
  359. function gt(t, o) {
  360. let [r, n] = e(o);
  361. return o === "isolate" ? `${r}${n}` : `${t}-${r}${n}`;
  362. }
  363. function dt(t, o) {
  364. let [r, n] = e(o);
  365. return t === "object-position" ? `${l(t)}-${W(r)}${n}` : `${l(t)}-${r}${n}`;
  366. }
  367. function bt(t, o) {
  368. let [r, n] = e(o), [i, s, p] = t.split("-");
  369. return p ? `${i}-${p}-${r}${n}` : `${i}-${r}${n}`;
  370. }
  371. function xt(t, o) {
  372. let [r, n] = e(o);
  373. if (t.startsWith("grid-template")) {
  374. let s = r.match(/repeat\s*\(\s*([0-9]+)/);
  375. return s ? `grid-${$(t) === "rows" ? "rows" : "cols"}-${s[1]}${n}` : `grid-${$(t) === "rows" ? "rows" : "cols"}-${r.includes(" ") ? `[${j(r)}]` : r}${n}`;
  376. }
  377. if (t === "grid-auto-flow") return `grid-flow-${W(r).replace("column", "col")}${n}`;
  378. if (t.startsWith("grid-auto")) {
  379. let s = r.match(/minmax\s*\(\s*0\s*,\s*1fr/);
  380. return `auto-${$(t) === "rows" ? "rows" : "cols"}-${s ? "fr" : l(r)}${n}`;
  381. }
  382. let i = r.match(/span\s+([0-9])/);
  383. return i ? `${t.slice(5).replace("column", "col")}-span-${i[1]}${n}` : r === "1/-1" ? `${t.slice(5).replace("column", "col")}-span-full${n}` : `${t.slice(5).replace("column", "col")}-${r}${n}`;
  384. }
  385. function ht(t, o) {
  386. let [r, n] = e(o);
  387. return `gap-y-${r}${n}`;
  388. }
  389. function wt(t, o) {
  390. let [r, n] = e(o);
  391. return `${t}-${$(r)}${n}`;
  392. }
  393. function It(t, o) {
  394. let [r, n] = e(o);
  395. return `tracking-${r}${n}`;
  396. }
  397. function jt(t, o) {
  398. let [r, n] = e(o);
  399. return `whitespace-${r}${n}`;
  400. }
  401. function _t(t, o) {
  402. let [r, n] = e(o);
  403. return t.startsWith("word-spacing") ? `word-spacing${a(o)}` : r === "keep-all" ? `break-keep${n}` : `break-${$(r)}${n}`;
  404. }
  405. function Wt(t, o) {
  406. let [r, n] = e(o);
  407. return t === "outline-offset" ? `${t}-${r}${n}` : `${l(t)}-${r}${n}`;
  408. }
  409. function vt(t, o) {
  410. let [r, n] = e(o);
  411. return `mix-blend-${r}${n}`;
  412. }
  413. var kt = { vertical: "y", horizontal: "x" };
  414. function Vt(t, o) {
  415. let [r, n] = e(o);
  416. return r === "both" ? `${t}${n}` : `${t}-${kt[r] || r}${n}`;
  417. }
  418. function Nt(t, o) {
  419. let [r, n] = e(o);
  420. if (t.startsWith("scroll-snap")) return `snap-${r}${n}`;
  421. if (t === "scroll-behavior") return `scroll-${r}${n}`;
  422. let [i, s, p, m] = t.match(/scroll-(margin|padding)-?([\w]+)?-?([\w]+)?/);
  423. return p === "inline" && m ? `scroll-${s[0]}${m[0]}-${r}${n}` : p ? `scroll-${s[0]}${p[0]}-${r}${n}` : `scroll-${s[0]}-${r}${n}`;
  424. }
  425. function Lt(t, o) {
  426. let [r, n] = e(o);
  427. return `${$(t)}-${r}${n}`;
  428. }
  429. function Ft(t, o) {
  430. let [r, n] = e(o);
  431. return `${t}-${l(r)}${n}`;
  432. }
  433. function Rt(t, o) {
  434. let [r, n] = e(o);
  435. return t === "animation-delay" ? `animate${a(r)}${n}` : t === "animation" ? `animate-${r.split(" ")[0]}${n}` : `animate-${r}${n}`;
  436. }
  437. function zt(t, o) {
  438. let [r, n] = e(o);
  439. return r === '" "' || r === "' '" ? `content-['_']${n}` : `content-[${r.replace(/"/g, "'")}]${n}`;
  440. }
  441. var tr = { show: "visible", hide: "hidden" };
  442. function St(t, o) {
  443. var i;
  444. let [r, n] = e(o);
  445. return `table-empty-cells-${(i = tr[r]) != null ? i : r}${n}`;
  446. }
  447. function Ct(t, o) {
  448. return o === "horizontal-tb" ? "write-normal" : `write-${o.replace("-rl", "-right").replace("-lr", "-left")}`;
  449. }
  450. function Tt(t, o) {
  451. let [r, n] = e(o);
  452. if (t === "inset-inline-start") return `start${a(r)}${n}`;
  453. if (t === "inset-inline-end") return `end${a(r)}${n}`;
  454. }
  455. var O = { animation: Rt, aspect: ut, backface: h, caption: h, column: $t, columns: x, break: x, empty: St, box: U, writing: Ct, display: T, float: x, clear: x, isolation: gt, object: dt, overflow: x, overscroll: bt, position: T, top: v, left: v, right: v, bottom: v, visibility: T, z: C, flex: lt, order: x, grid: xt, gap: v, justify: ct, align: ft, place: wt, padding: G, perspective: x, margin: G, width: C, min: E, max: E, height: C, font: Y, letter: It, line: et, list: h, text: rt, vertical: nt, white: jt, word: _t, content: zt, background: B, border: st, outline: Wt, opacity: k, mix: vt, filter: A, backdrop: at, table: h, transition: pt, transform: mt, accent: h, appearance: h, cursor: y, caret: h, pointer: x, resize: Vt, scroll: Nt, inset: Tt, touch: h, user: Lt, will: Ft, fill: x, stroke: h, color: tt, row: ht }, rr = /([\w-]+)\s*:\s*([.\w\(\)-\s%+'",#\/!@]+)/;
  456. function D(t, o = false) {
  457. var g;
  458. t = t.replace(S, "");
  459. let r = t.match(rr);
  460. if (!r) return;
  461. let [n, i, s] = r, p = l(i), m = (g = O[p]) == null ? void 0 : g.call(O, i, s);
  462. return m && o ? m.replace(/-([0-9\.]+)px/, (u, f) => `-${+f / 4}`).replace(/\[[^\]]+\]/g, (u) => u.replace(/([0-9\.]+)px/g, (f, c) => `${+c / 16}rem`)) : m;
  463. }
  464. function K(t, o) {
  465. let r = [], n = /* @__PURE__ */ new Set();
  466. return [t.split(";").filter(Boolean).reduce((i, s) => {
  467. let p = s.replaceAll(S, "").trim();
  468. if (n.has(p)) return i;
  469. n.add(p);
  470. let m = D(s, o) || "";
  471. return m || r.push(s), i += `${m} `;
  472. }, "").trim().replace(/\s+/g, " "), r];
  473. }
  474. function nr(t, o = false) {
  475. let [r, n] = K(t, o);
  476. return [r ? r.replace(/([^\s\=]+)="([^"]+)"/g, (i, s, p) => p.split(" ").map((m) => `${s}-${m}`).join(" ")) : "", n];
  477. }
  478. vue.createApp(App).mount(
  479. (() => {
  480. const app = document.createElement("div");
  481. document.body.append(app);
  482. return app;
  483. })()
  484. );
  485. _GM_addStyle(`
  486. [data-label=段落对齐],[data-label=垂直对齐]{
  487. display:none !important;
  488. }
  489. `);
  490. document.addEventListener("keydown", function(event) {
  491. var _a, _b, _c;
  492. if (event.ctrlKey && event.key === "c") {
  493. const selection = window.getSelection().toString();
  494. const content = (_c = (_b = (_a = document.querySelector(".screen-inspect")) == null ? void 0 : _a.__vue__) == null ? void 0 : _b.selectedLayer) == null ? void 0 : _c.content;
  495. if (!selection && content) {
  496. toCopy(content);
  497. }
  498. }
  499. });
  500. document.addEventListener("click", function() {
  501. var _a, _b;
  502. const layer = (_b = (_a = document.querySelector(".screen-inspect")) == null ? void 0 : _a.__vue__) == null ? void 0 : _b.selectedLayer;
  503. if (layer) {
  504. unoData.value = layer.css.filter(
  505. (item) => !["text-align:", "font-weight:", "font-family:"].some(
  506. (text) => item.includes(text)
  507. )
  508. ).map(
  509. (item) => nr(item, judgeIsRem(item))[0].replace(
  510. "border-rd",
  511. "rounded"
  512. )
  513. );
  514. } else {
  515. unoData.value = [];
  516. }
  517. });
  518. function judgeIsRem(css) {
  519. var _a, _b;
  520. if (["font-size", "box-shadow"].some((item) => css.includes(item))) {
  521. return false;
  522. }
  523. if (((_a = css.match(/px/g)) == null ? void 0 : _a.length) > 1) {
  524. return false;
  525. }
  526. const pxSize = (_b = css.match(/(\d+)px/)) == null ? void 0 : _b[1];
  527. if (pxSize && pxSize % 4 === 0) {
  528. return true;
  529. }
  530. }
  531.  
  532. })(Vue);

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址