@opendesign-plus-test/plugins 0.0.1-rc.7 → 0.0.1-rc.8

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.
Files changed (2) hide show
  1. package/dist/index.js +44 -43
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { i as B, o as K, v as z } from "./plugin-lvjNLBe-.js";
2
- const g = {}, L = `
1
+ import { i as B, o as K, 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) + '=';
@@ -30,41 +30,41 @@ function R(e) {
30
30
  cookieKey: n,
31
31
  lightValue: t = "light",
32
32
  darkValue: r = "dark",
33
- attribute: o = "data-o-theme",
33
+ attribute: a = "data-o-theme",
34
34
  attributeLightValue: s = t,
35
- attributeDarkValue: p = r,
36
- classLightValue: x = t,
37
- classDarkValue: k = r,
35
+ attributeDarkValue: c = r,
36
+ classLightValue: w = t,
37
+ classDarkValue: f = r,
38
38
  filename: l = "check-theme.js"
39
- } = e, m = 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, k).replace(/\$ATTRIBUTE_NAME/g, o).replace(/\$ATTRIBUTE_LIGHT_VALUE/g, s).replace(/\$ATTRIBUTE_DARK_VALUE/g, p);
40
- let c = "", f = !1, d = "", u = !1;
39
+ } = e, g = 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, f).replace(/\$ATTRIBUTE_NAME/g, a).replace(/\$ATTRIBUTE_LIGHT_VALUE/g, s).replace(/\$ATTRIBUTE_DARK_VALUE/g, c);
40
+ let d = "", h = !1, u = "", m = !1;
41
41
  return {
42
42
  name: "vite-check-theme-plugin",
43
43
  enforce: "pre",
44
- configResolved(a) {
45
- if (c = a.base, f = a.command === "serve", d = a.build.outDir, u = !!a.vitepress, !u || !Array.isArray(a.vitepress.site.head))
44
+ configResolved(o) {
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 w = a.vitepress.site.head.find((h) => {
47
+ const k = o.vitepress.site.head.find((x) => {
48
48
  var y, E;
49
- return h[0] === "script" && ((E = (y = h[1]) == null ? void 0 : y.src) == null ? void 0 : E.startsWith(`${c}${l}`));
49
+ return x[0] === "script" && ((E = (y = x[1]) == null ? void 0 : y.src) == null ? void 0 : E.startsWith(`${d}${l}`));
50
50
  });
51
- w ? w[1].src = `${c}${l}?t=${(/* @__PURE__ */ new Date()).getTime()}` : a.vitepress.site.head.push([
51
+ k ? k[1].src = `${d}${l}?t=${(/* @__PURE__ */ new Date()).getTime()}` : o.vitepress.site.head.push([
52
52
  "script",
53
53
  {
54
- src: `${c}${l}?t=${(/* @__PURE__ */ new Date()).getTime()}`
54
+ src: `${d}${l}?t=${(/* @__PURE__ */ new Date()).getTime()}`
55
55
  }
56
56
  ]);
57
57
  },
58
58
  generateBundle() {
59
- f || g.existsSync(g.join(d, l)) || (g.existsSync(d) || g.mkdirSync(d, { recursive: !0 }), g.writeFileSync(g.join(d, l), m, "utf-8"));
59
+ h || p.existsSync(p.join(u, l)) || (p.existsSync(u) || p.mkdirSync(u, { recursive: !0 }), p.writeFileSync(p.join(u, l), g, "utf-8"));
60
60
  },
61
- configureServer(a) {
62
- a.middlewares.use(`${c}${l}`, (w, h) => {
63
- h.setHeader("Content-Type", "application/javascript"), h.end(m);
61
+ configureServer(o) {
62
+ o.middlewares.use(`${d}${l}`, (k, x) => {
63
+ x.setHeader("Content-Type", "application/javascript"), x.end(g);
64
64
  });
65
65
  },
66
- transformIndexHtml(a) {
67
- return u ? a : a.replace("</head>", `<script src="${c}${l}?t=${(/* @__PURE__ */ new Date()).getTime()}"><\/script></head>`);
66
+ transformIndexHtml(o) {
67
+ return m ? o : o.replace("</head>", `<script src="${d}${l}?t=${(/* @__PURE__ */ new Date()).getTime()}"><\/script></head>`);
68
68
  }
69
69
  };
70
70
  }
@@ -104,9 +104,9 @@ const T = {
104
104
  let i = null, v = !1;
105
105
  function C(e, n, t) {
106
106
  const r = T[e];
107
- return new Promise((o) => {
107
+ return new Promise((a) => {
108
108
  if (v) {
109
- o(!1);
109
+ a(!1);
110
110
  return;
111
111
  }
112
112
  v = !0, _(), i || (i = document.createElement("div"), i.className = "elg-mask", i.innerHTML = `
