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

piral

Package Overview
Dependencies
Maintainers
1
Versions
1021
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

piral - npm Package Compare versions

Comparing version 0.3.1-pre.412 to 0.3.1-pre.413

lib/layout/vitalize.d.ts

3

lib/api.d.ts

@@ -9,1 +9,4 @@ import { PiralApi, PageComponentProps, TileComponentProps, MenuComponentProps, ExtensionComponentProps } from 'piral-core';

export declare type PiExtensionComponentProps<T = Record<string, any>> = ExtensionComponentProps<PiletApi, T>;
export interface PiralAttachment {
(api: PiletApi): void;
}

5

lib/layout/components/Menu.d.ts
import * as React from 'react';
export declare const Menu: React.SFC;
export interface MenuProps {
type?: string;
}
export declare const Menu: React.SFC<MenuProps>;

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

const piral_core_1 = require("piral-core");
exports.Menu = () => {
exports.Menu = ({ type = 'general' }) => {
const menuItems = piral_core_1.useGlobalState(s => s.components.menuItems);
return (React.createElement("pi-menu", null, Object.keys(menuItems).map(name => {
const item = menuItems[name];
if (item.settings.type === 'general') {
if (item.settings.type === type) {
const Component = item.component;

@@ -12,0 +12,0 @@ return (React.createElement("pi-item", { key: name },

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const React = require("react");
const standardComponents = require("./components");
const piral_core_1 = require("piral-core");
const rehydrate_1 = require("./rehydrate");
function vitalize(elements, children, components) {
const target = React.Children.toArray(elements);
for (let i = 0; i < target.length; i++) {
const element = target[i];
const type = element && element.type;
const id = element && element.props && element.props.htmlFor;
if (id && type === 'area') {
const Area = components.custom[id] || components[id] || standardComponents[id];
if (Area) {
target[i] = React.createElement(Area, element.props);
}
else if (/^content$/i.test(id)) {
target[i] = children;
}
else {
target[i] = React.createElement(components.ErrorInfo, {
type: 'feed',
error: `Area ${id} not found!`,
});
}
}
else if (typeof type === 'string') {
const kids = vitalize(element.props.children, children, components);
target[i] = React.cloneElement(element, undefined, ...kids);
}
}
return target;
}
const vitalize_1 = require("./vitalize");
function getLayout() {

@@ -39,3 +11,3 @@ const elements = rehydrate_1.rehydrate(document.querySelector('template[for=layout]'));

const components = piral_core_1.useGlobalState(m => m.app.components);
const layout = vitalize(elements, children, components);
const layout = vitalize_1.vitalize(elements, children, components);
return React.createElement(React.Fragment, null, layout);

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

import * as React from 'react';
import { RouteComponentProps } from 'react-router-dom';
import { LocalizationMessages } from 'piral-core';
import { PiralAttachment } from './api';
export interface PiralOptions {
selector?: string | Element;
gateway?: string;
routes?: Record<string, React.ComponentType<Partial<RouteComponentProps>>>;
routes?: Record<string, React.ComponentType<RouteComponentProps>>;
trackers?: Array<React.ComponentType<RouteComponentProps>>;
translations?: LocalizationMessages;
components?: Record<string, React.ComponentType<any>>;
attach?: PiralAttachment;
}
export declare function renderInstance(options?: PiralOptions): void;

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

function renderInstance(options = {}) {
const { routes = {}, selector = '#app', gateway, translations, components } = options;
const { routes = {}, trackers = [], selector = '#app', gateway, translations, components, attach } = options;
const origin = utils_1.getGateway(gateway);

@@ -20,3 +20,3 @@ const client = piral_ext_1.setupGqlClient({

const Piral = piral_core_1.createInstance({
availableModules: utils_1.getAvailableModules(),
availableModules: utils_1.getAvailableModules(attach),
requestModules() {

@@ -38,2 +38,3 @@ return fetch(`${origin}/api/v1/pilet`)

routes,
trackers,
});

@@ -40,0 +41,0 @@ const Layout = layout_1.getLayout();

@@ -0,3 +1,5 @@

import { ArbiterModule } from 'react-arbiter';
import { PiralAttachment } from '../api';
export declare function getContainer(selector?: string | Element): Element;
export declare function getGateway(url?: string): string;
export declare function getAvailableModules(): any[];
export declare function getAvailableModules(setup?: PiralAttachment): ArbiterModule<import("piral-core").PiralApi<import("../api").PiExtApi>>[];
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const react_arbiter_1 = require("react-arbiter");
function getContainer(selector) {

@@ -24,4 +25,4 @@ if (typeof selector === 'string') {

exports.getGateway = getGateway;
function getAvailableModules() {
const debugModules = (process.env.DEBUG_MODULE_PATHS || '').split(',');
function getAvailableModules(setup) {
const debugModules = (process.env.DEBUG_PILETS || '').split(',');
const availableModules = [];

@@ -33,2 +34,11 @@ for (const debugModule of debugModules) {

}
if (react_arbiter_1.isfunc(setup)) {
availableModules.push({
setup,
hash: '',
version: process.env.BUILD_PCKG_VERSION || '0.0.0',
name: 'app',
dependencies: {},
});
}
return availableModules;

@@ -35,0 +45,0 @@ }

{
"name": "piral",
"version": "0.3.1-pre.412",
"version": "0.3.1-pre.413",
"description": "The all-in-one piral package.",

@@ -44,4 +44,4 @@ "keywords": [

"graphql": "^14.3.0",
"piral-core": "^0.3.1-pre.412",
"piral-ext": "^0.3.1-pre.412",
"piral-core": "^0.3.1-pre.413",
"piral-ext": "^0.3.1-pre.413",
"promise-polyfill": "^8.1.0",

@@ -60,3 +60,3 @@ "react": "^16.8.1",

},
"gitHead": "96d5dfdd5bea99f37a61f070ecad816340b70104"
"gitHead": "39729c86cb902769a74cc4312a7cbcaad4b52295"
}

@@ -16,1 +16,5 @@ import {

export type PiExtensionComponentProps<T = Record<string, any>> = ExtensionComponentProps<PiletApi, T>;
export interface PiralAttachment {
(api: PiletApi): void;
}

@@ -0,1 +1,4 @@

import { isfunc, ArbiterModule } from 'react-arbiter';
import { PiralAttachment, PiletApi } from '../api';
export function getContainer(selector?: string | Element) {

@@ -19,5 +22,5 @@ if (typeof selector === 'string') {

export function getAvailableModules() {
const debugModules = (process.env.DEBUG_MODULE_PATHS || '').split(',');
const availableModules = [];
export function getAvailableModules(setup?: PiralAttachment) {
const debugModules = (process.env.DEBUG_PILETS || '').split(',');
const availableModules: Array<ArbiterModule<PiletApi>> = [];

@@ -30,3 +33,13 @@ for (const debugModule of debugModules) {

if (isfunc(setup)) {
availableModules.push({
setup,
hash: '',
version: process.env.BUILD_PCKG_VERSION || '0.0.0',
name: 'app',
dependencies: {},
});
}
return availableModules;
}

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