@braydenyang/fdoc 0.1.14 → 0.1.16

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/lib/fdoc.js CHANGED
@@ -6492,7 +6492,7 @@ const y2 = "n", Kl = `.${y2}-`, C2 = "__", w2 = "--", Ym = Xm(), Jm = o2({
6492
6492
  Ym.use(Jm);
6493
6493
  const {
6494
6494
  c: V,
6495
- find: hH
6495
+ find: pH
6496
6496
  } = Ym, {
6497
6497
  cB: $,
6498
6498
  cE: q,
@@ -47754,21 +47754,29 @@ const YL = { class: "toolbar" }, JL = { class: "lang-label" }, ZL = { class: "hl
47754
47754
  }, 8, ["theme", "theme-overrides"]));
47755
47755
  }
47756
47756
  }), fH = /* @__PURE__ */ Ot(uH, [["__scopeId", "data-v-b5984c8a"]]);
47757
- function pH(e, t) {
47757
+ function hH() {
47758
+ const e = new URLSearchParams(window.location.search).get("ep");
47759
+ if (e) return e;
47760
+ const t = window.location.hash, o = t.includes("?") ? t.slice(t.indexOf("?")) : "";
47761
+ return new URLSearchParams(o).get("ep");
47762
+ }
47763
+ function vH(e, t) {
47758
47764
  const o = typeof e == "string" ? document.querySelector(e) : e;
47759
47765
  if (!o) throw new Error(`[fdoc] mount: cannot find element "${String(e)}"`);
47760
- const n = Uw(), r = e2({
47761
- history: OS(),
47766
+ const n = (t == null ? void 0 : t.ep) ?? hH(), r = Uw(), i = e2({
47767
+ history: OS(n ? `/?ep=${encodeURIComponent(n)}` : "/"),
47762
47768
  routes: [{ path: "/", component: { template: "<div/>" } }]
47763
- }), i = $m(fH);
47764
- if (i.use(n), i.use(r), r.isReady().then(() => i.mount(o)), t != null && t.url) {
47765
- const l = Er(n);
47766
- fetch(t.url).then((a) => a.json()).then((a) => {
47767
- l.loadSpec(a), l.setSourceUrl(t.url);
47768
- }).catch((a) => console.error("[fdoc] Failed to load spec from url:", a));
47769
+ }), l = $m(fH);
47770
+ if (l.use(r), l.use(i), i.isReady().then(() => {
47771
+ l.mount(o);
47772
+ }), t != null && t.url) {
47773
+ const a = Er(r);
47774
+ fetch(t.url).then((s) => s.json()).then((s) => {
47775
+ a.loadSpec(s), a.setSourceUrl(t.url);
47776
+ }).catch((s) => console.error("[fdoc] Failed to load spec from url:", s));
47769
47777
  }
47770
- return () => i.unmount();
47778
+ return () => l.unmount();
47771
47779
  }
47772
47780
  export {
47773
- pH as mount
47781
+ vH as mount
47774
47782
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@braydenyang/fdoc",
3
- "version": "0.1.14",
3
+ "version": "0.1.16",
4
4
  "description": "Embeddable OpenAPI 3.x documentation & debug UI",
5
5
  "license": "MIT",
6
6
  "keywords": [