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

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 +59 -56
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { i as B, o as K, v as z } from "./plugin-lvjNLBe-.js";
2
- const u = {}, L = `
2
+ const g = {}, L = `
3
3
  (function () {
4
4
  function getCookie(key) {
5
5
  const name = encodeURIComponent(key) + '=';
@@ -29,46 +29,46 @@ function R(e) {
29
29
  const {
30
30
  cookieKey: n,
31
31
  lightValue: t = "light",
32
- darkValue: i = "dark",
33
- attribute: a = "data-o-theme",
34
- attributeLightValue: c = t,
35
- attributeDarkValue: m = i,
36
- classLightValue: h = t,
37
- classDarkValue: x = i,
38
- filename: s = "check-theme.js"
39
- } = e, g = L.replace(/\$COOKIE_KEY/g, n).replace(/\$LIGHT_VALUE/g, t).replace(/\$DARK_VALUE/g, i).replace(/\$CLASS_LIGHT_VALUE/g, h).replace(/\$CLASS_DARK_VALUE/g, x).replace(/\$ATTRIBUTE_NAME/g, a).replace(/\$ATTRIBUTE_LIGHT_VALUE/g, c).replace(/\$ATTRIBUTE_DARK_VALUE/g, m);
40
- let l = "", p = !1, d = "", w = !1;
32
+ darkValue: r = "dark",
33
+ attribute: o = "data-o-theme",
34
+ attributeLightValue: s = t,
35
+ attributeDarkValue: p = r,
36
+ classLightValue: x = t,
37
+ classDarkValue: k = r,
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;
41
41
  return {
42
42
  name: "vite-check-theme-plugin",
43
43
  enforce: "pre",
44
- configResolved(o) {
45
- if (l = o.base, p = o.command === "serve", d = o.build.outDir, w = !!o.vitepress, !w || !Array.isArray(o.vitepress.site.head))
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))
46
46
  return;
47
- const v = o.vitepress.site.head.find((f) => {
47
+ const w = a.vitepress.site.head.find((h) => {
48
48
  var y, E;
49
- return f[0] === "script" && ((E = (y = f[1]) == null ? void 0 : y.src) == null ? void 0 : E.startsWith(`${l}${s}`));
49
+ return h[0] === "script" && ((E = (y = h[1]) == null ? void 0 : y.src) == null ? void 0 : E.startsWith(`${c}${l}`));
50
50
  });
51
- v ? v[1].src = `${l}${s}?t=${(/* @__PURE__ */ new Date()).getTime()}` : o.vitepress.site.head.push([
51
+ w ? w[1].src = `${c}${l}?t=${(/* @__PURE__ */ new Date()).getTime()}` : a.vitepress.site.head.push([
52
52
  "script",
53
53
  {
54
- src: `${l}${s}?t=${(/* @__PURE__ */ new Date()).getTime()}`
54
+ src: `${c}${l}?t=${(/* @__PURE__ */ new Date()).getTime()}`
55
55
  }
56
56
  ]);
57
57
  },
58
58
  generateBundle() {
59
- p || u.existsSync(u.join(d, s)) || (u.existsSync(d) || u.mkdirSync(d, { recursive: !0 }), u.writeFileSync(u.join(d, s), g, "utf-8"));
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"));
60
60
  },
61
- configureServer(o) {
62
- o.middlewares.use(`${l}${s}`, (v, f) => {
63
- f.setHeader("Content-Type", "application/javascript"), f.end(g);
61
+ configureServer(a) {
62
+ a.middlewares.use(`${c}${l}`, (w, h) => {
63
+ h.setHeader("Content-Type", "application/javascript"), h.end(m);
64
64
  });
65
65
  },
66
- transformIndexHtml(o) {
67
- return w ? o : o.replace("</head>", `<script src="${l}${s}?t=${(/* @__PURE__ */ new Date()).getTime()}"><\/script></head>`);
66
+ transformIndexHtml(a) {
67
+ return u ? a : a.replace("</head>", `<script src="${c}${l}?t=${(/* @__PURE__ */ new Date()).getTime()}"><\/script></head>`);
68
68
  }
69
69
  };
70
70
  }
71
- function A(e) {
71
+ function b(e) {
72
72
  let n;
73
73
  try {
74
74
  n = new URL(e, window.location.href);
@@ -77,12 +77,12 @@ function A(e) {
77
77
  }
78
78
  return /^https?:$/.test(n.protocol) ? n.hostname !== window.location.hostname : !1;
79
79
  }
80
- function b(e, n = []) {
80
+ function A(e, n = []) {
81
81
  return n.some((t) => {
82
82
  if (t === "*") return !0;
83
83
  if (t.startsWith("*.")) {
84
- const i = t.slice(2);
85
- return e === i || e.endsWith(`.${i}`);
84
+ const r = t.slice(2);
85
+ return e === r || e.endsWith(`.${r}`);
86
86
  }
87
87
  return e === t || e.endsWith(`.${t}`);
88
88
  });
@@ -101,33 +101,36 @@ const T = {
101
101
  confirm: "Continue"
102
102
  }
103
103
  };
104
- let r = null, k = !1;
104
+ let i = null, v = !1;
105
105
  function C(e, n, t) {
106
- const i = T[e];
107
- return new Promise((a) => {
108
- if (k) return;
109
- k = !0, _(), r || (r = document.createElement("div"), r.className = "elg-mask", r.innerHTML = `
106
+ const r = T[e];
107
+ return new Promise((o) => {
108
+ if (v) {
109
+ o(!1);
110
+ return;
111
+ }
112
+ v = !0, _(), i || (i = document.createElement("div"), i.className = "elg-mask", i.innerHTML = `
110
113
  <div class="elg-modal">
111
114
  <div class="elg-title"></div>
112
115
  <div class="elg-content">
113
116
  <div class="elg-message"></div>
114
- <div class="elg-url">${n}</div>
117
+ <div class="elg-url"></div>
115
118
  </div>
116
119
 
117
120
  <div class="elg-actions">
118
- <button class="elg-btn elg-confirm">${i.confirm}</button>
119
- <button class="elg-btn elg-cancel">${i.cancel}</button>
121
+ <button class="elg-btn elg-confirm">${r.confirm}</button>
122
+ <button class="elg-btn elg-cancel">${r.cancel}</button>
120
123
  </div>
121
124
  </div>
122
- `, document.body.appendChild(r));
123
- const c = r.querySelector(".elg-title"), m = r.querySelector(".elg-message"), h = r.querySelector(".elg-cancel"), x = r.querySelector(".elg-confirm");
124
- c.textContent = i.title, m.textContent = i.message(t), r.style.display = "flex";
125
- const s = (d) => {
126
- r.style.display = "none", r.removeEventListener("click", p), h.removeEventListener("click", g), x.removeEventListener("click", l), k = !1, a(d);
127
- }, g = () => s(!1), l = () => s(!0), p = (d) => {
128
- d.target === r && s(!1);
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);
129
132
  };
130
- r.addEventListener("click", p), h.addEventListener("click", g), x.addEventListener("click", l);
133
+ i.addEventListener("click", d), k.addEventListener("click", c), l.addEventListener("click", f);
131
134
  });
132
135
  }
133
136
  function _() {
@@ -195,7 +198,7 @@ function _() {
195
198
  .elg-url,.elg-message {
196
199
  font-size: 18px;
197
200
  line-height: 26px;
198
- white-space: pre-wrap;
201
+ word-break: break-all;
199
202
 
200
203
  @media (max-width: 1440px) {
201
204
  font-size: 16px;
@@ -263,32 +266,32 @@ function U(e) {
263
266
  const t = n.target;
264
267
  if (!t)
265
268
  return;
266
- const i = t.closest("a[href]");
267
- if (!i)
269
+ const r = t.closest("a[href]");
270
+ if (!r)
268
271
  return;
269
- const a = i.getAttribute("href");
270
- if (!a || a.startsWith("#") || !A(a))
272
+ const o = r.getAttribute("href");
273
+ if (!o || o.startsWith("#") || !b(o))
271
274
  return;
272
- const c = new URL(a, window.location.href);
273
- if (b(c.hostname, e.whitelist))
275
+ const s = new URL(o, window.location.href);
276
+ if (A(s.hostname, e.whitelist))
274
277
  return;
275
- n.preventDefault(), await $(c.href, e) && (window.location.href = c.href);
278
+ n.preventDefault(), await $(s.href, e) && ((r.getAttribute("target") || "_self") === "_blank" ? window.open(s.href, "_blank", "noopener,noreferrer") : window.location.href = s.href);
276
279
  },
277
280
  !0
278
281
  );
279
282
  }
280
283
  function S(e) {
281
284
  const n = window.open;
282
- window.open = async function(t, ...i) {
285
+ window.open = async function(t, ...r) {
283
286
  if (t) {
284
- const a = t.toString();
285
- if (A(a)) {
286
- const c = new URL(a, window.location.href);
287
- if (!b(c.hostname, e.whitelist) && !await $(c.href, e))
287
+ const o = t.toString();
288
+ if (b(o)) {
289
+ const s = new URL(o, window.location.href);
290
+ if (!A(s.hostname, e.whitelist) && !await $(s.href, e))
288
291
  return null;
289
292
  }
290
293
  }
291
- return n.call(window, t, ...i);
294
+ return n.call(window, t, ...r);
292
295
  };
293
296
  }
294
297
  function I(e = {}) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opendesign-plus-test/plugins",
3
- "version": "0.0.1-rc.6",
3
+ "version": "0.0.1-rc.7",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public",