@xfe-repo/web-micro 1.1.8 → 1.2.1
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/dist/index.d.ts +8 -1
- package/dist/index.js +40 -0
- package/package.json +5 -5
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import * as _micro_zoe_micro_app from '@micro-zoe/micro-app';
|
|
|
2
2
|
export * from '@micro-zoe/micro-app';
|
|
3
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
4
|
import React from 'react';
|
|
5
|
+
import { LinkProps } from '@xfe-repo/web-router';
|
|
5
6
|
|
|
6
7
|
type MicroAppProps = {
|
|
7
8
|
name: string;
|
|
@@ -15,6 +16,12 @@ type MicroAppProps = {
|
|
|
15
16
|
};
|
|
16
17
|
declare const MicroAppRoute: React.MemoExoticComponent<(props: MicroAppProps) => react_jsx_runtime.JSX.Element>;
|
|
17
18
|
|
|
19
|
+
type MicroAppLinkProps = LinkProps & {
|
|
20
|
+
to?: string;
|
|
21
|
+
microApp?: string;
|
|
22
|
+
};
|
|
23
|
+
declare const MicroAppLink: React.MemoExoticComponent<(props: MicroAppLinkProps) => react_jsx_runtime.JSX.Element>;
|
|
24
|
+
|
|
18
25
|
declare enum MicroAppEventEnum {
|
|
19
26
|
DISPATCH_ACTION = "dispatchAction"
|
|
20
27
|
}
|
|
@@ -51,4 +58,4 @@ declare class MicroAppEventCenter {
|
|
|
51
58
|
|
|
52
59
|
declare const microApp: _micro_zoe_micro_app.MicroApp;
|
|
53
60
|
|
|
54
|
-
export { type MicroAppActionMetaType, type MicroAppActionType, type MicroAppDispatchListener, MicroAppEventCenter, type MicroAppEventCenterConfig, MicroAppEventEnum, type MicroAppGlobalDataType, type MicroAppProps, MicroAppRoute, microApp };
|
|
61
|
+
export { type MicroAppActionMetaType, type MicroAppActionType, type MicroAppDispatchListener, MicroAppEventCenter, type MicroAppEventCenterConfig, MicroAppEventEnum, type MicroAppGlobalDataType, MicroAppLink, type MicroAppProps, MicroAppRoute, microApp };
|
package/dist/index.js
CHANGED
|
@@ -286,6 +286,9 @@ __export(src_exports, {
|
|
|
286
286
|
MicroAppEventEnum: function() {
|
|
287
287
|
return MicroAppEventEnum;
|
|
288
288
|
},
|
|
289
|
+
MicroAppLink: function() {
|
|
290
|
+
return MicroAppLink;
|
|
291
|
+
},
|
|
289
292
|
MicroAppRoute: function() {
|
|
290
293
|
return MicroAppRoute;
|
|
291
294
|
},
|
|
@@ -353,6 +356,42 @@ var MicroAppRoute = (0, import_react.memo)(function(props) {
|
|
|
353
356
|
onError: handleMicroAppError
|
|
354
357
|
}));
|
|
355
358
|
});
|
|
359
|
+
// src/MicroAppLink.tsx
|
|
360
|
+
var import_react2 = require("react");
|
|
361
|
+
var import_web_router2 = require("@xfe-repo/web-router");
|
|
362
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
363
|
+
var MicroAppLink = (0, import_react2.memo)(function(props) {
|
|
364
|
+
var microAppBaseName = props.microApp, to = props.to, children = props.children, replace = props.replace, className = props.className;
|
|
365
|
+
var navigate = (0, import_web_router2.useNavigate)();
|
|
366
|
+
var handleLink = (0, import_react2.useCallback)(function(e) {
|
|
367
|
+
e.preventDefault();
|
|
368
|
+
navigate(to, {
|
|
369
|
+
replace: replace
|
|
370
|
+
});
|
|
371
|
+
if (!microAppBaseName) return;
|
|
372
|
+
var activeApps = microApp2.getActiveApps({
|
|
373
|
+
excludeHiddenApp: true
|
|
374
|
+
});
|
|
375
|
+
if (activeApps.includes(microAppBaseName)) microApp2.router.push({
|
|
376
|
+
name: microAppBaseName,
|
|
377
|
+
path: to,
|
|
378
|
+
replace: replace
|
|
379
|
+
}).catch(function(e2) {
|
|
380
|
+
return e2;
|
|
381
|
+
});
|
|
382
|
+
}, [
|
|
383
|
+
navigate,
|
|
384
|
+
microAppBaseName,
|
|
385
|
+
to,
|
|
386
|
+
replace
|
|
387
|
+
]);
|
|
388
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", {
|
|
389
|
+
className: className,
|
|
390
|
+
href: to,
|
|
391
|
+
onClick: handleLink,
|
|
392
|
+
children: children
|
|
393
|
+
});
|
|
394
|
+
});
|
|
356
395
|
// src/index.ts
|
|
357
396
|
var MicroAppEventEnum = /* @__PURE__ */ function(MicroAppEventEnum2) {
|
|
358
397
|
MicroAppEventEnum2["DISPATCH_ACTION"] = "dispatchAction";
|
|
@@ -536,6 +575,7 @@ var microApp2 = import_micro_app2.default;
|
|
|
536
575
|
0 && (module.exports = _object_spread({
|
|
537
576
|
MicroAppEventCenter: MicroAppEventCenter,
|
|
538
577
|
MicroAppEventEnum: MicroAppEventEnum,
|
|
578
|
+
MicroAppLink: MicroAppLink,
|
|
539
579
|
MicroAppRoute: MicroAppRoute,
|
|
540
580
|
microApp: microApp
|
|
541
581
|
}, require("@micro-zoe/micro-app")));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xfe-repo/web-micro",
|
|
3
|
-
"version": "1.1
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"module": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -8,14 +8,14 @@
|
|
|
8
8
|
"dist"
|
|
9
9
|
],
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@micro-zoe/micro-app": "1.0.0-rc.
|
|
12
|
-
"@xfe-repo/web-router": "1.1
|
|
13
|
-
"@xfe-repo/web-utils": "1.1
|
|
11
|
+
"@micro-zoe/micro-app": "1.0.0-rc.13",
|
|
12
|
+
"@xfe-repo/web-router": "1.2.1",
|
|
13
|
+
"@xfe-repo/web-utils": "1.2.1"
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
16
|
"@types/node": "^20.16.5",
|
|
17
17
|
"@types/react": "^18",
|
|
18
|
-
"@xfe-repo/eslint-config": "0.0.
|
|
18
|
+
"@xfe-repo/eslint-config": "0.0.5",
|
|
19
19
|
"@xfe-repo/typescript-config": "0.0.6"
|
|
20
20
|
},
|
|
21
21
|
"scripts": {
|