sample-piral 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
@@ -594,6 +594,10 @@ declare module "sample-piral" {
594
594
  * The provided parameters for showing the extension.
595
595
  */
596
596
  params: T extends keyof PiralExtensionSlotMap ? PiralExtensionSlotMap[T] : T extends string ? any : T;
597
+ /**
598
+ * The optional children to receive, if any.
599
+ */
600
+ children?: React.ReactNode;
597
601
  }
598
602
 
599
603
  /**
@@ -614,9 +618,27 @@ declare module "sample-piral" {
614
618
  * for the specified extension.
615
619
  */
616
620
  empty?(): React.ReactNode;
621
+ /**
622
+ * Determines if the `render` function should be called in case no
623
+ * components are available for the specified extension.
624
+ *
625
+ * If true, `empty` will be called and returned from the slot.
626
+ * If false, `render` will be called with the result of calling `empty`.
627
+ * The result of calling `render` will then be returned from the slot.
628
+ */
629
+ emptySkipsRender?: boolean;
630
+ /**
631
+ * Defines the order of the components to render.
632
+ * May be more convient than using `render` w.r.t. ordering extensions
633
+ * by their supplied metadata.
634
+ * @param extensions The registered extensions.
635
+ * @returns The ordered extensions.
636
+ */
637
+ order?(extensions: Array<ExtensionRegistration>): Array<ExtensionRegistration>;
617
638
  /**
618
639
  * Defines how the provided nodes should be rendered.
619
640
  * @param nodes The rendered extension nodes.
641
+ * @returns The rendered nodes, i.e., an ReactElement.
620
642
  */
621
643
  render?(nodes: Array<React.ReactNode>): React.ReactElement<any, any> | null;
622
644
  /**
@@ -948,6 +970,24 @@ declare module "sample-piral" {
948
970
  */
949
971
  export interface PiralCustomExtensionSlotMap {}
950
972
 
973
+ /**
974
+ * The interface modeling the registration of a pilet extension component.
975
+ */
976
+ export interface ExtensionRegistration extends BaseRegistration {
977
+ /**
978
+ * The wrapped registered extension component.
979
+ */
980
+ component: WrappedComponent<ExtensionComponentProps<string>>;
981
+ /**
982
+ * The original extension component that has been registered.
983
+ */
984
+ reference: any;
985
+ /**
986
+ * The default params (i.e., meta) of the extension.
987
+ */
988
+ defaults: any;
989
+ }
990
+
951
991
  /**
952
992
  * Metadata for pilets using the v0 schema with a content.
953
993
  */
@@ -995,6 +1035,18 @@ declare module "sample-piral" {
995
1035
  readState: PiralActions["readState"];
996
1036
  }
997
1037
 
1038
+ /**
1039
+ * The base type for pilet component registration in the global state context.
1040
+ */
1041
+ export interface BaseRegistration {
1042
+ /**
1043
+ * The pilet registering the component.
1044
+ */
1045
+ pilet: string;
1046
+ }
1047
+
1048
+ export type WrappedComponent<TProps> = React.ComponentType<Without<TProps, keyof BaseComponentProps>>;
1049
+
998
1050
  /**
999
1051
  * Basic metadata for pilets using the v0 schema.
1000
1052
  */
@@ -1204,6 +1256,8 @@ declare module "sample-piral" {
1204
1256
  readState<S>(select: (state: GlobalState) => S): S;
1205
1257
  }
1206
1258
 
1259
+ export type Without<T, K> = Pick<T, Exclude<keyof T, K>>;
1260
+
1207
1261
  /**
1208
1262
  * Custom state extensions defined outside of piral-core.
1209
1263
  */
