Comparing version 0.6.0-pre.453 to 0.6.0-pre.492
@@ -10,2 +10,2 @@ import * as React from 'react'; | ||
} | ||
export declare function createAppLayout({ Layout, ...props }: AppLayoutCreator): React.SFC; | ||
export declare function createAppLayout({ Layout, ...props }: AppLayoutCreator): React.FC; |
@@ -8,2 +8,2 @@ import * as React from 'react'; | ||
} | ||
export declare function createDashboard({ DashboardContainer, Tile }: DashboardCreator): React.SFC<DashboardProps>; | ||
export declare function createDashboard({ DashboardContainer, Tile }: DashboardCreator): React.FC<DashboardProps>; |
@@ -12,2 +12,2 @@ import * as React from 'react'; | ||
} | ||
export declare function createErrorInfo({ NotFoundErrorInfo, PageErrorInfo, LoadingErrorInfo, FeedErrorInfo, FormErrorInfo, UnknownErrorInfo, }: ErrorInfoCreator): React.SFC<ErrorInfoProps>; | ||
export declare function createErrorInfo({ NotFoundErrorInfo, PageErrorInfo, LoadingErrorInfo, FeedErrorInfo, FormErrorInfo, UnknownErrorInfo, }: ErrorInfoCreator): React.FC<ErrorInfoProps>; |
@@ -7,2 +7,2 @@ import * as React from 'react'; | ||
} | ||
export declare function createMenu({ MenuContainer, MenuItem }: MenuCreator): React.SFC<MenuProps>; | ||
export declare function createMenu({ MenuContainer, MenuItem }: MenuCreator): React.FC<MenuProps>; |
@@ -8,2 +8,2 @@ import * as React from 'react'; | ||
} | ||
export declare function createModals({ ModalsContainer, ModalDialog }: ModalsCreator): React.SFC; | ||
export declare function createModals({ ModalsContainer, ModalDialog }: ModalsCreator): React.FC; |
@@ -8,2 +8,2 @@ import * as React from 'react'; | ||
} | ||
export declare function createNotifications({ NotificationsContainer, NotificationItem }: NotificationsCreator): React.SFC; | ||
export declare function createNotifications({ NotificationsContainer, NotificationItem }: NotificationsCreator): React.FC; |
@@ -8,2 +8,2 @@ import * as React from 'react'; | ||
} | ||
export declare function createSearch({ SearchContainer, SearchInput, SearchResult }: SearchCreator): React.SFC; | ||
export declare function createSearch({ SearchContainer, SearchInput, SearchResult }: SearchCreator): React.FC; |
@@ -8,1 +8,2 @@ import 'promise-polyfill'; | ||
export * from './render'; | ||
export * from './layout'; |
@@ -12,2 +12,3 @@ "use strict"; | ||
__export(require("./render")); | ||
__export(require("./layout")); | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,1 @@ | ||
import * as React from 'react'; | ||
export declare function getLayout(customComponents?: Record<string, React.ComponentType>): React.SFC; | ||
export * from './builder'; |
"use strict"; | ||
function __export(m) { | ||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; | ||
} | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const React = require("react"); | ||
const piral_core_1 = require("piral-core"); | ||
const rehydrate_1 = require("./rehydrate"); | ||
const vitalize_1 = require("./vitalize"); | ||
function getLayout(customComponents = {}) { | ||
const elements = rehydrate_1.rehydrate(document.querySelector('template[for=layout]')); | ||
return ({ children }) => { | ||
const standardComponents = piral_core_1.useGlobalState(m => m.app.components); | ||
const layout = vitalize_1.vitalize(elements, children, id => { | ||
return customComponents[id] || standardComponents[id]; | ||
}); | ||
return React.createElement(React.Fragment, null, layout); | ||
}; | ||
} | ||
exports.getLayout = getLayout; | ||
__export(require("./builder")); | ||
//# sourceMappingURL=index.js.map |
@@ -15,8 +15,10 @@ "use strict"; | ||
const React = require("react"); | ||
const urql_1 = require("urql"); | ||
const react_dom_1 = require("react-dom"); | ||
const urql_1 = require("urql"); | ||
const piral_core_1 = require("piral-core"); | ||
const piral_ext_1 = require("piral-ext"); | ||
const utils_1 = require("./utils"); | ||
const components_1 = require("./components"); | ||
function defaultExtendApi(api) { | ||
return api; | ||
} | ||
/** | ||
@@ -47,4 +49,4 @@ * Sets up a new Piral instance and renders it using the provided options. | ||
}; | ||
const { selector = '#app', requestPilets = defaultRequestPilets, gatewayUrl: gateway, subscriptionUrl, translations = {}, attach, DashboardContainer, Tile, UnknownErrorInfo, PageErrorInfo = UnknownErrorInfo, NotFoundErrorInfo = UnknownErrorInfo, FeedErrorInfo = UnknownErrorInfo, FormErrorInfo = UnknownErrorInfo, LoadingErrorInfo = UnknownErrorInfo, MenuContainer, MenuItem, NotificationItem, NotificationsContainer, ModalDialog, ModalsContainer, SearchContainer, SearchInput, SearchResult, initialize, Layout } = options, forwardOptions = __rest(options, ["selector", "requestPilets", "gatewayUrl", "subscriptionUrl", "translations", "attach", "DashboardContainer", "Tile", "UnknownErrorInfo", "PageErrorInfo", "NotFoundErrorInfo", "FeedErrorInfo", "FormErrorInfo", "LoadingErrorInfo", "MenuContainer", "MenuItem", "NotificationItem", "NotificationsContainer", "ModalDialog", "ModalsContainer", "SearchContainer", "SearchInput", "SearchResult", "initialize", "Layout"]); | ||
const origin = utils_1.getGateway(gateway); | ||
const { selector = '#app', requestPilets = defaultRequestPilets, gatewayUrl, subscriptionUrl, translations = {}, attach, layout, extendApi = defaultExtendApi } = options, forwardOptions = __rest(options, ["selector", "requestPilets", "gatewayUrl", "subscriptionUrl", "translations", "attach", "layout", "extendApi"]); | ||
const origin = utils_1.getGateway(gatewayUrl); | ||
const client = piral_ext_1.setupGqlClient({ | ||
@@ -57,38 +59,10 @@ url: origin, | ||
}); | ||
const AppLayout = components_1.createAppLayout({ | ||
Layout, | ||
Menu: components_1.createMenu({ | ||
MenuContainer, | ||
MenuItem, | ||
}), | ||
Notifications: components_1.createNotifications({ | ||
NotificationItem, | ||
NotificationsContainer, | ||
}), | ||
Search: components_1.createSearch({ | ||
SearchContainer, | ||
SearchInput, | ||
SearchResult, | ||
}), | ||
Modals: components_1.createModals({ | ||
ModalDialog, | ||
ModalsContainer, | ||
}), | ||
}); | ||
const [AppLayout, config] = layout.build(); | ||
const renderLayout = (content) => React.createElement(AppLayout, null, content); | ||
const Piral = piral_core_1.createInstance(Object.assign({}, forwardOptions, { availablePilets: utils_1.getAvailablePilets(attach), requestPilets, Dashboard: components_1.createDashboard({ | ||
DashboardContainer, | ||
Tile, | ||
}), ErrorInfo: components_1.createErrorInfo({ | ||
FeedErrorInfo, | ||
FormErrorInfo, | ||
LoadingErrorInfo, | ||
NotFoundErrorInfo, | ||
PageErrorInfo, | ||
UnknownErrorInfo, | ||
}), extendApi(api) { | ||
return Object.assign({}, api, piral_ext_1.createFetchApi({ | ||
const Piral = piral_core_1.createInstance(Object.assign({}, forwardOptions, { availablePilets: utils_1.getAvailablePilets(attach), requestPilets, | ||
extendApi(api, target) { | ||
return extendApi(Object.assign({}, api, piral_ext_1.createFetchApi({ | ||
base: origin, | ||
}), piral_ext_1.createGqlApi(client), piral_ext_1.createLocaleApi(localizer)); | ||
}, languages: Object.keys(translations), setupState: initialize })); | ||
}), piral_ext_1.createGqlApi(client), piral_ext_1.createLocaleApi(localizer)), target); | ||
}, state: piral_core_1.setupState(Object.assign({}, config, { languages: Object.keys(translations) })) })); | ||
const App = () => (React.createElement(urql_1.Provider, { value: client }, | ||
@@ -95,0 +69,0 @@ React.createElement(Piral, null, renderLayout))); |
import { ComponentType } from 'react'; | ||
import { MenuType, LoaderProps, NotFoundErrorInfoProps, PageErrorInfoProps, LoadingErrorInfoProps, FeedErrorInfoProps, FormErrorInfoProps, OpenNotification, OpenModalDialog, LayoutType, UserInfo } from 'piral-core'; | ||
import { MenuType, LayoutType, UserInfo } from 'piral-core'; | ||
export interface MenuProps { | ||
@@ -37,6 +37,2 @@ type?: MenuType; | ||
export interface LayoutProps extends LayoutComponents { | ||
Menu: ComponentType<MenuProps>; | ||
Search: ComponentType; | ||
Modals: ComponentType; | ||
Notifications: ComponentType; | ||
selectedLanguage: string; | ||
@@ -53,22 +49,1 @@ availableLanguages: Array<string>; | ||
} | ||
export interface ComponentOptions { | ||
Loader?: ComponentType<LoaderProps>; | ||
FeedErrorInfo?: ComponentType<FeedErrorInfoProps>; | ||
FormErrorInfo?: ComponentType<FormErrorInfoProps>; | ||
LoadingErrorInfo?: ComponentType<LoadingErrorInfoProps>; | ||
NotFoundErrorInfo?: ComponentType<NotFoundErrorInfoProps>; | ||
PageErrorInfo?: ComponentType<PageErrorInfoProps>; | ||
UnknownErrorInfo: ComponentType<UnknownErrorInfoProps>; | ||
DashboardContainer: ComponentType<DashboardContainerProps>; | ||
Tile: ComponentType<TileProps>; | ||
MenuContainer: ComponentType<MenuContainerProps>; | ||
MenuItem: ComponentType<MenuItemProps>; | ||
SearchContainer: ComponentType<SearchContainerProps>; | ||
SearchInput: ComponentType<SearchInputProps>; | ||
SearchResult: ComponentType<SearchResultProps>; | ||
NotificationsContainer: ComponentType<NotificationsContainerProps>; | ||
NotificationItem: ComponentType<OpenNotification>; | ||
ModalsContainer: ComponentType<ModalsContainerProps>; | ||
ModalDialog: ComponentType<OpenModalDialog>; | ||
Layout: ComponentType<LayoutProps>; | ||
} |
export * from './api'; | ||
export * from './components'; | ||
export * from './layout'; | ||
export * from './options'; |
@@ -1,14 +0,12 @@ | ||
import { ComponentType } from 'react'; | ||
import { RouteComponentProps } from 'react-router-dom'; | ||
import { PiletRequester, GlobalState, ScaffoldPlugin } from 'piral-core'; | ||
import { PiralConfiguration } from 'piral-core'; | ||
import { LocalizationMessages } from 'piral-ext'; | ||
import { PiletApi } from './api'; | ||
import { ComponentOptions } from './components'; | ||
import { LayoutBuilder } from './layout'; | ||
export interface PiralAttachment { | ||
(api: PiletApi): void; | ||
} | ||
export interface PiralInitializer { | ||
<TState extends GlobalState<TUser>, TUser = {}>(state: GlobalState<TUser>): TState; | ||
} | ||
export interface PiralOptions extends ComponentOptions { | ||
/** | ||
* Defines the options for rendering a Piral instance. | ||
*/ | ||
export interface PiralOptions extends PiralConfiguration<PiletApi> { | ||
/** | ||
@@ -20,7 +18,2 @@ * Sets the selector of the element to render into. | ||
/** | ||
* Sets the function to request the pilets. By default the | ||
* pilets are requested via the standardized GraphQL resource. | ||
*/ | ||
requestPilets?: PiletRequester; | ||
/** | ||
* Sets the URL of the portal gateway to the backend. | ||
@@ -37,12 +30,2 @@ * @default document.location.origin, | ||
/** | ||
* Sets additional routes (pages) to be available. | ||
* @default {} | ||
*/ | ||
routes?: Record<string, ComponentType<RouteComponentProps>>; | ||
/** | ||
* Sets additional trackers to be available. | ||
* @default [] | ||
*/ | ||
trackers?: Array<ComponentType<RouteComponentProps>>; | ||
/** | ||
* Sets the default translations to be available. | ||
@@ -57,10 +40,5 @@ * @default {} | ||
/** | ||
* Initializes the global state container. | ||
* @param state The proposed initial state. | ||
* Gets the layout builder to construct the design to display. | ||
*/ | ||
initialize?: PiralInitializer; | ||
/** | ||
* Plugins for extending the core portal functionality. | ||
*/ | ||
plugins?: Array<ScaffoldPlugin>; | ||
layout: LayoutBuilder; | ||
} |
{ | ||
"name": "piral", | ||
"version": "0.6.0-pre.453", | ||
"version": "0.6.0-pre.492", | ||
"description": "The all-in-one piral package.", | ||
@@ -44,4 +44,4 @@ "keywords": [ | ||
"graphql": "^14.3.0", | ||
"piral-core": "^0.6.0-pre.453", | ||
"piral-ext": "^0.6.0-pre.453", | ||
"piral-core": "^0.6.0-pre.492", | ||
"piral-ext": "^0.6.0-pre.492", | ||
"promise-polyfill": "^8.1.0", | ||
@@ -60,3 +60,3 @@ "react": "^16.8.1", | ||
}, | ||
"gitHead": "f46faa7d03a5046f2dcab641ea89cd55aa80a5dd" | ||
"gitHead": "a64b460e27457a5bbee2c5227eaca5723a838898" | ||
} |
import { ComponentType } from 'react'; | ||
import { | ||
MenuType, | ||
LoaderProps, | ||
NotFoundErrorInfoProps, | ||
PageErrorInfoProps, | ||
LoadingErrorInfoProps, | ||
FeedErrorInfoProps, | ||
FormErrorInfoProps, | ||
OpenNotification, | ||
OpenModalDialog, | ||
LayoutType, | ||
UserInfo, | ||
} from 'piral-core'; | ||
import { MenuType, LayoutType, UserInfo } from 'piral-core'; | ||
@@ -58,6 +46,2 @@ export interface MenuProps { | ||
export interface LayoutProps extends LayoutComponents { | ||
Menu: ComponentType<MenuProps>; | ||
Search: ComponentType; | ||
Modals: ComponentType; | ||
Notifications: ComponentType; | ||
selectedLanguage: string; | ||
@@ -75,23 +59,1 @@ availableLanguages: Array<string>; | ||
} | ||
export interface ComponentOptions { | ||
Loader?: ComponentType<LoaderProps>; | ||
FeedErrorInfo?: ComponentType<FeedErrorInfoProps>; | ||
FormErrorInfo?: ComponentType<FormErrorInfoProps>; | ||
LoadingErrorInfo?: ComponentType<LoadingErrorInfoProps>; | ||
NotFoundErrorInfo?: ComponentType<NotFoundErrorInfoProps>; | ||
PageErrorInfo?: ComponentType<PageErrorInfoProps>; | ||
UnknownErrorInfo: ComponentType<UnknownErrorInfoProps>; | ||
DashboardContainer: ComponentType<DashboardContainerProps>; | ||
Tile: ComponentType<TileProps>; | ||
MenuContainer: ComponentType<MenuContainerProps>; | ||
MenuItem: ComponentType<MenuItemProps>; | ||
SearchContainer: ComponentType<SearchContainerProps>; | ||
SearchInput: ComponentType<SearchInputProps>; | ||
SearchResult: ComponentType<SearchResultProps>; | ||
NotificationsContainer: ComponentType<NotificationsContainerProps>; | ||
NotificationItem: ComponentType<OpenNotification>; | ||
ModalsContainer: ComponentType<ModalsContainerProps>; | ||
ModalDialog: ComponentType<OpenModalDialog>; | ||
Layout: ComponentType<LayoutProps>; | ||
} |
export * from './api'; | ||
export * from './components'; | ||
export * from './layout'; | ||
export * from './options'; |
@@ -1,7 +0,5 @@ | ||
import { ComponentType } from 'react'; | ||
import { RouteComponentProps } from 'react-router-dom'; | ||
import { PiletRequester, GlobalState, ScaffoldPlugin } from 'piral-core'; | ||
import { PiralConfiguration } from 'piral-core'; | ||
import { LocalizationMessages } from 'piral-ext'; | ||
import { PiletApi } from './api'; | ||
import { ComponentOptions } from './components'; | ||
import { LayoutBuilder } from './layout'; | ||
@@ -12,7 +10,6 @@ export interface PiralAttachment { | ||
export interface PiralInitializer { | ||
<TState extends GlobalState<TUser>, TUser = {}>(state: GlobalState<TUser>): TState; | ||
} | ||
export interface PiralOptions extends ComponentOptions { | ||
/** | ||
* Defines the options for rendering a Piral instance. | ||
*/ | ||
export interface PiralOptions extends PiralConfiguration<PiletApi> { | ||
/** | ||
@@ -24,7 +21,2 @@ * Sets the selector of the element to render into. | ||
/** | ||
* Sets the function to request the pilets. By default the | ||
* pilets are requested via the standardized GraphQL resource. | ||
*/ | ||
requestPilets?: PiletRequester; | ||
/** | ||
* Sets the URL of the portal gateway to the backend. | ||
@@ -41,12 +33,2 @@ * @default document.location.origin, | ||
/** | ||
* Sets additional routes (pages) to be available. | ||
* @default {} | ||
*/ | ||
routes?: Record<string, ComponentType<RouteComponentProps>>; | ||
/** | ||
* Sets additional trackers to be available. | ||
* @default [] | ||
*/ | ||
trackers?: Array<ComponentType<RouteComponentProps>>; | ||
/** | ||
* Sets the default translations to be available. | ||
@@ -61,10 +43,5 @@ * @default {} | ||
/** | ||
* Initializes the global state container. | ||
* @param state The proposed initial state. | ||
* Gets the layout builder to construct the design to display. | ||
*/ | ||
initialize?: PiralInitializer; | ||
/** | ||
* Plugins for extending the core portal functionality. | ||
*/ | ||
plugins?: Array<ScaffoldPlugin>; | ||
layout: LayoutBuilder; | ||
} |
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
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
98190
119
2093
Updatedpiral-core@^0.6.0-pre.492
Updatedpiral-ext@^0.6.0-pre.492