@koordinates/xstate-tree 4.1.0-beta.5 → 4.1.0-beta.6

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/lib/index.js CHANGED
@@ -3,6 +3,6 @@ export * from "./slots";
3
3
  export { broadcast, buildRootComponent, onBroadcast } from "./xstateTree";
4
4
  export * from "./types";
5
5
  export { buildTestRootComponent, buildViewProps, genericSlotsTestingDummy, slotTestingDummyFactory, } from "./testingUtilities";
6
- export { Link, buildCreateRoute, matchRoute, useIsRouteActive, useRouteArgsIfActive, } from "./routing";
6
+ export { Link, buildCreateRoute, matchRoute, useIsRouteActive, useRouteArgsIfActive, TestRoutingContext, } from "./routing";
7
7
  export { loggingMetaOptions } from "./useService";
8
8
  export { lazy } from "./lazy";
@@ -5,4 +5,4 @@ export { matchRoute } from "./matchRoute";
5
5
  export { handleLocationChange, } from "./handleLocationChange";
6
6
  export { useIsRouteActive } from "./useIsRouteActive";
7
7
  export { useRouteArgsIfActive } from "./useRouteArgsIfActive";
8
- export { RoutingContext } from "./providers";
8
+ export { RoutingContext, TestRoutingContext } from "./providers";
@@ -1,3 +1,4 @@
1
+ import React from "react";
1
2
  import { createContext, useContext } from "react";
2
3
  export const RoutingContext = createContext(undefined);
3
4
  function useRoutingContext() {
@@ -17,3 +18,14 @@ export function useActiveRouteEvents() {
17
18
  return undefined;
18
19
  }
19
20
  }
21
+ /**
22
+ * @public
23
+ *
24
+ * Renders the xstate-tree routing context. Designed for use in tests/storybook
25
+ * for components that make use of routing hooks but aren't part of an xstate-tree view
26
+ *
27
+ * @param activeRouteEvents - The active route events to use in the context
28
+ */
29
+ export function TestRoutingContext({ activeRouteEvents, children, }) {
30
+ return (React.createElement(RoutingContext.Provider, { value: { activeRouteEvents: { current: activeRouteEvents } } }, children));
31
+ }
@@ -697,6 +697,19 @@ declare type States = {
697
697
  */
698
698
  export declare type StyledLink<TStyleProps = {}> = <TRoute extends AnyRoute>(props: LinkProps<TRoute> & TStyleProps) => JSX.Element;
699
699
 
700
+ /**
701
+ * @public
702
+ *
703
+ * Renders the xstate-tree routing context. Designed for use in tests/storybook
704
+ * for components that make use of routing hooks but aren't part of an xstate-tree view
705
+ *
706
+ * @param activeRouteEvents - The active route events to use in the context
707
+ */
708
+ export declare function TestRoutingContext({ activeRouteEvents, children, }: {
709
+ activeRouteEvents: RoutingEvent<any>[];
710
+ children: React_2.ReactNode;
711
+ }): JSX.Element;
712
+
700
713
  /**
701
714
  * @public
702
715
  * Accepts Routes and returns true if any route is currently active. False if not.
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@koordinates/xstate-tree",
3
3
  "main": "lib/index.js",
4
4
  "types": "lib/xstate-tree.d.ts",
5
- "version": "4.1.0-beta.5",
5
+ "version": "4.1.0-beta.6",
6
6
  "license": "MIT",
7
7
  "description": "Build UIs with Actors using xstate and React",
8
8
  "keywords": [