piral-core 0.15.1-beta.4906 → 0.15.1-beta.4908

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/codegen.js CHANGED
@@ -5142,7 +5142,7 @@ __export(exports, {
5142
5142
  // ../../tooling/piral-cli/src/external/resolve.ts
5143
5143
  var fs = __toModule(require_graceful_fs());
5144
5144
  var import_enhanced_resolve = __toModule(require_lib2());
5145
- var nodeFileSystem = new import_enhanced_resolve.CachedInputFileSystem(fs, 4e3);
5145
+ var nodeFileSystem = new import_enhanced_resolve.CachedInputFileSystem(fs, 100);
5146
5146
  var nodeContext = {
5147
5147
  environments: ["node+es3+es5+process+native"]
5148
5148
  };
@@ -7,5 +7,7 @@ export declare function removePilet(ctx: GlobalStateContext, name: string): Prom
7
7
  export declare function injectPilet(ctx: GlobalStateContext, pilet: Pilet): Pilet;
8
8
  export declare function setComponent<TKey extends keyof ComponentsState>(ctx: GlobalStateContext, name: TKey, component: ComponentsState[TKey]): void;
9
9
  export declare function setErrorComponent<TKey extends keyof ErrorComponentsState>(ctx: GlobalStateContext, type: TKey, component: ErrorComponentsState[TKey]): void;
10
- export declare function setRoute<T = {}>(ctx: GlobalStateContext, path: string, component: ComponentType<RouteComponentProps<T>>): void;
10
+ export declare function setRoute<T extends {
11
+ [K in keyof T]?: string;
12
+ } = {}>(ctx: GlobalStateContext, path: string, component: ComponentType<RouteComponentProps<T>>): void;
11
13
  export declare function includeProvider(ctx: GlobalStateContext, provider: JSX.Element): void;
@@ -3,7 +3,9 @@ import { RouteComponentProps } from 'react-router';
3
3
  /**
4
4
  * The props for the SetRoute component.
5
5
  */
6
- export interface SetRouteProps<T = {}> {
6
+ export interface SetRouteProps<T extends {
7
+ [K in keyof T]?: string;
8
+ } = {}> {
7
9
  /**
8
10
  * The path to the route.
9
11
  */
@@ -16,4 +18,6 @@ export interface SetRouteProps<T = {}> {
16
18
  /**
17
19
  * The component capable of setting a global route at mounting.
18
20
  */
19
- export declare function SetRoute<T = {}>({ path, component }: SetRouteProps<T>): React.ReactElement;
21
+ export declare function SetRoute<T extends {
22
+ [K in keyof T]?: string;
23
+ } = {}>({ path, component, }: SetRouteProps<T>): React.ReactElement;
@@ -2,7 +2,7 @@ import { useGlobalStateContext, useSetter } from '../hooks';
2
2
  /**
3
3
  * The component capable of setting a global route at mounting.
4
4
  */
5
- export function SetRoute({ path, component }) {
5
+ export function SetRoute({ path, component, }) {
6
6
  const { setRoute } = useGlobalStateContext();
7
7
  useSetter(() => component && setRoute(path, component));
8
8
  // tslint:disable-next-line:no-null-keyword
@@ -1 +1 @@
1
- {"version":3,"file":"SetRoute.js","sourceRoot":"","sources":["../../src/setters/SetRoute.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAgB5D;;GAEG;AACH,MAAM,UAAU,QAAQ,CAAS,EAAE,IAAI,EAAE,SAAS,EAAoB;IACpE,MAAM,EAAE,QAAQ,EAAE,GAAG,qBAAqB,EAAE,CAAC;IAC7C,SAAS,CAAC,GAAG,EAAE,CAAC,SAAS,IAAI,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC;IACxD,2CAA2C;IAC3C,OAAO,IAAI,CAAC;AACd,CAAC"}
1
+ {"version":3,"file":"SetRoute.js","sourceRoot":"","sources":["../../src/setters/SetRoute.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAgB5D;;GAEG;AACH,MAAM,UAAU,QAAQ,CAA6C,EACnE,IAAI,EACJ,SAAS,GACQ;IACjB,MAAM,EAAE,QAAQ,EAAE,GAAG,qBAAqB,EAAE,CAAC;IAC7C,SAAS,CAAC,GAAG,EAAE,CAAC,SAAS,IAAI,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC;IACxD,2CAA2C;IAC3C,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -46,12 +46,16 @@ export interface PiralPageMeta extends PiralCustomPageMeta {
46
46
  /**
47
47
  * The props that every registered page component obtains.
48
48
  */
49
- export interface RouteBaseProps<UrlParams = any, UrlState = any> extends RouteComponentProps<UrlParams, {}, UrlState>, BaseComponentProps {
49
+ export interface RouteBaseProps<UrlParams extends {
50
+ [K in keyof UrlParams]?: string;
51
+ } = {}, UrlState = any> extends RouteComponentProps<UrlParams, {}, UrlState>, BaseComponentProps {
50
52
  }
51
53
  /**
52
54
  * The props used by a page component.
53
55
  */
54
- export interface PageComponentProps<T = any, S = any> extends RouteBaseProps<T, S> {
56
+ export interface PageComponentProps<T extends {
57
+ [K in keyof T]?: string;
58
+ } = {}, S = any> extends RouteBaseProps<T, S> {
55
59
  /**
56
60
  * The meta data registered with the page.
57
61
  */
@@ -264,7 +264,9 @@ export interface PiralActions extends PiralCustomActions {
264
264
  * @param path The name of the component.
265
265
  * @param component The component to use for rendering.
266
266
  */
267
- setRoute<T = {}>(path: string, component: ComponentType<RouteComponentProps<T>>): void;
267
+ setRoute<T extends {
268
+ [K in keyof T]?: string;
269
+ } = {}>(path: string, component: ComponentType<RouteComponentProps<T>>): void;
268
270
  /**
269
271
  * Includes a new provider as a sub-provider to the current provider.
270
272
  * @param provider The provider to include.
@@ -52,4 +52,6 @@ export declare function withProvider(provider: JSX.Element): (state: GlobalState
52
52
  * @param component The component representing the route.
53
53
  * @returns The dispatcher.
54
54
  */
55
- export declare function withRoute<T>(path: string, component: ComponentType<RouteComponentProps<T>>): (state: GlobalState) => GlobalState;
55
+ export declare function withRoute<T extends {
56
+ [K in keyof T]?: string;
57
+ } = {}>(path: string, component: ComponentType<RouteComponentProps<T>>): (state: GlobalState) => GlobalState;
@@ -1 +1 @@
1
- {"version":3,"file":"state.js","sourceRoot":"","sources":["../../src/utils/state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAiB,aAAa,EAAE,MAAM,OAAO,CAAC;AAEnE,OAAO,EAAE,W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AC,KAAK,CAAC,CAAC,IACzG,CAAC;AACL,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,SAAS,CACvB,IAAY,EACZ,SAAgD;IAEhD,OAAO,CAAC,KAAkB,EAAe,EAAE,CAAC,iCACvC,KAAK,KACR,MAAM,EAAE,OAAO,CAAC,KAAK,CAAC,MAAM,EAAE,IAAI,EAAE,SAAS,CAAC,IAC9C,CAAC;AACL,CAAC"}
@@ -7,5 +7,7 @@ export declare function removePilet(ctx: GlobalStateContext, name: string): Prom
7
7
  export declare function injectPilet(ctx: GlobalStateContext, pilet: Pilet): Pilet;
8
8
  export declare function setComponent<TKey extends keyof ComponentsState>(ctx: GlobalStateContext, name: TKey, component: ComponentsState[TKey]): void;
9
9
  export declare function setErrorComponent<TKey extends keyof ErrorComponentsState>(ctx: GlobalStateContext, type: TKey, component: ErrorComponentsState[TKey]): void;
10
- export declare function setRoute<T = {}>(ctx: GlobalStateContext, path: string, component: ComponentType<RouteComponentProps<T>>): void;
10
+ export declare function setRoute<T extends {
11
+ [K in keyof T]?: string;
12
+ } = {}>(ctx: GlobalStateContext, path: string, component: ComponentType<RouteComponentProps<T>>): void;
11
13
  export declare function includeProvider(ctx: GlobalStateContext, provider: JSX.Element): void;
@@ -3,7 +3,9 @@ import { RouteComponentProps } from 'react-router';
3
3
  /**
4
4
  * The props for the SetRoute component.
5
5
  */
6
- export interface SetRouteProps<T = {}> {
6
+ export interface SetRouteProps<T extends {
7
+ [K in keyof T]?: string;
8
+ } = {}> {
7
9
  /**
8
10
  * The path to the route.
9
11
  */
@@ -16,4 +18,6 @@ export interface SetRouteProps<T = {}> {
16
18
  /**
17
19
  * The component capable of setting a global route at mounting.
18
20
  */
19
- export declare function SetRoute<T = {}>({ path, component }: SetRouteProps<T>): React.ReactElement;
21
+ export declare function SetRoute<T extends {
22
+ [K in keyof T]?: string;
23
+ } = {}>({ path, component, }: SetRouteProps<T>): React.ReactElement;
@@ -5,7 +5,7 @@ const hooks_1 = require("../hooks");
5
5
  /**
6
6
  * The component capable of setting a global route at mounting.
7
7
  */
8
- function SetRoute({ path, component }) {
8
+ function SetRoute({ path, component, }) {
9
9
  const { setRoute } = (0, hooks_1.useGlobalStateContext)();
10
10
  (0, hooks_1.useSetter)(() => component && setRoute(path, component));
11
11
  // tslint:disable-next-line:no-null-keyword
@@ -1 +1 @@
1
- {"version":3,"file":"SetRoute.js","sourceRoot":"","sources":["../../src/setters/SetRoute.tsx"],"names":[],"mappings":";;;AAEA,oCAA4D;AAgB5D;;GAEG;AACH,SAAgB,QAAQ,CAAS,EAAE,IAAI,EAAE,SAAS,EAAoB;IACpE,MAAM,EAAE,QAAQ,EAAE,GAAG,IAAA,6BAAqB,GAAE,CAAC;IAC7C,IAAA,iBAAS,EAAC,GAAG,EAAE,CAAC,SAAS,IAAI,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC;IACxD,2CAA2C;IAC3C,OAAO,IAAI,CAAC;AACd,CAAC;AALD,4BAKC"}
1
+ {"version":3,"file":"SetRoute.js","sourceRoot":"","sources":["../../src/setters/SetRoute.tsx"],"names":[],"mappings":";;;AAEA,oCAA4D;AAgB5D;;GAEG;AACH,SAAgB,QAAQ,CAA6C,EACnE,IAAI,EACJ,SAAS,GACQ;IACjB,MAAM,EAAE,QAAQ,EAAE,GAAG,IAAA,6BAAqB,GAAE,CAAC;IAC7C,IAAA,iBAAS,EAAC,GAAG,EAAE,CAAC,SAAS,IAAI,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC;IACxD,2CAA2C;IAC3C,OAAO,IAAI,CAAC;AACd,CAAC;AARD,4BAQC"}
@@ -46,12 +46,16 @@ export interface PiralPageMeta extends PiralCustomPageMeta {
46
46
  /**
47
47
  * The props that every registered page component obtains.
48
48
  */
49
- export interface RouteBaseProps<UrlParams = any, UrlState = any> extends RouteComponentProps<UrlParams, {}, UrlState>, BaseComponentProps {
49
+ export interface RouteBaseProps<UrlParams extends {
50
+ [K in keyof UrlParams]?: string;
51
+ } = {}, UrlState = any> extends RouteComponentProps<UrlParams, {}, UrlState>, BaseComponentProps {
50
52
  }
51
53
  /**
52
54
  * The props used by a page component.
53
55
  */
54
- export interface PageComponentProps<T = any, S = any> extends RouteBaseProps<T, S> {
56
+ export interface PageComponentProps<T extends {
57
+ [K in keyof T]?: string;
58
+ } = {}, S = any> extends RouteBaseProps<T, S> {
55
59
  /**
56
60
  * The meta data registered with the page.
57
61
  */
@@ -264,7 +264,9 @@ export interface PiralActions extends PiralCustomActions {
264
264
  * @param path The name of the component.
265
265
  * @param component The component to use for rendering.
266
266
  */
267
- setRoute<T = {}>(path: string, component: ComponentType<RouteComponentProps<T>>): void;
267
+ setRoute<T extends {
268
+ [K in keyof T]?: string;
269
+ } = {}>(path: string, component: ComponentType<RouteComponentProps<T>>): void;
268
270
  /**
269
271
  * Includes a new provider as a sub-provider to the current provider.
270
272
  * @param provider The provider to include.
@@ -52,4 +52,6 @@ export declare function withProvider(provider: JSX.Element): (state: GlobalState
52
52
  * @param component The component representing the route.
53
53
  * @returns The dispatcher.
54
54
  */
55
- export declare function withRoute<T>(path: string, component: ComponentType<RouteComponentProps<T>>): (state: GlobalState) => GlobalState;
55
+ export declare function withRoute<T extends {
56
+ [K in keyof T]?: string;
57
+ } = {}>(path: string, component: ComponentType<RouteComponentProps<T>>): (state: GlobalState) => GlobalState;
@@ -1 +1 @@
1
- {"version":3,"file":"state.js","sourceRoot":"","sources":["../../src/utils/state.ts"],"names":[],"mappings":";;;AAAA,iCAAmE;AAEnE,2CAA0C;AAC1C,uCAAuE;AAGvE;;;GAGG;AACH,SAAgB,OAAO,CAAC,GAAG,WAAuD;IAChF,OAAO,CAAC,KAAkB,EAAe,EAAE;QACzC,KAAK,MAAM,UAAU,IAAI,WAAW,EAAE;YACpC,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC;SAC3B;QAED,OAAO,KAAK,CAAC;IACf,CAAC,CAAC;AACJ,CAAC;AARD,0BAQC;A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,CAAC;AARD,8BAQC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "piral-core",
3
- "version": "0.15.1-beta.4906",
3
+ "version": "0.15.1-beta.4908",
4
4
  "description": "The core library for creating a Piral instance.",
5
5
  "keywords": [
6
6
  "portal",
@@ -72,8 +72,8 @@
72
72
  "test": "echo \"Error: run tests from root\" && exit 1"
73
73
  },
74
74
  "dependencies": {
75
- "piral-base": "0.15.1-beta.4906",
76
- "piral-debug-utils": "0.15.1-beta.4906",
75
+ "piral-base": "0.15.1-beta.4908",
76
+ "piral-debug-utils": "0.15.1-beta.4908",
77
77
  "zustand": "^3.0.0"
78
78
  },
79
79
  "peerDependencies": {
@@ -99,5 +99,5 @@
99
99
  "react-router-dom",
100
100
  "tslib"
101
101
  ],
102
- "gitHead": "478dd9009975d891b6734ea0a0ba499fc9212126"
102
+ "gitHead": "83a8aa5c0a1994ca184276864022e09da2e87195"
103
103
  }
@@ -82,7 +82,7 @@ export function setErrorComponent<TKey extends keyof ErrorComponentsState>(
82
82
  }));
83
83
  }
84
84
 
85
- export function setRoute<T = {}>(
85
+ export function setRoute<T extends { [K in keyof T]?: string } = {}>(
86
86
  ctx: GlobalStateContext,
87
87
  path: string,
88
88
  component: ComponentType<RouteComponentProps<T>>,
@@ -5,7 +5,7 @@ import { useGlobalStateContext, useSetter } from '../hooks';
5
5
  /**
6
6
  * The props for the SetRoute component.
7
7
  */
8
- export interface SetRouteProps<T = {}> {
8
+ export interface SetRouteProps<T extends { [K in keyof T]?: string } = {}> {
9
9
  /**
10
10
  * The path to the route.
11
11
  */
@@ -19,7 +19,10 @@ export interface SetRouteProps<T = {}> {
19
19
  /**
20
20
  * The component capable of setting a global route at mounting.
21
21
  */
22
- export function SetRoute<T = {}>({ path, component }: SetRouteProps<T>): React.ReactElement {
22
+ export function SetRoute<T extends { [K in keyof T]?: string } = {}>({
23
+ path,
24
+ component,
25
+ }: SetRouteProps<T>): React.ReactElement {
23
26
  const { setRoute } = useGlobalStateContext();
24
27
  useSetter(() => component && setRoute(path, component));
25
28
  // tslint:disable-next-line:no-null-keyword
package/src/types/api.ts CHANGED
@@ -61,14 +61,14 @@ export interface PiralPageMeta extends PiralCustomPageMeta {}
61
61
  /**
62
62
  * The props that every registered page component obtains.
63
63
  */
64
- export interface RouteBaseProps<UrlParams = any, UrlState = any>
64
+ export interface RouteBaseProps<UrlParams extends { [K in keyof UrlParams]?: string } = {}, UrlState = any>
65
65
  extends RouteComponentProps<UrlParams, {}, UrlState>,
66
66
  BaseComponentProps {}
67
67
 
68
68
  /**
69
69
  * The props used by a page component.
70
70
  */
71
- export interface PageComponentProps<T = any, S = any> extends RouteBaseProps<T, S> {
71
+ export interface PageComponentProps<T extends { [K in keyof T]?: string } = {}, S = any> extends RouteBaseProps<T, S> {
72
72
  /**
73
73
  * The meta data registered with the page.
74
74
  */
@@ -297,7 +297,10 @@ export interface PiralActions extends PiralCustomActions {
297
297
  * @param path The name of the component.
298
298
  * @param component The component to use for rendering.
299
299
  */
300
- setRoute<T = {}>(path: string, component: ComponentType<RouteComponentProps<T>>): void;
300
+ setRoute<T extends { [K in keyof T]?: string } = {}>(
301
+ path: string,
302
+ component: ComponentType<RouteComponentProps<T>>,
303
+ ): void;
301
304
  /**
302
305
  * Includes a new provider as a sub-provider to the current provider.
303
306
  * @param provider The provider to include.
@@ -120,7 +120,10 @@ export function withProvider(provider: JSX.Element) {
120
120
  * @param component The component representing the route.
121
121
  * @returns The dispatcher.
122
122
  */
123
- export function withRoute<T>(path: string, component: ComponentType<RouteComponentProps<T>>) {
123
+ export function withRoute<T extends { [K in keyof T]?: string } = {}>(
124
+ path: string,
125
+ component: ComponentType<RouteComponentProps<T>>,
126
+ ) {
124
127
  return (state: GlobalState): GlobalState => ({
125
128
  ...state,
126
129
  routes: withKey(state.routes, path, component),