@breautek/router 4.1.1 → 4.1.3

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/router.js CHANGED
@@ -1,18 +1,5 @@
1
1
  'use strict';
2
2
 
3
-
4
-
5
- function ___$insertStyle(css) {
6
- if (!css || typeof window === 'undefined') {
7
- return;
8
- }
9
- const style = document.createElement('style');
10
- style.setAttribute('type', 'text/css');
11
- style.innerHTML = css;
12
- document.head.appendChild(style);
13
- return css;
14
- }
15
-
16
3
  var React = require('react');
17
4
  var events = require('events');
18
5
 
@@ -537,7 +524,7 @@ class Router extends React__namespace.Component {
537
524
  }
538
525
  exitTransitionPromise.then(() => {
539
526
  let entryTransitionPromise = null;
540
- if (this.$incomingRoute.props.entryTransition) {
527
+ if (this.$incomingRoute && this.$incomingRoute.props.entryTransition) {
541
528
  entryTransitionPromise = this.$incomingRoute.props.entryTransition.execute(this.$incomingRoute.getView(), this.$exitingRoute.getView());
542
529
  }
543
530
  else {
@@ -733,7 +720,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
733
720
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
734
721
  PERFORMANCE OF THIS SOFTWARE.
735
722
  ***************************************************************************** */
736
- /* global Reflect, Promise, SuppressedError, Symbol */
723
+ /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
737
724
 
738
725
 
739
726
  function __awaiter(thisArg, _arguments, P, generator) {
@@ -751,7 +738,18 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
751
738
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
752
739
  };
753
740
 
754
- ___$insertStyle(".View {\n position: static;\n top: 0px;\n left: 0px;\n width: 100%;\n height: 100%;\n z-index: 1;\n}");
741
+ function insertStyle(css) {
742
+ if (typeof window === 'undefined') {
743
+ return;
744
+ }
745
+ const style = document.createElement('style');
746
+ style.setAttribute('type', 'text/css');
747
+ style.innerHTML = css;
748
+ document.head.appendChild(style);
749
+ return css;
750
+ }
751
+
752
+ insertStyle(".View {\n position: static;\n top: 0px;\n left: 0px;\n width: 100%;\n height: 100%;\n z-index: 1;\n}");
755
753
 
756
754
  class View extends React__namespace.Component {
757
755
  /**
@@ -866,6 +864,7 @@ class Route extends React__namespace.Component {
866
864
  $getChildren(component) {
867
865
  let children = null;
868
866
  if (!component) {
867
+ // eslint-disable-next-line @typescript-eslint/no-this-alias
869
868
  component = this;
870
869
  }
871
870
  if (!component.props.children) {
@@ -1019,7 +1018,7 @@ class TransitionSlide extends TransitionStrategy {
1019
1018
  }
1020
1019
 
1021
1020
  var name = "@breautek/router";
1022
- var version = "4.1.1";
1021
+ var version = "4.1.3";
1023
1022
  var description = "An alternate react router.";
1024
1023
  var main = "dist/router.js";
1025
1024
  var types = "dist/src/api.d.ts";
@@ -1055,33 +1054,33 @@ var peerDependencies = {
1055
1054
  "react-dom": "16.x || 17.x || 18.x"
1056
1055
  };
1057
1056
  var devDependencies = {
1058
- "@rollup/plugin-commonjs": "25.0.7",
1059
- "@rollup/plugin-json": "6.0.1",
1060
- "@rollup/plugin-node-resolve": "15.2.3",
1061
- "@testing-library/jest-dom": "6.1.4",
1062
- "@testing-library/react": "14.0.0",
1063
- "@types/jest": "29.5.6",
1064
- "@types/react": "18.2.33",
1065
- "@types/react-dom": "18.2.14",
1066
- "@typescript-eslint/eslint-plugin": "6.9.0",
1067
- "@typescript-eslint/parser": "6.9.0",
1068
- ajv: "8.12.0",
1069
- eslint: "8.52.0",
1070
- "eslint-plugin-react": "7.33.2",
1071
- glob: "10.3.10",
1057
+ "@rollup/plugin-commonjs": "28.0.1",
1058
+ "@rollup/plugin-json": "6.1.0",
1059
+ "@rollup/plugin-node-resolve": "15.3.0",
1060
+ "@testing-library/jest-dom": "6.6.3",
1061
+ "@testing-library/react": "16.0.1",
1062
+ "@types/jest": "29.5.14",
1063
+ "@types/react": "18.3.12",
1064
+ "@types/react-dom": "18.3.1",
1065
+ "@typescript-eslint/eslint-plugin": "7.18.0",
1066
+ "@typescript-eslint/parser": "7.18.0",
1067
+ ajv: "8.17.1",
1068
+ eslint: "8.57.1",
1069
+ "eslint-plugin-react": "7.37.2",
1070
+ glob: "11.0.0",
1072
1071
  "ignore-styles": "5.0.1",
1073
1072
  jest: "29.7.0",
1074
1073
  "jest-environment-jsdom": "29.7.0",
1075
1074
  "node-sass": "9.0.0",
1076
- react: "18.2.0",
1077
- "react-dom": "18.2.0",
1078
- rollup: "4.1.4",
1075
+ react: "18.3.1",
1076
+ "react-dom": "18.3.1",
1077
+ rollup: "4.24.4",
1079
1078
  "rollup-plugin-progress": "1.1.2",
1080
- "rollup-plugin-sass": "1.12.21",
1079
+ "rollup-plugin-sass": "1.14.0",
1081
1080
  "rollup-plugin-typescript2": "0.36.0",
1082
- "ts-jest": "29.1.1",
1083
- "ts-node": "10.9.1",
1084
- typescript: "5.2.2"
1081
+ "ts-jest": "29.2.5",
1082
+ "ts-node": "10.9.2",
1083
+ typescript: "5.5.4"
1085
1084
  };
1086
1085
  var packageInfo = {
1087
1086
  name: name,
@@ -9,8 +9,17 @@ export interface IRouteProps<T> {
9
9
  index?: boolean;
10
10
  entryTransition?: TransitionStrategy;
11
11
  exitTransition?: TransitionStrategy;
12
+ /**
13
+ * @internal
14
+ */
12
15
  base?: string;
16
+ /**
17
+ * @internal
18
+ */
13
19
  componentProps?: T;
20
+ /**
21
+ * @internal
22
+ */
14
23
  matcher?: RouteMatcher;
15
24
  }
16
25
  export interface IComponentProps {
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { RouterStrategy } from './RouterStrategy';
3
2
  /**
4
3
  * Will be invoked when no routes are found. Default implementation is to simply return the `indexRoute`.
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { EventEmitter } from 'events';
3
2
  import { Router } from './Router';
4
3
  import { View } from './View';
@@ -38,7 +38,7 @@ export declare abstract class View<TPageProps extends IViewProps = IViewProps> e
38
38
  * Get the inline styles for this view.
39
39
  * Use React style notation.
40
40
  */
41
- getViewStyles(): Record<any, string>;
41
+ getViewStyles(): React.CSSProperties;
42
42
  protected abstract _renderView(): React.ReactNode;
43
43
  render(): React.ReactNode;
44
44
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@breautek/router",
3
- "version": "4.1.1",
3
+ "version": "4.1.3",
4
4
  "description": "An alternate react router.",
5
5
  "main": "dist/router.js",
6
6
  "types": "dist/src/api.d.ts",
@@ -36,32 +36,32 @@
36
36
  "react-dom": "16.x || 17.x || 18.x"
37
37
  },
38
38
  "devDependencies": {
39
- "@rollup/plugin-commonjs": "25.0.7",
40
- "@rollup/plugin-json": "6.0.1",
41
- "@rollup/plugin-node-resolve": "15.2.3",
42
- "@testing-library/jest-dom": "6.1.4",
43
- "@testing-library/react": "14.0.0",
44
- "@types/jest": "29.5.6",
45
- "@types/react": "18.2.33",
46
- "@types/react-dom": "18.2.14",
47
- "@typescript-eslint/eslint-plugin": "6.9.0",
48
- "@typescript-eslint/parser": "6.9.0",
49
- "ajv": "8.12.0",
50
- "eslint": "8.52.0",
51
- "eslint-plugin-react": "7.33.2",
52
- "glob": "10.3.10",
39
+ "@rollup/plugin-commonjs": "28.0.1",
40
+ "@rollup/plugin-json": "6.1.0",
41
+ "@rollup/plugin-node-resolve": "15.3.0",
42
+ "@testing-library/jest-dom": "6.6.3",
43
+ "@testing-library/react": "16.0.1",
44
+ "@types/jest": "29.5.14",
45
+ "@types/react": "18.3.12",
46
+ "@types/react-dom": "18.3.1",
47
+ "@typescript-eslint/eslint-plugin": "7.18.0",
48
+ "@typescript-eslint/parser": "7.18.0",
49
+ "ajv": "8.17.1",
50
+ "eslint": "8.57.1",
51
+ "eslint-plugin-react": "7.37.2",
52
+ "glob": "11.0.0",
53
53
  "ignore-styles": "5.0.1",
54
54
  "jest": "29.7.0",
55
55
  "jest-environment-jsdom": "29.7.0",
56
56
  "node-sass": "9.0.0",
57
- "react": "18.2.0",
58
- "react-dom": "18.2.0",
59
- "rollup": "4.1.4",
57
+ "react": "18.3.1",
58
+ "react-dom": "18.3.1",
59
+ "rollup": "4.24.4",
60
60
  "rollup-plugin-progress": "1.1.2",
61
- "rollup-plugin-sass": "1.12.21",
61
+ "rollup-plugin-sass": "1.14.0",
62
62
  "rollup-plugin-typescript2": "0.36.0",
63
- "ts-jest": "29.1.1",
64
- "ts-node": "10.9.1",
65
- "typescript": "5.2.2"
63
+ "ts-jest": "29.2.5",
64
+ "ts-node": "10.9.2",
65
+ "typescript": "5.5.4"
66
66
  }
67
67
  }
package/src/Route.tsx CHANGED
@@ -12,8 +12,19 @@ export interface IRouteProps<T> {
12
12
  entryTransition?: TransitionStrategy;
13
13
  exitTransition?: TransitionStrategy;
14
14
 
15
+ /**
16
+ * @internal
17
+ */
15
18
  base?: string;
19
+
20
+ /**
21
+ * @internal
22
+ */
16
23
  componentProps?: T;
24
+
25
+ /**
26
+ * @internal
27
+ */
17
28
  matcher?: RouteMatcher;
18
29
  }
19
30
 
@@ -90,6 +101,7 @@ export class Route<TComponentProps extends IComponentProps = IComponentProps, TR
90
101
  let children: React.ReactElement[] = null;
91
102
 
92
103
  if (!component) {
104
+ // eslint-disable-next-line @typescript-eslint/no-this-alias
93
105
  component = this;
94
106
  }
95
107
 
package/src/Router.tsx CHANGED
@@ -185,7 +185,7 @@ export class Router<TRouterProps extends IRouterProps = IRouterProps> extends Re
185
185
 
186
186
  exitTransitionPromise.then(() => {
187
187
  let entryTransitionPromise = null;
188
- if (this.$incomingRoute.props.entryTransition) {
188
+ if (this.$incomingRoute && this.$incomingRoute.props.entryTransition) {
189
189
  entryTransitionPromise = this.$incomingRoute.props.entryTransition.execute(this.$incomingRoute.getView(), this.$exitingRoute.getView());
190
190
  }
191
191
  else {
package/src/View.tsx CHANGED
@@ -87,7 +87,7 @@ export abstract class View<TPageProps extends IViewProps = IViewProps> extends R
87
87
  * Get the inline styles for this view.
88
88
  * Use React style notation.
89
89
  */
90
- public getViewStyles(): Record<any, string> {
90
+ public getViewStyles(): React.CSSProperties {
91
91
  return {};
92
92
  }
93
93