sample-cross-fx 0.14.24-beta.4144 → 0.14.24-beta.4161

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.d.ts CHANGED
@@ -878,6 +878,10 @@ declare module "sample-cross-fx" {
878
878
  * The provided parameters for showing the extension.
879
879
  */
880
880
  params: T extends keyof PiralExtensionSlotMap ? PiralExtensionSlotMap[T] : T extends string ? any : T;
881
+ /**
882
+ * The optional children to receive, if any.
883
+ */
884
+ children?: React.ReactNode;
881
885
  }
882
886
 
883
887
  /**
@@ -898,9 +902,27 @@ declare module "sample-cross-fx" {
898
902
  * for the specified extension.
899
903
  */
900
904
  empty?(): React.ReactNode;
905
+ /**
906
+ * Determines if the `render` function should be called in case no
907
+ * components are available for the specified extension.
908
+ *
909
+ * If true, `empty` will be called and returned from the slot.
910
+ * If false, `render` will be called with the result of calling `empty`.
911
+ * The result of calling `render` will then be returned from the slot.
912
+ */
913
+ emptySkipsRender?: boolean;
914
+ /**
915
+ * Defines the order of the components to render.
916
+ * May be more convient than using `render` w.r.t. ordering extensions
917
+ * by their supplied metadata.
918
+ * @param extensions The registered extensions.
919
+ * @returns The ordered extensions.
920
+ */
921
+ order?(extensions: Array<ExtensionRegistration>): Array<ExtensionRegistration>;
901
922
  /**
902
923
  * Defines how the provided nodes should be rendered.
903
924
  * @param nodes The rendered extension nodes.
925
+ * @returns The rendered nodes, i.e., an ReactElement.
904
926
  */
905
927
  render?(nodes: Array<React.ReactNode>): React.ReactElement<any, any> | null;
906
928
  /**
@@ -1188,6 +1210,24 @@ declare module "sample-cross-fx" {
1188
1210
  */
1189
1211
  export interface PiralCustomExtensionSlotMap {}
1190
1212
 
1213
+ /**
1214
+ * The interface modeling the registration of a pilet extension component.
1215
+ */
1216
+ export interface ExtensionRegistration extends BaseRegistration {
1217
+ /**
1218
+ * The wrapped registered extension component.
1219
+ */
1220
+ component: WrappedComponent<ExtensionComponentProps<string>>;
1221
+ /**
1222
+ * The original extension component that has been registered.
1223
+ */
1224
+ reference: any;
1225
+ /**
1226
+ * The default params (i.e., meta) of the extension.
1227
+ */
1228
+ defaults: any;
1229
+ }
1230
+
1191
1231
  /**
1192
1232
  * Metadata for pilets using the v0 schema with a content.
1193
1233
  */
@@ -1225,6 +1265,18 @@ declare module "sample-cross-fx" {
1225
1265
  readState: PiralActions["readState"];
1226
1266
  }
1227
1267
 
1268
+ /**
1269
+ * The base type for pilet component registration in the global state context.
1270
+ */
1271
+ export interface BaseRegistration {
1272
+ /**
1273
+ * The pilet registering the component.
1274
+ */
1275
+ pilet: string;
1276
+ }
1277
+
1278
+ export type WrappedComponent<TProps> = React.ComponentType<Without<TProps, keyof BaseComponentProps>>;
1279
+
1228
1280
  /**
1229
1281
  * Basic metadata for pilets using the v0 schema.
1230
1282
  */
@@ -1434,6 +1486,8 @@ declare module "sample-cross-fx" {
1434
1486
  readState<S>(select: (state: GlobalState) => S): S;
1435
1487
  }
1436
1488
 
1489
+ export type Without<T, K> = Pick<T, Exclude<keyof T, K>>;
1490
+
1437
1491
  /**
1438
1492
  * Custom state extensions defined outside of piral-core.
1439
1493
  */
