@plurid/plurid-data
Version:
Plurid Constants, Interfaces, Enumerations
70 lines (69 loc) • 2.13 kB
TypeScript
import { PluridRouteParameter, PluridRouteFragments } from '../router';
export interface PluridPlaneOptions {
/**
* Constraints for the parameters.
*/
parameters?: Record<string, PluridRouteParameter>;
}
export interface PluridPlaneObject<C> extends PluridPlaneOptions {
/**
* Route to the plane, e.g. `/plane-1`. By convention, it starts with an '/'.
*
* The `route` can be
* + unassigned,
* + assigned,
* + absolute.
*
* The unassigned route respects the format
* `/plane` and will be automatically assigned
* to the `default` space, `default` universe, `default` cluster.
*
* The assigned path respects the format
* `/path://space://universe://cluster://plane`
* and it presupposes the given `protocol` and `host`.
*
* The absolute path respects the format
* `protocol://host://path://space://universe://cluster://plane`
* and is useful for cross-origins requests.
*
* The route can have parameters, e.g. `/plane/:id`.
*
* The parameter, in the example `id`,
* will be passed in the property `plurid.parameters` to the component,
* e.g. `componentProperties.plurid.route.plane.parameters.id`.
*
*/
route: string;
/**
* Component to be rendered in the PluridPlane.
*/
component: C;
}
export declare type PluridPlaneTuple<C> = [
/**
* See `PluridPlaneObject<C>.route`.
*/
route: string,
/**
* See `PluridPlaneObject<C>.component`.
*/
component: C,
/**
* See `PluridPlaneOptions`.
*/
options?: PluridPlaneOptions
];
export declare type PluridPlane<C> = PluridPlaneObject<C> | PluridPlaneTuple<C>;
export declare type PluridPlaneContext<T> = any;
export interface RouteSegment {
[key: string]: any;
}
export interface RegisteredPluridPlane<C> {
route: {
absolute: string;
fragments: PluridRouteFragments;
parameters: Record<string, string>;
query: Record<string, string>;
};
component: C;
}