@mittwald/react-tunnel 0.2.0-alpha.8 → 0.2.0-alpha.80

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/index.js CHANGED
@@ -1,66 +1,67 @@
1
1
  "use client"
2
2
  /* */
3
- var g = Object.defineProperty;
4
- var E = (s, e, t) => e in s ? g(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
5
- var o = (s, e, t) => E(s, typeof e != "symbol" ? e + "" : e, t);
6
- import C, { useRef as f, createContext as b, useContext as m, useId as v, useEffect as w } from "react";
7
- import { observable as a, makeObservable as x, action as p } from "mobx";
8
- import { observer as y } from "mobx-react-lite";
3
+ var m = Object.defineProperty;
4
+ var g = (s, e, r) => e in s ? m(s, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : s[e] = r;
5
+ var c = (s, e, r) => g(s, typeof e != "symbol" ? e + "" : e, r);
6
+ import { jsx as C } from "react/jsx-runtime";
7
+ import { useState as b, createContext as E, useContext as f, useId as v, useRef as w, useEffect as x } from "react";
8
+ import { observable as a, makeObservable as y, action as p } from "mobx";
9
+ import { observer as T } from "mobx-react-lite";
9
10
  const l = "default";
10
- class c {
11
+ class o {
11
12
  constructor() {
12
- o(this, "children", a.map(
13
+ c(this, "children", a.map(
13
14
  {},
14
15
  {
15
16
  deep: !1
16
17
  }
17
18
  ));
18
- o(this, "preparedChildren", /* @__PURE__ */ new Map());
19
- x(this, {
19
+ c(this, "preparedChildren", /* @__PURE__ */ new Map());
20
+ y(this, {
20
21
  deleteChildren: p.bound,
21
22
  setChildren: p.bound
22
23
  });
23
24
  }
24
25
  static useNew() {
25
- return f(new c()).current;
26
+ return b(() => new o())[0];
26
27
  }
27
- setChildren(e = l, t, n) {
28
+ setChildren(e = l, r, n) {
28
29
  var i;
29
- const r = this.children.get(e) ?? a.map({}, { deep: !1 });
30
- r.set(t, n), (i = this.preparedChildren.get(e)) == null || i.delete(t), this.children.set(e, r);
30
+ const t = this.children.get(e) ?? a.map({}, { deep: !1 });
31
+ t.set(r, n), (i = this.preparedChildren.get(e)) == null || i.delete(r), this.children.set(e, t);
31
32
  }
32
- prepareChildren(e = l, t, n) {
33
- const r = this.preparedChildren.get(e) ?? /* @__PURE__ */ new Map();
34
- r.set(t, n), this.preparedChildren.set(e, r);
33
+ prepareChildren(e = l, r, n) {
34
+ const t = this.preparedChildren.get(e) ?? /* @__PURE__ */ new Map();
35
+ t.set(r, n), this.preparedChildren.set(e, t);
35
36
  }
36
- deleteChildren(e = l, t) {
37
- var n, r;
38
- (n = this.children.get(e)) == null || n.delete(t), (r = this.preparedChildren.get(e)) == null || r.delete(t);
37
+ deleteChildren(e = l, r) {
38
+ var n, t;
39
+ (n = this.children.get(e)) == null || n.delete(r), (t = this.preparedChildren.get(e)) == null || t.delete(r);
39
40
  }
40
41
  getChildren(e = l) {
41
- var n, r;
42
- const t = ((n = this.children.get(e)) == null ? void 0 : n.entries()) ?? ((r = this.preparedChildren.get(e)) == null ? void 0 : r.entries());
43
- if (t)
44
- return Array.from(t);
42
+ var n, t;
43
+ const r = ((n = this.children.get(e)) == null ? void 0 : n.entries()) ?? ((t = this.preparedChildren.get(e)) == null ? void 0 : t.entries());
44
+ if (r)
45
+ return Array.from(r);
45
46
  }
46
47
  }
47
- const h = b(new c()), P = (s) => {
48
+ const h = E(new o()), A = (s) => {
48
49
  const { children: e } = s;
49
- return /* @__PURE__ */ C.createElement(h.Provider, { value: c.useNew() }, e);
50
- }, A = (s) => {
51
- const { children: e, id: t, staticEntryId: n } = s, r = m(h), i = v(), d = n ?? i, u = f(!1);
52
- return u.current || r.prepareChildren(t, d, e), w(() => (u.current = !0, r.setChildren(t, d, e), () => {
53
- r.deleteChildren(t, d);
54
- }), [e, t, d]), null;
55
- }, R = (s) => {
50
+ return /* @__PURE__ */ C(h.Provider, { value: o.useNew(), children: e });
51
+ }, O = (s) => {
52
+ const { children: e, id: r, staticEntryId: n } = s, t = f(h), i = v(), d = n ?? i, u = w(!1);
53
+ return u.current || t.prepareChildren(r, d, e), x(() => (u.current = !0, t.setChildren(r, d, e), () => {
54
+ t.deleteChildren(r, d);
55
+ }), [e, r, d]), null;
56
+ }, M = (s) => {
56
57
  const { children: e } = s;
57
58
  return typeof e == "function" ? e() : e;
58
- }, O = y((s) => {
59
- const { children: e, id: t } = s, n = m(h).getChildren(t);
60
- return n ? n.map(([r, i]) => /* @__PURE__ */ C.createElement(R, { key: r }, i)) : e;
59
+ }, S = T((s) => {
60
+ const { children: e, id: r } = s, n = f(h).getChildren(r);
61
+ return n ? n.map(([t, i]) => /* @__PURE__ */ C(M, { children: i }, t)) : e;
61
62
  });
62
63
  export {
63
- A as TunnelEntry,
64
- O as TunnelExit,
65
- P as TunnelProvider
64
+ O as TunnelEntry,
65
+ S as TunnelExit,
66
+ A as TunnelProvider
66
67
  };
@@ -1 +1,2 @@
1
1
  export {};
2
+ //# sourceMappingURL=Tunnel.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Tunnel.test.d.ts","sourceRoot":"","sources":["../../src/Tunnel.test.tsx"],"names":[],"mappings":""}
@@ -10,3 +10,4 @@ export declare class TunnelState {
10
10
  deleteChildren(tunnelId: string | undefined, entryId: string): void;
11
11
  getChildren(tunnelId?: string): [string, TunnelChildren][] | undefined;
12
12
  }
13
+ //# sourceMappingURL=TunnelState.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TunnelState.d.ts","sourceRoot":"","sources":["../../src/TunnelState.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,MAAM,CAAC;AAE1C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAI9C,qBAAa,WAAW;IACtB,SAAgB,QAAQ,+DAQtB;IAEF,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAG7B;;WASU,MAAM,IAAI,WAAW;IAI5B,WAAW,CAChB,QAAQ,EAAE,MAAM,YAAY,EAC5B,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,cAAc,GACvB,IAAI;IAWA,eAAe,CACpB,QAAQ,EAAE,MAAM,YAAY,EAC5B,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,cAAc,GACvB,IAAI;IASA,cAAc,CAAC,QAAQ,EAAE,MAAM,YAAY,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI;IAKnE,WAAW,CAChB,QAAQ,GAAE,MAAkB,GAC3B,CAAC,MAAM,EAAE,cAAc,CAAC,EAAE,GAAG,SAAS;CAQ1C"}
@@ -8,3 +8,4 @@ interface Props {
8
8
  }
9
9
  export declare const TunnelEntry: FC<Props>;
10
10
  export default TunnelEntry;
11
+ //# sourceMappingURL=TunnelEntry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TunnelEntry.d.ts","sourceRoot":"","sources":["../../../src/components/TunnelEntry.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAGhC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE9C,UAAU,KAAK;IACb,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,QAAQ,CAAC,EAAE,cAAc,CAAC;IAC1B,yDAAyD;IACzD,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,eAAO,MAAM,WAAW,EAAE,EAAE,CAAC,KAAK,CAqBjC,CAAC;AAEF,eAAe,WAAW,CAAC"}
@@ -4,3 +4,4 @@ interface Props extends PropsWithChildren {
4
4
  }
5
5
  export declare const TunnelExit: FC<Props>;
6
6
  export default TunnelExit;
7
+ //# sourceMappingURL=TunnelExit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TunnelExit.d.ts","sourceRoot":"","sources":["../../../src/components/TunnelExit.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAOnD,UAAU,KAAM,SAAQ,iBAAiB;IACvC,EAAE,CAAC,EAAE,MAAM,CAAC;CACb;AAOD,eAAO,MAAM,UAAU,EAAE,EAAE,CAAC,KAAK,CAU/B,CAAC;AAEH,eAAe,UAAU,CAAC"}
@@ -1,3 +1,4 @@
1
1
  import { FC, PropsWithChildren } from 'react';
2
2
  export declare const TunnelProvider: FC<PropsWithChildren>;
3
3
  export default TunnelProvider;
4
+ //# sourceMappingURL=TunnelProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TunnelProvider.d.ts","sourceRoot":"","sources":["../../../src/components/TunnelProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAKnD,eAAO,MAAM,cAAc,EAAE,EAAE,CAAC,iBAAiB,CAQhD,CAAC;AAEF,eAAe,cAAc,CAAC"}
@@ -1,3 +1,4 @@
1
1
  import { TunnelState } from './TunnelState';
2
2
  export declare const tunnelContext: import('react').Context<TunnelState>;
3
3
  export default tunnelContext;
4
+ //# sourceMappingURL=context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/context.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,eAAO,MAAM,aAAa,sCAAgD,CAAC;AAE3E,eAAe,aAAa,CAAC"}
@@ -1,3 +1,4 @@
1
1
  export { TunnelProvider } from './components/TunnelProvider';
2
2
  export { TunnelEntry } from './components/TunnelEntry';
3
3
  export { TunnelExit } from './components/TunnelExit';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC"}
@@ -1,2 +1,3 @@
1
1
  import { ReactNode } from 'react';
2
2
  export type TunnelChildren = ReactNode | undefined | (() => ReactNode | undefined);
3
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,MAAM,MAAM,cAAc,GACtB,SAAS,GACT,SAAS,GACT,CAAC,MAAM,SAAS,GAAG,SAAS,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mittwald/react-tunnel",
3
- "version": "0.2.0-alpha.8",
3
+ "version": "0.2.0-alpha.80",
4
4
  "type": "module",
5
5
  "description": "It's like a Portal – but with React components",
6
6
  "keywords": [
@@ -23,40 +23,42 @@
23
23
  "dist"
24
24
  ],
25
25
  "scripts": {
26
- "build": "run vite build --config vite.build.config.ts",
27
- "build:deps:watch": "run -T build:deps:watch @mittwald/react-tunnel",
28
- "test": "",
29
- "test:compile": "run tsc --noEmit",
30
- "test:unit": "run vitest run"
26
+ "build": "vite build --config vite.build.config.ts",
27
+ "clean": "rimraf dist",
28
+ "test": "exit 0",
29
+ "test:compile": "tsc --noEmit",
30
+ "test:unit": "vitest run"
31
31
  },
32
32
  "dependencies": {
33
- "mobx": "^6.13.5",
33
+ "mobx": "^6.13.6",
34
34
  "mobx-react-lite": "^4.1.0"
35
35
  },
36
36
  "devDependencies": {
37
+ "@mittwald/typescript-config": "workspace:*",
37
38
  "@testing-library/dom": "^10.4.0",
38
- "@testing-library/react": "^16.1.0",
39
- "@types/node": "^22.10.5",
40
- "@types/react": "^19.0.4",
41
- "@types/react-dom": "^19.0.2",
39
+ "@testing-library/react": "^16.2.0",
40
+ "@types/node": "^22.13.4",
41
+ "@types/react": "^19",
42
+ "@types/react-dom": "^19",
42
43
  "@vitejs/plugin-react": "^4.3.4",
43
- "@vitest/coverage-v8": "^2.1.8",
44
- "happy-dom": "^15.11.7",
45
- "nx": "^20.3.1",
46
- "prettier": "^3.4.2",
47
- "react": "19.0.0",
48
- "react-dom": "19.0.0",
44
+ "@vitest/coverage-v8": "^2.1.9",
45
+ "happy-dom": "^16.8.1",
46
+ "nx": "^20.4.5",
47
+ "prettier": "^3.5.1",
48
+ "react": "^19",
49
+ "react-dom": "^19",
50
+ "rimraf": "^6.0.1",
49
51
  "typescript": "^5.7.3",
50
- "vite": "^5.4.11",
52
+ "vite": "^6.1.1",
51
53
  "vite-plugin-banner": "^0.8.0",
52
54
  "vite-plugin-checker": "^0.8.0",
53
- "vite-plugin-dts": "^4.4.0",
54
- "vite-plugin-externalize-deps": "^0.8.0",
55
- "vitest": "^2.1.8"
55
+ "vite-plugin-dts": "^4.5.0",
56
+ "vite-plugin-externalize-deps": "^0.9.0",
57
+ "vitest": "^2.1.9"
56
58
  },
57
59
  "peerDependencies": {
58
- "react": "^19.0.0",
59
- "react-dom": "^19.0.0"
60
+ "react": "^19",
61
+ "react-dom": "^19"
60
62
  },
61
- "gitHead": "0b37c710a3810094a9de4e8b9901207a2619c18b"
63
+ "gitHead": "2838d43d568012772e2088fea4d89b045979f6a4"
62
64
  }