@lemon-fe/mini-app 1.1.5 → 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/es/global.d.ts CHANGED
@@ -45,8 +45,8 @@ declare const bridge: {
45
45
  success?: () => void;
46
46
  params: 'default' | 'light-content' | 'dark-content';
47
47
  }): void;
48
- getUserInfo(opts: {
49
- success?: ((user: UserInfo) => void) | undefined;
48
+ getUserInfo<T = UserInfo>(opts: {
49
+ success?: ((user: T) => void) | undefined;
50
50
  }): void;
51
51
  getAccessToken(opts: {
52
52
  success?: ((token: string | null) => void) | undefined;
@@ -141,8 +141,8 @@ export declare const mini: {
141
141
  success?: () => void;
142
142
  params: 'default' | 'light-content' | 'dark-content';
143
143
  }) => void;
144
- getUserInfo: (opts: {
145
- success?: ((user: UserInfo) => void) | undefined;
144
+ getUserInfo: <T = UserInfo>(opts: {
145
+ success?: ((user: T) => void) | undefined;
146
146
  }) => void;
147
147
  getAccessToken: (opts: {
148
148
  success?: ((token: string | null) => void) | undefined;
package/es/global.js CHANGED
@@ -155,9 +155,7 @@ var bridge = {
155
155
  * @param opts
156
156
  */
157
157
  syncRoutes: function syncRoutes(opts) {
158
- bridge.methodRegister(SYNC_ROUTES, {
159
- params: opts
160
- });
158
+ bridge.methodRegister(SYNC_ROUTES, opts);
161
159
  },
162
160
 
163
161
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lemon-fe/mini-app",
3
- "version": "1.1.5",
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": "e4b6e1f4d04b766d37ab7e5914bc7a5e02f0eb9c"
34
+ "gitHead": "7c73454162a841d6c46f93a1fbc3fe1f47184bdb"
35
35
  }