wj-elements 0.0.9 → 0.0.11

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.
@@ -1,16 +1,16 @@
1
1
  var i = Object.defineProperty;
2
- var a = (e, t, r) => t in e ? i(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
- var o = (e, t, r) => (a(e, typeof t != "symbol" ? t + "" : t, r), r);
4
- import c from "./wj-element.js";
2
+ var c = (e, t, s) => t in e ? i(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s;
3
+ var n = (e, t, s) => (c(e, typeof t != "symbol" ? t + "" : t, s), s);
4
+ import a from "./wj-element.js";
5
5
  import { b as u } from "./router-links-e0087f84.js";
6
6
  import "./wj-store.js";
7
7
  const l = `:host{display:block;background:transparent!important}:host(.active){cursor:pointer;font-weight:700}
8
8
  `;
9
- class m extends c {
9
+ class m extends a {
10
10
  constructor() {
11
11
  super();
12
- o(this, "className", "RouterLink");
13
- u(this, { selector: !1 });
12
+ n(this, "className", "RouterLink");
13
+ this.unbindRouterLinks = u(this, { selector: !1 });
14
14
  }
15
15
  static get cssStyleSheet() {
16
16
  return l;
@@ -21,9 +21,12 @@ class m extends c {
21
21
  setupAttributes() {
22
22
  this.isShadowRoot = "open", this.setAttribute("active-class", "active");
23
23
  }
24
- draw(r, p, d) {
25
- let s = document.createDocumentFragment(), n = document.createElement("slot");
26
- return s.appendChild(n), s;
24
+ draw(s, d, p) {
25
+ let r = document.createDocumentFragment(), o = document.createElement("slot");
26
+ return r.appendChild(o), r;
27
+ }
28
+ beforeDisconnect() {
29
+ this.unbindRouterLinks();
27
30
  }
28
31
  }
29
32
  customElements.get("wj-router-link") || window.customElements.define("wj-router-link", m);
@@ -267,7 +267,7 @@ class Ct {
267
267
  if (t == null)
268
268
  if (this._hasPushState || !this._wantsHashChange || e) {
269
269
  t = decodeURI(this.location.pathname + this.location.search);
270
- const n = this.root.replace(St, "");
270
+ const n = this.root.replace(Ut, "");
271
271
  t.indexOf(n) || (t = t.slice(n.length));
272
272
  } else
273
273
  t = this.getHash();
@@ -326,7 +326,7 @@ class Ct {
326
326
  return !1;
327
327
  (!e || e === !0) && (e = { trigger: !!e });
328
328
  let n = this.root + (t = this.getFragment(t || ""));
329
- if (t = t.replace(Ut, ""), this.fragment !== t) {
329
+ if (t = t.replace(St, ""), this.fragment !== t) {
330
330
  if (this.fragment = t, t === "" && n !== "/" && (n = n.slice(0, -1)), this._hasPushState)
331
331
  this.history[e.replace ? "replaceState" : "pushState"]({}, document.title, n);
332
332
  else if (this._wantsHashChange)
@@ -358,7 +358,7 @@ class Ct {
358
358
  return this._hasPushState;
359
359
  }
360
360
  }
361
- const B = /^[#\/]|\s+$/g, $t = /^\/+|\/+$/g, St = /\/$/, Ut = /#.*$/;
361
+ const B = /^[#\/]|\s+$/g, $t = /^\/+|\/+$/g, Ut = /\/$/, St = /#.*$/;
362
362
  class xt {
363
363
  constructor(t = {}) {
364
364
  this.path = t.path || "", this.options = C({
@@ -523,13 +523,13 @@ function k(r) {
523
523
  if (!w)
524
524
  if (l < t.middleware.length) {
525
525
  E = t.middleware[l], b = E.name || "anonymous", e("Transition #" + h, "resolving middleware:", b);
526
- let S;
526
+ let U;
527
527
  try {
528
- S = E.resolve ? E.resolve(p, v) : v, q(p !== S, "Middleware %s returned a transition which resulted in a deadlock", b);
528
+ U = E.resolve ? E.resolve(p, v) : v, q(p !== U, "Middleware %s returned a transition which resulted in a deadlock", b);
529
529
  } catch (T) {
530
530
  return t.state.activeTransition = null, W(t, p, T), f(T);
531
531
  }
532
- Promise.resolve(S).then(function(T) {
532
+ Promise.resolve(U).then(function(T) {
533
533
  y(l + 1, T);
534
534
  }).catch(function(T) {
535
535
  e("Transition #" + h, "resolving middleware:", b, "FAILED"), t.state.activeTransition = null, W(t, p, T), f(T);
@@ -542,8 +542,8 @@ function k(r) {
542
542
  pathname: u,
543
543
  params: o,
544
544
  query: a
545
- }, t.middleware.forEach((S) => {
546
- S.done && S.done(p);
545
+ }, t.middleware.forEach((U) => {
546
+ U.done && U.done(p);
547
547
  }), m();
548
548
  }
549
549
  return r.noop ? m() : Promise.resolve().then(() => y(0)), r.noop && (p.noop = !0), p;
@@ -586,7 +586,7 @@ function It(r, t) {
586
586
  function qt(r) {
587
587
  return r = r || window.event, r.which === null ? r.button : r.which;
588
588
  }
589
- function Q(r, t, e) {
589
+ function V(r, t, e) {
590
590
  e !== !0 && (r[t] = typeof e == "function" ? e : () => {
591
591
  });
592
592
  }
@@ -607,7 +607,7 @@ class Mt {
607
607
  location: "browser",
608
608
  logError: !0,
609
609
  qs: Dt
610
- }, t), Q(this, "log", this.options.log), Q(this, "logError", this.options.logError), t.routes && this.map(t.routes);
610
+ }, t), V(this, "log", this.options.log), V(this, "logError", this.options.logError), t.routes && this.map(t.routes);
611
611
  }
612
612
  /**
613
613
  * Add a middleware
@@ -842,7 +842,7 @@ function Ft(r, t = document, e = jt) {
842
842
  return _t(t, (n, i) => e(n, i, r));
843
843
  }
844
844
  const Ht = Promise.resolve();
845
- let $ = /* @__PURE__ */ Object.create(null), M = /* @__PURE__ */ Object.create(null), j, U, x;
845
+ let $ = /* @__PURE__ */ Object.create(null), M = /* @__PURE__ */ Object.create(null), j, S, x;
846
846
  function Bt(r) {
847
847
  const t = parseFloat(r);
848
848
  return r == t ? t : r;
@@ -861,12 +861,12 @@ class Wt {
861
861
  }
862
862
  }
863
863
  function kt(r) {
864
- j = r, U = r.options.outlet;
864
+ j = r, S = r.options.outlet;
865
865
  }
866
- function Qt() {
866
+ function Vt() {
867
867
  j = null, $ = /* @__PURE__ */ Object.create(null), M = /* @__PURE__ */ Object.create(null), x = null;
868
868
  }
869
- function Vt(r, t) {
869
+ function Qt(r, t) {
870
870
  const e = Object.keys(r);
871
871
  return e.length === Object.keys(t).length && e.every((n) => t[n] === r[n]);
872
872
  }
@@ -876,10 +876,10 @@ function Kt(r) {
876
876
  function zt() {
877
877
  if (x)
878
878
  return x;
879
- if (!U)
879
+ if (!S)
880
880
  return document.body;
881
- if (x = typeof U == "string" ? document.querySelector(U) : U, !x)
882
- throw new Error(`slick-router(wc): Invalid outlet option ${U}`);
881
+ if (x = typeof S == "string" ? document.querySelector(S) : S, !x)
882
+ throw new Error(`slick-router(wc): Invalid outlet option ${S}`);
883
883
  return x;
884
884
  }
885
885
  function Jt(r, t) {
@@ -893,7 +893,7 @@ function Jt(r, t) {
893
893
  function Zt(r, t) {
894
894
  let e, n, i;
895
895
  const s = Math.max(r.length, t.length);
896
- for (e = 0; e < s && (n = r[e], i = t[e], !(!(n && i) || n.name !== i.name || !Vt(n.params, i.params))); e++)
896
+ for (e = 0; e < s && (n = r[e], i = t[e], !(!(n && i) || n.name !== i.name || !Qt(n.params, i.params))); e++)
897
897
  ;
898
898
  return e;
899
899
  }
@@ -919,7 +919,7 @@ async function Xt(r) {
919
919
  }
920
920
  return t;
921
921
  }
922
- function V(r, t, e) {
922
+ function Q(r, t, e) {
923
923
  e && Object.keys(e).forEach((n) => {
924
924
  const i = e[n];
925
925
  t[n] = i instanceof Wt ? i.value(r) : i;
@@ -930,7 +930,7 @@ async function Yt(r, t, e) {
930
930
  const { path: n, pathname: i, routes: s, params: c, query: o } = r, u = { path: n, pathname: i, routes: s, params: c, query: o };
931
931
  for (let a = 0; a < e; a++) {
932
932
  const h = r.routes[a], g = $[h.name];
933
- g && (g.$route = u, V(r, g, h.options.properties));
933
+ g && (g.$route = u, Q(r, g, h.options.properties));
934
934
  }
935
935
  for (let a = 0; a < t.length; a++) {
936
936
  const { el: h, route: g } = t[a];
@@ -938,7 +938,7 @@ async function Yt(r, t, e) {
938
938
  const m = Jt(r, e + a - 1), f = m ? Kt(m) : zt();
939
939
  if (f) {
940
940
  const d = K.get(f) || f.firstElementChild;
941
- d && (f.removeChild(d), nt.add(d)), h.$route = u, V(r, h, g.options.properties), f.appendChild(h), K.set(f, h), await (h.updateComplete || Ht);
941
+ d && (f.removeChild(d), nt.add(d)), h.$route = u, Q(r, h, g.options.properties), f.appendChild(h), K.set(f, h), await (h.updateComplete || Ht);
942
942
  }
943
943
  }
944
944
  }
@@ -966,7 +966,7 @@ function re(r) {
966
966
  }
967
967
  const ne = {
968
968
  create: kt,
969
- destroy: Qt,
969
+ destroy: Vt,
970
970
  resolve: ee,
971
971
  done: re
972
972
  };
@@ -1033,7 +1033,7 @@ class se extends at {
1033
1033
  const n = {}, i = e.attributes;
1034
1034
  for (let o = 0; o < i.length; o++) {
1035
1035
  const u = i[o].name, a = i[o].value;
1036
- u === "component" && a.indexOf(".js") > -1 ? n.component = () => import(a) : u !== "shadow" && (n[u] = a);
1036
+ u === "component" && a.indexOf(".js") > -1 ? (console.log("attributeValue", a, new URL(a, import.meta.url).href), n.component = () => import(new URL(a, import.meta.url).href)) : u !== "shadow" && (n[u] = a);
1037
1037
  }
1038
1038
  const s = [];
1039
1039
  return Array.from(e.children).forEach((o) => {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "wj-elements",
3
3
  "private": false,
4
- "version": "0.0.9",
4
+ "version": "0.0.11",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "./dist"