@plurid/plurid-data 0.0.0-2 → 0.0.0-20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/distribution/constants/compare/index.d.ts +1 -1
- package/distribution/constants/configuration/index.d.ts +1 -1
- package/distribution/constants/defaults/index.d.ts +3 -0
- package/distribution/constants/general/index.d.ts +6 -0
- package/distribution/constants/index.d.ts +13 -11
- package/distribution/constants/internationalization/chinese/index.d.ts +1 -1
- package/distribution/constants/internationalization/english/index.d.ts +1 -1
- package/distribution/constants/internationalization/fields.d.ts +82 -2
- package/distribution/constants/internationalization/french/index.d.ts +1 -1
- package/distribution/constants/internationalization/german/index.d.ts +1 -1
- package/distribution/constants/internationalization/hindi/index.d.ts +1 -1
- package/distribution/constants/internationalization/index.d.ts +93 -12
- package/distribution/constants/internationalization/italian/index.d.ts +1 -1
- package/distribution/constants/internationalization/japanese/index.d.ts +1 -1
- package/distribution/constants/internationalization/languages.d.ts +1 -1
- package/distribution/constants/internationalization/romanian/index.d.ts +1 -1
- package/distribution/constants/internationalization/russian/index.d.ts +1 -1
- package/distribution/constants/internationalization/spanish/index.d.ts +1 -1
- package/distribution/constants/keys/index.d.ts +1 -1
- package/distribution/constants/protocols/index.d.ts +9 -0
- package/distribution/constants/pubsub/index.d.ts +38 -30
- package/distribution/constants/shortcuts/index.d.ts +2 -2
- package/distribution/constants/space/index.d.ts +1 -0
- package/distribution/constants/tree/index.d.ts +1 -1
- package/distribution/enumerations/general/index.d.ts +10 -1
- package/distribution/enumerations/index.d.ts +1 -1
- package/distribution/index.d.ts +3 -3
- package/distribution/index.es.js +231 -2
- package/distribution/index.es.js.map +1 -1
- package/distribution/index.js +250 -1
- package/distribution/index.js.map +1 -1
- package/distribution/interfaces/external/application/index.d.ts +52 -14
- package/distribution/interfaces/external/component/index.d.ts +20 -39
- package/distribution/interfaces/external/configuration/index.d.ts +19 -8
- package/distribution/interfaces/external/configurator/index.d.ts +3 -4
- package/distribution/interfaces/external/index.d.ts +17 -16
- package/distribution/interfaces/external/internationalization/index.d.ts +15 -0
- package/distribution/interfaces/external/link/index.d.ts +5 -7
- package/distribution/interfaces/external/metastate/index.d.ts +1 -1
- package/distribution/interfaces/external/plane/index.d.ts +31 -26
- package/distribution/interfaces/external/pubsub/index.d.ts +4 -5
- package/distribution/interfaces/external/pubsub/message.d.ts +103 -9
- package/distribution/interfaces/external/registrar/index.d.ts +5 -5
- package/distribution/interfaces/external/router/fragment/index.d.ts +18 -0
- package/distribution/interfaces/external/router/index.d.ts +27 -208
- package/distribution/interfaces/external/router/multispace/index.d.ts +14 -0
- package/distribution/interfaces/external/router/preserve/index.d.ts +70 -0
- package/distribution/interfaces/external/router/route/index.d.ts +171 -0
- package/distribution/interfaces/external/routing/index.d.ts +58 -0
- package/distribution/interfaces/external/universe/index.d.ts +5 -22
- package/distribution/interfaces/external/window/index.d.ts +3 -3
- package/distribution/interfaces/index.d.ts +3 -3
- package/distribution/interfaces/internal/context/index.d.ts +12 -5
- package/distribution/interfaces/internal/index.d.ts +5 -7
- package/distribution/interfaces/internal/shortcuts/index.d.ts +1 -1
- package/distribution/interfaces/internal/state/index.d.ts +11 -7
- package/distribution/interfaces/internal/transform/index.d.ts +9 -0
- package/distribution/interfaces/internal/tree/index.d.ts +1 -1
- package/package.json +16 -16
- package/distribution/interfaces/external/cluster/index.d.ts +0 -9
- package/distribution/interfaces/internal/internationalization/index.d.ts +0 -157
- package/distribution/interfaces/internal/plane/index.d.ts +0 -10
- package/distribution/interfaces/internal/universe/index.d.ts +0 -27
|
@@ -1,16 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { PluridRoute, PluridRoutePlane } from './route';
|
|
2
|
+
export interface PluridRouterProperties<C> {
|
|
3
|
+
routes: PluridRoute<C>[];
|
|
4
|
+
/**
|
|
5
|
+
* Plurid planes not specific to any route.
|
|
6
|
+
*/
|
|
7
|
+
planes?: PluridRoutePlane<C>[];
|
|
6
8
|
/**
|
|
7
9
|
* Component to be rendered outside of the current `path` component and of the `shell`.
|
|
8
10
|
*/
|
|
9
|
-
exterior?:
|
|
11
|
+
exterior?: C;
|
|
10
12
|
/**
|
|
11
13
|
* Component to wrap around the current path component.
|
|
12
14
|
*/
|
|
13
|
-
shell?:
|
|
15
|
+
shell?: C;
|
|
14
16
|
/**
|
|
15
17
|
* Path to navigate to when using clean navigation.
|
|
16
18
|
*/
|
|
@@ -25,11 +27,9 @@ export interface PluridRouterProperties {
|
|
|
25
27
|
*/
|
|
26
28
|
protocol?: string;
|
|
27
29
|
/**
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
* Production default: `window.location.host`.
|
|
30
|
+
* Default: `'origin'` | `window.location.host`.
|
|
31
31
|
*/
|
|
32
|
-
|
|
32
|
+
hostname?: string;
|
|
33
33
|
/**
|
|
34
34
|
* The `gatewayPath` is used to receive external routing requests.
|
|
35
35
|
*
|
|
@@ -45,7 +45,7 @@ export interface PluridRouterProperties {
|
|
|
45
45
|
/**
|
|
46
46
|
* Component to be rendered on the gateway path, external to the plurid view.
|
|
47
47
|
*/
|
|
48
|
-
gatewayExterior?:
|
|
48
|
+
gatewayExterior?: C;
|
|
49
49
|
/**
|
|
50
50
|
* Redirect not found paths to this path.
|
|
51
51
|
* Default: `/not-found`.
|
|
@@ -55,210 +55,29 @@ export interface PluridRouterProperties {
|
|
|
55
55
|
* API endpoint to request the elements for the paths not found in the initial routing.
|
|
56
56
|
*/
|
|
57
57
|
api?: string;
|
|
58
|
-
static?:
|
|
59
|
-
}
|
|
60
|
-
export interface PluridRouterStatic {
|
|
61
|
-
path: string;
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* A route can be `plurid space` or `exterior`-based.
|
|
65
|
-
*/
|
|
66
|
-
export interface PluridRoute {
|
|
67
|
-
/**
|
|
68
|
-
* The route `value` can:
|
|
69
|
-
* + be a simple string, e.g. `'/route/to/page'`;
|
|
70
|
-
* + be a parametric location, e.g. `'/route/to/:page'`, where `:page` is the parameter name;
|
|
71
|
-
* + receive query `key=value` pairs,
|
|
72
|
-
* e.g. `'/route/to/page?id=1&show=true'`, where `id=1` and `show=true` are `key=value` pairs;
|
|
73
|
-
*/
|
|
74
|
-
value: string;
|
|
75
|
-
parameters?: Record<string, PluridRouteParameter>;
|
|
58
|
+
static?: PluridRouterStatic;
|
|
76
59
|
/**
|
|
77
|
-
*
|
|
60
|
+
* Replace the internal plurid plane with a custom implementation.
|
|
78
61
|
*/
|
|
79
|
-
|
|
62
|
+
customPlane?: C;
|
|
80
63
|
/**
|
|
81
|
-
*
|
|
64
|
+
* After router navigation scroll to the top.
|
|
82
65
|
*
|
|
83
|
-
*
|
|
66
|
+
* Default: `smooth`.
|
|
84
67
|
*/
|
|
85
|
-
|
|
86
|
-
view?: string[];
|
|
68
|
+
scrollToTop?: boolean | 'instant' | 'smooth';
|
|
87
69
|
/**
|
|
88
|
-
*
|
|
89
|
-
*/
|
|
90
|
-
spaces?: PluridRouteSpace[];
|
|
91
|
-
/**
|
|
92
|
-
* Pass the rendered `spaces[]` components as a property to the `exterior` component
|
|
93
|
-
* to be rendered in particular slots.
|
|
94
|
-
*/
|
|
95
|
-
slotted?: boolean;
|
|
96
|
-
multispace?: PluridRouteMultispace;
|
|
97
|
-
defaultConfiguration?: PluridPartialConfiguration;
|
|
98
|
-
}
|
|
99
|
-
export interface PluridPreserve<C = undefined> {
|
|
100
|
-
/**
|
|
101
|
-
* Served path value.
|
|
102
|
-
*/
|
|
103
|
-
serve: string;
|
|
104
|
-
/**
|
|
105
|
-
* The function will be executed and awaited before rendering the application on the server.
|
|
70
|
+
* Fade in from black, in milliseconds.
|
|
106
71
|
*
|
|
107
|
-
*
|
|
108
|
-
* can redirect to a different path, or can handle any cross-cutting concerns, such as eventing or logging.
|
|
109
|
-
*/
|
|
110
|
-
onServe: PluridPreserveOnServe<C>;
|
|
111
|
-
/**
|
|
112
|
-
* Function called after route is served successfully.
|
|
113
|
-
*/
|
|
114
|
-
afterServe?: PluridPreserveAfterServe<C>;
|
|
115
|
-
/**
|
|
116
|
-
* Function called if `onServe` throws an error.
|
|
72
|
+
* Default: `10`
|
|
117
73
|
*/
|
|
118
|
-
|
|
74
|
+
fadeIn?: number;
|
|
119
75
|
}
|
|
120
|
-
export
|
|
121
|
-
export declare type PluridPreserveAfterServe<C> = (transmission: PluridPreserveTransmission<C | undefined>) => Promise<void>;
|
|
122
|
-
export declare type PluridPreserveOnError<C> = (error: any, transmission: PluridPreserveTransmission<C | undefined>) => Promise<PluridPreserveResponse | void>;
|
|
123
|
-
export interface PluridPreserveTransmission<C = undefined> {
|
|
124
|
-
request: any;
|
|
125
|
-
response: any;
|
|
126
|
-
context: PluridPreserveTransmissionContext<C>;
|
|
127
|
-
}
|
|
128
|
-
export interface PluridPreserveTransmissionContext<C = undefined> {
|
|
76
|
+
export interface PluridRouterStatic {
|
|
129
77
|
path: string;
|
|
130
|
-
|
|
131
|
-
match: {
|
|
132
|
-
target: string;
|
|
133
|
-
source: string;
|
|
134
|
-
elements: any;
|
|
135
|
-
parameters?: Record<string, string>;
|
|
136
|
-
};
|
|
137
|
-
contextualizers: C;
|
|
138
|
-
}
|
|
139
|
-
export interface PluridPreserveResponse {
|
|
140
|
-
providers?: PluridPreserveResponseProviders;
|
|
141
|
-
/**
|
|
142
|
-
* Redirect to another route.
|
|
143
|
-
*/
|
|
144
|
-
redirect?: string;
|
|
145
|
-
/**
|
|
146
|
-
* If `response` is handled within the preserve `action`, set the `responded` value to `true`,
|
|
147
|
-
* to prevent the server from sending a double response.
|
|
148
|
-
*/
|
|
149
|
-
responded?: boolean;
|
|
150
|
-
/**
|
|
151
|
-
* Handle the server response without taking into account the preserve.
|
|
152
|
-
* Considers only the first match.
|
|
153
|
-
*/
|
|
154
|
-
depreserve?: boolean;
|
|
155
|
-
/**
|
|
156
|
-
* Ignore the preserve computation, but continue to try to find a match in the preserves array.
|
|
157
|
-
* To be used with the catch-all matcher `'*'` or with complex routing with overlapping parameters.
|
|
158
|
-
*/
|
|
159
|
-
pass?: boolean;
|
|
160
|
-
}
|
|
161
|
-
export interface PluridPreserveResponseProviders {
|
|
162
|
-
apollo?: any;
|
|
163
|
-
redux?: any;
|
|
164
|
-
plurid?: any;
|
|
165
|
-
}
|
|
166
|
-
export interface PluridRouteParameter {
|
|
167
|
-
/**
|
|
168
|
-
* Constrain the path parameter to be of a certain length.
|
|
169
|
-
*/
|
|
170
|
-
length?: number;
|
|
171
|
-
/**
|
|
172
|
-
* Ensure that the `length` of the path is of a certain type:
|
|
173
|
-
*
|
|
174
|
-
* * `'=='` - equal,
|
|
175
|
-
* * `'<='` - equal or less than,
|
|
176
|
-
* * `'<'` - less than,
|
|
177
|
-
* * `'>='` - equal or greater than,
|
|
178
|
-
* * `'>'` - greater than.
|
|
179
|
-
*
|
|
180
|
-
* Default `'<='`, if a `length` is provided.
|
|
181
|
-
*/
|
|
182
|
-
lengthType?: CompareType;
|
|
183
|
-
startsWith?: string;
|
|
184
|
-
endsWith?: string;
|
|
185
|
-
includes?: string[];
|
|
186
|
-
}
|
|
187
|
-
export interface PluridRouteSpace {
|
|
188
|
-
value: string;
|
|
189
|
-
/**
|
|
190
|
-
* Accepts a component which will be rendered outside of the `space`.
|
|
191
|
-
*/
|
|
192
|
-
exterior?: PluridComponent;
|
|
193
|
-
/**
|
|
194
|
-
* A space can have planes and/or universes.
|
|
195
|
-
*
|
|
196
|
-
* Planes will be assigned to the `default` universe, `default` cluster.
|
|
197
|
-
*/
|
|
198
|
-
planes?: PluridRoutePlane[];
|
|
199
|
-
view?: string[];
|
|
200
|
-
/**
|
|
201
|
-
* A space can have planes and/or universes.
|
|
202
|
-
*/
|
|
203
|
-
universes?: PluridRouteUniverse[];
|
|
204
|
-
configuration?: PluridPartialConfiguration;
|
|
205
|
-
}
|
|
206
|
-
export interface PluridRouteUniverse {
|
|
207
|
-
value: string;
|
|
208
|
-
/**
|
|
209
|
-
* An universe can have planes and/or clusters.
|
|
210
|
-
*
|
|
211
|
-
* Planes will be assigned to the `default` cluster.
|
|
212
|
-
*/
|
|
213
|
-
planes?: PluridRoutePlane[];
|
|
214
|
-
clusters?: PluridRouteCluster[];
|
|
215
|
-
}
|
|
216
|
-
export interface PluridRouteCluster {
|
|
217
|
-
value: string;
|
|
218
|
-
planes: PluridRoutePlane[];
|
|
219
|
-
}
|
|
220
|
-
export interface PluridRoutePlane {
|
|
221
|
-
component: PluridComponent;
|
|
222
|
-
value: string;
|
|
223
|
-
/**
|
|
224
|
-
* Map a direct link for a specific plane.
|
|
225
|
-
*
|
|
226
|
-
* e.g. `/plane-one` will route in browser the path `protocol://host/plane-one`
|
|
227
|
-
*/
|
|
228
|
-
link?: string;
|
|
229
|
-
/**
|
|
230
|
-
* On direct link access, show the plane in a `plurid` space,
|
|
231
|
-
* or as the legacy view of an web page.
|
|
232
|
-
*/
|
|
233
|
-
linkView?: 'legacy' | 'plurid';
|
|
234
|
-
}
|
|
235
|
-
export interface PluridRouteMultispace {
|
|
236
|
-
/**
|
|
237
|
-
* Default: `y`.
|
|
238
|
-
*/
|
|
239
|
-
alignment?: 'x' | 'y';
|
|
240
|
-
/**
|
|
241
|
-
* Default: `mandatory`.
|
|
242
|
-
*/
|
|
243
|
-
snapType?: 'none' | 'mandatory' | 'proximity';
|
|
244
|
-
header?: PluridComponent;
|
|
245
|
-
footer?: PluridComponent;
|
|
246
|
-
}
|
|
247
|
-
export interface PluridRouteFragments {
|
|
248
|
-
texts: PluridRouteFragmentText[];
|
|
249
|
-
elements: PluridRouteFragmentElement[];
|
|
250
|
-
}
|
|
251
|
-
export interface PluridRouteFragment {
|
|
252
|
-
type: string;
|
|
253
|
-
}
|
|
254
|
-
export interface PluridRouteFragmentText extends PluridRouteFragment {
|
|
255
|
-
type: 'text';
|
|
256
|
-
start: string;
|
|
257
|
-
end: string;
|
|
258
|
-
occurence: number;
|
|
259
|
-
}
|
|
260
|
-
export interface PluridRouteFragmentElement extends PluridRouteFragment {
|
|
261
|
-
type: 'element';
|
|
262
|
-
id: string;
|
|
263
|
-
occurence: number;
|
|
78
|
+
directPlane?: string;
|
|
264
79
|
}
|
|
80
|
+
export * from './fragment';
|
|
81
|
+
export * from './multispace';
|
|
82
|
+
export * from './preserve';
|
|
83
|
+
export * from './route';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare type PluridRouteMultispaceAlignment = 'x' | 'y';
|
|
2
|
+
export declare type PluridRouteMultispaceSnapType = 'none' | 'mandatory' | 'proximity';
|
|
3
|
+
export interface PluridRouteMultispace<C> {
|
|
4
|
+
/**
|
|
5
|
+
* Default: `y`.
|
|
6
|
+
*/
|
|
7
|
+
alignment?: PluridRouteMultispaceAlignment;
|
|
8
|
+
/**
|
|
9
|
+
* Default: `mandatory`.
|
|
10
|
+
*/
|
|
11
|
+
snapType?: PluridRouteMultispaceSnapType;
|
|
12
|
+
header?: C;
|
|
13
|
+
footer?: C;
|
|
14
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
export interface PluridPreserve<M = any, RQ = any, RS = any> {
|
|
2
|
+
/**
|
|
3
|
+
* Served path value.
|
|
4
|
+
*/
|
|
5
|
+
serve: string;
|
|
6
|
+
/**
|
|
7
|
+
* The function will be executed and awaited before rendering the application on the server.
|
|
8
|
+
*
|
|
9
|
+
* The function can return one or more providers which will be passed to their appropriate consumers,
|
|
10
|
+
* can redirect to a different path, or can handle any cross-cutting concerns, such as eventing or logging.
|
|
11
|
+
*/
|
|
12
|
+
onServe: PluridPreserveOnServe<M, RQ, RS>;
|
|
13
|
+
/**
|
|
14
|
+
* Function called after route is served successfully.
|
|
15
|
+
*/
|
|
16
|
+
afterServe?: PluridPreserveAfterServe<M, RQ, RS>;
|
|
17
|
+
/**
|
|
18
|
+
* Function called if `onServe` throws an error.
|
|
19
|
+
*/
|
|
20
|
+
onError?: PluridPreserveOnError<M, RQ, RS>;
|
|
21
|
+
}
|
|
22
|
+
export declare type PluridPreserveOnServe<M, RQ, RS> = (transmission: PluridPreserveTransmission<M, RQ, RS>) => Promise<PluridPreserveResponse | undefined>;
|
|
23
|
+
export declare type PluridPreserveAfterServe<M, RQ, RS> = (transmission: PluridPreserveTransmission<M, RQ, RS>) => Promise<undefined>;
|
|
24
|
+
export declare type PluridPreserveOnError<M, RQ, RS> = (error: any, transmission: PluridPreserveTransmission<M, RQ, RS>) => Promise<PluridPreserveResponse | undefined>;
|
|
25
|
+
export interface PluridPreserveTransmission<M, RQ, RS> {
|
|
26
|
+
context: PluridPreserveTransmissionContext<M>;
|
|
27
|
+
request: RQ;
|
|
28
|
+
response: RS;
|
|
29
|
+
}
|
|
30
|
+
export interface PluridPreserveTransmissionContext<M = undefined> {
|
|
31
|
+
match: M;
|
|
32
|
+
route: string;
|
|
33
|
+
}
|
|
34
|
+
export interface PluridPreserveResponse {
|
|
35
|
+
providers?: PluridPreserveResponseProviders;
|
|
36
|
+
/**
|
|
37
|
+
* Redirect to another route.
|
|
38
|
+
*/
|
|
39
|
+
redirect?: string;
|
|
40
|
+
/**
|
|
41
|
+
* If `response` is handled within the preserve `action`, set the `responded` value to `true`,
|
|
42
|
+
* to prevent the server from sending a double response.
|
|
43
|
+
*/
|
|
44
|
+
responded?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Handle the server response without taking into account the preserve.
|
|
47
|
+
* Considers only the first match.
|
|
48
|
+
*/
|
|
49
|
+
depreserve?: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Ignore the preserve computation, but continue to try to find a match in the preserves array.
|
|
52
|
+
* To be used with the catch-all matcher `'*'` or with complex routing with overlapping parameters.
|
|
53
|
+
*/
|
|
54
|
+
pass?: boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Key-value pairs which will be inserted as globals on the window as in
|
|
57
|
+
* `window.${key} = ${value}`.
|
|
58
|
+
*/
|
|
59
|
+
globals?: Record<string, string>;
|
|
60
|
+
template?: PluridPreserveResponseTemplate;
|
|
61
|
+
}
|
|
62
|
+
export declare type PluridPreserveResponseProviders = Record<string, any>;
|
|
63
|
+
export interface PluridPreserveResponseTemplate {
|
|
64
|
+
htmlLanguage?: string;
|
|
65
|
+
htmlAttributes?: Record<string, string>;
|
|
66
|
+
bodyAttributes?: Record<string, string>;
|
|
67
|
+
headScripts?: string[];
|
|
68
|
+
bodyScripts?: string[];
|
|
69
|
+
styles?: string[];
|
|
70
|
+
}
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import { PluridPartialConfiguration } from "../../configuration";
|
|
2
|
+
import { CompareType } from "../../compare";
|
|
3
|
+
import { PluridRouteMultispace } from '../multispace';
|
|
4
|
+
export declare type PluridRouteResolver<C> = Omit<PluridRoute<C>, 'value' | 'resolver'>;
|
|
5
|
+
/**
|
|
6
|
+
* A route can be `plurid space` or `exterior`-based.
|
|
7
|
+
*/
|
|
8
|
+
export interface PluridRoute<C, G = any> {
|
|
9
|
+
/**
|
|
10
|
+
* The route `value` can:
|
|
11
|
+
* + be a simple string, e.g. `'/route/to/page'`;
|
|
12
|
+
* + be a parametric location, e.g. `'/route/to/:page'`, where `:page` is the parameter name;
|
|
13
|
+
* + receive query `key=value` pairs,
|
|
14
|
+
* e.g. `'/route/to/page?id=1&show=true'`, where `id=1` and `show=true` are `key=value` pairs;
|
|
15
|
+
*/
|
|
16
|
+
value: string;
|
|
17
|
+
parameters?: Record<string, PluridRouteParameter>;
|
|
18
|
+
/**
|
|
19
|
+
* Accepts a component which will be rendered outside of the `spaces`.
|
|
20
|
+
*/
|
|
21
|
+
exterior?: C;
|
|
22
|
+
/**
|
|
23
|
+
* A route can have planes and/or spaces.
|
|
24
|
+
*/
|
|
25
|
+
planes?: PluridRoutePlane<C>[];
|
|
26
|
+
view?: string[];
|
|
27
|
+
/**
|
|
28
|
+
* A route can have planes and/or spaces.
|
|
29
|
+
*/
|
|
30
|
+
spaces?: PluridRouteSpace<C>[];
|
|
31
|
+
/**
|
|
32
|
+
* Pass the rendered `spaces[]` components as a property to the `exterior` component
|
|
33
|
+
* to be rendered in particular slots.
|
|
34
|
+
*/
|
|
35
|
+
slotted?: boolean;
|
|
36
|
+
multispace?: PluridRouteMultispace<C>;
|
|
37
|
+
defaultConfiguration?: PluridPartialConfiguration;
|
|
38
|
+
/**
|
|
39
|
+
* Resolve the route at request time.
|
|
40
|
+
*
|
|
41
|
+
* Receives the `globals` from the preserve, if any.
|
|
42
|
+
*/
|
|
43
|
+
resolver?: (globals: G | undefined) => PluridRouteResolver<C> | Promise<PluridRouteResolver<C>>;
|
|
44
|
+
}
|
|
45
|
+
export interface PluridRouteParameter {
|
|
46
|
+
/**
|
|
47
|
+
* Constrain the route parameter to be of a certain length.
|
|
48
|
+
*/
|
|
49
|
+
length?: number;
|
|
50
|
+
/**
|
|
51
|
+
* Ensure that the `length` of the route parameter is of a certain type:
|
|
52
|
+
*
|
|
53
|
+
* * `'=='` - equal,
|
|
54
|
+
* * `'<='` - equal or less than,
|
|
55
|
+
* * `'<'` - less than,
|
|
56
|
+
* * `'>='` - equal or greater than,
|
|
57
|
+
* * `'>'` - greater than.
|
|
58
|
+
*
|
|
59
|
+
* Default `'<='`, if a `length` is provided.
|
|
60
|
+
*/
|
|
61
|
+
lengthType?: CompareType;
|
|
62
|
+
startsWith?: string;
|
|
63
|
+
endsWith?: string;
|
|
64
|
+
includes?: string[];
|
|
65
|
+
}
|
|
66
|
+
export interface PluridRouteSpace<C> {
|
|
67
|
+
value: string;
|
|
68
|
+
/**
|
|
69
|
+
* Accepts a component which will be rendered outside of the `space`.
|
|
70
|
+
*/
|
|
71
|
+
exterior?: C;
|
|
72
|
+
/**
|
|
73
|
+
* A space can have planes and/or universes.
|
|
74
|
+
*/
|
|
75
|
+
planes?: PluridRoutePlane<C>[];
|
|
76
|
+
view?: string[];
|
|
77
|
+
/**
|
|
78
|
+
* A space can have planes and/or universes.
|
|
79
|
+
*/
|
|
80
|
+
universes?: PluridRouteUniverse<C>[];
|
|
81
|
+
configuration?: PluridPartialConfiguration;
|
|
82
|
+
}
|
|
83
|
+
export interface PluridRouteUniverse<C> {
|
|
84
|
+
value: string;
|
|
85
|
+
planes?: PluridRoutePlane<C>[];
|
|
86
|
+
view?: string[];
|
|
87
|
+
/**
|
|
88
|
+
* By default, the order the documents are shown in is based on their index in the `documents[]`.
|
|
89
|
+
* The ordinal can be used to overrule the default order.
|
|
90
|
+
* If not unique, the documents with equal `ordinal` will be ordered by index.
|
|
91
|
+
*
|
|
92
|
+
* 0-based.
|
|
93
|
+
*/
|
|
94
|
+
ordinal?: number;
|
|
95
|
+
/**
|
|
96
|
+
* Set the document as active. By default the first document is active.
|
|
97
|
+
*
|
|
98
|
+
* Only one document can be active at a time.
|
|
99
|
+
*/
|
|
100
|
+
active?: boolean;
|
|
101
|
+
}
|
|
102
|
+
export interface PluridRoutePlaneOptions {
|
|
103
|
+
/**
|
|
104
|
+
* Map a direct link for a specific plane.
|
|
105
|
+
*
|
|
106
|
+
* e.g. `/plane-one` will route in browser the path `protocol://host/plane-one`
|
|
107
|
+
*
|
|
108
|
+
* Default composed from route and plane value, `/<route.value/<plane.value>`
|
|
109
|
+
*/
|
|
110
|
+
link?: string;
|
|
111
|
+
/**
|
|
112
|
+
* On direct link access (from the browser), show the plane in a `plurid` space,
|
|
113
|
+
* or as the legacy view of an web page.
|
|
114
|
+
*
|
|
115
|
+
* Default `'plurid'`
|
|
116
|
+
*/
|
|
117
|
+
linkView?: 'legacy' | 'plurid';
|
|
118
|
+
/**
|
|
119
|
+
* Injectable into other `plurid` spaces.
|
|
120
|
+
*
|
|
121
|
+
* Default `true`
|
|
122
|
+
*/
|
|
123
|
+
injectable?: boolean;
|
|
124
|
+
/**
|
|
125
|
+
* Direct access to the plane from the browser.
|
|
126
|
+
*
|
|
127
|
+
* Default plane link composed from route and plane value, `/<route.value/<plane.value>`;
|
|
128
|
+
* changeable through the `link` property.
|
|
129
|
+
*
|
|
130
|
+
* Default `true`
|
|
131
|
+
*/
|
|
132
|
+
urlable?: boolean;
|
|
133
|
+
/**
|
|
134
|
+
* Access to the plane through the `gateway` path.
|
|
135
|
+
*
|
|
136
|
+
* Default `true`
|
|
137
|
+
*/
|
|
138
|
+
gateable?: boolean;
|
|
139
|
+
/**
|
|
140
|
+
* Render route exterior when directly accessed.
|
|
141
|
+
*
|
|
142
|
+
* Default `true`
|
|
143
|
+
*/
|
|
144
|
+
directExterior?: boolean;
|
|
145
|
+
/**
|
|
146
|
+
* Render route exterior when injected into other `plurid` space.
|
|
147
|
+
*
|
|
148
|
+
* Default `false`
|
|
149
|
+
*/
|
|
150
|
+
injectExterior?: boolean;
|
|
151
|
+
/**
|
|
152
|
+
* Constraints for the parameters.
|
|
153
|
+
*/
|
|
154
|
+
parameters?: Record<string, PluridRouteParameter>;
|
|
155
|
+
}
|
|
156
|
+
export interface PluridRoutePlaneObject<C> extends PluridRoutePlaneOptions {
|
|
157
|
+
value: string;
|
|
158
|
+
component: C;
|
|
159
|
+
}
|
|
160
|
+
export declare type PluridRoutePlaneTuple<C> = [
|
|
161
|
+
/**
|
|
162
|
+
* See `PluridRoutePlaneObject<C>.value`.
|
|
163
|
+
*/
|
|
164
|
+
value: string,
|
|
165
|
+
/**
|
|
166
|
+
* See `PluridRoutePlaneObject<C>.component`.
|
|
167
|
+
*/
|
|
168
|
+
component: C,
|
|
169
|
+
options?: PluridRoutePlaneOptions
|
|
170
|
+
];
|
|
171
|
+
export declare type PluridRoutePlane<C> = PluridRoutePlaneObject<C> | PluridRoutePlaneTuple<C>;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { PluridRoute, PluridRoutePlane, PluridRoutePlaneObject, PluridRouteFragments } from '../router';
|
|
2
|
+
import { PluridPlane, PluridPlaneObject } from '../plane';
|
|
3
|
+
export interface IsoMatcherData<C> {
|
|
4
|
+
routes?: PluridRoute<C>[];
|
|
5
|
+
routePlanes?: PluridRoutePlane<C>[];
|
|
6
|
+
planes?: PluridPlane<C>[];
|
|
7
|
+
}
|
|
8
|
+
export declare type IsoMatcherContext = 'route' | 'plane';
|
|
9
|
+
export interface IsoMatcherResultBase {
|
|
10
|
+
value: string;
|
|
11
|
+
parameters: Record<string, string>;
|
|
12
|
+
query: Record<string, string>;
|
|
13
|
+
}
|
|
14
|
+
export interface IsoMatcherRouteResultBase {
|
|
15
|
+
match: IsoMatcherResultBase;
|
|
16
|
+
}
|
|
17
|
+
export interface IsoMatcherRouteResultRoute<C> extends IsoMatcherRouteResultBase {
|
|
18
|
+
kind: 'Route';
|
|
19
|
+
data: PluridRoute<C>;
|
|
20
|
+
}
|
|
21
|
+
export interface IsoMatcherRouteResultRoutePlane<C> extends IsoMatcherRouteResultBase {
|
|
22
|
+
kind: 'RoutePlane';
|
|
23
|
+
data: PluridRoutePlaneObject<C>;
|
|
24
|
+
}
|
|
25
|
+
export declare type IsoMatcherRouteResult<C> = IsoMatcherRouteResultRoute<C> | IsoMatcherRouteResultRoutePlane<C>;
|
|
26
|
+
export interface IsoMatcherIndexedRoute<C> {
|
|
27
|
+
data: PluridRoute<C>;
|
|
28
|
+
}
|
|
29
|
+
export declare type IsoMatcherPlaneType = 'Plane' | 'RoutePlane';
|
|
30
|
+
export interface IsoMatcherPlaneResultMatch extends IsoMatcherResultBase {
|
|
31
|
+
fragments: PluridRouteFragments;
|
|
32
|
+
}
|
|
33
|
+
export interface IsoMatcherPlaneResultBase<C> {
|
|
34
|
+
parent?: string;
|
|
35
|
+
match: IsoMatcherPlaneResultMatch;
|
|
36
|
+
}
|
|
37
|
+
export interface IsoMatcherPlaneResultPlane<C> extends IsoMatcherPlaneResultBase<C> {
|
|
38
|
+
kind: 'Plane';
|
|
39
|
+
data: PluridPlaneObject<C>;
|
|
40
|
+
}
|
|
41
|
+
export interface IsoMatcherPlaneResultRoutePlane<C> extends IsoMatcherPlaneResultBase<C> {
|
|
42
|
+
kind: 'RoutePlane';
|
|
43
|
+
data: PluridRoutePlaneObject<C>;
|
|
44
|
+
}
|
|
45
|
+
export declare type IsoMatcherPlaneResult<C> = IsoMatcherPlaneResultPlane<C> | IsoMatcherPlaneResultRoutePlane<C>;
|
|
46
|
+
export declare type IsoMatcherResult<C> = IsoMatcherRouteResult<C> | IsoMatcherPlaneResult<C>;
|
|
47
|
+
export interface IsoMatcherIndexedPlaneBase<C> {
|
|
48
|
+
parent?: string;
|
|
49
|
+
}
|
|
50
|
+
export interface IsoMatcherIndexedPlanePlane<C> extends IsoMatcherIndexedPlaneBase<C> {
|
|
51
|
+
kind: 'Plane';
|
|
52
|
+
data: PluridPlaneObject<C>;
|
|
53
|
+
}
|
|
54
|
+
export interface IsoMatcherIndexedPlaneRoutePlane<C> extends IsoMatcherIndexedPlaneBase<C> {
|
|
55
|
+
kind: 'RoutePlane';
|
|
56
|
+
data: PluridRoutePlaneObject<C>;
|
|
57
|
+
}
|
|
58
|
+
export declare type IsoMatcherIndexedPlane<C> = IsoMatcherIndexedPlanePlane<C> | IsoMatcherIndexedPlaneRoutePlane<C>;
|
|
@@ -1,16 +1,8 @@
|
|
|
1
|
-
import { PluridPlane } from
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
* Optional, application-wide unique identifier.
|
|
7
|
-
*/
|
|
8
|
-
id?: string;
|
|
9
|
-
/**
|
|
10
|
-
* Must be unique if IDs not provided.
|
|
11
|
-
*/
|
|
12
|
-
name: string;
|
|
13
|
-
planes: PluridPlane[];
|
|
1
|
+
import { PluridPlane } from '../plane';
|
|
2
|
+
export interface PluridUniverse<C> {
|
|
3
|
+
value: string;
|
|
4
|
+
planes?: PluridPlane<C>[];
|
|
5
|
+
view?: string[];
|
|
14
6
|
/**
|
|
15
7
|
* By default, the order the documents are shown in is based on their index in the `documents[]`.
|
|
16
8
|
* The ordinal can be used to overrule the default order.
|
|
@@ -25,13 +17,4 @@ export interface PluridUniverse {
|
|
|
25
17
|
* Only one document can be active at a time.
|
|
26
18
|
*/
|
|
27
19
|
active?: boolean;
|
|
28
|
-
/**
|
|
29
|
-
* Paths to the pages in view on the initial rendering.
|
|
30
|
-
*/
|
|
31
|
-
view?: string[] | PluridView[];
|
|
32
|
-
/**
|
|
33
|
-
* A cluster ensures the rendering of all the pages that it contains
|
|
34
|
-
* in the same space zone.
|
|
35
|
-
*/
|
|
36
|
-
clusters?: PluridCluster[];
|
|
37
20
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PluridPlanesRegistrar } from
|
|
2
|
-
export declare type PluridalWindow = typeof window & {
|
|
3
|
-
__pluridPlanesRegistrar__: PluridPlanesRegistrar
|
|
1
|
+
import { PluridPlanesRegistrar } from '../registrar';
|
|
2
|
+
export declare type PluridalWindow<C> = typeof window & {
|
|
3
|
+
__pluridPlanesRegistrar__: PluridPlanesRegistrar<C>;
|
|
4
4
|
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
1
|
+
export * from './external';
|
|
2
|
+
export * from './internal';
|
|
3
|
+
export * from './helpers';
|
|
@@ -1,9 +1,16 @@
|
|
|
1
|
-
import { PluridPlaneContext } from "../../external/plane
|
|
2
|
-
import { PluridPlanesRegistrar } from "../../external/registrar
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { PluridPlaneContext } from "../../external/plane";
|
|
2
|
+
import { PluridPlanesRegistrar } from "../../external/registrar";
|
|
3
|
+
import { IsoMatcherRouteResult } from "../../external/routing";
|
|
4
|
+
import { PluridPubSub } from "../../external/pubsub";
|
|
5
|
+
export interface PluridContext<C> {
|
|
6
|
+
planesRegistrar?: PluridPlanesRegistrar<C>;
|
|
6
7
|
planeContext?: PluridPlaneContext<any>;
|
|
7
8
|
planeContextValue?: any;
|
|
9
|
+
customPlane?: C;
|
|
10
|
+
planeNotFound?: boolean | C;
|
|
11
|
+
planeRenderError?: boolean | C;
|
|
12
|
+
matchedRoute?: IsoMatcherRouteResult<C> | undefined;
|
|
13
|
+
hostname?: string;
|
|
14
|
+
defaultPubSub: PluridPubSub;
|
|
8
15
|
registerPubSub: (pubsub: PluridPubSub) => void;
|
|
9
16
|
}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
4
|
-
export * from
|
|
5
|
-
export * from
|
|
6
|
-
export * from "./tree/index";
|
|
7
|
-
export * from "./universe/index";
|
|
1
|
+
export * from './context';
|
|
2
|
+
export * from './shortcuts';
|
|
3
|
+
export * from './state';
|
|
4
|
+
export * from './transform';
|
|
5
|
+
export * from './tree';
|