@flowsterix/react 0.8.0 → 0.8.1
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.mjs +1 -2
- package/dist/router/index.cjs +2 -81
- package/dist/router/index.d.ts +0 -2
- package/dist/router/index.d.ts.map +1 -1
- package/dist/router/index.mjs +2 -16
- package/dist/router/tanstackRouterAdapter.mjs +60 -8
- package/package.json +1 -1
- package/dist/chunk-2ZX2Y3JL.mjs +0 -70
- /package/dist/{chunk-WCLT3A6G.mjs → chunk-Y5EAQSU3.mjs} +0 -0
package/dist/index.mjs
CHANGED
package/dist/router/index.cjs
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
2
|
var __defProp = Object.defineProperty;
|
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
6
|
var __export = (target, all) => {
|
|
9
7
|
for (var name in all)
|
|
@@ -17,31 +15,17 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
15
|
}
|
|
18
16
|
return to;
|
|
19
17
|
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
19
|
|
|
30
20
|
// src/router/index.ts
|
|
31
21
|
var router_exports = {};
|
|
32
22
|
__export(router_exports, {
|
|
33
|
-
TanStackRouterSync: () => TanStackRouterSync,
|
|
34
23
|
createPathString: () => createPathString,
|
|
35
24
|
getCurrentRoutePath: () => getCurrentRoutePath,
|
|
36
|
-
getTanStackRouter: () => getTanStackRouter,
|
|
37
|
-
getTourRouter: () => getTourRouter,
|
|
38
25
|
matchRoute: () => matchRoute,
|
|
39
26
|
notifyRouteChange: () => notifyRouteChange,
|
|
40
27
|
routeGatingChannel: () => routeGatingChannel,
|
|
41
|
-
|
|
42
|
-
setTourRouter: () => setTourRouter,
|
|
43
|
-
subscribeToRouteChanges: () => subscribeToRouteChanges,
|
|
44
|
-
useTanStackRouterTourAdapter: () => useTanStackRouterTourAdapter
|
|
28
|
+
subscribeToRouteChanges: () => subscribeToRouteChanges
|
|
45
29
|
});
|
|
46
30
|
module.exports = __toCommonJS(router_exports);
|
|
47
31
|
|
|
@@ -211,75 +195,12 @@ var createPathString = (pathname, search, hash) => {
|
|
|
211
195
|
const hashPart = toHashString(hash);
|
|
212
196
|
return `${normalizedPath}${searchPart}${hashPart}`;
|
|
213
197
|
};
|
|
214
|
-
|
|
215
|
-
// src/router/tanstackRouterAdapter.tsx
|
|
216
|
-
var import_react_router = require("@tanstack/react-router");
|
|
217
|
-
var import_react2 = require("react");
|
|
218
|
-
|
|
219
|
-
// src/router/tanstackRouterSync.tsx
|
|
220
|
-
var TanStackRouter = __toESM(require("@tanstack/react-router"), 1);
|
|
221
|
-
var import_react = require("react");
|
|
222
|
-
var currentRouter = null;
|
|
223
|
-
var setTourRouter = (router) => {
|
|
224
|
-
currentRouter = router;
|
|
225
|
-
};
|
|
226
|
-
var setTanStackRouter = setTourRouter;
|
|
227
|
-
var getTourRouter = () => {
|
|
228
|
-
return currentRouter;
|
|
229
|
-
};
|
|
230
|
-
var getTanStackRouter = getTourRouter;
|
|
231
|
-
var TanStackRouterSync = ({
|
|
232
|
-
onRouterAvailable
|
|
233
|
-
}) => {
|
|
234
|
-
const useRouter2 = TanStackRouter.useRouter;
|
|
235
|
-
if (typeof useRouter2 !== "function") {
|
|
236
|
-
if (typeof console !== "undefined") {
|
|
237
|
-
console.warn(
|
|
238
|
-
"[tour][router] TanStackRouterSync requires @tanstack/react-router. Call this component only inside TanStack Router environments."
|
|
239
|
-
);
|
|
240
|
-
}
|
|
241
|
-
return null;
|
|
242
|
-
}
|
|
243
|
-
useTanStackRouterTourAdapter();
|
|
244
|
-
const router = useRouter2();
|
|
245
|
-
(0, import_react.useEffect)(() => {
|
|
246
|
-
setTourRouter(router);
|
|
247
|
-
onRouterAvailable?.(router);
|
|
248
|
-
return () => {
|
|
249
|
-
if (getTourRouter() === router) {
|
|
250
|
-
setTourRouter(null);
|
|
251
|
-
}
|
|
252
|
-
onRouterAvailable?.(null);
|
|
253
|
-
};
|
|
254
|
-
}, [router, onRouterAvailable]);
|
|
255
|
-
return null;
|
|
256
|
-
};
|
|
257
|
-
|
|
258
|
-
// src/router/tanstackRouterAdapter.tsx
|
|
259
|
-
var useTanStackRouterTourAdapter = () => {
|
|
260
|
-
const location = (0, import_react_router.useRouterState)({
|
|
261
|
-
select: (state) => state.location
|
|
262
|
-
});
|
|
263
|
-
(0, import_react2.useEffect)(() => {
|
|
264
|
-
const resolvedPathname = typeof location.pathname === "string" && location.pathname.length > 0 ? location.pathname : "/";
|
|
265
|
-
const resolvedSearch = "searchStr" in location && typeof location.searchStr === "string" ? location.searchStr : typeof location.search === "string" ? location.search : "";
|
|
266
|
-
const resolvedHash = typeof location.hash === "string" ? location.hash : "";
|
|
267
|
-
const path = typeof location.href === "string" && location.href.length > 0 ? location.href : createPathString(resolvedPathname, resolvedSearch, resolvedHash);
|
|
268
|
-
notifyRouteChange(path);
|
|
269
|
-
}, [location]);
|
|
270
|
-
};
|
|
271
198
|
// Annotate the CommonJS export names for ESM import in node:
|
|
272
199
|
0 && (module.exports = {
|
|
273
|
-
TanStackRouterSync,
|
|
274
200
|
createPathString,
|
|
275
201
|
getCurrentRoutePath,
|
|
276
|
-
getTanStackRouter,
|
|
277
|
-
getTourRouter,
|
|
278
202
|
matchRoute,
|
|
279
203
|
notifyRouteChange,
|
|
280
204
|
routeGatingChannel,
|
|
281
|
-
|
|
282
|
-
setTourRouter,
|
|
283
|
-
subscribeToRouteChanges,
|
|
284
|
-
useTanStackRouterTourAdapter
|
|
205
|
+
subscribeToRouteChanges
|
|
285
206
|
});
|
package/dist/router/index.d.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
1
|
export { getCurrentRoutePath, matchRoute, notifyRouteChange, routeGatingChannel, subscribeToRouteChanges, } from './routeGating';
|
|
2
2
|
export { createPathString } from './utils';
|
|
3
|
-
export { useTanStackRouterTourAdapter } from './tanstackRouterAdapter';
|
|
4
|
-
export { getTanStackRouter, getTourRouter, setTanStackRouter, setTourRouter, TanStackRouterSync, } from './tanstackRouterSync';
|
|
5
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/router/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,UAAU,EACV,iBAAiB,EACjB,kBAAkB,EAClB,uBAAuB,GACxB,MAAM,eAAe,CAAA;AAEtB,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/router/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,UAAU,EACV,iBAAiB,EACjB,kBAAkB,EAClB,uBAAuB,GACxB,MAAM,eAAe,CAAA;AAEtB,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA"}
|
package/dist/router/index.mjs
CHANGED
|
@@ -1,12 +1,4 @@
|
|
|
1
|
-
import "../chunk-
|
|
2
|
-
import {
|
|
3
|
-
TanStackRouterSync,
|
|
4
|
-
getTanStackRouter,
|
|
5
|
-
getTourRouter,
|
|
6
|
-
setTanStackRouter,
|
|
7
|
-
setTourRouter,
|
|
8
|
-
useTanStackRouterTourAdapter
|
|
9
|
-
} from "../chunk-2ZX2Y3JL.mjs";
|
|
1
|
+
import "../chunk-Y5EAQSU3.mjs";
|
|
10
2
|
import {
|
|
11
3
|
createPathString,
|
|
12
4
|
getCurrentRoutePath,
|
|
@@ -16,16 +8,10 @@ import {
|
|
|
16
8
|
subscribeToRouteChanges
|
|
17
9
|
} from "../chunk-B44EX7YT.mjs";
|
|
18
10
|
export {
|
|
19
|
-
TanStackRouterSync,
|
|
20
11
|
createPathString,
|
|
21
12
|
getCurrentRoutePath,
|
|
22
|
-
getTanStackRouter,
|
|
23
|
-
getTourRouter,
|
|
24
13
|
matchRoute,
|
|
25
14
|
notifyRouteChange,
|
|
26
15
|
routeGatingChannel,
|
|
27
|
-
|
|
28
|
-
setTourRouter,
|
|
29
|
-
subscribeToRouteChanges,
|
|
30
|
-
useTanStackRouterTourAdapter
|
|
16
|
+
subscribeToRouteChanges
|
|
31
17
|
};
|
|
@@ -1,12 +1,64 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
} from "
|
|
9
|
-
|
|
2
|
+
createPathString,
|
|
3
|
+
notifyRouteChange
|
|
4
|
+
} from "../chunk-B44EX7YT.mjs";
|
|
5
|
+
|
|
6
|
+
// src/router/tanstackRouterAdapter.tsx
|
|
7
|
+
import { useRouterState } from "@tanstack/react-router";
|
|
8
|
+
import { useEffect as useEffect2 } from "react";
|
|
9
|
+
|
|
10
|
+
// src/router/tanstackRouterSync.tsx
|
|
11
|
+
import * as TanStackRouter from "@tanstack/react-router";
|
|
12
|
+
import { useEffect } from "react";
|
|
13
|
+
var currentRouter = null;
|
|
14
|
+
var setTourRouter = (router) => {
|
|
15
|
+
currentRouter = router;
|
|
16
|
+
};
|
|
17
|
+
var setTanStackRouter = setTourRouter;
|
|
18
|
+
var getTourRouter = () => {
|
|
19
|
+
return currentRouter;
|
|
20
|
+
};
|
|
21
|
+
var getTanStackRouter = getTourRouter;
|
|
22
|
+
var TanStackRouterSync = ({
|
|
23
|
+
onRouterAvailable
|
|
24
|
+
}) => {
|
|
25
|
+
const useRouter2 = TanStackRouter.useRouter;
|
|
26
|
+
if (typeof useRouter2 !== "function") {
|
|
27
|
+
if (typeof console !== "undefined") {
|
|
28
|
+
console.warn(
|
|
29
|
+
"[tour][router] TanStackRouterSync requires @tanstack/react-router. Call this component only inside TanStack Router environments."
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
useTanStackRouterTourAdapter();
|
|
35
|
+
const router = useRouter2();
|
|
36
|
+
useEffect(() => {
|
|
37
|
+
setTourRouter(router);
|
|
38
|
+
onRouterAvailable?.(router);
|
|
39
|
+
return () => {
|
|
40
|
+
if (getTourRouter() === router) {
|
|
41
|
+
setTourRouter(null);
|
|
42
|
+
}
|
|
43
|
+
onRouterAvailable?.(null);
|
|
44
|
+
};
|
|
45
|
+
}, [router, onRouterAvailable]);
|
|
46
|
+
return null;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
// src/router/tanstackRouterAdapter.tsx
|
|
50
|
+
var useTanStackRouterTourAdapter = () => {
|
|
51
|
+
const location = useRouterState({
|
|
52
|
+
select: (state) => state.location
|
|
53
|
+
});
|
|
54
|
+
useEffect2(() => {
|
|
55
|
+
const resolvedPathname = typeof location.pathname === "string" && location.pathname.length > 0 ? location.pathname : "/";
|
|
56
|
+
const resolvedSearch = "searchStr" in location && typeof location.searchStr === "string" ? location.searchStr : typeof location.search === "string" ? location.search : "";
|
|
57
|
+
const resolvedHash = typeof location.hash === "string" ? location.hash : "";
|
|
58
|
+
const path = typeof location.href === "string" && location.href.length > 0 ? location.href : createPathString(resolvedPathname, resolvedSearch, resolvedHash);
|
|
59
|
+
notifyRouteChange(path);
|
|
60
|
+
}, [location]);
|
|
61
|
+
};
|
|
10
62
|
export {
|
|
11
63
|
TanStackRouterSync,
|
|
12
64
|
getTanStackRouter,
|
package/package.json
CHANGED
package/dist/chunk-2ZX2Y3JL.mjs
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
createPathString,
|
|
3
|
-
notifyRouteChange
|
|
4
|
-
} from "./chunk-B44EX7YT.mjs";
|
|
5
|
-
|
|
6
|
-
// src/router/tanstackRouterAdapter.tsx
|
|
7
|
-
import { useRouterState } from "@tanstack/react-router";
|
|
8
|
-
import { useEffect as useEffect2 } from "react";
|
|
9
|
-
|
|
10
|
-
// src/router/tanstackRouterSync.tsx
|
|
11
|
-
import * as TanStackRouter from "@tanstack/react-router";
|
|
12
|
-
import { useEffect } from "react";
|
|
13
|
-
var currentRouter = null;
|
|
14
|
-
var setTourRouter = (router) => {
|
|
15
|
-
currentRouter = router;
|
|
16
|
-
};
|
|
17
|
-
var setTanStackRouter = setTourRouter;
|
|
18
|
-
var getTourRouter = () => {
|
|
19
|
-
return currentRouter;
|
|
20
|
-
};
|
|
21
|
-
var getTanStackRouter = getTourRouter;
|
|
22
|
-
var TanStackRouterSync = ({
|
|
23
|
-
onRouterAvailable
|
|
24
|
-
}) => {
|
|
25
|
-
const useRouter2 = TanStackRouter.useRouter;
|
|
26
|
-
if (typeof useRouter2 !== "function") {
|
|
27
|
-
if (typeof console !== "undefined") {
|
|
28
|
-
console.warn(
|
|
29
|
-
"[tour][router] TanStackRouterSync requires @tanstack/react-router. Call this component only inside TanStack Router environments."
|
|
30
|
-
);
|
|
31
|
-
}
|
|
32
|
-
return null;
|
|
33
|
-
}
|
|
34
|
-
useTanStackRouterTourAdapter();
|
|
35
|
-
const router = useRouter2();
|
|
36
|
-
useEffect(() => {
|
|
37
|
-
setTourRouter(router);
|
|
38
|
-
onRouterAvailable?.(router);
|
|
39
|
-
return () => {
|
|
40
|
-
if (getTourRouter() === router) {
|
|
41
|
-
setTourRouter(null);
|
|
42
|
-
}
|
|
43
|
-
onRouterAvailable?.(null);
|
|
44
|
-
};
|
|
45
|
-
}, [router, onRouterAvailable]);
|
|
46
|
-
return null;
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
// src/router/tanstackRouterAdapter.tsx
|
|
50
|
-
var useTanStackRouterTourAdapter = () => {
|
|
51
|
-
const location = useRouterState({
|
|
52
|
-
select: (state) => state.location
|
|
53
|
-
});
|
|
54
|
-
useEffect2(() => {
|
|
55
|
-
const resolvedPathname = typeof location.pathname === "string" && location.pathname.length > 0 ? location.pathname : "/";
|
|
56
|
-
const resolvedSearch = "searchStr" in location && typeof location.searchStr === "string" ? location.searchStr : typeof location.search === "string" ? location.search : "";
|
|
57
|
-
const resolvedHash = typeof location.hash === "string" ? location.hash : "";
|
|
58
|
-
const path = typeof location.href === "string" && location.href.length > 0 ? location.href : createPathString(resolvedPathname, resolvedSearch, resolvedHash);
|
|
59
|
-
notifyRouteChange(path);
|
|
60
|
-
}, [location]);
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
export {
|
|
64
|
-
setTourRouter,
|
|
65
|
-
setTanStackRouter,
|
|
66
|
-
getTourRouter,
|
|
67
|
-
getTanStackRouter,
|
|
68
|
-
TanStackRouterSync,
|
|
69
|
-
useTanStackRouterTourAdapter
|
|
70
|
-
};
|
|
File without changes
|