@@ -1527,19 +1581,16 @@ declare module "sample-piral" {
1527
1581
  * The interface modeling the registration of a pilet page component.
1528
1582
  */
1529
1583
  export interface PageRegistration extends BaseRegistration {
1584
+ /**
1585
+ * The registered page component.
1586
+ */
1530
1587
  component: WrappedComponent<PageComponentProps>;
1588
+ /**
1589
+ * The page's associated metadata.
1590
+ */
1531
1591
  meta: PiralPageMeta;
1532
1592
  }
1533
1593
 
1534
- /**
1535
- * The interface modeling the registration of a pilet extension component.
1536
- */
1537
- export interface ExtensionRegistration extends BaseRegistration {
1538
- component: WrappedComponent<ExtensionComponentProps<string>>;
1539
- reference: any;
1540
- defaults: any;
1541
- }
1542
-
1543
1594
  export interface OpenNotification {
1544
1595
  id: string;
1545
1596
  component: React.ComponentType<BareNotificationProps>;
@@ -1820,15 +1871,6 @@ declare module "sample-piral" {
1820
1871
  options: LoadPiletsOptions;
1821
1872
  }
1822
1873
 
1823
- /**
1824
- * The base type for pilet component registration in the global state context.
1825
- */
1826
- export interface BaseRegistration {
1827
- pilet: string;
1828
- }
1829
-
1830
- export type WrappedComponent<TProps> = React.ComponentType<Without<TProps, keyof BaseComponentProps>>;
1831
-
1832
1874
  export interface FeedDataState {
1833
1875
  /**
1834
1876
  * Determines if the feed data is currently loading.
@@ -2103,8 +2145,6 @@ declare module "sample-piral" {
2103
2145
  strategy?: PiletLoadingStrategy;
2104
2146
  }
2105
2147
 
2106
- export type Without<T, K> = Pick<T, Exclude<keyof T, K>>;
2107
-
2108
2148
  export interface TileErrorInfoProps {
2109
2149
  /**
2110
2150
  * The type of the error.
@@ -2639,23 +2639,33 @@ __webpack_require__.r(__webpack_exports__);
2639
2639
 
2640
2640
 
2641
2641
 
2642
+
2643
+ function defaultOrder(extensions) {
2644
+ return extensions;
2645
+ }
2642
2646
  /**
2643
2647
  * The extension slot component to be used when the available
2644
2648
  * extensions of a given name should be rendered at a specific
2645
2649
  * location.
2646
2650
  */
2647
2651
 
2652
+
2648
2653
  function ExtensionSlot(props) {
2649
2654
  var name = props.name,
2650
2655
  _props$render = props.render,
2651
2656
  render = _props$render === void 0 ? _utils__WEBPACK_IMPORTED_MODULE_1__.defaultRender : _props$render,
2652
2657
  empty = props.empty,
2653
2658
  params = props.params,
2654
- children = props.children;
2659
+ children = props.children,
2660
+ _props$emptySkipsRend = props.emptySkipsRender,
2661
+ emptySkipsRender = _props$emptySkipsRend === void 0 ? false : _props$emptySkipsRend,
2662
+ _props$order = props.order,
2663
+ order = _props$order === void 0 ? defaultOrder : _props$order;
2655
2664
  var extensions = (0,_hooks__WEBPACK_IMPORTED_MODULE_2__.useGlobalState)(function (s) {
2656
2665
  return s.registry.extensions[name] || _utils__WEBPACK_IMPORTED_MODULE_3__.none;
2657
2666
  });
2658
- 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(function (_ref, i) {
2667
+ var isEmpty = extensions.length === 0 && (0,piral_base__WEBPACK_IMPORTED_MODULE_4__.isfunc)(empty);
2668
+ var content = isEmpty ? [(0,_utils__WEBPACK_IMPORTED_MODULE_1__.defaultRender)(empty(), 'empty')] : order(extensions).map(function (_ref, i) {
2659
2669
  var Component = _ref.component,
2660
2670
  reference = _ref.reference,
2661
2671
  _ref$defaults = _ref.defaults,
@@ -2665,7 +2675,13 @@ function ExtensionSlot(props) {
2665
2675
  children: children,
2666
2676
  params: Object.assign(Object.assign({}, defaults), params || {})
2667
2677
  });
2668
- }));
2678
+ });
2679
+
2680
+ if (isEmpty && emptySkipsRender) {
2681
+ return content[0];
2682
+ }
2683
+
2684
+ return render(content);
2669
2685
  }
2670
2686
  ExtensionSlot.displayName = "ExtensionSlot";
2671
2687
 
@@ -3525,7 +3541,7 @@ function createInstance() {
3525
3541
  var createApi = apiFactory(context, usedPlugins);
3526
3542
  var root = createApi({
3527
3543
  name: 'root',
3528
- version: "0.14.24-beta.4144" || 0,
3544
+ version: "0.14.24-beta.4161" || 0,
3529
3545
  spec: ''
3530
3546
  });
3531
3547
  var options = (0,_helpers__WEBPACK_IMPORTED_MODULE_6__.createPiletOptions)({
@@ -8474,11 +8490,11 @@ function installPiralDebug(options) {
8474
8490
  debug: debugApiVersion,
8475
8491
  instance: {
8476
8492
  name: "sample-piral",
8477
- version: "0.14.24-beta.4144",
8493
+ version: "0.14.24-beta.4161",
8478
8494
  dependencies: "reactstrap,react,react-dom,react-router,react-router-dom,history,tslib,path-to-regexp,@libre/atom,@dbeining/react-atom"
8479
8495
  },
8480
8496
  build: {
8481
- date: "2022-05-04T12:53:01.648Z",
8497
+ date: "2022-05-06T14:36:17.678Z",
8482
8498
  cli: "0.14.23",
8483
8499
  compat: "0.14"
8484
8500
  },
@@ -79879,4 +79895,4 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
79879
79895
 
79880
79896
  /******/ })()
79881
79897
  ;
79882
- //# sourceMappingURL=index.374623.js.map
79898
+ //# sourceMappingURL=index.d51e4f.js.map