@lark-apaas/miaoda-inspector 1.0.9 → 1.0.10-alpha.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/es/MiaodaInspector/MiaodaInspector.mjs +1 -1
- package/dist/es/utils/index.mjs +1 -2
- package/dist/es/utils/origin.mjs +4 -21
- package/dist/lib/MiaodaInspector/MiaodaInspector.js +1 -1
- package/dist/lib/utils/index.js +0 -1
- package/dist/lib/utils/origin.js +4 -21
- package/dist/types/Inspector/hooks/use-layout-effect.d.ts +2 -2
- package/dist/types/utils/index.d.ts +1 -1
- package/dist/types/utils/origin.d.ts +1 -2
- package/package.json +1 -1
package/dist/es/utils/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "../chunk-I4E63NIC.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { postMessage, isIncomingMessage, isOutgoingMessage } from "./origin";
|
|
3
3
|
import { cx } from "./css";
|
|
4
4
|
import {
|
|
5
5
|
calculateFontSizeInfo,
|
|
@@ -25,7 +25,6 @@ export {
|
|
|
25
25
|
calculatePaddingInfo,
|
|
26
26
|
calculateTextAlignInfo,
|
|
27
27
|
cx,
|
|
28
|
-
getPreviewParentOrigin,
|
|
29
28
|
isIncomingMessage,
|
|
30
29
|
isOutgoingMessage,
|
|
31
30
|
postMessage
|
package/dist/es/utils/origin.mjs
CHANGED
|
@@ -1,25 +1,9 @@
|
|
|
1
1
|
import "../chunk-I4E63NIC.mjs";
|
|
2
|
-
function getPreviewParentOrigin() {
|
|
3
|
-
const { origin } = window.location;
|
|
4
|
-
if (origin.includes("force.feishuapp.net")) {
|
|
5
|
-
return "https://force.feishu.cn";
|
|
6
|
-
}
|
|
7
|
-
if (origin.includes("force-pre.feishuapp.net")) {
|
|
8
|
-
return "https://force.feishu-pre.cn";
|
|
9
|
-
}
|
|
10
|
-
if (origin.includes("force.byted.org")) {
|
|
11
|
-
return "https://force.feishu-boe.cn";
|
|
12
|
-
}
|
|
13
|
-
if (origin.includes("feishuapp.cn") || origin.includes("miaoda.feishuapp.net")) {
|
|
14
|
-
return "https://miaoda.feishu.cn";
|
|
15
|
-
} else if (origin.includes("fsapp.kundou.cn") || origin.includes("miaoda-pre.feishuapp.net")) {
|
|
16
|
-
return "https://miaoda.feishu-pre.cn";
|
|
17
|
-
} else {
|
|
18
|
-
return "https://miaoda.feishu-boe.cn";
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
2
|
function postMessage(message, targetOrigin) {
|
|
22
|
-
|
|
3
|
+
const parentOrigin = process.env.FORCE_FRAMEWORK_DOMAIN_MAIN;
|
|
4
|
+
const origin = targetOrigin != null ? targetOrigin : parentOrigin;
|
|
5
|
+
if (!origin) return;
|
|
6
|
+
window.parent.postMessage(message, origin);
|
|
23
7
|
}
|
|
24
8
|
function isOutgoingMessage(msg, type) {
|
|
25
9
|
return msg.type === type;
|
|
@@ -28,7 +12,6 @@ function isIncomingMessage(msg, type) {
|
|
|
28
12
|
return msg.type === type;
|
|
29
13
|
}
|
|
30
14
|
export {
|
|
31
|
-
getPreviewParentOrigin,
|
|
32
15
|
isIncomingMessage,
|
|
33
16
|
isOutgoingMessage,
|
|
34
17
|
postMessage
|
package/dist/lib/utils/index.js
CHANGED
|
@@ -29,7 +29,6 @@ __export(utils_exports, {
|
|
|
29
29
|
calculatePaddingInfo: () => import_style_calculator.calculatePaddingInfo,
|
|
30
30
|
calculateTextAlignInfo: () => import_style_calculator.calculateTextAlignInfo,
|
|
31
31
|
cx: () => import_css.cx,
|
|
32
|
-
getPreviewParentOrigin: () => import_origin.getPreviewParentOrigin,
|
|
33
32
|
isIncomingMessage: () => import_origin.isIncomingMessage,
|
|
34
33
|
isOutgoingMessage: () => import_origin.isOutgoingMessage,
|
|
35
34
|
postMessage: () => import_origin.postMessage
|
package/dist/lib/utils/origin.js
CHANGED
|
@@ -18,33 +18,16 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var origin_exports = {};
|
|
20
20
|
__export(origin_exports, {
|
|
21
|
-
getPreviewParentOrigin: () => getPreviewParentOrigin,
|
|
22
21
|
isIncomingMessage: () => isIncomingMessage,
|
|
23
22
|
isOutgoingMessage: () => isOutgoingMessage,
|
|
24
23
|
postMessage: () => postMessage
|
|
25
24
|
});
|
|
26
25
|
module.exports = __toCommonJS(origin_exports);
|
|
27
|
-
function getPreviewParentOrigin() {
|
|
28
|
-
const { origin } = window.location;
|
|
29
|
-
if (origin.includes("force.feishuapp.net")) {
|
|
30
|
-
return "https://force.feishu.cn";
|
|
31
|
-
}
|
|
32
|
-
if (origin.includes("force-pre.feishuapp.net")) {
|
|
33
|
-
return "https://force.feishu-pre.cn";
|
|
34
|
-
}
|
|
35
|
-
if (origin.includes("force.byted.org")) {
|
|
36
|
-
return "https://force.feishu-boe.cn";
|
|
37
|
-
}
|
|
38
|
-
if (origin.includes("feishuapp.cn") || origin.includes("miaoda.feishuapp.net")) {
|
|
39
|
-
return "https://miaoda.feishu.cn";
|
|
40
|
-
} else if (origin.includes("fsapp.kundou.cn") || origin.includes("miaoda-pre.feishuapp.net")) {
|
|
41
|
-
return "https://miaoda.feishu-pre.cn";
|
|
42
|
-
} else {
|
|
43
|
-
return "https://miaoda.feishu-boe.cn";
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
26
|
function postMessage(message, targetOrigin) {
|
|
47
|
-
|
|
27
|
+
const parentOrigin = process.env.FORCE_FRAMEWORK_DOMAIN_MAIN;
|
|
28
|
+
const origin = targetOrigin != null ? targetOrigin : parentOrigin;
|
|
29
|
+
if (!origin) return;
|
|
30
|
+
window.parent.postMessage(message, origin);
|
|
48
31
|
}
|
|
49
32
|
function isOutgoingMessage(msg, type) {
|
|
50
33
|
return msg.type === type;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { isIncomingMessage, isOutgoingMessage, postMessage } from './origin.js';
|
|
2
2
|
export { cx } from './css.js';
|
|
3
3
|
export { calculateBackgroundColorInfo, calculateBorderColorInfo, calculateBorderRadiusInfo, calculateBorderWidthInfo, calculateColorInfo, calculateFontSizeInfo, calculateFontWeightInfo, calculateMarginInfo, calculatePaddingInfo, calculateTextAlignInfo } from './style-calculator.js';
|
|
4
4
|
import '../types/iframe-events.js';
|
|
@@ -2,7 +2,6 @@ import { OutgoingMessage, IncomingMessage } from '../types/iframe-events.js';
|
|
|
2
2
|
import '../types/feature.js';
|
|
3
3
|
import '../config/ui-config.js';
|
|
4
4
|
|
|
5
|
-
declare function getPreviewParentOrigin(): "https://force.feishu.cn" | "https://force.feishu-pre.cn" | "https://force.feishu-boe.cn" | "https://miaoda.feishu.cn" | "https://miaoda.feishu-pre.cn" | "https://miaoda.feishu-boe.cn";
|
|
6
5
|
declare function postMessage<T extends OutgoingMessage>(message: T, targetOrigin?: string): void;
|
|
7
6
|
declare function isOutgoingMessage<T extends OutgoingMessage['type']>(msg: OutgoingMessage, type: T): msg is Extract<OutgoingMessage, {
|
|
8
7
|
type: T;
|
|
@@ -11,4 +10,4 @@ declare function isIncomingMessage<T extends IncomingMessage['type']>(msg: Incom
|
|
|
11
10
|
type: T;
|
|
12
11
|
}>;
|
|
13
12
|
|
|
14
|
-
export {
|
|
13
|
+
export { isIncomingMessage, isOutgoingMessage, postMessage };
|