sample-cross-fx 0.14.28 → 0.15.0-beta.4465
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/app/{index.f1c99e.js → index.5f9048.js} +108354 -103022
- package/app/{index.f1c99e.js.map → index.5f9048.js.map} +1 -1
- package/app/index.d.ts +679 -541
- package/app/index.html +1 -1
- package/app/index.js +1 -1
- package/files.tar +0 -0
- package/files_once.tar +0 -0
- package/package.json +54 -114
package/app/index.d.ts
CHANGED
|
@@ -7,7 +7,6 @@ import * as Riot from 'riot';
|
|
|
7
7
|
import * as SolidJs from 'solid-js';
|
|
8
8
|
import * as ReactRouter from 'react-router';
|
|
9
9
|
import * as AngularCore from '@angular/core';
|
|
10
|
-
import * as LibreAtom from '@libre/atom';
|
|
11
10
|
|
|
12
11
|
declare module "sample-cross-fx" {
|
|
13
12
|
/**
|
|
@@ -113,9 +112,47 @@ declare module "sample-cross-fx" {
|
|
|
113
112
|
}
|
|
114
113
|
|
|
115
114
|
/**
|
|
116
|
-
* Describes the metadata
|
|
115
|
+
* Describes the metadata of a pilet available in its API.
|
|
117
116
|
*/
|
|
118
|
-
export
|
|
117
|
+
export interface PiletMetadata {
|
|
118
|
+
/**
|
|
119
|
+
* The name of the pilet, i.e., the package id.
|
|
120
|
+
*/
|
|
121
|
+
name: string;
|
|
122
|
+
/**
|
|
123
|
+
* The version of the pilet. Should be semantically versioned.
|
|
124
|
+
*/
|
|
125
|
+
version: string;
|
|
126
|
+
/**
|
|
127
|
+
* Provides the version of the specification for this pilet.
|
|
128
|
+
*/
|
|
129
|
+
spec: string;
|
|
130
|
+
/**
|
|
131
|
+
* Provides some custom metadata for the pilet.
|
|
132
|
+
*/
|
|
133
|
+
custom?: any;
|
|
134
|
+
/**
|
|
135
|
+
* Optionally indicates the global require reference, if any.
|
|
136
|
+
*/
|
|
137
|
+
requireRef?: string;
|
|
138
|
+
/**
|
|
139
|
+
* Additional shared dependencies from the pilet.
|
|
140
|
+
*/
|
|
141
|
+
dependencies: Record<string, string>;
|
|
142
|
+
/**
|
|
143
|
+
* Provides some configuration to be used in the pilet.
|
|
144
|
+
*/
|
|
145
|
+
config: Record<string, any>;
|
|
146
|
+
/**
|
|
147
|
+
* The URL of the main script of the pilet.
|
|
148
|
+
*/
|
|
149
|
+
link: string;
|
|
150
|
+
/**
|
|
151
|
+
* The base path to the pilet. Can be used to make resource requests
|
|
152
|
+
* and override the public path.
|
|
153
|
+
*/
|
|
154
|
+
basePath: string;
|
|
155
|
+
}
|
|
119
156
|
|
|
120
157
|
/**
|
|
121
158
|
* Listener for Piral app shell events.
|
|
@@ -458,7 +495,7 @@ declare module "sample-cross-fx" {
|
|
|
458
495
|
/**
|
|
459
496
|
* The meta data registered for a page.
|
|
460
497
|
*/
|
|
461
|
-
export interface PiralPageMeta extends PiralCustomPageMeta {}
|
|
498
|
+
export interface PiralPageMeta extends PiralCustomPageMeta, PiralCustomPageMeta {}
|
|
462
499
|
|
|
463
500
|
/**
|
|
464
501
|
* The shape of an implicit unregister function.
|
|
@@ -489,23 +526,6 @@ declare module "sample-cross-fx" {
|
|
|
489
526
|
(): void;
|
|
490
527
|
}
|
|
491
528
|
|
|
492
|
-
/**
|
|
493
|
-
* The metadata response for a single pilet.
|
|
494
|
-
*/
|
|
495
|
-
export type SinglePiletMetadata = PiletMetadataV0 | PiletMetadataV1 | PiletMetadataV2 | PiletMetadataVx;
|
|
496
|
-
|
|
497
|
-
/**
|
|
498
|
-
* The metadata response for a multi pilet.
|
|
499
|
-
*/
|
|
500
|
-
export type MultiPiletMetadata = PiletMetadataBundle;
|
|
501
|
-
|
|
502
|
-
/**
|
|
503
|
-
* Additional metadata that may be added to the runtime information.
|
|
504
|
-
*/
|
|
505
|
-
export interface PiletRuntimeMetadata {
|
|
506
|
-
basePath?: string;
|
|
507
|
-
}
|
|
508
|
-
|
|
509
529
|
/**
|
|
510
530
|
* Custom events defined outside of piral-core.
|
|
511
531
|
*/
|
|
@@ -939,158 +959,6 @@ declare module "sample-cross-fx" {
|
|
|
939
959
|
name: TName;
|
|
940
960
|
}
|
|
941
961
|
|
|
942
|
-
/**
|
|
943
|
-
* Metadata for pilets using the v0 schema.
|
|
944
|
-
*/
|
|
945
|
-
export type PiletMetadataV0 = PiletMetadataV0Content | PiletMetadataV0Link;
|
|
946
|
-
|
|
947
|
-
/**
|
|
948
|
-
* Metadata for pilets using the v1 schema.
|
|
949
|
-
*/
|
|
950
|
-
export interface PiletMetadataV1 {
|
|
951
|
-
/**
|
|
952
|
-
* The name of the pilet, i.e., the package id.
|
|
953
|
-
*/
|
|
954
|
-
name: string;
|
|
955
|
-
/**
|
|
956
|
-
* The version of the pilet. Should be semantically versioned.
|
|
957
|
-
*/
|
|
958
|
-
version: string;
|
|
959
|
-
/**
|
|
960
|
-
* Optionally provides the version of the specification for this pilet.
|
|
961
|
-
*/
|
|
962
|
-
spec?: "v1";
|
|
963
|
-
/**
|
|
964
|
-
* The link for retrieving the content of the pilet.
|
|
965
|
-
*/
|
|
966
|
-
link: string;
|
|
967
|
-
/**
|
|
968
|
-
* The reference name for the global require.
|
|
969
|
-
*/
|
|
970
|
-
requireRef: string;
|
|
971
|
-
/**
|
|
972
|
-
* The computed integrity of the pilet. Will be used to set the
|
|
973
|
-
* integrity value of the script.
|
|
974
|
-
*/
|
|
975
|
-
integrity?: string;
|
|
976
|
-
/**
|
|
977
|
-
* Optionally provides some custom metadata for the pilet.
|
|
978
|
-
*/
|
|
979
|
-
custom?: any;
|
|
980
|
-
/**
|
|
981
|
-
* Optionally provides some configuration to be used in the pilet.
|
|
982
|
-
*/
|
|
983
|
-
config?: Record<string, any>;
|
|
984
|
-
/**
|
|
985
|
-
* Additional shared dependency script files.
|
|
986
|
-
*/
|
|
987
|
-
dependencies?: Record<string, string>;
|
|
988
|
-
}
|
|
989
|
-
|
|
990
|
-
/**
|
|
991
|
-
* Metadata for pilets using the v2 schema.
|
|
992
|
-
*/
|
|
993
|
-
export interface PiletMetadataV2 {
|
|
994
|
-
/**
|
|
995
|
-
* The name of the pilet, i.e., the package id.
|
|
996
|
-
*/
|
|
997
|
-
name: string;
|
|
998
|
-
/**
|
|
999
|
-
* The version of the pilet. Should be semantically versioned.
|
|
1000
|
-
*/
|
|
1001
|
-
version: string;
|
|
1002
|
-
/**
|
|
1003
|
-
* Provides the version of the specification for this pilet.
|
|
1004
|
-
*/
|
|
1005
|
-
spec: "v2";
|
|
1006
|
-
/**
|
|
1007
|
-
* The reference name for the global require.
|
|
1008
|
-
*/
|
|
1009
|
-
requireRef: string;
|
|
1010
|
-
/**
|
|
1011
|
-
* The computed integrity of the pilet.
|
|
1012
|
-
*/
|
|
1013
|
-
integrity?: string;
|
|
1014
|
-
/**
|
|
1015
|
-
* The link for retrieving the content of the pilet.
|
|
1016
|
-
*/
|
|
1017
|
-
link: string;
|
|
1018
|
-
/**
|
|
1019
|
-
* Optionally provides some custom metadata for the pilet.
|
|
1020
|
-
*/
|
|
1021
|
-
custom?: any;
|
|
1022
|
-
/**
|
|
1023
|
-
* Optionally provides some configuration to be used in the pilet.
|
|
1024
|
-
*/
|
|
1025
|
-
config?: Record<string, any>;
|
|
1026
|
-
/**
|
|
1027
|
-
* Additional shared dependency script files.
|
|
1028
|
-
*/
|
|
1029
|
-
dependencies?: Record<string, string>;
|
|
1030
|
-
}
|
|
1031
|
-
|
|
1032
|
-
export interface PiletMetadataVx {
|
|
1033
|
-
/**
|
|
1034
|
-
* The name of the pilet, i.e., the package id.
|
|
1035
|
-
*/
|
|
1036
|
-
name: string;
|
|
1037
|
-
/**
|
|
1038
|
-
* The version of the pilet. Should be semantically versioned.
|
|
1039
|
-
*/
|
|
1040
|
-
version: string;
|
|
1041
|
-
/**
|
|
1042
|
-
* Provides an identifier for the custom specification.
|
|
1043
|
-
*/
|
|
1044
|
-
spec: string;
|
|
1045
|
-
/**
|
|
1046
|
-
* Optionally provides some custom metadata for the pilet.
|
|
1047
|
-
*/
|
|
1048
|
-
custom?: any;
|
|
1049
|
-
/**
|
|
1050
|
-
* Optionally provides some configuration to be used in the pilet.
|
|
1051
|
-
*/
|
|
1052
|
-
config?: Record<string, any>;
|
|
1053
|
-
/**
|
|
1054
|
-
* Additional shared dependency script files.
|
|
1055
|
-
*/
|
|
1056
|
-
dependencies?: Record<string, string>;
|
|
1057
|
-
}
|
|
1058
|
-
|
|
1059
|
-
/**
|
|
1060
|
-
* Metadata for pilets using the bundle schema.
|
|
1061
|
-
*/
|
|
1062
|
-
export interface PiletMetadataBundle {
|
|
1063
|
-
/**
|
|
1064
|
-
* The name of the bundle pilet, i.e., the package id.
|
|
1065
|
-
*/
|
|
1066
|
-
name?: string;
|
|
1067
|
-
/**
|
|
1068
|
-
* Optionally provides the version of the specification for this pilet.
|
|
1069
|
-
*/
|
|
1070
|
-
spec?: "v1";
|
|
1071
|
-
/**
|
|
1072
|
-
* The link for retrieving the bundle content of the pilet.
|
|
1073
|
-
*/
|
|
1074
|
-
link: string;
|
|
1075
|
-
/**
|
|
1076
|
-
* The reference name for the global bundle-shared require.
|
|
1077
|
-
*/
|
|
1078
|
-
bundle: string;
|
|
1079
|
-
/**
|
|
1080
|
-
* The computed integrity of the pilet. Will be used to set the
|
|
1081
|
-
* integrity value of the script.
|
|
1082
|
-
*/
|
|
1083
|
-
integrity?: string;
|
|
1084
|
-
/**
|
|
1085
|
-
* Optionally provides some custom metadata for the pilet.
|
|
1086
|
-
*/
|
|
1087
|
-
custom?: any;
|
|
1088
|
-
/**
|
|
1089
|
-
* Additional shared dependency script files.
|
|
1090
|
-
*/
|
|
1091
|
-
dependencies?: Record<string, string>;
|
|
1092
|
-
}
|
|
1093
|
-
|
|
1094
962
|
/**
|
|
1095
963
|
* Options passed through to Angular `bootstrapModule`.
|
|
1096
964
|
*
|
|
@@ -1232,40 +1100,11 @@ declare module "sample-cross-fx" {
|
|
|
1232
1100
|
defaults: any;
|
|
1233
1101
|
}
|
|
1234
1102
|
|
|
1235
|
-
/**
|
|
1236
|
-
* Metadata for pilets using the v0 schema with a content.
|
|
1237
|
-
*/
|
|
1238
|
-
export interface PiletMetadataV0Content extends PiletMetadataV0Base {
|
|
1239
|
-
/**
|
|
1240
|
-
* The content of the pilet. If the content is not available
|
|
1241
|
-
* the link will be used (unless caching has been activated).
|
|
1242
|
-
*/
|
|
1243
|
-
content: string;
|
|
1244
|
-
/**
|
|
1245
|
-
* If available indicates that the pilet should not be cached.
|
|
1246
|
-
* In case of a string this is interpreted as the expiration time
|
|
1247
|
-
* of the cache. In case of an accurate hash this should not be
|
|
1248
|
-
* required or set.
|
|
1249
|
-
*/
|
|
1250
|
-
noCache?: boolean | string;
|
|
1251
|
-
}
|
|
1252
|
-
|
|
1253
|
-
/**
|
|
1254
|
-
* Metadata for pilets using the v0 schema with a link.
|
|
1255
|
-
*/
|
|
1256
|
-
export interface PiletMetadataV0Link extends PiletMetadataV0Base {
|
|
1257
|
-
/**
|
|
1258
|
-
* The link for retrieving the content of the pilet.
|
|
1259
|
-
*/
|
|
1260
|
-
link: string;
|
|
1261
|
-
}
|
|
1262
|
-
|
|
1263
1103
|
/**
|
|
1264
1104
|
* The context to be transported into the generic components.
|
|
1265
1105
|
*/
|
|
1266
1106
|
export interface ComponentContext {
|
|
1267
1107
|
router: ReactRouter.RouteComponentProps;
|
|
1268
|
-
state: LibreAtom.Atom<GlobalState>;
|
|
1269
1108
|
readState: PiralActions["readState"];
|
|
1270
1109
|
}
|
|
1271
1110
|
|
|
@@ -1279,117 +1118,52 @@ declare module "sample-cross-fx" {
|
|
|
1279
1118
|
pilet: string;
|
|
1280
1119
|
}
|
|
1281
1120
|
|
|
1282
|
-
export type WrappedComponent<TProps> = React.ComponentType<Without<TProps, keyof BaseComponentProps
|
|
1121
|
+
export type WrappedComponent<TProps> = React.ComponentType<React.PropsWithChildren<Without<TProps, keyof BaseComponentProps>>>;
|
|
1283
1122
|
|
|
1284
1123
|
/**
|
|
1285
|
-
*
|
|
1124
|
+
* The globally defined actions.
|
|
1286
1125
|
*/
|
|
1287
|
-
export interface
|
|
1288
|
-
/**
|
|
1289
|
-
* The name of the pilet, i.e., the package id.
|
|
1290
|
-
*/
|
|
1291
|
-
name: string;
|
|
1126
|
+
export interface PiralActions extends PiralCustomActions {
|
|
1292
1127
|
/**
|
|
1293
|
-
*
|
|
1128
|
+
* Initializes the application shell.
|
|
1129
|
+
* @param loading The current loading state.
|
|
1130
|
+
* @param error The application error, if any.
|
|
1131
|
+
* @param modules The loaded pilets.
|
|
1294
1132
|
*/
|
|
1295
|
-
|
|
1133
|
+
initialize(loading: boolean, error: Error | undefined, modules: Array<Pilet>): void;
|
|
1296
1134
|
/**
|
|
1297
|
-
*
|
|
1135
|
+
* Injects an evaluated pilet at runtime - removes the pilet from registry first if available.
|
|
1136
|
+
* @param pilet The pilet to be injected.
|
|
1137
|
+
* @returns The injected pilet.
|
|
1298
1138
|
*/
|
|
1299
|
-
|
|
1139
|
+
injectPilet(pilet: Pilet): Pilet;
|
|
1300
1140
|
/**
|
|
1301
|
-
*
|
|
1302
|
-
*
|
|
1141
|
+
* Adds a pilet at runtime by loading it, evaluating it, and then injecting it.
|
|
1142
|
+
* @param pilet The pilet to be added.
|
|
1143
|
+
* @returns The promise indicating when the pilet was fully added.
|
|
1303
1144
|
*/
|
|
1304
|
-
|
|
1145
|
+
addPilet(pilet: PiletEntry): Promise<void>;
|
|
1305
1146
|
/**
|
|
1306
|
-
*
|
|
1147
|
+
* Removes a pilet by unloading it and deleting all component registrations.
|
|
1148
|
+
* @param name The name of the pilet to remove.
|
|
1307
1149
|
*/
|
|
1308
|
-
|
|
1150
|
+
removePilet(name: string): Promise<void>;
|
|
1309
1151
|
/**
|
|
1310
|
-
*
|
|
1152
|
+
* Defines a single action for Piral.
|
|
1153
|
+
* @param actionName The name of the action to define.
|
|
1154
|
+
* @param action The action to include.
|
|
1311
1155
|
*/
|
|
1312
|
-
|
|
1156
|
+
defineAction<T extends keyof PiralActions>(actionName: T, action: PiralAction<PiralActions[T]>): void;
|
|
1313
1157
|
/**
|
|
1314
|
-
*
|
|
1158
|
+
* Defines a set of actions for Piral.
|
|
1159
|
+
* @param actions The actions to define.
|
|
1315
1160
|
*/
|
|
1316
|
-
|
|
1317
|
-
}
|
|
1318
|
-
|
|
1319
|
-
/**
|
|
1320
|
-
* The Piral global app state container.
|
|
1321
|
-
*/
|
|
1322
|
-
export interface GlobalState extends PiralCustomState {
|
|
1161
|
+
defineActions(actions: PiralDefineActions): void;
|
|
1323
1162
|
/**
|
|
1324
|
-
*
|
|
1163
|
+
* Reads the value of a shared data item.
|
|
1164
|
+
* @param name The name of the shared item.
|
|
1325
1165
|
*/
|
|
1326
|
-
|
|
1327
|
-
/**
|
|
1328
|
-
* The relevant state for rendering errors of the app.
|
|
1329
|
-
*/
|
|
1330
|
-
errorComponents: ErrorComponentsState;
|
|
1331
|
-
/**
|
|
1332
|
-
* The relevant state for rendering parts of the app.
|
|
1333
|
-
*/
|
|
1334
|
-
components: ComponentsState;
|
|
1335
|
-
/**
|
|
1336
|
-
* The relevant state for the registered components.
|
|
1337
|
-
*/
|
|
1338
|
-
registry: RegistryState;
|
|
1339
|
-
/**
|
|
1340
|
-
* Gets the loaded modules.
|
|
1341
|
-
*/
|
|
1342
|
-
modules: Array<PiletMetadata>;
|
|
1343
|
-
/**
|
|
1344
|
-
* The foreign component portals to render.
|
|
1345
|
-
*/
|
|
1346
|
-
portals: Record<string, Array<React.ReactPortal>>;
|
|
1347
|
-
/**
|
|
1348
|
-
* The application's shared data.
|
|
1349
|
-
*/
|
|
1350
|
-
data: Dict<SharedDataItem>;
|
|
1351
|
-
/**
|
|
1352
|
-
* The used (exact) application routes.
|
|
1353
|
-
*/
|
|
1354
|
-
routes: Dict<React.ComponentType<ReactRouter.RouteComponentProps<any>>>;
|
|
1355
|
-
/**
|
|
1356
|
-
* The current provider.
|
|
1357
|
-
*/
|
|
1358
|
-
provider?: React.ComponentType;
|
|
1359
|
-
}
|
|
1360
|
-
|
|
1361
|
-
/**
|
|
1362
|
-
* The globally defined actions.
|
|
1363
|
-
*/
|
|
1364
|
-
export interface PiralActions extends PiralCustomActions {
|
|
1365
|
-
/**
|
|
1366
|
-
* Initializes the application shell.
|
|
1367
|
-
* @param loading The current loading state.
|
|
1368
|
-
* @param error The application error, if any.
|
|
1369
|
-
* @param modules The loaded pilets.
|
|
1370
|
-
*/
|
|
1371
|
-
initialize(loading: boolean, error: Error | undefined, modules: Array<Pilet>): void;
|
|
1372
|
-
/**
|
|
1373
|
-
* Injects a pilet at runtime - removes the pilet from registry first if available.
|
|
1374
|
-
* @param pilet The pilet to be injected.
|
|
1375
|
-
*/
|
|
1376
|
-
injectPilet(pilet: Pilet): void;
|
|
1377
|
-
/**
|
|
1378
|
-
* Defines a single action for Piral.
|
|
1379
|
-
* @param actionName The name of the action to define.
|
|
1380
|
-
* @param action The action to include.
|
|
1381
|
-
*/
|
|
1382
|
-
defineAction<T extends keyof PiralActions>(actionName: T, action: PiralAction<PiralActions[T]>): void;
|
|
1383
|
-
/**
|
|
1384
|
-
* Defines a set of actions for Piral.
|
|
1385
|
-
* @param actions The actions to define.
|
|
1386
|
-
*/
|
|
1387
|
-
defineActions(actions: PiralDefineActions): void;
|
|
1388
|
-
/**
|
|
1389
|
-
* Reads the value of a shared data item.
|
|
1390
|
-
* @param name The name of the shared item.
|
|
1391
|
-
*/
|
|
1392
|
-
readDataValue(name: string): any;
|
|
1166
|
+
readDataValue(name: string): any;
|
|
1393
1167
|
/**
|
|
1394
1168
|
* Tries to write a shared data item. The write access is only
|
|
1395
1169
|
* possible if the name belongs to the provided owner or has not
|
|
@@ -1402,11 +1176,6 @@ declare module "sample-cross-fx" {
|
|
|
1402
1176
|
* @param expiration The time for when to dispose the shared item.
|
|
1403
1177
|
*/
|
|
1404
1178
|
tryWriteDataItem(name: string, value: any, owner: string, target: DataStoreTarget, expiration: number): boolean;
|
|
1405
|
-
/**
|
|
1406
|
-
* Performs a layout change.
|
|
1407
|
-
* @param current The layout to take.
|
|
1408
|
-
*/
|
|
1409
|
-
changeLayout(current: LayoutType): void;
|
|
1410
1179
|
/**
|
|
1411
1180
|
* Registers a new route to be resolved.
|
|
1412
1181
|
* @param route The route to register.
|
|
@@ -1488,43 +1257,71 @@ declare module "sample-cross-fx" {
|
|
|
1488
1257
|
* @returns The desired part.
|
|
1489
1258
|
*/
|
|
1490
1259
|
readState<S>(select: (state: GlobalState) => S): S;
|
|
1260
|
+
/**
|
|
1261
|
+
* Performs a navigation.
|
|
1262
|
+
* @param path The path to navigate to.
|
|
1263
|
+
* @param state The optional state for the navigation.
|
|
1264
|
+
*/
|
|
1265
|
+
navigate(path: string, state?: any): void;
|
|
1491
1266
|
}
|
|
1492
1267
|
|
|
1493
1268
|
export type Without<T, K> = Pick<T, Exclude<keyof T, K>>;
|
|
1494
1269
|
|
|
1495
1270
|
/**
|
|
1496
|
-
* Custom
|
|
1497
|
-
*/
|
|
1498
|
-
export interface PiralCustomState {}
|
|
1499
|
-
|
|
1500
|
-
/**
|
|
1501
|
-
* The Piral global app sub-state container for app information.
|
|
1271
|
+
* Custom actions defined outside of piral-core.
|
|
1502
1272
|
*/
|
|
1503
|
-
export interface
|
|
1273
|
+
export interface PiralCustomActions {
|
|
1504
1274
|
/**
|
|
1505
|
-
*
|
|
1275
|
+
* Registers a new tile.
|
|
1276
|
+
* @param name The name of the tile.
|
|
1277
|
+
* @param value The tile registration.
|
|
1506
1278
|
*/
|
|
1507
|
-
|
|
1279
|
+
registerTile(name: string, value: TileRegistration): void;
|
|
1508
1280
|
/**
|
|
1509
|
-
*
|
|
1510
|
-
*
|
|
1511
|
-
* translations.
|
|
1281
|
+
* Unregisters an existing tile.
|
|
1282
|
+
* @param name The name of the tile to be removed.
|
|
1512
1283
|
*/
|
|
1513
|
-
|
|
1284
|
+
unregisterTile(name: string): void;
|
|
1285
|
+
}
|
|
1286
|
+
|
|
1287
|
+
/**
|
|
1288
|
+
* An evaluated pilet, i.e., a full pilet: functionality and metadata.
|
|
1289
|
+
*/
|
|
1290
|
+
export type Pilet = SinglePilet | MultiPilet;
|
|
1291
|
+
|
|
1292
|
+
/**
|
|
1293
|
+
* Pilet entry representing part of a response from the feed service.
|
|
1294
|
+
*/
|
|
1295
|
+
export type PiletEntry = MultiPiletEntry | SinglePiletEntry;
|
|
1296
|
+
|
|
1297
|
+
/**
|
|
1298
|
+
* The shape of an app action in Piral.
|
|
1299
|
+
*/
|
|
1300
|
+
export interface PiralAction<T extends (...args: any) => any> {
|
|
1301
|
+
(ctx: GlobalStateContext, ...args: Parameters<T>): ReturnType<T>;
|
|
1302
|
+
}
|
|
1303
|
+
|
|
1304
|
+
/**
|
|
1305
|
+
* A subset of the available app actions in Piral.
|
|
1306
|
+
*/
|
|
1307
|
+
export type PiralDefineActions = Partial<{
|
|
1308
|
+
[P in keyof PiralActions]: PiralAction<PiralActions[P]>;
|
|
1309
|
+
}>;
|
|
1310
|
+
|
|
1311
|
+
/**
|
|
1312
|
+
* The interface modeling the registration of a pilet page component.
|
|
1313
|
+
*/
|
|
1314
|
+
export interface PageRegistration extends BaseRegistration {
|
|
1514
1315
|
/**
|
|
1515
|
-
*
|
|
1316
|
+
* The registered page component.
|
|
1516
1317
|
*/
|
|
1517
|
-
|
|
1318
|
+
component: WrappedComponent<PageComponentProps>;
|
|
1518
1319
|
/**
|
|
1519
|
-
*
|
|
1320
|
+
* The page's associated metadata.
|
|
1520
1321
|
*/
|
|
1521
|
-
|
|
1322
|
+
meta: PiralPageMeta;
|
|
1522
1323
|
}
|
|
1523
1324
|
|
|
1524
|
-
export type ErrorComponentsState = {
|
|
1525
|
-
[P in keyof Errors]?: React.ComponentType<Errors[P]>;
|
|
1526
|
-
};
|
|
1527
|
-
|
|
1528
1325
|
/**
|
|
1529
1326
|
* The Piral global app sub-state container for shared components.
|
|
1530
1327
|
*/
|
|
@@ -1555,127 +1352,98 @@ declare module "sample-cross-fx" {
|
|
|
1555
1352
|
Debug?: React.ComponentType;
|
|
1556
1353
|
}
|
|
1557
1354
|
|
|
1355
|
+
export type ErrorComponentsState = {
|
|
1356
|
+
[P in keyof Errors]?: React.ComponentType<Errors[P]>;
|
|
1357
|
+
};
|
|
1358
|
+
|
|
1558
1359
|
/**
|
|
1559
|
-
* The Piral global app
|
|
1360
|
+
* The Piral global app state container.
|
|
1560
1361
|
*/
|
|
1561
|
-
export interface
|
|
1362
|
+
export interface GlobalState extends PiralCustomState {
|
|
1562
1363
|
/**
|
|
1563
|
-
* The
|
|
1364
|
+
* The relevant state for the app itself.
|
|
1564
1365
|
*/
|
|
1565
|
-
|
|
1366
|
+
app: AppState;
|
|
1566
1367
|
/**
|
|
1567
|
-
* The
|
|
1368
|
+
* The relevant state for rendering errors of the app.
|
|
1568
1369
|
*/
|
|
1569
|
-
|
|
1370
|
+
errorComponents: ErrorComponentsState;
|
|
1570
1371
|
/**
|
|
1571
|
-
* The
|
|
1372
|
+
* The relevant state for rendering parts of the app.
|
|
1572
1373
|
*/
|
|
1573
|
-
|
|
1574
|
-
}
|
|
1575
|
-
|
|
1576
|
-
export type Dict<T> = Record<string, T>;
|
|
1577
|
-
|
|
1578
|
-
/**
|
|
1579
|
-
* Defines the shape of a shared data item.
|
|
1580
|
-
*/
|
|
1581
|
-
export interface SharedDataItem<TValue = any> {
|
|
1374
|
+
components: ComponentsState;
|
|
1582
1375
|
/**
|
|
1583
|
-
*
|
|
1376
|
+
* The relevant state for the registered components.
|
|
1584
1377
|
*/
|
|
1585
|
-
|
|
1378
|
+
registry: RegistryState;
|
|
1586
1379
|
/**
|
|
1587
|
-
* Gets the
|
|
1380
|
+
* Gets the loaded modules.
|
|
1588
1381
|
*/
|
|
1589
|
-
|
|
1382
|
+
modules: Array<Pilet>;
|
|
1590
1383
|
/**
|
|
1591
|
-
*
|
|
1384
|
+
* The foreign component portals to render.
|
|
1592
1385
|
*/
|
|
1593
|
-
|
|
1386
|
+
portals: Record<string, Array<React.ReactPortal>>;
|
|
1594
1387
|
/**
|
|
1595
|
-
*
|
|
1388
|
+
* The application's shared data.
|
|
1596
1389
|
*/
|
|
1597
|
-
|
|
1598
|
-
}
|
|
1599
|
-
|
|
1600
|
-
/**
|
|
1601
|
-
* Custom actions defined outside of piral-core.
|
|
1602
|
-
*/
|
|
1603
|
-
export interface PiralCustomActions {
|
|
1390
|
+
data: Dict<SharedDataItem>;
|
|
1604
1391
|
/**
|
|
1605
|
-
*
|
|
1606
|
-
* @param name The name of the tile.
|
|
1607
|
-
* @param value The tile registration.
|
|
1392
|
+
* The used (exact) application routes.
|
|
1608
1393
|
*/
|
|
1609
|
-
|
|
1394
|
+
routes: Dict<React.ComponentType<ReactRouter.RouteComponentProps<any>>>;
|
|
1610
1395
|
/**
|
|
1611
|
-
*
|
|
1612
|
-
* @param name The name of the tile to be removed.
|
|
1396
|
+
* The current provider.
|
|
1613
1397
|
*/
|
|
1614
|
-
|
|
1398
|
+
provider?: React.ComponentType;
|
|
1615
1399
|
}
|
|
1616
1400
|
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1401
|
+
export interface TileRegistration extends BaseRegistration {
|
|
1402
|
+
component: WrappedComponent<TileComponentProps>;
|
|
1403
|
+
preferences: TilePreferences;
|
|
1404
|
+
}
|
|
1621
1405
|
|
|
1622
1406
|
/**
|
|
1623
|
-
*
|
|
1407
|
+
* An evaluated single pilet.
|
|
1624
1408
|
*/
|
|
1625
|
-
export
|
|
1626
|
-
(ctx: GlobalStateContext, ...args: Parameters<T>): ReturnType<T>;
|
|
1627
|
-
}
|
|
1409
|
+
export type SinglePilet = SinglePiletApp & PiletMetadata;
|
|
1628
1410
|
|
|
1629
1411
|
/**
|
|
1630
|
-
*
|
|
1412
|
+
* An evaluated multi pilet.
|
|
1631
1413
|
*/
|
|
1632
|
-
export type
|
|
1633
|
-
[P in keyof PiralActions]: PiralAction<PiralActions[P]>;
|
|
1634
|
-
}>;
|
|
1414
|
+
export type MultiPilet = MultiPiletApp & PiletMetadata;
|
|
1635
1415
|
|
|
1636
1416
|
/**
|
|
1637
|
-
* The
|
|
1417
|
+
* The metadata response for a multi pilet.
|
|
1638
1418
|
*/
|
|
1639
|
-
export type
|
|
1419
|
+
export type MultiPiletEntry = PiletBundleEntry;
|
|
1640
1420
|
|
|
1641
1421
|
/**
|
|
1642
|
-
* The
|
|
1422
|
+
* The metadata response for a single pilet.
|
|
1643
1423
|
*/
|
|
1644
|
-
export
|
|
1645
|
-
/**
|
|
1646
|
-
* The registered page component.
|
|
1647
|
-
*/
|
|
1648
|
-
component: WrappedComponent<PageComponentProps>;
|
|
1649
|
-
/**
|
|
1650
|
-
* The page's associated metadata.
|
|
1651
|
-
*/
|
|
1652
|
-
meta: PiralPageMeta;
|
|
1653
|
-
}
|
|
1424
|
+
export type SinglePiletEntry = PiletV0Entry | PiletV1Entry | PiletV2Entry | PiletVxEntry;
|
|
1654
1425
|
|
|
1655
1426
|
/**
|
|
1656
|
-
*
|
|
1427
|
+
* The Piral app instance context.
|
|
1657
1428
|
*/
|
|
1658
|
-
export interface
|
|
1659
|
-
/**
|
|
1660
|
-
* The props type for an extension error.
|
|
1661
|
-
*/
|
|
1662
|
-
extension: ExtensionErrorInfoProps;
|
|
1429
|
+
export interface GlobalStateContext extends PiralActions, EventEmitter {
|
|
1663
1430
|
/**
|
|
1664
|
-
* The
|
|
1431
|
+
* The global state context atom.
|
|
1432
|
+
* Changes to the state should always be dispatched via the `dispatch` action.
|
|
1665
1433
|
*/
|
|
1666
|
-
|
|
1434
|
+
state: UseBoundStore<GlobalState>;
|
|
1667
1435
|
/**
|
|
1668
|
-
* The
|
|
1436
|
+
* The API objects created for the loaded pilets.
|
|
1669
1437
|
*/
|
|
1670
|
-
|
|
1438
|
+
apis: PiletsBag;
|
|
1671
1439
|
/**
|
|
1672
|
-
* The
|
|
1440
|
+
* The available component converters.
|
|
1673
1441
|
*/
|
|
1674
|
-
|
|
1442
|
+
converters: ComponentConverters<any>;
|
|
1675
1443
|
/**
|
|
1676
|
-
* The
|
|
1444
|
+
* The initial options.
|
|
1677
1445
|
*/
|
|
1678
|
-
|
|
1446
|
+
options: LoadPiletsOptions;
|
|
1679
1447
|
}
|
|
1680
1448
|
|
|
1681
1449
|
/**
|
|
@@ -1705,7 +1473,12 @@ declare module "sample-cross-fx" {
|
|
|
1705
1473
|
/**
|
|
1706
1474
|
* The props of a Router component.
|
|
1707
1475
|
*/
|
|
1708
|
-
export interface RouterProps {
|
|
1476
|
+
export interface RouterProps {
|
|
1477
|
+
/**
|
|
1478
|
+
* The content to be rendered inside the router.
|
|
1479
|
+
*/
|
|
1480
|
+
children?: React.ReactNode;
|
|
1481
|
+
}
|
|
1709
1482
|
|
|
1710
1483
|
/**
|
|
1711
1484
|
* The props of a Layout component.
|
|
@@ -1715,6 +1488,10 @@ declare module "sample-cross-fx" {
|
|
|
1715
1488
|
* The currently selected layout type.
|
|
1716
1489
|
*/
|
|
1717
1490
|
currentLayout: LayoutType;
|
|
1491
|
+
/**
|
|
1492
|
+
* The page's content.
|
|
1493
|
+
*/
|
|
1494
|
+
children: React.ReactNode;
|
|
1718
1495
|
}
|
|
1719
1496
|
|
|
1720
1497
|
/**
|
|
@@ -1728,64 +1505,389 @@ declare module "sample-cross-fx" {
|
|
|
1728
1505
|
/**
|
|
1729
1506
|
* The component to register for the different paths.
|
|
1730
1507
|
*/
|
|
1731
|
-
paths: Array<
|
|
1732
|
-
/**
|
|
1733
|
-
* The exact path to use.
|
|
1734
|
-
*/
|
|
1735
|
-
path: string;
|
|
1736
|
-
/**
|
|
1737
|
-
* The component to register for this path.
|
|
1738
|
-
*/
|
|
1739
|
-
Component: React.ComponentType<ReactRouter.RouteComponentProps>;
|
|
1740
|
-
}>;
|
|
1508
|
+
paths: Array<AppPath>;
|
|
1741
1509
|
}
|
|
1742
1510
|
|
|
1743
1511
|
/**
|
|
1744
|
-
*
|
|
1512
|
+
* Map of all error types to their respective props.
|
|
1745
1513
|
*/
|
|
1746
|
-
export interface
|
|
1514
|
+
export interface Errors extends PiralCustomErrors {
|
|
1747
1515
|
/**
|
|
1748
|
-
* The
|
|
1516
|
+
* The props type for an extension error.
|
|
1517
|
+
*/
|
|
1518
|
+
extension: ExtensionErrorInfoProps;
|
|
1519
|
+
/**
|
|
1520
|
+
* The props type for a loading error.
|
|
1521
|
+
*/
|
|
1522
|
+
loading: LoadingErrorInfoProps;
|
|
1523
|
+
/**
|
|
1524
|
+
* The props type for a page error.
|
|
1525
|
+
*/
|
|
1526
|
+
page: PageErrorInfoProps;
|
|
1527
|
+
/**
|
|
1528
|
+
* The props type for a not found error.
|
|
1529
|
+
*/
|
|
1530
|
+
not_found: NotFoundErrorInfoProps;
|
|
1531
|
+
/**
|
|
1532
|
+
* The props type for an unknown error.
|
|
1533
|
+
*/
|
|
1534
|
+
unknown: UnknownErrorInfoProps;
|
|
1535
|
+
}
|
|
1536
|
+
|
|
1537
|
+
/**
|
|
1538
|
+
* Custom state extensions defined outside of piral-core.
|
|
1539
|
+
*/
|
|
1540
|
+
export interface PiralCustomState {}
|
|
1541
|
+
|
|
1542
|
+
/**
|
|
1543
|
+
* The Piral global app sub-state container for app information.
|
|
1544
|
+
*/
|
|
1545
|
+
export interface AppState {
|
|
1546
|
+
/**
|
|
1547
|
+
* Gets if the application is currently performing a background loading
|
|
1548
|
+
* activity, e.g., for loading modules asynchronously or fetching
|
|
1549
|
+
* translations.
|
|
1550
|
+
*/
|
|
1551
|
+
loading: boolean;
|
|
1552
|
+
/**
|
|
1553
|
+
* Gets an unrecoverable application error, if any.
|
|
1554
|
+
*/
|
|
1555
|
+
error: Error | undefined;
|
|
1556
|
+
/**
|
|
1557
|
+
* Gets the public path of the application.
|
|
1558
|
+
*/
|
|
1559
|
+
publicPath: string;
|
|
1560
|
+
}
|
|
1561
|
+
|
|
1562
|
+
/**
|
|
1563
|
+
* The Piral global app sub-state container for component registrations.
|
|
1564
|
+
*/
|
|
1565
|
+
export interface RegistryState extends PiralCustomRegistryState {
|
|
1566
|
+
/**
|
|
1567
|
+
* The registered page components for the router.
|
|
1568
|
+
*/
|
|
1569
|
+
pages: Dict<PageRegistration>;
|
|
1570
|
+
/**
|
|
1571
|
+
* The registered extension components for extension slots.
|
|
1572
|
+
*/
|
|
1573
|
+
extensions: Dict<Array<ExtensionRegistration>>;
|
|
1574
|
+
/**
|
|
1575
|
+
* The registered wrappers for any component.
|
|
1576
|
+
*/
|
|
1577
|
+
wrappers: Dict<React.ComponentType<any>>;
|
|
1578
|
+
}
|
|
1579
|
+
|
|
1580
|
+
export type Dict<T> = Record<string, T>;
|
|
1581
|
+
|
|
1582
|
+
/**
|
|
1583
|
+
* Defines the shape of a shared data item.
|
|
1584
|
+
*/
|
|
1585
|
+
export interface SharedDataItem<TValue = any> {
|
|
1586
|
+
/**
|
|
1587
|
+
* Gets the associated value.
|
|
1588
|
+
*/
|
|
1589
|
+
value: TValue;
|
|
1590
|
+
/**
|
|
1591
|
+
* Gets the owner of the item.
|
|
1592
|
+
*/
|
|
1593
|
+
owner: string;
|
|
1594
|
+
/**
|
|
1595
|
+
* Gets the storage location.
|
|
1596
|
+
*/
|
|
1597
|
+
target: DataStoreTarget;
|
|
1598
|
+
/**
|
|
1599
|
+
* Gets the expiration of the item.
|
|
1600
|
+
*/
|
|
1601
|
+
expires: number;
|
|
1602
|
+
}
|
|
1603
|
+
|
|
1604
|
+
/**
|
|
1605
|
+
* The pilet app, i.e., the functional exports.
|
|
1606
|
+
*/
|
|
1607
|
+
export interface SinglePiletApp {
|
|
1608
|
+
/**
|
|
1609
|
+
* Integrates the evaluated pilet into the application.
|
|
1610
|
+
* @param api The API to access the application.
|
|
1611
|
+
*/
|
|
1612
|
+
setup(api: PiletApi): void | Promise<void>;
|
|
1613
|
+
/**
|
|
1614
|
+
* Optional function for cleanup.
|
|
1615
|
+
* @param api The API to access the application.
|
|
1616
|
+
*/
|
|
1617
|
+
teardown?(api: PiletApi): void;
|
|
1618
|
+
}
|
|
1619
|
+
|
|
1620
|
+
/**
|
|
1621
|
+
* The pilet app, i.e., the functional exports.
|
|
1622
|
+
*/
|
|
1623
|
+
export interface MultiPiletApp {
|
|
1624
|
+
/**
|
|
1625
|
+
* Integrates the evaluated pilet into the application.
|
|
1626
|
+
* @param api The API to access the application.
|
|
1627
|
+
*/
|
|
1628
|
+
setup(apiFactory: PiletApiCreator): void | Promise<void>;
|
|
1629
|
+
}
|
|
1630
|
+
|
|
1631
|
+
/**
|
|
1632
|
+
* Metadata for pilets using the bundle schema.
|
|
1633
|
+
*/
|
|
1634
|
+
export interface PiletBundleEntry {
|
|
1635
|
+
/**
|
|
1636
|
+
* The name of the bundle pilet, i.e., the package id.
|
|
1637
|
+
*/
|
|
1638
|
+
name?: string;
|
|
1639
|
+
/**
|
|
1640
|
+
* Optionally provides the version of the specification for this pilet.
|
|
1641
|
+
*/
|
|
1642
|
+
spec?: "v1";
|
|
1643
|
+
/**
|
|
1644
|
+
* The link for retrieving the bundle content of the pilet.
|
|
1645
|
+
*/
|
|
1646
|
+
link: string;
|
|
1647
|
+
/**
|
|
1648
|
+
* The reference name for the global bundle-shared require.
|
|
1649
|
+
*/
|
|
1650
|
+
bundle: string;
|
|
1651
|
+
/**
|
|
1652
|
+
* The computed integrity of the pilet. Will be used to set the
|
|
1653
|
+
* integrity value of the script.
|
|
1654
|
+
*/
|
|
1655
|
+
integrity?: string;
|
|
1656
|
+
/**
|
|
1657
|
+
* Optionally provides some custom metadata for the pilet.
|
|
1658
|
+
*/
|
|
1659
|
+
custom?: any;
|
|
1660
|
+
/**
|
|
1661
|
+
* Additional shared dependency script files.
|
|
1662
|
+
*/
|
|
1663
|
+
dependencies?: Record<string, string>;
|
|
1664
|
+
}
|
|
1665
|
+
|
|
1666
|
+
/**
|
|
1667
|
+
* Metadata for pilets using the v0 schema.
|
|
1668
|
+
*/
|
|
1669
|
+
export type PiletV0Entry = PiletV0ContentEntry | PiletV0LinkEntry;
|
|
1670
|
+
|
|
1671
|
+
/**
|
|
1672
|
+
* Metadata for pilets using the v1 schema.
|
|
1673
|
+
*/
|
|
1674
|
+
export interface PiletV1Entry {
|
|
1675
|
+
/**
|
|
1676
|
+
* The name of the pilet, i.e., the package id.
|
|
1677
|
+
*/
|
|
1678
|
+
name: string;
|
|
1679
|
+
/**
|
|
1680
|
+
* The version of the pilet. Should be semantically versioned.
|
|
1681
|
+
*/
|
|
1682
|
+
version: string;
|
|
1683
|
+
/**
|
|
1684
|
+
* Optionally provides the version of the specification for this pilet.
|
|
1685
|
+
*/
|
|
1686
|
+
spec?: "v1";
|
|
1687
|
+
/**
|
|
1688
|
+
* The link for retrieving the content of the pilet.
|
|
1689
|
+
*/
|
|
1690
|
+
link: string;
|
|
1691
|
+
/**
|
|
1692
|
+
* The reference name for the global require.
|
|
1693
|
+
*/
|
|
1694
|
+
requireRef: string;
|
|
1695
|
+
/**
|
|
1696
|
+
* The computed integrity of the pilet. Will be used to set the
|
|
1697
|
+
* integrity value of the script.
|
|
1698
|
+
*/
|
|
1699
|
+
integrity?: string;
|
|
1700
|
+
/**
|
|
1701
|
+
* Optionally provides some custom metadata for the pilet.
|
|
1702
|
+
*/
|
|
1703
|
+
custom?: any;
|
|
1704
|
+
/**
|
|
1705
|
+
* Optionally provides some configuration to be used in the pilet.
|
|
1706
|
+
*/
|
|
1707
|
+
config?: Record<string, any>;
|
|
1708
|
+
/**
|
|
1709
|
+
* Additional shared dependency script files.
|
|
1710
|
+
*/
|
|
1711
|
+
dependencies?: Record<string, string>;
|
|
1712
|
+
}
|
|
1713
|
+
|
|
1714
|
+
/**
|
|
1715
|
+
* Metadata for pilets using the v2 schema.
|
|
1716
|
+
*/
|
|
1717
|
+
export interface PiletV2Entry {
|
|
1718
|
+
/**
|
|
1719
|
+
* The name of the pilet, i.e., the package id.
|
|
1720
|
+
*/
|
|
1721
|
+
name: string;
|
|
1722
|
+
/**
|
|
1723
|
+
* The version of the pilet. Should be semantically versioned.
|
|
1724
|
+
*/
|
|
1725
|
+
version: string;
|
|
1726
|
+
/**
|
|
1727
|
+
* Provides the version of the specification for this pilet.
|
|
1728
|
+
*/
|
|
1729
|
+
spec: "v2";
|
|
1730
|
+
/**
|
|
1731
|
+
* The reference name for the global require.
|
|
1732
|
+
*/
|
|
1733
|
+
requireRef: string;
|
|
1734
|
+
/**
|
|
1735
|
+
* The computed integrity of the pilet.
|
|
1736
|
+
*/
|
|
1737
|
+
integrity?: string;
|
|
1738
|
+
/**
|
|
1739
|
+
* The link for retrieving the content of the pilet.
|
|
1740
|
+
*/
|
|
1741
|
+
link: string;
|
|
1742
|
+
/**
|
|
1743
|
+
* Optionally provides some custom metadata for the pilet.
|
|
1744
|
+
*/
|
|
1745
|
+
custom?: any;
|
|
1746
|
+
/**
|
|
1747
|
+
* Optionally provides some configuration to be used in the pilet.
|
|
1748
|
+
*/
|
|
1749
|
+
config?: Record<string, any>;
|
|
1750
|
+
/**
|
|
1751
|
+
* Additional shared dependency script files.
|
|
1752
|
+
*/
|
|
1753
|
+
dependencies?: Record<string, string>;
|
|
1754
|
+
}
|
|
1755
|
+
|
|
1756
|
+
export interface PiletVxEntry {
|
|
1757
|
+
/**
|
|
1758
|
+
* The name of the pilet, i.e., the package id.
|
|
1759
|
+
*/
|
|
1760
|
+
name: string;
|
|
1761
|
+
/**
|
|
1762
|
+
* The version of the pilet. Should be semantically versioned.
|
|
1763
|
+
*/
|
|
1764
|
+
version: string;
|
|
1765
|
+
/**
|
|
1766
|
+
* Provides an identifier for the custom specification.
|
|
1767
|
+
*/
|
|
1768
|
+
spec: string;
|
|
1769
|
+
/**
|
|
1770
|
+
* Optionally provides some custom metadata for the pilet.
|
|
1771
|
+
*/
|
|
1772
|
+
custom?: any;
|
|
1773
|
+
/**
|
|
1774
|
+
* Optionally provides some configuration to be used in the pilet.
|
|
1775
|
+
*/
|
|
1776
|
+
config?: Record<string, any>;
|
|
1777
|
+
/**
|
|
1778
|
+
* Additional shared dependency script files.
|
|
1779
|
+
*/
|
|
1780
|
+
dependencies?: Record<string, string>;
|
|
1781
|
+
}
|
|
1782
|
+
|
|
1783
|
+
export type UseBoundStore<T extends State, CustomStoreApi extends StoreApi<T> = StoreApi<T>> = {
|
|
1784
|
+
(): T;
|
|
1785
|
+
<U>(selector: StateSelector<T, U>, equalityFn?: EqualityChecker<U>): U;
|
|
1786
|
+
} & CustomStoreApi;
|
|
1787
|
+
|
|
1788
|
+
/**
|
|
1789
|
+
* Represents the dictionary of the loaded pilets and their APIs.
|
|
1790
|
+
*/
|
|
1791
|
+
export interface PiletsBag {
|
|
1792
|
+
[name: string]: PiletApi;
|
|
1793
|
+
}
|
|
1794
|
+
|
|
1795
|
+
/**
|
|
1796
|
+
* The options for loading pilets.
|
|
1797
|
+
*/
|
|
1798
|
+
export interface LoadPiletsOptions {
|
|
1799
|
+
/**
|
|
1800
|
+
* The callback function for creating an API object.
|
|
1801
|
+
* The API object is passed on to a specific pilet.
|
|
1802
|
+
*/
|
|
1803
|
+
createApi: PiletApiCreator;
|
|
1804
|
+
/**
|
|
1805
|
+
* The callback for fetching the dynamic pilets.
|
|
1806
|
+
*/
|
|
1807
|
+
fetchPilets: PiletRequester;
|
|
1808
|
+
/**
|
|
1809
|
+
* Optionally, some already existing evaluated pilets, e.g.,
|
|
1810
|
+
* helpful when debugging or in SSR scenarios.
|
|
1811
|
+
*/
|
|
1812
|
+
pilets?: Array<Pilet>;
|
|
1813
|
+
/**
|
|
1814
|
+
* Optionally, configures the default loader.
|
|
1815
|
+
*/
|
|
1816
|
+
config?: DefaultLoaderConfig;
|
|
1817
|
+
/**
|
|
1818
|
+
* Optionally, defines the default way how to load a pilet.
|
|
1819
|
+
*/
|
|
1820
|
+
loadPilet?: PiletLoader;
|
|
1821
|
+
/**
|
|
1822
|
+
* Optionally, defines loaders for custom specifications.
|
|
1823
|
+
*/
|
|
1824
|
+
loaders?: CustomSpecLoaders;
|
|
1825
|
+
/**
|
|
1826
|
+
* Optionally, defines a set of loading hooks to be used.
|
|
1827
|
+
*/
|
|
1828
|
+
hooks?: PiletLifecycleHooks;
|
|
1829
|
+
/**
|
|
1830
|
+
* Gets the map of globally available dependencies with their names
|
|
1831
|
+
* as keys and their evaluated pilet content as value.
|
|
1832
|
+
*/
|
|
1833
|
+
dependencies?: AvailableDependencies;
|
|
1834
|
+
/**
|
|
1835
|
+
* Optionally, defines the loading strategy to use.
|
|
1836
|
+
*/
|
|
1837
|
+
strategy?: PiletLoadingStrategy;
|
|
1838
|
+
}
|
|
1839
|
+
|
|
1840
|
+
export interface DashboardContainerProps extends ReactRouter.RouteComponentProps {
|
|
1841
|
+
/**
|
|
1842
|
+
* The tiles to display.
|
|
1749
1843
|
*/
|
|
1750
|
-
|
|
1844
|
+
children?: React.ReactNode;
|
|
1751
1845
|
}
|
|
1752
1846
|
|
|
1753
|
-
export interface
|
|
1754
|
-
|
|
1755
|
-
|
|
1847
|
+
export interface DashboardTileProps {
|
|
1848
|
+
/**
|
|
1849
|
+
* The currently used number of columns.
|
|
1850
|
+
*/
|
|
1851
|
+
columns: number;
|
|
1852
|
+
/**
|
|
1853
|
+
* The currently used number of rows.
|
|
1854
|
+
*/
|
|
1855
|
+
rows: number;
|
|
1856
|
+
/**
|
|
1857
|
+
* The resizable status.
|
|
1858
|
+
*/
|
|
1859
|
+
resizable: boolean;
|
|
1860
|
+
/**
|
|
1861
|
+
* The provided tile preferences.
|
|
1862
|
+
*/
|
|
1863
|
+
meta: TilePreferences;
|
|
1864
|
+
/**
|
|
1865
|
+
* The content of the tile to display.
|
|
1866
|
+
*/
|
|
1867
|
+
children?: React.ReactNode;
|
|
1756
1868
|
}
|
|
1757
1869
|
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
export type SinglePilet = SinglePiletApp & SinglePiletMetadata;
|
|
1870
|
+
export type UnionOf<T> = {
|
|
1871
|
+
[K in keyof T]: T[K];
|
|
1872
|
+
}[keyof T];
|
|
1762
1873
|
|
|
1763
1874
|
/**
|
|
1764
|
-
*
|
|
1875
|
+
* The different known layout types.
|
|
1765
1876
|
*/
|
|
1766
|
-
export type
|
|
1877
|
+
export type LayoutType = "mobile" | "tablet" | "desktop";
|
|
1767
1878
|
|
|
1768
1879
|
/**
|
|
1769
|
-
*
|
|
1880
|
+
* Represents a path in the app registration.
|
|
1770
1881
|
*/
|
|
1771
|
-
export interface
|
|
1772
|
-
/**
|
|
1773
|
-
* The global state context atom.
|
|
1774
|
-
* Changes to the state should always be dispatched via the `dispatch` action.
|
|
1775
|
-
*/
|
|
1776
|
-
state: LibreAtom.Atom<GlobalState>;
|
|
1777
|
-
/**
|
|
1778
|
-
* The API objects created for the loaded pilets.
|
|
1779
|
-
*/
|
|
1780
|
-
apis: PiletsBag;
|
|
1882
|
+
export interface AppPath {
|
|
1781
1883
|
/**
|
|
1782
|
-
* The
|
|
1884
|
+
* The exact path to use.
|
|
1783
1885
|
*/
|
|
1784
|
-
|
|
1886
|
+
path: string;
|
|
1785
1887
|
/**
|
|
1786
|
-
* The
|
|
1888
|
+
* The component to register for this path.
|
|
1787
1889
|
*/
|
|
1788
|
-
|
|
1890
|
+
Component: React.ComponentType<ReactRouter.RouteComponentProps>;
|
|
1789
1891
|
}
|
|
1790
1892
|
|
|
1791
1893
|
/**
|
|
@@ -1873,104 +1975,125 @@ declare module "sample-cross-fx" {
|
|
|
1873
1975
|
pilet?: string;
|
|
1874
1976
|
}
|
|
1875
1977
|
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
* The currently used number of columns.
|
|
1881
|
-
*/
|
|
1882
|
-
columns: number;
|
|
1883
|
-
/**
|
|
1884
|
-
* The currently used number of rows.
|
|
1885
|
-
*/
|
|
1886
|
-
rows: number;
|
|
1887
|
-
/**
|
|
1888
|
-
* The resizable status.
|
|
1889
|
-
*/
|
|
1890
|
-
resizable: boolean;
|
|
1978
|
+
/**
|
|
1979
|
+
* Custom parts of the global registry state defined outside of piral-core.
|
|
1980
|
+
*/
|
|
1981
|
+
export interface PiralCustomRegistryState {
|
|
1891
1982
|
/**
|
|
1892
|
-
* The
|
|
1983
|
+
* The registered tile components for a dashboard.
|
|
1893
1984
|
*/
|
|
1894
|
-
|
|
1985
|
+
tiles: Dict<TileRegistration>;
|
|
1895
1986
|
}
|
|
1896
1987
|
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1988
|
+
/**
|
|
1989
|
+
* The creator function for the pilet API.
|
|
1990
|
+
*/
|
|
1991
|
+
export interface PiletApiCreator {
|
|
1992
|
+
(target: PiletMetadata): PiletApi;
|
|
1993
|
+
}
|
|
1900
1994
|
|
|
1901
1995
|
/**
|
|
1902
|
-
*
|
|
1996
|
+
* Metadata for pilets using the v0 schema with a content.
|
|
1903
1997
|
*/
|
|
1904
|
-
export interface
|
|
1998
|
+
export interface PiletV0ContentEntry extends PiletV0BaseEntry {
|
|
1905
1999
|
/**
|
|
1906
|
-
*
|
|
1907
|
-
*
|
|
2000
|
+
* The content of the pilet. If the content is not available
|
|
2001
|
+
* the link will be used (unless caching has been activated).
|
|
1908
2002
|
*/
|
|
1909
|
-
|
|
2003
|
+
content: string;
|
|
1910
2004
|
/**
|
|
1911
|
-
*
|
|
1912
|
-
*
|
|
2005
|
+
* If available indicates that the pilet should not be cached.
|
|
2006
|
+
* In case of a string this is interpreted as the expiration time
|
|
2007
|
+
* of the cache. In case of an accurate hash this should not be
|
|
2008
|
+
* required or set.
|
|
1913
2009
|
*/
|
|
1914
|
-
|
|
2010
|
+
noCache?: boolean | string;
|
|
1915
2011
|
}
|
|
1916
2012
|
|
|
1917
2013
|
/**
|
|
1918
|
-
*
|
|
2014
|
+
* Metadata for pilets using the v0 schema with a link.
|
|
1919
2015
|
*/
|
|
1920
|
-
export interface
|
|
2016
|
+
export interface PiletV0LinkEntry extends PiletV0BaseEntry {
|
|
1921
2017
|
/**
|
|
1922
|
-
*
|
|
1923
|
-
* @param api The API to access the application.
|
|
2018
|
+
* The link for retrieving the content of the pilet.
|
|
1924
2019
|
*/
|
|
1925
|
-
|
|
2020
|
+
link: string;
|
|
1926
2021
|
}
|
|
1927
2022
|
|
|
2023
|
+
export type StateSelector<T extends State, U> = (state: T) => U;
|
|
2024
|
+
|
|
2025
|
+
export type EqualityChecker<T> = (state: T, newState: T) => boolean;
|
|
2026
|
+
|
|
2027
|
+
export type State = object;
|
|
2028
|
+
|
|
2029
|
+
export type StoreApi<T extends State> = {
|
|
2030
|
+
setState: SetState<T>;
|
|
2031
|
+
getState: GetState<T>;
|
|
2032
|
+
subscribe: Subscribe<T>;
|
|
2033
|
+
destroy: Destroy;
|
|
2034
|
+
};
|
|
2035
|
+
|
|
1928
2036
|
/**
|
|
1929
|
-
*
|
|
2037
|
+
* The interface describing a function capable of fetching pilets.
|
|
1930
2038
|
*/
|
|
1931
|
-
export interface
|
|
1932
|
-
|
|
2039
|
+
export interface PiletRequester {
|
|
2040
|
+
(): Promise<PiletEntries>;
|
|
1933
2041
|
}
|
|
1934
2042
|
|
|
1935
2043
|
/**
|
|
1936
|
-
*
|
|
2044
|
+
* Additional configuration options for the default loader.
|
|
1937
2045
|
*/
|
|
1938
|
-
export interface
|
|
1939
|
-
/**
|
|
1940
|
-
* The callback function for creating an API object.
|
|
1941
|
-
* The API object is passed on to a specific pilet.
|
|
1942
|
-
*/
|
|
1943
|
-
createApi: PiletApiCreator;
|
|
1944
|
-
/**
|
|
1945
|
-
* The callback for fetching the dynamic pilets.
|
|
1946
|
-
*/
|
|
1947
|
-
fetchPilets: PiletRequester;
|
|
1948
|
-
/**
|
|
1949
|
-
* Optionally, some already existing evaluated pilets, e.g.,
|
|
1950
|
-
* helpful when debugging or in SSR scenarios.
|
|
1951
|
-
*/
|
|
1952
|
-
pilets?: Array<Pilet>;
|
|
1953
|
-
/**
|
|
1954
|
-
* Optionally, configures the default loader.
|
|
1955
|
-
*/
|
|
1956
|
-
config?: DefaultLoaderConfig;
|
|
2046
|
+
export interface DefaultLoaderConfig {
|
|
1957
2047
|
/**
|
|
1958
|
-
*
|
|
2048
|
+
* Sets the cross-origin attribute of potential script tags.
|
|
2049
|
+
* For pilets v1 this may be useful. Otherwise, only pilets that
|
|
2050
|
+
* have an integrity defined will be set to "anonymous".
|
|
1959
2051
|
*/
|
|
1960
|
-
|
|
2052
|
+
crossOrigin?: string;
|
|
2053
|
+
}
|
|
2054
|
+
|
|
2055
|
+
/**
|
|
2056
|
+
* The callback to be used to load a single pilet.
|
|
2057
|
+
*/
|
|
2058
|
+
export interface PiletLoader {
|
|
2059
|
+
(entry: PiletEntry): Promise<Pilet>;
|
|
2060
|
+
}
|
|
2061
|
+
|
|
2062
|
+
/**
|
|
2063
|
+
* Defines the spec identifiers for custom loading.
|
|
2064
|
+
*/
|
|
2065
|
+
export type CustomSpecLoaders = Record<string, PiletLoader>;
|
|
2066
|
+
|
|
2067
|
+
/**
|
|
2068
|
+
* A set of pipeline hooks used by the Piral loading orchestrator.
|
|
2069
|
+
*/
|
|
2070
|
+
export interface PiletLifecycleHooks {
|
|
1961
2071
|
/**
|
|
1962
|
-
*
|
|
2072
|
+
* Hook fired before a pilet is loaded.
|
|
1963
2073
|
*/
|
|
1964
|
-
|
|
2074
|
+
loadPilet?(pilet: PiletMetadata): void;
|
|
1965
2075
|
/**
|
|
1966
|
-
*
|
|
1967
|
-
* as keys and their evaluated pilet content as value.
|
|
2076
|
+
* Hook fired before a pilet is being set up.
|
|
1968
2077
|
*/
|
|
1969
|
-
|
|
2078
|
+
setupPilet?(pilet: Pilet): void;
|
|
1970
2079
|
/**
|
|
1971
|
-
*
|
|
2080
|
+
* Hook fired before a pilet is being cleaned up.
|
|
1972
2081
|
*/
|
|
1973
|
-
|
|
2082
|
+
cleanupPilet?(pilet: Pilet): void;
|
|
2083
|
+
}
|
|
2084
|
+
|
|
2085
|
+
/**
|
|
2086
|
+
* The record containing all available dependencies.
|
|
2087
|
+
*/
|
|
2088
|
+
export interface AvailableDependencies {
|
|
2089
|
+
[name: string]: any;
|
|
2090
|
+
}
|
|
2091
|
+
|
|
2092
|
+
/**
|
|
2093
|
+
* The strategy for how pilets are loaded at runtime.
|
|
2094
|
+
*/
|
|
2095
|
+
export interface PiletLoadingStrategy {
|
|
2096
|
+
(options: LoadPiletsOptions, pilets: PiletsLoaded): PromiseLike<void>;
|
|
1974
2097
|
}
|
|
1975
2098
|
|
|
1976
2099
|
export interface TileErrorInfoProps {
|
|
@@ -1997,61 +2120,76 @@ declare module "sample-cross-fx" {
|
|
|
1997
2120
|
}
|
|
1998
2121
|
|
|
1999
2122
|
/**
|
|
2000
|
-
*
|
|
2001
|
-
*/
|
|
2002
|
-
export interface PiletApiCreator {
|
|
2003
|
-
(target: PiletMetadata): PiletApi;
|
|
2004
|
-
}
|
|
2005
|
-
|
|
2006
|
-
/**
|
|
2007
|
-
* The interface describing a function capable of fetching pilets.
|
|
2008
|
-
*/
|
|
2009
|
-
export interface PiletRequester {
|
|
2010
|
-
(): Promise<Array<PiletMetadata>>;
|
|
2011
|
-
}
|
|
2012
|
-
|
|
2013
|
-
/**
|
|
2014
|
-
* Additional configuration options for the default loader.
|
|
2123
|
+
* Basic metadata for pilets using the v0 schema.
|
|
2015
2124
|
*/
|
|
2016
|
-
export interface
|
|
2125
|
+
export interface PiletV0BaseEntry {
|
|
2017
2126
|
/**
|
|
2018
|
-
*
|
|
2019
|
-
* For pilets v1 this may be useful. Otherwise, only pilets that
|
|
2020
|
-
* have an integrity defined will be set to "anonymous".
|
|
2127
|
+
* The name of the pilet, i.e., the package id.
|
|
2021
2128
|
*/
|
|
2022
|
-
|
|
2129
|
+
name: string;
|
|
2130
|
+
/**
|
|
2131
|
+
* The version of the pilet. Should be semantically versioned.
|
|
2132
|
+
*/
|
|
2133
|
+
version: string;
|
|
2134
|
+
/**
|
|
2135
|
+
* Optionally provides the version of the specification for this pilet.
|
|
2136
|
+
*/
|
|
2137
|
+
spec?: "v0";
|
|
2138
|
+
/**
|
|
2139
|
+
* The computed hash value of the pilet's content. Should be
|
|
2140
|
+
* accurate to allow caching.
|
|
2141
|
+
*/
|
|
2142
|
+
hash: string;
|
|
2143
|
+
/**
|
|
2144
|
+
* Optionally provides some custom metadata for the pilet.
|
|
2145
|
+
*/
|
|
2146
|
+
custom?: any;
|
|
2147
|
+
/**
|
|
2148
|
+
* Optionally provides some configuration to be used in the pilet.
|
|
2149
|
+
*/
|
|
2150
|
+
config?: Record<string, any>;
|
|
2151
|
+
/**
|
|
2152
|
+
* Additional shared dependency script files.
|
|
2153
|
+
*/
|
|
2154
|
+
dependencies?: Record<string, string>;
|
|
2023
2155
|
}
|
|
2024
2156
|
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2157
|
+
export type SetState<T extends State> = {
|
|
2158
|
+
<K1 extends keyof T, K2 extends keyof T = K1, K3 extends keyof T = K2, K4 extends keyof T = K3>(partial: PartialState<T, K1, K2, K3, K4>, replace?: boolean): void;
|
|
2159
|
+
};
|
|
2160
|
+
|
|
2161
|
+
export type GetState<T extends State> = () => T;
|
|
2162
|
+
|
|
2163
|
+
export type Subscribe<T extends State> = {
|
|
2164
|
+
(listener: StateListener<T>): () => void;
|
|
2165
|
+
<StateSlice>(listener: StateSliceListener<StateSlice>, selector?: StateSelector<T, StateSlice>, equalityFn?: EqualityChecker<StateSlice>): () => void;
|
|
2166
|
+
};
|
|
2167
|
+
|
|
2168
|
+
export type Destroy = () => void;
|
|
2031
2169
|
|
|
2032
2170
|
/**
|
|
2033
|
-
*
|
|
2171
|
+
* The entries representing pilets from a feed service response.
|
|
2034
2172
|
*/
|
|
2035
|
-
export type
|
|
2173
|
+
export type PiletEntries = Array<PiletEntry>;
|
|
2036
2174
|
|
|
2037
2175
|
/**
|
|
2038
|
-
* The
|
|
2176
|
+
* The callback to be used when pilets have been loaded.
|
|
2039
2177
|
*/
|
|
2040
|
-
export interface
|
|
2041
|
-
|
|
2178
|
+
export interface PiletsLoaded {
|
|
2179
|
+
(error: Error | undefined, pilets: Array<Pilet>): void;
|
|
2042
2180
|
}
|
|
2043
2181
|
|
|
2044
2182
|
/**
|
|
2045
|
-
*
|
|
2183
|
+
* @deprecated Use the builtin `Partial<T>` instead of `PartialState<T>`.
|
|
2184
|
+
* Additionally turn on `--exactOptionalPropertyTypes` tsc flag.
|
|
2185
|
+
* `PartialState` will be removed in next major
|
|
2046
2186
|
*/
|
|
2047
|
-
export
|
|
2048
|
-
|
|
2049
|
-
|
|
2187
|
+
export type PartialState<T extends State, K1 extends keyof T = keyof T, K2 extends keyof T = K1, K3 extends keyof T = K2, K4 extends keyof T = K3> = (Pick<T, K1> | Pick<T, K2> | Pick<T, K3> | Pick<T, K4> | T) | ((state: T) => Pick<T, K1> | Pick<T, K2> | Pick<T, K3> | Pick<T, K4> | T);
|
|
2188
|
+
|
|
2189
|
+
export type StateListener<T> = (state: T, previousState: T) => void;
|
|
2050
2190
|
|
|
2051
2191
|
/**
|
|
2052
|
-
*
|
|
2192
|
+
* @deprecated Use `StateListener<T>` instead of `StateSliceListener<T>`.
|
|
2053
2193
|
*/
|
|
2054
|
-
export
|
|
2055
|
-
(error: Error | undefined, pilets: Array<Pilet>): void;
|
|
2056
|
-
}
|
|
2194
|
+
export type StateSliceListener<T> = (slice: T, previousSlice: T) => void;
|
|
2057
2195
|
}
|