@mittwald/react-tunnel 0.2.0-alpha.18 → 0.2.0-alpha.181
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,67 +1,70 @@
|
|
|
1
1
|
"use client"
|
|
2
2
|
/* */
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
3
|
+
var m = Object.defineProperty;
|
|
4
|
+
var g = (n, e, r) => e in n ? m(n, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : n[e] = r;
|
|
5
|
+
var h = (n, e, r) => g(n, typeof e != "symbol" ? e + "" : e, r);
|
|
6
6
|
import { jsx as C } from "react/jsx-runtime";
|
|
7
|
-
import {
|
|
8
|
-
import { observable as p, makeObservable as
|
|
9
|
-
import { observer as
|
|
7
|
+
import { useState as b, createContext as v, useContext as f, useId as w, useRef as x, useEffect as M } from "react";
|
|
8
|
+
import { observable as p, makeObservable as y, action as a } from "mobx";
|
|
9
|
+
import { observer as E } from "mobx-react-lite";
|
|
10
10
|
const l = "default";
|
|
11
11
|
class o {
|
|
12
12
|
constructor() {
|
|
13
|
-
|
|
13
|
+
h(this, "children", p.map(
|
|
14
14
|
{},
|
|
15
15
|
{
|
|
16
16
|
deep: !1
|
|
17
17
|
}
|
|
18
18
|
));
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
h(this, "preparedChildren", /* @__PURE__ */ new Map());
|
|
20
|
+
y(this, {
|
|
21
21
|
deleteChildren: a.bound,
|
|
22
22
|
setChildren: a.bound
|
|
23
23
|
});
|
|
24
24
|
}
|
|
25
25
|
static useNew() {
|
|
26
|
-
return
|
|
26
|
+
return b(() => new o())[0];
|
|
27
27
|
}
|
|
28
|
-
setChildren(e = l, r,
|
|
28
|
+
setChildren(e = l, r, i) {
|
|
29
29
|
var s;
|
|
30
30
|
const t = this.children.get(e) ?? p.map({}, { deep: !1 });
|
|
31
|
-
t.set(r,
|
|
31
|
+
t.set(r, i), (s = this.preparedChildren.get(e)) == null || s.delete(r), this.children.set(e, t);
|
|
32
32
|
}
|
|
33
|
-
prepareChildren(e = l, r,
|
|
33
|
+
prepareChildren(e = l, r, i) {
|
|
34
34
|
const t = this.preparedChildren.get(e) ?? /* @__PURE__ */ new Map();
|
|
35
|
-
t.set(r,
|
|
35
|
+
t.set(r, i), this.preparedChildren.set(e, t);
|
|
36
|
+
}
|
|
37
|
+
deleteChildrenFromMap(e, r, i) {
|
|
38
|
+
const t = e.get(r);
|
|
39
|
+
t == null || t.delete(i), (t == null ? void 0 : t.size) === 0 && e.delete(r);
|
|
36
40
|
}
|
|
37
41
|
deleteChildren(e = l, r) {
|
|
38
|
-
|
|
39
|
-
(n = this.children.get(e)) == null || n.delete(r), (t = this.preparedChildren.get(e)) == null || t.delete(r);
|
|
42
|
+
this.deleteChildrenFromMap(this.children, e, r), this.deleteChildrenFromMap(this.preparedChildren, e, r);
|
|
40
43
|
}
|
|
41
44
|
getChildren(e = l) {
|
|
42
|
-
var
|
|
43
|
-
const r = ((
|
|
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());
|
|
44
47
|
if (r)
|
|
45
48
|
return Array.from(r);
|
|
46
49
|
}
|
|
47
50
|
}
|
|
48
|
-
const
|
|
49
|
-
const { children: e } =
|
|
50
|
-
return /* @__PURE__ */ C(
|
|
51
|
-
},
|
|
52
|
-
const { children: e, id: r, staticEntryId:
|
|
53
|
-
return u.current || t.prepareChildren(r, d, e),
|
|
51
|
+
const c = v(new o()), k = (n) => {
|
|
52
|
+
const { children: e } = n;
|
|
53
|
+
return /* @__PURE__ */ C(c.Provider, { value: o.useNew(), children: e });
|
|
54
|
+
}, z = (n) => {
|
|
55
|
+
const { children: e, id: r, staticEntryId: i } = n, t = f(c), s = w(), d = i ?? s, u = x(!1);
|
|
56
|
+
return u.current || t.prepareChildren(r, d, e), M(() => (u.current = !0, t.setChildren(r, d, e), () => {
|
|
54
57
|
t.deleteChildren(r, d);
|
|
55
58
|
}), [e, r, d]), null;
|
|
56
|
-
}, T = (
|
|
57
|
-
const { children: e } =
|
|
59
|
+
}, T = (n) => {
|
|
60
|
+
const { children: e } = n;
|
|
58
61
|
return typeof e == "function" ? e() : e;
|
|
59
|
-
},
|
|
60
|
-
const { children: e, id: r } =
|
|
61
|
-
return
|
|
62
|
+
}, A = E((n) => {
|
|
63
|
+
const { children: e, id: r } = n, i = f(c).getChildren(r), t = i ? i.map(([s, d]) => /* @__PURE__ */ C(T, { children: d }, s)) : null;
|
|
64
|
+
return typeof e == "function" ? e(t) : t ?? e;
|
|
62
65
|
});
|
|
63
66
|
export {
|
|
64
|
-
|
|
65
|
-
|
|
67
|
+
z as TunnelEntry,
|
|
68
|
+
A as TunnelExit,
|
|
66
69
|
k as TunnelProvider
|
|
67
70
|
};
|
|
@@ -7,6 +7,7 @@ export declare class TunnelState {
|
|
|
7
7
|
static useNew(): TunnelState;
|
|
8
8
|
setChildren(tunnelId: string | undefined, entryId: string, children: TunnelChildren): void;
|
|
9
9
|
prepareChildren(tunnelId: string | undefined, entryId: string, children: TunnelChildren): void;
|
|
10
|
+
private deleteChildrenFromMap;
|
|
10
11
|
deleteChildren(tunnelId: string | undefined, entryId: string): void;
|
|
11
12
|
getChildren(tunnelId?: string): [string, TunnelChildren][] | undefined;
|
|
12
13
|
}
|
|
@@ -1 +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;
|
|
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;IASP,OAAO,CAAC,qBAAqB;IAYtB,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"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { FC,
|
|
2
|
-
interface Props
|
|
1
|
+
import { FC, ReactNode } from 'react';
|
|
2
|
+
interface Props {
|
|
3
3
|
id?: string;
|
|
4
|
+
children?: ReactNode | undefined | ((tunnelChildren?: ReactNode | undefined) => ReactNode | undefined);
|
|
4
5
|
}
|
|
5
6
|
export declare const TunnelExit: FC<Props>;
|
|
6
7
|
export default TunnelExit;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TunnelExit.d.ts","sourceRoot":"","sources":["../../../src/components/TunnelExit.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,
|
|
1
|
+
{"version":3,"file":"TunnelExit.d.ts","sourceRoot":"","sources":["../../../src/components/TunnelExit.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAM3C,UAAU,KAAK;IACb,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,QAAQ,CAAC,EACL,SAAS,GACT,SAAS,GACT,CAAC,CAAC,cAAc,CAAC,EAAE,SAAS,GAAG,SAAS,KAAK,SAAS,GAAG,SAAS,CAAC,CAAC;CACzE;AAOD,eAAO,MAAM,UAAU,EAAE,EAAE,CAAC,KAAK,CAe/B,CAAC;AAEH,eAAe,UAAU,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mittwald/react-tunnel",
|
|
3
|
-
"version": "0.2.0-alpha.
|
|
3
|
+
"version": "0.2.0-alpha.181",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "It's like a Portal – but with React components",
|
|
6
6
|
"keywords": [
|
|
@@ -23,42 +23,42 @@
|
|
|
23
23
|
"dist"
|
|
24
24
|
],
|
|
25
25
|
"scripts": {
|
|
26
|
-
"build": "
|
|
26
|
+
"build": "vite build --config vite.build.config.ts",
|
|
27
27
|
"clean": "rimraf dist",
|
|
28
|
-
"test": "",
|
|
29
|
-
"test:compile": "
|
|
30
|
-
"test:unit": "
|
|
28
|
+
"test": "exit 0",
|
|
29
|
+
"test:compile": "tsc --noEmit",
|
|
30
|
+
"test:unit": "vitest run"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"mobx": "^6.13.
|
|
33
|
+
"mobx": "^6.13.6",
|
|
34
34
|
"mobx-react-lite": "^4.1.0"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@mittwald/typescript-config": "workspace:*",
|
|
38
38
|
"@testing-library/dom": "^10.4.0",
|
|
39
39
|
"@testing-library/react": "^16.2.0",
|
|
40
|
-
"@types/node": "^22.10
|
|
41
|
-
"@types/react": "^19
|
|
42
|
-
"@types/react-dom": "^19
|
|
40
|
+
"@types/node": "^22.13.10",
|
|
41
|
+
"@types/react": "^19",
|
|
42
|
+
"@types/react-dom": "^19",
|
|
43
43
|
"@vitejs/plugin-react": "^4.3.4",
|
|
44
|
-
"@vitest/coverage-v8": "^
|
|
45
|
-
"happy-dom": "^
|
|
46
|
-
"nx": "^20.
|
|
47
|
-
"prettier": "^3.
|
|
48
|
-
"react": "19
|
|
49
|
-
"react-dom": "19
|
|
44
|
+
"@vitest/coverage-v8": "^3.0.8",
|
|
45
|
+
"happy-dom": "^17.4.3",
|
|
46
|
+
"nx": "^20.8.1",
|
|
47
|
+
"prettier": "^3.5.3",
|
|
48
|
+
"react": "^19",
|
|
49
|
+
"react-dom": "^19",
|
|
50
50
|
"rimraf": "^6.0.1",
|
|
51
|
-
"typescript": "^5.
|
|
52
|
-
"vite": "^6.
|
|
51
|
+
"typescript": "^5.8.2",
|
|
52
|
+
"vite": "^6.3.5",
|
|
53
53
|
"vite-plugin-banner": "^0.8.0",
|
|
54
|
-
"vite-plugin-checker": "^0.
|
|
55
|
-
"vite-plugin-dts": "^4.5.
|
|
54
|
+
"vite-plugin-checker": "^0.9.0",
|
|
55
|
+
"vite-plugin-dts": "^4.5.3",
|
|
56
56
|
"vite-plugin-externalize-deps": "^0.9.0",
|
|
57
|
-
"vitest": "^
|
|
57
|
+
"vitest": "^3.0.8"
|
|
58
58
|
},
|
|
59
59
|
"peerDependencies": {
|
|
60
|
-
"react": "^19
|
|
61
|
-
"react-dom": "^19
|
|
60
|
+
"react": "^19",
|
|
61
|
+
"react-dom": "^19"
|
|
62
62
|
},
|
|
63
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "5b52b043996b1dac1def293dcb701d795dbdadec"
|
|
64
64
|
}
|