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

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.2.0 to 0.3.0-pre.386

lib/components/helpers.d.ts

4

lib/components/default/dashboard.js

@@ -10,4 +10,4 @@ "use strict";

return (React.createElement(ExtensionSlot, { params: Object.assign({ tiles }, props), empty: () => (React.createElement(React.Fragment, { key: "default_dashboard" }, Object.keys(tiles).map(tile => {
const Component = tiles[tile].component;
return React.createElement(Component, { key: tile, columns: 1, rows: 1 });
const { component: Component, preferences: { initialColumns = 1, initialRows = 1 }, } = tiles[tile];
return React.createElement(Component, { key: tile, columns: initialColumns, rows: initialRows });
}))) }));

@@ -14,0 +14,0 @@ };

@@ -13,7 +13,2 @@ "use strict";

" not found.");
case 'feed':
return React.createElement("div", { key: "default_error" },
"Feed error: ",
props.error,
".");
case 'page':

@@ -29,2 +24,12 @@ return React.createElement("div", { key: "default_error" },

".");
case 'feed':
return React.createElement("div", { key: "default_error" },
"Feed error: ",
props.error,
".");
case 'form':
return React.createElement("div", { key: "default_error" },
"Form error: ",
props.error,
".");
}

@@ -31,0 +36,0 @@ } }));

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const React = require("react");
const react_arbiter_1 = require("react-arbiter");
const hooks_1 = require("../hooks");

@@ -11,3 +12,3 @@ function defaultRender(items) {

const extensions = hooks_1.useGlobalState(s => s.components.extensions[name] || []);
return render(extensions.length === 0 && typeof empty === 'function'
return render(extensions.length === 0 && react_arbiter_1.isfunc(empty)
? [empty()]

@@ -14,0 +15,0 @@ : extensions.map(({ component: Component }, i) => React.createElement(Component, { key: i, params: params })));

@@ -5,7 +5,3 @@ "use strict";

const react_arbiter_1 = require("react-arbiter");
const hooks_1 = require("../hooks");
const ComponentError = ({ error }) => {
const { ErrorInfo } = hooks_1.useGlobalState(s => s.app.components);
return React.createElement(ErrorInfo, { type: "feed", error: error });
};
const helpers_1 = require("./helpers");
function withApi(component, piral) {

@@ -17,4 +13,7 @@ return react_arbiter_1.wrapComponent(component, {

},
renderChild(child) {
return React.createElement(React.Suspense, { fallback: React.createElement(helpers_1.ComponentLoader, null) }, child);
},
renderError(error) {
return React.createElement(ComponentError, { error: error });
return React.createElement(helpers_1.ComponentError, { type: "feed", error: error });
},

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

@@ -5,8 +5,8 @@ "use strict";

const hooks_1 = require("../hooks");
const helpers_1 = require("./helpers");
function withFeed(Component, options) {
const FeedView = props => {
const { Loader, ErrorInfo } = hooks_1.useGlobalState(s => s.app.components);
const [loaded, data, error] = hooks_1.useFeed(options);
if (!loaded) {
return React.createElement(Loader, null);
return React.createElement(helpers_1.ComponentLoader, null);
}

@@ -17,3 +17,3 @@ else if (data) {

else {
return React.createElement(ErrorInfo, { type: "feed", error: error });
return React.createElement(helpers_1.ComponentError, { type: "feed", error: error });
}

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

@@ -5,2 +5,3 @@ "use strict";

const react_router_dom_1 = require("react-router-dom");
const helpers_1 = require("./helpers");
const hooks_1 = require("../hooks");

@@ -15,6 +16,5 @@ function withForm(Component, options) {

const { loadData, emptyData } = options;
const { Loader, ErrorInfo } = hooks_1.useGlobalState(s => s.app.components);
const { loading, data, error } = hooks_1.usePromise(() => typeof loadData !== 'function' ? Promise.resolve(emptyData) : loadData(props));
if (loading) {
return React.createElement(Loader, null);
return React.createElement(helpers_1.ComponentLoader, null);
}

@@ -25,3 +25,3 @@ else if (data) {

else {
return React.createElement(ErrorInfo, { type: "form", error: error });
return React.createElement(helpers_1.ComponentError, { type: "form", error: error });
}

@@ -28,0 +28,0 @@ };

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

function getExtender(plugins) {
const extenders = plugins.filter(m => typeof m === 'function');
const extenders = plugins.filter(react_arbiter_1.isfunc);
return container => {

@@ -27,0 +27,0 @@ extenders.forEach(extender => {

@@ -8,2 +8,3 @@ "use strict";

const utils_1 = require("../utils");
const react_arbiter_1 = require("react-arbiter");
function createDefaultState(data) {

@@ -26,3 +27,3 @@ return {

});
if (typeof onChange === 'function') {
if (react_arbiter_1.isfunc(onChange)) {
Promise.resolve(onChange(newData))

@@ -48,3 +49,3 @@ .then(data => {

});
if (typeof onSubmit === 'function') {
if (react_arbiter_1.isfunc(onSubmit)) {
Promise.resolve(onSubmit(state.currentData))

@@ -51,0 +52,0 @@ .then(() => updateState(id, state, {

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const react_1 = require("react");
const react_arbiter_1 = require("react-arbiter");
/**

@@ -15,3 +16,3 @@ * Hook to notify the user in case of potential data loss when

const beforeUnload = (ev) => {
const msg = typeof message === 'function' ? message() : message;
const msg = react_arbiter_1.isfunc(message) ? message() : message;
ev.returnValue = msg;

@@ -18,0 +19,0 @@ return msg;

@@ -92,2 +92,3 @@ import { ComponentType } from 'react';

export declare type ErrorInfoProps = NotFoundErrorInfoProps | PageErrorInfoProps | FeedErrorInfoProps | LoadingErrorInfoProps | FormErrorInfoProps;
export declare type ErrorType = ErrorInfoProps['type'];
export interface LoaderProps {

@@ -94,0 +95,0 @@ }

export interface PiralStorage {
/**
* Sets the value of an item.
* @param name The name of the item to set.
* @param data The new value of the item.
* @param expires Optional expiration information.
*/
setItem(name: string, data: string, expires?: string): void;
/**
* Gets the value of an item.
* @param name The name of the item to look for.
*/
getItem(name: string): string | null;
/**
* Removes an item from the storage.
* @param name The name of the item to remove.
*/
removeItem(name: string): void;
}
export interface LocalizationMessages {
/**
* The available languages (lang to wordings).
*/
[lang: string]: {
/**
* The available wordings (tag to translation).
*/
[tag: string]: string;
};
}
export interface Dict<T> {
[name: string]: T;
}
export declare type Dict<T> = Record<string, T>;
export declare type Without<T, K> = Pick<T, Exclude<keyof T, K>>;

@@ -15,0 +33,0 @@ export interface Disposable {

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const react_arbiter_1 = require("react-arbiter");
function createFeedOptions(id, resolver) {
let initialized;
if (typeof resolver === 'function') {
if (react_arbiter_1.isfunc(resolver)) {
return {

@@ -7,0 +8,0 @@ id,

{
"name": "piral-core",
"version": "0.2.0",
"version": "0.3.0-pre.386",
"description": "The core library for creating a Piral instance.",

@@ -50,5 +50,5 @@ "keywords": [

"@dbeining/react-atom": "^4.0.0",
"react-arbiter": "^0.4.1"
"react-arbiter": "^0.5.0"
},
"gitHead": "5a74ac9aa1fedac3d897cb1790adb229a9a76ace"
"gitHead": "295a4110d246967e3b7fd06cd59cadf3687b48aa"
}

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

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