@@ -123,14 +123,14 @@ function C(e, n, t) {
123
123
  </div>
124
124
  </div>
125
125
  `, document.body.appendChild(i));
126
- const s = i.querySelector(".elg-title"), p = i.querySelector(".elg-message"), x = i.querySelector(".elg-url"), k = i.querySelector(".elg-cancel"), l = i.querySelector(".elg-confirm");
127
- s.textContent = r.title, p.textContent = r.message(t), x.textContent = n, i.style.display = "flex";
128
- const m = (u) => {
129
- i && (i.style.display = "none", i.removeEventListener("click", d), k.removeEventListener("click", c), l.removeEventListener("click", f), v = !1, o(u));
130
- }, c = () => m(!1), f = () => m(!0), d = (u) => {
131
- u.target === i && m(!1);
126
+ const s = i.querySelector(".elg-title"), c = i.querySelector(".elg-message"), w = i.querySelector(".elg-url"), f = i.querySelector(".elg-cancel"), l = i.querySelector(".elg-confirm");
127
+ s.textContent = r.title, c.textContent = r.message(t), w.textContent = n, i.style.display = "flex";
128
+ const g = (m) => {
129
+ i && (i.style.display = "none", i.removeEventListener("click", u), f.removeEventListener("click", d), l.removeEventListener("click", h), v = !1, a(m));
130
+ }, d = () => g(!1), h = () => g(!0), u = (m) => {
131
+ m.target === i && g(!1);
132
132
  };
133
- i.addEventListener("click", d), k.addEventListener("click", c), l.addEventListener("click", f);
133
+ i.addEventListener("click", u), f.addEventListener("click", d), l.addEventListener("click", h);
134
134
  });
135
135
  }
136
136
  function _() {
@@ -260,22 +260,23 @@ ${e}`;
260
260
  return Promise.resolve(window.confirm(t));
261
261
  }
262
262
  function U(e) {
263
+ const n = window.open;
263
264
  document.addEventListener(
264
265
  "click",
265
- async (n) => {
266
- const t = n.target;
267
- if (!t)
268
- return;
269
- const r = t.closest("a[href]");
266
+ async (t) => {
267
+ const r = t.target;
270
268
  if (!r)
271
269
  return;
272
- const o = r.getAttribute("href");
273
- if (!o || o.startsWith("#") || !b(o))
270
+ const a = r.closest("a[href]");
271
+ if (!a)
272
+ return;
273
+ const s = a.getAttribute("href");
274
+ if (!s || s.startsWith("#") || !b(s))
274
275
  return;
275
- const s = new URL(o, window.location.href);
276
- if (A(s.hostname, e.whitelist))
276
+ const c = new URL(s, window.location.href);
277
+ if (A(c.hostname, e.whitelist))
277
278
  return;
278
- n.preventDefault(), await $(s.href, e) && ((r.getAttribute("target") || "_self") === "_blank" ? window.open(s.href, "_blank", "noopener,noreferrer") : window.location.href = s.href);
279
+ t.preventDefault(), await $(c.href, e) && ((a.getAttribute("target") || "_self") === "_blank" ? n.call(window, c.href, "_blank", "noopener,noreferrer") : window.location.href = c.href);
279
280
  },
280
281
  !0
281
282
  );
@@ -284,9 +285,9 @@ function S(e) {
284
285
  const n = window.open;
285
286
  window.open = async function(t, ...r) {
286
287
  if (t) {
287
- const o = t.toString();
288
- if (b(o)) {
289
- const s = new URL(o, window.location.href);
288
+ const a = t.toString();
289
+ if (b(a)) {
290
+ const s = new URL(a, window.location.href);
290
291
  if (!A(s.hostname, e.whitelist) && !await $(s.href, e))
291
292
  return null;
292
293
  }
@@ -306,5 +307,5 @@ export {
306
307
  I as createExternalLinkGuard,
307
308
  B as initOpenDesignAnalytics,
308
309
  K as oaReport,
309
- z as vAnalytics
310
+ O as vAnalytics
310
311
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opendesign-plus-test/plugins",
3
- "version": "0.0.1-rc.7",
3
+ "version": "0.0.1-rc.8",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public",