@lemon-fe/mini-app 1.2.0 → 1.2.4

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.
@@ -1,11 +1,12 @@
1
- import type { ReactElement } from 'react';
1
+ import type { ReactElement, ReactNode } from 'react';
2
2
  declare type ContentType = ReactElement | null;
3
3
  declare function PortalHost(props: {
4
4
  children: ContentType;
5
5
  }): JSX.Element;
6
6
  declare function PortalSlot(props: {
7
7
  slot: string;
8
- }): ContentType;
8
+ children?: ReactNode;
9
+ }): JSX.Element;
9
10
  declare function Portal(props: {
10
11
  children: ContentType;
11
12
  slot: string;
@@ -98,7 +98,9 @@ function PortalHost(props) {
98
98
  }
99
99
 
100
100
  function PortalSlot(props) {
101
- var slot = props.slot;
101
+ var slot = props.slot,
102
+ _props$children = props.children,
103
+ children = _props$children === void 0 ? null : _props$children;
102
104
 
103
105
  var _useContext = useContext(Context),
104
106
  observable = _useContext.observable;
@@ -118,7 +120,7 @@ function PortalSlot(props) {
118
120
 
119
121
  return unsubscribe;
120
122
  }, [slot]);
121
- return node;
123
+ return node || /*#__PURE__*/React.createElement(React.Fragment, null, children);
122
124
  }
123
125
 
124
126
  function Portal(props) {
@@ -54,7 +54,9 @@ function Content(props, ref) {
54
54
  fillRule: "evenodd"
55
55
  }))), /*#__PURE__*/React.createElement("div", {
56
56
  className: "lemon-route-header-center"
57
- }, route.title), /*#__PURE__*/React.createElement("div", {
57
+ }, /*#__PURE__*/React.createElement(Portal.Slot, {
58
+ slot: "header-title"
59
+ }, route.title)), /*#__PURE__*/React.createElement("div", {
58
60
  className: "lemon-route-header-right"
59
61
  }, /*#__PURE__*/React.createElement(Portal.Slot, {
60
62
  slot: "header-right"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lemon-fe/mini-app",
3
- "version": "1.2.0",
3
+ "version": "1.2.4",
4
4
  "description": "> TODO: description",
5
5
  "author": "鲁盛杰 <lusj@cnlemon.net>",
6
6
  "homepage": "",
@@ -31,5 +31,5 @@
31
31
  "react": "^17.0.2",
32
32
  "react-dom": "17.0.2"
33
33
  },
34
- "gitHead": "a2027e9e0d57e66684b9fbe3478cd42e1ec18cad"
34
+ "gitHead": "7c73454162a841d6c46f93a1fbc3fe1f47184bdb"
35
35
  }