Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

piral-core

Package Overview
Dependencies
Maintainers
1
Versions
1027
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

piral-core - npm Package Compare versions

Comparing version 0.7.0-pre.638 to 0.7.0-pre.639

22

lib/components/default/errorInfo.js

@@ -18,5 +18,25 @@ "use strict";

" crashed.");
case 'tile':
return React.createElement("div", { key: "default_error" },
"Tile crashed: ",
props.error,
".");
case 'extension':
return React.createElement("div", { key: "default_error" },
"Extension crashed: ",
props.error,
".");
case 'modal':
return React.createElement("div", { key: "default_error" },
"Modal crashed: ",
props.error,
".");
case 'menu':
return React.createElement("div", { key: "default_error" },
"Menu crashed: ",
props.error,
".");
case 'loading':
return React.createElement("div", { key: "default_error" },
"Page could not be loaded: ",
"App could not be loaded: ",
props.error,

@@ -23,0 +43,0 @@ ".");

2

lib/components/portal.js

@@ -11,3 +11,3 @@ "use strict";

return (React.createElement(react_router_dom_1.Router, { history: history },
React.createElement(responsive_1.Responsive, null, loaded ? (children(error ? (React.createElement(ErrorInfo, { type: "loading", error: error })) : (React.createElement(routes_1.Routes, { Home: Dashboard, NotFound: props => React.createElement(ErrorInfo, Object.assign({ type: "not_found" }, props)) })))) : (React.createElement(Loader, null)))));
React.createElement(responsive_1.Responsive, null, loaded ? (error ? (React.createElement(ErrorInfo, { type: "loading", error: error })) : (children(React.createElement(routes_1.Routes, { Home: Dashboard, NotFound: props => React.createElement(ErrorInfo, Object.assign({ type: "not_found" }, props)) })))) : (React.createElement(Loader, null)))));
};

@@ -14,0 +14,0 @@ exports.Portal.displayName = 'Portal';

import * as React from 'react';
import { AnyComponent } from '../types';
import { AnyComponent, ErrorType } from '../types';
export interface ApiForward<TApi> {
piral: TApi;
}
export declare function withApi<TApi, TProps>(component: AnyComponent<TProps & ApiForward<TApi>>, piral: TApi): React.ComponentType<TProps>;
export declare function withApi<TApi, TProps>(component: AnyComponent<TProps & ApiForward<TApi>>, piral: TApi, errorType: ErrorType): React.ComponentType<TProps>;

@@ -6,3 +6,3 @@ "use strict";