@@ -1584,19 +1638,16 @@ declare module "sample-cross-fx" {
1584
1638
  * The interface modeling the registration of a pilet page component.
1585
1639
  */
1586
1640
  export interface PageRegistration extends BaseRegistration {
1641
+ /**
1642
+ * The registered page component.
1643
+ */
1587
1644
  component: WrappedComponent<PageComponentProps>;
1645
+ /**
1646
+ * The page's associated metadata.
1647
+ */
1588
1648
  meta: PiralPageMeta;
1589
1649
  }
1590
1650
 
1591
- /**
1592
- * The interface modeling the registration of a pilet extension component.
1593
- */
1594
- export interface ExtensionRegistration extends BaseRegistration {
1595
- component: WrappedComponent<ExtensionComponentProps<string>>;
1596
- reference: any;
1597
- defaults: any;
1598
- }
1599
-
1600
1651
  /**
1601
1652
  * Map of all error types to their respective props.
1602
1653
  */
@@ -1733,15 +1784,6 @@ declare module "sample-cross-fx" {
1733
1784
  options: LoadPiletsOptions;
1734
1785
  }
1735
1786
 
1736
- /**
1737
- * The base type for pilet component registration in the global state context.
1738
- */
1739
- export interface BaseRegistration {
1740
- pilet: string;
1741
- }
1742
-
1743
- export type WrappedComponent<TProps> = React.ComponentType<Without<TProps, keyof BaseComponentProps>>;
1744
-
1745
1787
  /**
1746
1788
  * Custom errors defined outside of piral-core.
1747
1789
  */
@@ -1927,8 +1969,6 @@ declare module "sample-cross-fx" {
1927
1969
  strategy?: PiletLoadingStrategy;
1928
1970
  }
1929
1971
 
1930
- export type Without<T, K> = Pick<T, Exclude<keyof T, K>>;
1931
-
1932
1972
  export interface TileErrorInfoProps {
1933
1973
  /**
1934
1974
  * The type of the error.
@@ -129049,22 +129049,30 @@ __webpack_require__.r(__webpack_exports__);
129049
129049
 
129050
129050
 
129051
129051
 
129052
+
129053
+ function defaultOrder(extensions) {
129054
+ return extensions;
129055
+ }
129052
129056
  /**
129053
129057
  * The extension slot component to be used when the available
129054
129058
  * extensions of a given name should be rendered at a specific
129055
129059
  * location.
129056
129060
  */
129057
129061
 
129062
+
129058
129063
  function ExtensionSlot(props) {
129059
129064
  const {
129060
129065
  name,
129061
129066
  render = _utils__WEBPACK_IMPORTED_MODULE_1__.defaultRender,
129062
129067
  empty,
129063
129068
  params,
129064
- children
129069
+ children,
129070
+ emptySkipsRender = false,
129071
+ order = defaultOrder
129065
129072
  } = props;
129066
129073
  const extensions = (0,_hooks__WEBPACK_IMPORTED_MODULE_2__.useGlobalState)(s => s.registry.extensions[name] || _utils__WEBPACK_IMPORTED_MODULE_3__.none);
129067
- return render(extensions.length === 0 && (0,piral_base__WEBPACK_IMPORTED_MODULE_4__.isfunc)(empty) ? [(0,_utils__WEBPACK_IMPORTED_MODULE_1__.defaultRender)(empty(), 'empty')] : extensions.map(({
129074
+ const isEmpty = extensions.length === 0 && (0,piral_base__WEBPACK_IMPORTED_MODULE_4__.isfunc)(empty);
129075
+ const content = isEmpty ? [(0,_utils__WEBPACK_IMPORTED_MODULE_1__.defaultRender)(empty(), 'empty')] : order(extensions).map(({
129068
129076
  component: Component,
129069
129077
  reference,
129070
129078
  defaults = {}
@@ -129072,7 +129080,13 @@ function ExtensionSlot(props) {
129072
129080
  key: `${(reference === null || reference === void 0 ? void 0 : reference.displayName) || '_'}${i}`,
129073
129081
  children: children,
129074
129082
  params: Object.assign(Object.assign({}, defaults), params || {})
129075
- })));
129083
+ }));
129084
+
129085
+ if (isEmpty && emptySkipsRender) {
129086
+ return content[0];
129087
+ }
129088
+
129089
+ return render(content);
129076
129090
  }
129077
129091
  ExtensionSlot.displayName = `ExtensionSlot`;
129078
129092
 
@@ -129757,7 +129771,7 @@ function createInstance(config = {}) {
129757
129771
  const createApi = apiFactory(context, usedPlugins);
129758
129772
  const root = createApi({
129759
129773
  name: 'root',
129760
- version: "0.14.24-beta.4144" || 0,
129774
+ version: "0.14.24-beta.4161" || 0,
129761
129775
  spec: ''
129762
129776
  });
129763
129777
  const options = (0,_helpers__WEBPACK_IMPORTED_MODULE_6__.createPiletOptions)({
@@ -131757,11 +131771,11 @@ function installPiralDebug(options) {
131757
131771
  debug: debugApiVersion,
131758
131772
  instance: {
131759
131773
  name: "sample-cross-fx",
131760
- version: "0.14.24-beta.4144",
131774
+ version: "0.14.24-beta.4161",
131761
131775
  dependencies: "@angular/common,@angular/compiler,@angular/core,@angular/platform-browser,@angular/platform-browser-dynamic,@webcomponents/webcomponentsjs,angular,aurelia-framework,aurelia-templating-binding,aurelia-templating-resources,aurelia-pal-browser,aurelia-event-aggregator,aurelia-history-browser,hyperapp,inferno,inferno-create-element,mithril,lit-element,solid-js,solid-js/dom,piral-ng/common,preact,riot,rxjs,vue,zone.js,react,react-dom,react-router,react-router-dom,history,tslib,path-to-regexp,@libre/atom,@dbeining/react-atom"
131762
131776
  },
131763
131777
  build: {
131764
- date: "2022-05-04T12:53:45.333Z",
131778
+ date: "2022-05-06T14:34:53.098Z",
131765
131779
  cli: "0.14.23",
131766
131780
  compat: "0.14"
131767
131781
  },
@@ -254023,4 +254037,4 @@ const app = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_7__.createElement(piral_
254023
254037
 
254024
254038
  /******/ })()
254025
254039
  ;
254026
- //# sourceMappingURL=index.b6b3d6.js.map
254040
+ //# sourceMappingURL=index.ea3783.js.map