arc-ux 0.0.12 → 0.0.13

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": "arc-ux",
3
- "version": "0.0.12",
3
+ "version": "0.0.13",
4
4
  "description": "A purely functional router for independently evaluating a path against a list of routes",
5
5
  "main": "src/ArcUX.js",
6
6
  "type": "module",
package/src/ArcUX.js CHANGED
@@ -1,4 +1,4 @@
1
- import {ArcRouter, ArcEvents, is} from "arc-lib";
1
+ import {ArcRouter, ArcEvents, is, Log} from "arc-lib";
2
2
  import {createRoot} from "react-dom/client";
3
3
  import React from "react";
4
4
  import Html from "./Html.js";
@@ -148,6 +148,14 @@ class ArcUX {
148
148
 
149
149
  pushURI(_newURI, _replace) {
150
150
  const fullHistoryString = decodeURI(_newURI);
151
+
152
+ const routeData = this.#RouteRenderer.travel(fullHistoryString)
153
+ Log.info('Push uri', [fullHistoryString, routeData]);
154
+ if(routeData.match){
155
+ this.setKeyVal('route', fullHistoryString, true);
156
+ this.setKeyVal('routeData', routeData, true);
157
+ }
158
+
151
159
  if (_replace) {
152
160
  return window.history.replaceState({ code: fullHistoryString }, "", fullHistoryString);
153
161
  }
@@ -30,7 +30,7 @@ class App extends React.Component {
30
30
  }
31
31
  };
32
32
 
33
- this.props.ArcUX.emit('log', {message: `Our initial route is ${initialRoute}`})
33
+ Log.info( `Our initial route is ${initialRoute}`);
34
34
  const match = this.props.ArcUX.renderRoute(initialRoute);
35
35
  if(match){
36
36
  this.setState({
@@ -58,7 +58,7 @@ class App extends React.Component {
58
58
  const RoutedComponent = this.state.target;
59
59
 
60
60
  if(!RoutedComponent){
61
- this.props.ArcUX.emit('log', {message: "Could not render anything. No AppLoader. No route matched. No NotFound handler. Returning null."})
61
+ Log.info("Could not render anything. No AppLoader. No route matched. No NotFound handler. Returning null.")
62
62
  return null;
63
63
  }
64
64
 
@@ -81,10 +81,10 @@ class App extends React.Component {
81
81
  }
82
82
 
83
83
  loadRoute(_newRoute) {
84
- this.props.ArcUX.emit('log', [{message: `New route called:`, data: [_newRoute]}])
84
+ Log.info(`New route called:`, [_newRoute]);
85
85
  const match = this.props.ArcUX.renderRoute(_newRoute);
86
86
  if(!match){
87
- this.props.ArcUX.emit('log', [{message: 'Not Found handler missing'}]);
87
+ Log.warning(`Not found handler missing`);
88
88
  return;
89
89
  }
90
90
  const fullHistoryString = decodeURI(_newRoute);