@opendesign-plus-test/plugins 0.0.1-rc.26 → 0.0.1-rc.27

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/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { i as B, o as K, v as O } from "./plugin-lvjNLBe-.js";
2
- const g = {}, L = `
1
+ import { i as K, o as z, v as O } from "./plugin-lvjNLBe-.js";
2
+ const p = {}, L = `
3
3
  (function () {
4
4
  function getCookie(key) {
5
5
  const name = encodeURIComponent(key) + '=';
@@ -25,18 +25,18 @@ const g = {}, L = `
25
25
  }
26
26
  })();
27
27
  `.trim();
28
- function R(e) {
28
+ function I(e) {
29
29
  const {
30
30
  cookieKey: n,
31
31
  lightValue: t = "light",
32
32
  darkValue: r = "dark",
33
33
  attribute: a = "data-o-theme",
34
- attributeLightValue: s = t,
35
- attributeDarkValue: c = r,
36
- classLightValue: w = t,
37
- classDarkValue: p = r,
38
- filename: l = "check-theme.js"
39
- } = e, f = L.replace(/\$COOKIE_KEY/g, n).replace(/\$LIGHT_VALUE/g, t).replace(/\$DARK_VALUE/g, r).replace(/\$CLASS_LIGHT_VALUE/g, w).replace(/\$CLASS_DARK_VALUE/g, p).replace(/\$ATTRIBUTE_NAME/g, a).replace(/\$ATTRIBUTE_LIGHT_VALUE/g, s).replace(/\$ATTRIBUTE_DARK_VALUE/g, c);
34
+ attributeLightValue: c = t,
35
+ attributeDarkValue: l = r,
36
+ classLightValue: x = t,
37
+ classDarkValue: f = r,
38
+ filename: s = "check-theme.js"
39
+ } = e, g = L.replace(/\$COOKIE_KEY/g, n).replace(/\$LIGHT_VALUE/g, t).replace(/\$DARK_VALUE/g, r).replace(/\$CLASS_LIGHT_VALUE/g, x).replace(/\$CLASS_DARK_VALUE/g, f).replace(/\$ATTRIBUTE_NAME/g, a).replace(/\$ATTRIBUTE_LIGHT_VALUE/g, c).replace(/\$ATTRIBUTE_DARK_VALUE/g, l);
40
40
  let d = "", h = !1, u = "", m = !1;
41
41
  return {
42
42
  name: "vite-check-theme-plugin",
@@ -44,27 +44,27 @@ function R(e) {
44
44
  configResolved(o) {
45
45
  if (d = o.base, h = o.command === "serve", u = o.build.outDir, m = !!o.vitepress, !m || !Array.isArray(o.vitepress.site.head))
46
46
  return;
47
- const k = o.vitepress.site.head.find((x) => {
47
+ const k = o.vitepress.site.head.find((w) => {
48
48
  var y, E;
49
- return x[0] === "script" && ((E = (y = x[1]) == null ? void 0 : y.src) == null ? void 0 : E.startsWith(`${d}${l}`));
49
+ return w[0] === "script" && ((E = (y = w[1]) == null ? void 0 : y.src) == null ? void 0 : E.startsWith(`${d}${s}`));
50
50
  });
51
- k ? k[1].src = `${d}${l}?t=${(/* @__PURE__ */ new Date()).getTime()}` : o.vitepress.site.head.push([
51
+ k ? k[1].src = `${d}${s}?t=${(/* @__PURE__ */ new Date()).getTime()}` : o.vitepress.site.head.push([
52
52
  "script",
53
53
  {
54
- src: `${d}${l}?t=${(/* @__PURE__ */ new Date()).getTime()}`
54
+ src: `${d}${s}?t=${(/* @__PURE__ */ new Date()).getTime()}`
55
55
  }
56
56
  ]);
57
57
  },
58
58
  generateBundle() {
59
- h || g.existsSync(g.join(u, l)) || (g.existsSync(u) || g.mkdirSync(u, { recursive: !0 }), g.writeFileSync(g.join(u, l), f, "utf-8"));
59
+ h || p.existsSync(p.join(u, s)) || (p.existsSync(u) || p.mkdirSync(u, { recursive: !0 }), p.writeFileSync(p.join(u, s), g, "utf-8"));
60
60
  },
61
61
  configureServer(o) {
62
- o.middlewares.use(`${d}${l}`, (k, x) => {
63
- x.setHeader("Content-Type", "application/javascript"), x.end(f);
62
+ o.middlewares.use(`${d}${s}`, (k, w) => {
63
+ w.setHeader("Content-Type", "application/javascript"), w.end(g);
64
64
  });
65
65
  },
66
66
  transformIndexHtml(o) {
67
- return m ? o : o.replace("</head>", `<script src="${d}${l}?t=${(/* @__PURE__ */ new Date()).getTime()}"><\/script></head>`);
67
+ return m ? o : o.replace("</head>", `<script src="${d}${s}?t=${(/* @__PURE__ */ new Date()).getTime()}"><\/script></head>`);
68
68
  }
69
69
  };
70
70
  }
@@ -125,14 +125,14 @@ function C(e, n, t) {
125
125
  </div>
126
126
  </div>
127
127
  `, document.body.appendChild(i));
128
- const s = i.querySelector(".elg-title"), c = i.querySelector(".elg-message"), w = i.querySelector(".elg-url"), p = i.querySelector(".elg-cancel"), l = i.querySelector(".elg-confirm");
129
- s.textContent = r.title, c.textContent = r.message(t), w.textContent = n, i.style.display = "flex";
130
- const f = (m) => {
131
- i && (i.style.display = "none", i.removeEventListener("click", u), p.removeEventListener("click", d), l.removeEventListener("click", h), v = !1, a(m));
132
- }, d = () => f(!1), h = () => f(!0), u = (m) => {
133
- m.target === i && f(!1);
128
+ const c = i.querySelector(".elg-title"), l = i.querySelector(".elg-message"), x = i.querySelector(".elg-url"), f = i.querySelector(".elg-cancel"), s = i.querySelector(".elg-confirm");
129
+ c.textContent = r.title, l.textContent = r.message(t), x.textContent = n, f.textContent = r.cancel, s.textContent = r.confirm, i.style.display = "flex";
130
+ const g = (m) => {
131
+ i && (i.style.display = "none", i.removeEventListener("click", u), f.removeEventListener("click", d), s.removeEventListener("click", h), v = !1, a(m));
132
+ }, d = () => g(!1), h = () => g(!0), u = (m) => {
133
+ m.target === i && g(!1);
134
134
  };
135
- i.addEventListener("click", u), p.addEventListener("click", d), l.addEventListener("click", h);
135
+ i.addEventListener("click", u), f.addEventListener("click", d), s.addEventListener("click", h);
136
136
  });
137
137
  }
138
138
  function _() {
@@ -253,15 +253,18 @@ function _() {
253
253
  }
254
254
  `, document.head.appendChild(e);
255
255
  }
256
+ function U() {
257
+ return typeof window > "u" ? "zh" : /\/en(\/|$)/.test(window.location.pathname) ? "en" : "zh";
258
+ }
256
259
  async function $(e, n) {
257
260
  if (n.showCustomConfirm)
258
- return C(n.lang || "zh", e, n.community || "");
261
+ return C(n.lang ?? U(), e, n.community || "");
259
262
  const t = n.message ?? `即将离开本站,前往第三方网站:
260
263
 
261
264
  ${e}`;
262
265
  return Promise.resolve(window.confirm(t));
263
266
  }
264
- function U(e) {
267
+ function S(e) {
265
268
  const n = window.open;
266
269
  document.addEventListener(
267
270
  "click",
@@ -272,42 +275,42 @@ function U(e) {
272
275
  const a = r.closest("a[href]");
273
276
  if (!a)
274
277
  return;
275
- const s = a.getAttribute("href");
276
- if (!s || s.startsWith("#") || !b(s))
278
+ const c = a.getAttribute("href");
279
+ if (!c || c.startsWith("#") || !b(c))
277
280
  return;
278
- const c = new URL(s, window.location.href);
279
- if (A(c.hostname, e.whitelist))
281
+ const l = new URL(c, window.location.href);
282
+ if (A(l.hostname, e.whitelist))
280
283
  return;
281
- t.preventDefault(), await $(c.href, e) && ((a.getAttribute("target") || "_self") === "_blank" ? n.call(window, c.href, "_blank", "noopener,noreferrer") : window.location.href = c.href);
284
+ t.preventDefault(), await $(l.href, e) && ((a.getAttribute("target") || "_self") === "_blank" ? n.call(window, l.href, "_blank", "noopener,noreferrer") : window.location.href = l.href);
282
285
  },
283
286
  !0
284
287
  );
285
288
  }
286
- function S(e) {
289
+ function R(e) {
287
290
  const n = window.open;
288
291
  window.open = async function(t, ...r) {
289
292
  if (t) {
290
293
  const a = t.toString();
291
294
  if (b(a)) {
292
- const s = new URL(a, window.location.href);
293
- if (!A(s.hostname, e.whitelist) && !await $(s.href, e))
295
+ const c = new URL(a, window.location.href);
296
+ if (!A(c.hostname, e.whitelist) && !await $(c.href, e))
294
297
  return null;
295
298
  }
296
299
  }
297
300
  return n.call(window, t, ...r);
298
301
  };
299
302
  }
300
- function I(e = {}) {
303
+ function V(e = {}) {
301
304
  return {
302
305
  install() {
303
- typeof window > "u" || typeof document > "u" || (U(e), S(e));
306
+ typeof window > "u" || typeof document > "u" || (S(e), R(e));
304
307
  }
305
308
  };
306
309
  }
307
310
  export {
308
- R as CheckThemePlugin,
309
- I as createExternalLinkGuard,
310
- B as initOpenDesignAnalytics,
311
- K as oaReport,
311
+ I as CheckThemePlugin,
312
+ V as createExternalLinkGuard,
313
+ K as initOpenDesignAnalytics,
314
+ z as oaReport,
312
315
  O as vAnalytics
313
316
  };
@@ -6,7 +6,7 @@ export interface PageInfo {
6
6
  }
7
7
  export interface LastModifiedPluginOptions {
8
8
  modifyDepMap?: (map: Map<string, Set<string>>) => (Map<string, Set<string>> | void) | Promise<Map<string, Set<string>> | void>;
9
- pageEntryPattern: string | RegExp;
9
+ pageEntryPattern: string | RegExp | (string | RegExp)[];
10
10
  /** Path to the git repository root. */
11
11
  rootDir?: string;
12
12
  /** Absolute path for the output JSON file.
@@ -19,4 +19,4 @@ export interface LastModifiedPluginOptions {
19
19
  /** Glob patterns (relative to appDir) to exclude dependency files from traversal and timestamp calculation. */
20
20
  ignoreDeps?: string | string[];
21
21
  }
22
- export declare function generateLastmodAndChangefreq(options: LastModifiedPluginOptions): Plugin;
22
+ export default function generateLastmodAndChangefreq(options: LastModifiedPluginOptions): Plugin;