@opendesign-plus-test/plugins 0.0.1-rc.6 → 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 +59 -55
  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 u = {}, 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) + '=';
@@ -29,46 +29,46 @@ function R(e) {
29
29
  const {
30
30
  cookieKey: n,
31
31
  lightValue: t = "light",
32
- darkValue: i = "dark",
32
+ darkValue: r = "dark",
33
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;
34
+ attributeLightValue: s = t,
35
+ attributeDarkValue: c = r,
36
+ classLightValue: w = t,
37
+ classDarkValue: f = r,
38
+ filename: l = "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, 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
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))
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 v = o.vitepress.site.head.find((f) => {
47
+ const k = o.vitepress.site.head.find((x) => {
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 x[0] === "script" && ((E = (y = x[1]) == null ? void 0 : y.src) == null ? void 0 : E.startsWith(`${d}${l}`));
50
50
  });
51
- v ? v[1].src = `${l}${s}?t=${(/* @__PURE__ */ new Date()).getTime()}` : o.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: `${l}${s}?t=${(/* @__PURE__ */ new Date()).getTime()}`
54
+ src: `${d}${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
+ 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
61
  configureServer(o) {
62
- o.middlewares.use(`${l}${s}`, (v, f) => {
63
- f.setHeader("Content-Type", "application/javascript"), f.end(g);
62
+ o.middlewares.use(`${d}${l}`, (k, x) => {
63
+ x.setHeader("Content-Type", "application/javascript"), x.end(g);
64
64
  });
65
65
  },
66
66
  transformIndexHtml(o) {
67
- return w ? o : o.replace("</head>", `<script src="${l}${s}?t=${(/* @__PURE__ */ new Date()).getTime()}"><\/script></head>`);
67
+ return m ? o : o.replace("</head>", `<script src="${d}${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];
106
+ const r = T[e];
107
107
  return new Promise((a) => {
108
- if (k) return;
109
- k = !0, _(), r || (r = document.createElement("div"), r.className = "elg-mask", r.innerHTML = `
108
+ if (v) {
109
+ a(!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"), 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);
129
132
  };
130
- r.addEventListener("click", p), h.addEventListener("click", g), x.addEventListener("click", l);
133
+ i.addEventListener("click", u), f.addEventListener("click", d), l.addEventListener("click", h);
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;
@@ -257,38 +260,39 @@ ${e}`;
257
260
  return Promise.resolve(window.confirm(t));
258
261
  }
259
262
  function U(e) {
263
+ const n = window.open;
260
264
  document.addEventListener(
261
265
  "click",
262
- async (n) => {
263
- const t = n.target;
264
- if (!t)
266
+ async (t) => {
267
+ const r = t.target;
268
+ if (!r)
265
269
  return;
266
- const i = t.closest("a[href]");
267
- if (!i)
270
+ const a = r.closest("a[href]");
271
+ if (!a)
268
272
  return;
269
- const a = i.getAttribute("href");
270
- if (!a || a.startsWith("#") || !A(a))
273
+ const s = a.getAttribute("href");
274
+ if (!s || s.startsWith("#") || !b(s))
271
275
  return;
272
- const c = new URL(a, window.location.href);
273
- if (b(c.hostname, e.whitelist))
276
+ const c = new URL(s, window.location.href);
277
+ if (A(c.hostname, e.whitelist))
274
278
  return;
275
- n.preventDefault(), await $(c.href, e) && (window.location.href = c.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);
276
280
  },
277
281
  !0
278
282
  );
279
283
  }
280
284
  function S(e) {
281
285
  const n = window.open;
282
- window.open = async function(t, ...i) {
286
+ window.open = async function(t, ...r) {
283
287
  if (t) {
284
288
  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))
289
+ if (b(a)) {
290
+ const s = new URL(a, window.location.href);
291
+ if (!A(s.hostname, e.whitelist) && !await $(s.href, e))
288
292
  return null;
289
293
  }
290
294
  }
291
- return n.call(window, t, ...i);
295
+ return n.call(window, t, ...r);
292
296
  };
293
297
  }
294
298
  function I(e = {}) {
@@ -303,5 +307,5 @@ export {
303
307
  I as createExternalLinkGuard,
304
308
  B as initOpenDesignAnalytics,
305
309
  K as oaReport,
306
- z as vAnalytics
310
+ O as vAnalytics
307
311
  };
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.8",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public",