const helpers_1 = require("./helpers");
function withApi(component, piral) {
function withApi(component, piral, errorType) {
return react_arbiter_1.wrapComponent(component, {

@@ -16,4 +16,4 @@ forwardProps: { piral },

},
renderError(error) {
return React.createElement(helpers_1.ComponentError, { type: "feed", error: error });
renderError(error, props) {
return React.createElement(helpers_1.ComponentError, Object.assign({ type: errorType, error: error }, props));
},

@@ -20,0 +20,0 @@ });

@@ -17,3 +17,3 @@ "use strict";

context.registerPage(route, {
component: components_1.withApi(arg, api),
component: components_1.withApi(arg, api, 'page'),
});

@@ -23,3 +23,3 @@ }

context.registerTile(id, {
component: components_1.withApi(arg, api),
component: components_1.withApi(arg, api, 'tile'),
preferences,

@@ -30,3 +30,3 @@ });

context.registerExtension(name, {
component: components_1.withApi(arg, api),
component: components_1.withApi(arg, api, 'extension'),
reference: arg,

@@ -38,3 +38,3 @@ defaults,

context.registerMenuItem(id, {
component: components_1.withApi(arg, api),
component: components_1.withApi(arg, api, 'menu'),
settings: {

@@ -47,3 +47,3 @@ type: settings.type || 'general',

context.registerModal(id, {
component: components_1.withApi(arg, api),
component: components_1.withApi(arg, api, 'modal'),
defaults,

@@ -50,0 +50,0 @@ });

import { ComponentType } from 'react';
import { RouteComponentProps } from 'react-router-dom';
import { Dict } from './common';
import { MenuType } from './menu';
export interface BaseComponentProps<TApi> {

@@ -49,2 +50,5 @@ /**

export declare type AnyComponent<T> = ComponentType<T> | ForeignComponent<T>;
/**
* The error used when a route cannot be resolved.
*/
export interface NotFoundErrorInfoProps extends RouteComponentProps {

@@ -56,2 +60,5 @@ /**

}
/**
* The error used when a registered page component crashes.
*/
export interface PageErrorInfoProps extends RouteComponentProps {

@@ -62,3 +69,10 @@ /**

type: 'page';
/**
* The provided error details.
*/
error: any;
}
/**
* The error used when loading a feed resulted in an error.
*/
export interface FeedErrorInfoProps {

@@ -74,2 +88,5 @@ /**

}
/**
* The error used when a form submission resulted in an error.
*/
export interface FormErrorInfoProps {

@@ -85,2 +102,5 @@ /**

}
/**
* The error used when the app could not be loaded.
*/
export interface LoadingErrorInfoProps {

@@ -96,3 +116,71 @@ /**

}
export declare type ErrorInfoProps = NotFoundErrorInfoProps | PageErrorInfoProps | FeedErrorInfoProps | LoadingErrorInfoProps | FormErrorInfoProps;
/**
* The error used when a registered tile component crashed.
*/
export interface TileErrorInfoProps {
/**
* The type of the error.
*/
type: 'tile';
/**
* The provided error details.
*/
error: any;
/**
* The currently used number of columns.
*/
columns: number;
/**
* The currently used number of rows.
*/
rows: number;
}
/**
* The error used when a registered menu item component crashed.
*/
export interface MenuItemErrorInfoProps {
/**
* The type of the error.
*/
type: 'menu';
/**
* The provided error details.
*/
error: any;
/**
* The type of the used menu.
*/
menu: MenuType;
}
/**
* The error used when a registered modal dialog crashed.
*/
export interface ModalErrorInfoProps {
/**
* The type of the error.
*/
type: 'modal';
/**
* The provided error details.
*/
error: any;
/**
* Callback for closing the modal programmatically.
*/
onClose(): void;
}
/**
* The error used when a registered extension component crashed.
*/
export interface ExtensionErrorInfoProps {
/**
* The type of the error.
*/
type: 'extension';
/**
* The provided error details.
*/
error: any;
}
export declare type ErrorInfoProps = NotFoundErrorInfoProps | PageErrorInfoProps | TileErrorInfoProps | MenuItemErrorInfoProps | ExtensionErrorInfoProps | ModalErrorInfoProps | FeedErrorInfoProps | LoadingErrorInfoProps | FormErrorInfoProps;
export declare type ErrorType = ErrorInfoProps['type'];

@@ -99,0 +187,0 @@ export interface LoaderProps {

{
"name": "piral-core",
"version": "0.7.0-pre.638",
"version": "0.7.0-pre.639",
"description": "The core library for creating a Piral instance.",

@@ -51,6 +51,6 @@ "keywords": [

"@dbeining/react-atom": "^4.0.0",
"react-arbiter": "^0.9.1",
"react-arbiter": "^0.9.2",
"tslib": "^1.10.0"
},
"gitHead": "11f9a4c5532ce747cecf3761a1006af0d603f5f4"
"gitHead": "0007b22a5fc0a5b8f5cdbfb1cf00664daa9cddbd"
}

@@ -38,3 +38,3 @@ import { ArbiterModuleMetadata, wrapElement, isfunc } from 'react-arbiter';

context.registerPage(route, {
component: withApi(arg, api) as any,
component: withApi(arg, api, 'page') as any,
});

@@ -51,3 +51,3 @@ }

context.registerTile(id, {
component: withApi(arg, api) as any,
component: withApi(arg, api, 'tile') as any,
preferences,

@@ -65,3 +65,3 @@ });

context.registerExtension(name, {
component: withApi(arg, api) as any,
component: withApi(arg, api, 'extension') as any,
reference: arg,

@@ -80,3 +80,3 @@ defaults,

context.registerMenuItem(id, {
component: withApi(arg, api) as any,
component: withApi(arg, api, 'menu') as any,
settings: {

@@ -96,3 +96,3 @@ type: settings.type || 'general',

context.registerModal(id, {
component: withApi(arg, api) as any,
component: withApi(arg, api, 'modal') as any,
defaults,

@@ -99,0 +99,0 @@ });

import { ComponentType } from 'react';
import { RouteComponentProps } from 'react-router-dom';
import { Dict } from './common';
import { MenuType } from './menu';

@@ -58,2 +59,5 @@ export interface BaseComponentProps<TApi> {

/**
* The error used when a route cannot be resolved.
*/
export interface NotFoundErrorInfoProps extends RouteComponentProps {

@@ -66,2 +70,5 @@ /**

/**
* The error used when a registered page component crashes.
*/
export interface PageErrorInfoProps extends RouteComponentProps {

@@ -72,4 +79,11 @@ /**

type: 'page';
/**
* The provided error details.
*/
error: any;
}
/**
* The error used when loading a feed resulted in an error.
*/
export interface FeedErrorInfoProps {

@@ -86,2 +100,5 @@ /**

/**
* The error used when a form submission resulted in an error.
*/
export interface FormErrorInfoProps {

@@ -98,2 +115,5 @@ /**

/**
* The error used when the app could not be loaded.
*/
export interface LoadingErrorInfoProps {

@@ -110,5 +130,81 @@ /**

/**
* The error used when a registered tile component crashed.
*/
export interface TileErrorInfoProps {
/**
* The type of the error.
*/
type: 'tile';
/**
* The provided error details.
*/
error: any;
/**
* The currently used number of columns.
*/
columns: number;
/**
* The currently used number of rows.
*/
rows: number;
}
/**
* The error used when a registered menu item component crashed.
*/
export interface MenuItemErrorInfoProps {
/**
* The type of the error.
*/
type: 'menu';
/**
* The provided error details.
*/
error: any;
/**
* The type of the used menu.
*/
menu: MenuType;
}
/**
* The error used when a registered modal dialog crashed.
*/
export interface ModalErrorInfoProps {
/**
* The type of the error.
*/
type: 'modal';
/**
* The provided error details.
*/
error: any;
/**
* Callback for closing the modal programmatically.
*/
onClose(): void;
}
/**
* The error used when a registered extension component crashed.
*/
export interface ExtensionErrorInfoProps {
/**
* The type of the error.
*/
type: 'extension';
/**
* The provided error details.
*/
error: any;
}
export type ErrorInfoProps =
| NotFoundErrorInfoProps
| PageErrorInfoProps
| TileErrorInfoProps
| MenuItemErrorInfoProps
| ExtensionErrorInfoProps
| ModalErrorInfoProps
| FeedErrorInfoProps

@@ -115,0 +211,0 @@ | LoadingErrorInfoProps

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc