@mittwald/react-tunnel 0.2.0-alpha.515 → 0.2.0-alpha.517

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 +42 -47
  2. package/package.json +14 -14
package/dist/index.js CHANGED
@@ -1,72 +1,67 @@
1
1
  "use client"
2
2
  /* */
3
- var g = Object.defineProperty;
4
- var b = (n, e, r) => e in n ? g(n, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : n[e] = r;
5
- var h = (n, e, r) => b(n, typeof e != "symbol" ? e + "" : e, r);
6
- import { jsx as f } from "react/jsx-runtime";
7
- import { useState as v, createContext as w, useContext as m, useId as x, useRef as M, useEffect as p } from "react";
8
- import { observable as a, makeObservable as y, action as C } from "mobx";
9
- import { observer as E } from "mobx-react-lite";
10
- const l = "default";
11
- class o {
3
+ import { jsx as C } from "react/jsx-runtime";
4
+ import { useState as m, createContext as g, useContext as f, useId as E, useRef as b, useEffect as u } from "react";
5
+ import { observable as p, makeObservable as v, action as a } from "mobx";
6
+ import { observer as w } from "mobx-react-lite";
7
+ const d = "default";
8
+ class l {
9
+ children = p.map(
10
+ {},
11
+ {
12
+ deep: !1
13
+ }
14
+ );
15
+ preparedChildren = /* @__PURE__ */ new Map();
12
16
  constructor() {
13
- h(this, "children", a.map(
14
- {},
15
- {
16
- deep: !1
17
- }
18
- ));
19
- h(this, "preparedChildren", /* @__PURE__ */ new Map());
20
- y(this, {
21
- deleteChildren: C.bound,
22
- setChildren: C.bound
17
+ v(this, {
18
+ deleteChildren: a.bound,
19
+ setChildren: a.bound
23
20
  });
24
21
  }
25
22
  static useNew() {
26
- return v(() => new o())[0];
23
+ return m(() => new l())[0];
27
24
  }
28
- setChildren(e = l, r, i) {
29
- var d;
30
- const t = this.children.get(e) ?? a.map({}, { deep: !1 });
31
- t.set(r, i), (d = this.preparedChildren.get(e)) == null || d.delete(r), this.children.set(e, t);
25
+ setChildren(e = d, r, n) {
26
+ const t = this.children.get(e) ?? p.map({}, { deep: !1 });
27
+ t.set(r, n), this.preparedChildren.get(e)?.delete(r), this.children.set(e, t);
32
28
  }
33
- prepareChildren(e = l, r, i) {
29
+ prepareChildren(e = d, r, n) {
34
30
  const t = this.preparedChildren.get(e) ?? /* @__PURE__ */ new Map();
35
- t.set(r, i), this.preparedChildren.set(e, t);
31
+ t.set(r, n), this.preparedChildren.set(e, t);
36
32
  }
37
- deleteChildrenFromMap(e, r, i) {
33
+ deleteChildrenFromMap(e, r, n) {
38
34
  const t = e.get(r);
39
- t == null || t.delete(i), (t == null ? void 0 : t.size) === 0 && e.delete(r);
35
+ t?.delete(n), t?.size === 0 && e.delete(r);
40
36
  }
41
- deleteChildren(e = l, r) {
37
+ deleteChildren(e = d, r) {
42
38
  this.deleteChildrenFromMap(this.children, e, r), this.deleteChildrenFromMap(this.preparedChildren, e, r);
43
39
  }
44
- getChildren(e = l) {
45
- var i, t;
46
- const r = ((i = this.children.get(e)) == null ? void 0 : i.entries()) ?? ((t = this.preparedChildren.get(e)) == null ? void 0 : t.entries());
40
+ getChildren(e = d) {
41
+ const r = this.children.get(e)?.entries() ?? this.preparedChildren.get(e)?.entries();
47
42
  if (r)
48
43
  return Array.from(r);
49
44
  }
50
45
  }
51
- const c = w(new o()), k = (n) => {
52
- const { children: e } = n;
53
- return /* @__PURE__ */ f(c.Provider, { value: o.useNew(), children: e });
54
- }, z = (n) => {
55
- const { children: e, id: r, staticEntryId: i } = n, t = m(c), d = x(), s = i ?? d, u = M(!1);
56
- return u.current || t.prepareChildren(r, s, e), p(() => {
57
- u.current = !0, t.setChildren(r, s, e);
58
- }, [e, r, s]), p(() => () => {
46
+ const h = g(new l()), N = (i) => {
47
+ const { children: e } = i;
48
+ return /* @__PURE__ */ C(h.Provider, { value: l.useNew(), children: e });
49
+ }, P = (i) => {
50
+ const { children: e, id: r, staticEntryId: n } = i, t = f(h), o = E(), s = n ?? o, c = b(!1);
51
+ return c.current || t.prepareChildren(r, s, e), u(() => {
52
+ c.current = !0, t.setChildren(r, s, e);
53
+ }, [e, r, s]), u(() => () => {
59
54
  t.deleteChildren(r, s);
60
55
  }, [r, s]), null;
61
- }, T = (n) => {
62
- const { children: e } = n;
56
+ }, x = (i) => {
57
+ const { children: e } = i;
63
58
  return typeof e == "function" ? e() : e;
64
- }, A = E((n) => {
65
- const { children: e, id: r } = n, i = m(c).getChildren(r), t = i ? i.map(([d, s]) => /* @__PURE__ */ f(T, { children: s }, d)) : null;
59
+ }, R = w((i) => {
60
+ const { children: e, id: r } = i, n = f(h).getChildren(r), t = n ? n.map(([o, s]) => /* @__PURE__ */ C(x, { children: s }, o)) : null;
66
61
  return typeof e == "function" ? e(t) : t ?? e;
67
62
  });
68
63
  export {
69
- z as TunnelEntry,
70
- A as TunnelExit,
71
- k as TunnelProvider
64
+ P as TunnelEntry,
65
+ R as TunnelExit,
66
+ N as TunnelProvider
72
67
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mittwald/react-tunnel",
3
- "version": "0.2.0-alpha.515",
3
+ "version": "0.2.0-alpha.517",
4
4
  "type": "module",
5
5
  "description": "It's like a Portal – but with React components",
6
6
  "keywords": [
@@ -38,28 +38,28 @@
38
38
  "@mittwald/typescript-config": "workspace:*",
39
39
  "@testing-library/dom": "^10.4.1",
40
40
  "@testing-library/react": "^16.3.0",
41
- "@types/node": "^22.18.6",
42
- "@types/react": "^19.1.13",
43
- "@types/react-dom": "^19.1.9",
44
- "@vitejs/plugin-react": "^4.7.0",
41
+ "@types/node": "^24.7.2",
42
+ "@types/react": "^19.2.2",
43
+ "@types/react-dom": "^19.2.2",
44
+ "@vitejs/plugin-react": "^5.0.4",
45
45
  "@vitest/coverage-v8": "^3.2.4",
46
- "happy-dom": "^17.6.3",
47
- "nx": "^20.8.2",
46
+ "happy-dom": "^20.0.1",
47
+ "nx": "^21.6.4",
48
48
  "prettier": "^3.6.2",
49
- "react": "^19.1.1",
50
- "react-dom": "^19.1.1",
49
+ "react": "^19.2.0",
50
+ "react-dom": "^19.2.0",
51
51
  "rimraf": "^6.0.1",
52
- "typescript": "^5.9.2",
53
- "vite": "^6.3.6",
52
+ "typescript": "^5.9.3",
53
+ "vite": "^7.1.10",
54
54
  "vite-plugin-banner": "^0.8.1",
55
- "vite-plugin-checker": "^0.9.3",
55
+ "vite-plugin-checker": "^0.11.0",
56
56
  "vite-plugin-dts": "^4.5.4",
57
- "vite-plugin-externalize-deps": "^0.9.0",
57
+ "vite-plugin-externalize-deps": "^0.10.0",
58
58
  "vitest": "^3.2.4"
59
59
  },
60
60
  "peerDependencies": {
61
61
  "react": "^19",
62
62
  "react-dom": "^19"
63
63
  },
64
- "gitHead": "9ed87e1832978162d99b95ff869a6092ee2a8a65"
64
+ "gitHead": "761ba9a36c7238153866514f7ec0a6c28f887c8f"
65
65
  }