@mittwald/react-tunnel 0.1.0-alpha.65 → 0.1.0-alpha.72

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mittwald/react-tunnel",
3
- "version": "0.1.0-alpha.65",
3
+ "version": "0.1.0-alpha.72",
4
4
  "type": "module",
5
5
  "description": "It's like a Portal – but with React components",
6
6
  "keywords": [
@@ -34,28 +34,28 @@
34
34
  "mobx-react-lite": "^4.0.7"
35
35
  },
36
36
  "devDependencies": {
37
- "@testing-library/react": "^14.3.0",
37
+ "@testing-library/react": "^15.0.2",
38
38
  "@types/node": "^20.12.7",
39
- "@types/react": "^18.2.75",
40
- "@types/react-dom": "^18.2.24",
39
+ "@types/react": "^18.2.79",
40
+ "@types/react-dom": "^18.2.25",
41
41
  "@vitejs/plugin-react": "^4.2.1",
42
- "@vitest/coverage-v8": "^1.4.0",
42
+ "@vitest/coverage-v8": "^1.5.0",
43
43
  "happy-dom": "^14.7.1",
44
- "nx": "^18.2.4",
44
+ "nx": "^18.3.1",
45
45
  "prettier": "^3.2.5",
46
46
  "react": "^18.2.0",
47
47
  "react-dom": "^18.2.0",
48
48
  "typescript": "^5.4.5",
49
- "vite": "^5.2.8",
49
+ "vite": "^5.2.9",
50
50
  "vite-plugin-banner": "^0.7.1",
51
51
  "vite-plugin-checker": "^0.6.4",
52
- "vite-plugin-dts": "^3.8.1",
52
+ "vite-plugin-dts": "^3.8.3",
53
53
  "vite-plugin-externalize-deps": "^0.8.0",
54
- "vitest": "^1.4.0"
54
+ "vitest": "^1.5.0"
55
55
  },
56
56
  "peerDependencies": {
57
57
  "react": "^18.2.0",
58
58
  "react-dom": "^18.2.0"
59
59
  },
60
- "gitHead": "000868d3499fd78147a5a50f1d5e6571c18527b7"
60
+ "gitHead": "a14bd1b7c1fa1617e385e986830f6d397df913dc"
61
61
  }
package/dist/index.js DELETED
@@ -1,57 +0,0 @@
1
- "use client"
2
- /* */
3
- var f = Object.defineProperty;
4
- var m = (r, e, t) => e in r ? f(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
5
- var u = (r, e, t) => (m(r, typeof e != "symbol" ? e + "" : e, t), t);
6
- import C, { useState as p, createContext as b, useContext as a, useId as v, useRef as E, useLayoutEffect as g } from "react";
7
- import { observable as c, makeObservable as x, action as h } from "mobx";
8
- import { observer as w } from "mobx-react-lite";
9
- const i = "default";
10
- class l {
11
- constructor() {
12
- u(this, "children", c.map(
13
- {},
14
- {
15
- deep: !1
16
- }
17
- ));
18
- x(this, {
19
- deleteChildren: h.bound,
20
- setChildren: h.bound
21
- });
22
- }
23
- static useNew() {
24
- return p(new l())[0];
25
- }
26
- setChildren(e = i, t, n) {
27
- const s = this.children.get(e) ?? c.map({}, { deep: !1 });
28
- s.set(t, n), this.children.set(e, s);
29
- }
30
- deleteChildren(e = i, t) {
31
- var n;
32
- (n = this.children.get(e)) == null || n.delete(t);
33
- }
34
- getChildren(e = i) {
35
- var n;
36
- const t = (n = this.children.get(e)) == null ? void 0 : n.values();
37
- if (t)
38
- return Array.from(t);
39
- }
40
- }
41
- const o = b(new l()), P = (r) => {
42
- const { children: e } = r;
43
- return /* @__PURE__ */ C.createElement(o.Provider, { value: l.useNew() }, e);
44
- }, R = (r) => {
45
- const { children: e, id: t } = r, n = a(o), s = v(), d = E(!1);
46
- return d.current || n.setChildren(t, s, e), g(() => (d.current = !0, n.setChildren(t, s, e), () => {
47
- n.deleteChildren(t, s);
48
- }), [e, t, s]), null;
49
- }, k = w((r) => {
50
- const { children: e, id: t } = r;
51
- return a(o).getChildren(t) ?? e;
52
- });
53
- export {
54
- R as TunnelEntry,
55
- k as TunnelExit,
56
- P as TunnelProvider
57
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1,11 +0,0 @@
1
- import { ObservableMap } from 'mobx';
2
- import { ReactNode } from 'react';
3
-
4
- export declare class TunnelState {
5
- readonly children: ObservableMap<string, ObservableMap<string, ReactNode>>;
6
- constructor();
7
- static useNew(): TunnelState;
8
- setChildren(tunnelId: string | undefined, entryId: string, children: ReactNode): void;
9
- deleteChildren(tunnelId: string | undefined, entryId: string): void;
10
- getChildren(tunnelId?: string): ReactNode;
11
- }
@@ -1,7 +0,0 @@
1
- import { FC, PropsWithChildren } from 'react';
2
-
3
- interface Props extends PropsWithChildren {
4
- id?: string;
5
- }
6
- export declare const TunnelEntry: FC<Props>;
7
- export default TunnelEntry;
@@ -1,7 +0,0 @@
1
- import { FC, PropsWithChildren } from 'react';
2
-
3
- interface Props extends PropsWithChildren {
4
- id?: string;
5
- }
6
- export declare const TunnelExit: FC<Props>;
7
- export default TunnelExit;
@@ -1,4 +0,0 @@
1
- import { FC, PropsWithChildren } from 'react';
2
-
3
- export declare const TunnelProvider: FC<PropsWithChildren>;
4
- export default TunnelProvider;
@@ -1,4 +0,0 @@
1
- import { TunnelState } from './TunnelState';
2
-
3
- export declare const tunnelContext: import('react').Context<TunnelState>;
4
- export default tunnelContext;
@@ -1,3 +0,0 @@
1
- export { TunnelProvider } from './components/TunnelProvider';
2
- export { TunnelEntry } from './components/TunnelEntry';
3
- export { TunnelExit } from './components/TunnelExit';