@plurid/plurid-data
Version:
Plurid Constants, Interfaces, Enumerations
96 lines (95 loc) • 3.06 kB
TypeScript
import { PluridState } from '../../internal/state';
import { PluridPlane, PluridPlaneContext } from '../plane';
import { PluridUniverse } from '../universe';
import { PluridView } from '../view';
import { PluridPartialConfiguration } from '../configuration';
import { PluridPubSub } from '../pubsub';
import { PluridPlanesRegistrar } from '../registrar';
import { IsoMatcherRouteResult } from '../routing';
export interface PluridApplication<C> {
id?: string;
planesProperties?: Map<string, any>;
/**
* The planes which will be rendered by the `PluridApplication`.
*/
planes?: PluridPlane<C>[];
/**
* Optional context for the plane to have access to.
*/
planeContext?: PluridPlaneContext<any>;
/**
* Optional context initial value.
*/
planeContextValue?: Record<string, any>;
/**
* Routes of the planes in view on the initial rendering.
*/
view: PluridApplicationView;
/**
* Center the view on a plane from `view`.
*/
centerView?: string;
/**
* The hostname of the server exposed to the internet, e.g. `example.com`,
* to be used in plurid plane links.
*/
hostname?: string;
/**
* A `PluridApplication` must be either planes or universes based.
*
* A `PluridUniverse` is a collection of `PluridPlane`s.
*/
universes?: PluridUniverse<C>[];
/**
* Show or not the default Plane Not Found component, or pass a custom component.
*
* Default `true`.
*/
planeNotFound?: boolean | C;
/**
* Use or not Plurid Plane Error Boundary and show the default Plurid Plane Render Error component,
* or pass a custom component.
*
* Default `true`.
*/
planeRenderError?: boolean | C;
/**
* Application-wide partial configuration.
*/
configuration?: PluridPartialConfiguration;
/**
* Publish/Subscribe bus based on `@plurid/plurid-pubsub`.
*/
pubsub?: PluridPubSub;
/**
* Render the application statically.
*/
static?: boolean;
precomputedState?: Partial<PluridState>;
planesRegistrar?: PluridPlanesRegistrar<C>;
/**
* Save plurid application state to local storage,
* and load from local storage at startup.
*
* If multiple plurid applications run on the same origin,
* use the `id` property to differentiate between states.
*
* `LocalStorageUsage` differentiates between multiple local storages:
* for view, for user interface configuration.
*/
useLocalStorage?: boolean;
/**
* Replace the internal plurid plane with a custom implementation.
*/
customPlane?: C;
matchedRoute?: IsoMatcherRouteResult<C>;
/**
* Used to identify the space if using `multispace`.
*/
space?: string;
}
export declare type PluridApplicationView = (string | PluridView)[];
export interface LocalStorageUsage {
view: boolean;
ui: boolean;
}