@lark-apaas/miaoda-inspector 0.1.0-alpha.1 → 0.1.0-alpha.3
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/Inspector/{Inspector.js → Inspector.mjs} +50 -55
- package/dist/es/Inspector/{Overlay.js → Overlay.mjs} +157 -125
- package/dist/es/Inspector/hooks/use-effect-event.mjs +17 -0
- package/dist/es/Inspector/hooks/use-layout-effect.mjs +9 -0
- package/dist/es/Inspector/hooks/{use-mouse.js → use-mouse.mjs} +8 -4
- package/dist/es/Inspector/index.mjs +5 -0
- package/dist/es/Inspector/utils/fiber.mjs +70 -0
- package/dist/es/Inspector/utils/highlight.mjs +78 -0
- package/dist/es/Inspector/utils/inspect.mjs +131 -0
- package/dist/es/Inspector/utils/{overlay.js → overlay.mjs} +7 -2
- package/dist/es/MiaodaInspector/MiaodaInspector.mjs +427 -0
- package/dist/es/MiaodaInspector/index.mjs +5 -0
- package/dist/es/chunk-I4E63NIC.mjs +24 -0
- package/dist/es/config/{ui-config.js → ui-config.mjs} +66 -286
- package/dist/es/global.d.mjs +0 -0
- package/dist/es/index.mjs +7 -0
- package/dist/es/types/iframe-events.mjs +0 -0
- package/dist/es/types/index.mjs +27 -0
- package/dist/es/utils/{config-mapper.js → config-mapper.mjs} +14 -56
- package/dist/es/utils/{css.js → css.mjs} +5 -1
- package/dist/es/utils/index.mjs +37 -0
- package/dist/es/utils/origin.mjs +26 -0
- package/dist/es/utils/style-calculator.mjs +177 -0
- package/dist/lib/Inspector/Inspector.js +99 -104
- package/dist/lib/Inspector/Overlay.js +172 -143
- package/dist/lib/Inspector/hooks/index.js +19 -19
- package/dist/lib/Inspector/hooks/use-effect-event.js +26 -15
- package/dist/lib/Inspector/hooks/use-layout-effect.js +25 -10
- package/dist/lib/Inspector/hooks/use-mouse.js +27 -14
- package/dist/lib/Inspector/index.js +21 -8
- package/dist/lib/Inspector/utils/fiber.js +49 -55
- package/dist/lib/Inspector/utils/highlight.js +44 -31
- package/dist/lib/Inspector/utils/index.js +19 -19
- package/dist/lib/Inspector/utils/inspect.js +62 -72
- package/dist/lib/Inspector/utils/overlay.js +20 -15
- package/dist/lib/MiaodaInspector/MiaodaInspector.js +265 -266
- package/dist/lib/MiaodaInspector/index.js +21 -8
- package/dist/lib/config/ui-config.js +81 -292
- package/dist/lib/global.d.js +1 -0
- package/dist/lib/index.js +22 -17
- package/dist/lib/types/iframe-events.js +15 -3
- package/dist/lib/types/index.js +30 -43
- package/dist/lib/utils/config-mapper.js +41 -69
- package/dist/lib/utils/css.js +33 -15
- package/dist/lib/utils/index.js +36 -57
- package/dist/lib/utils/origin.js +23 -22
- package/dist/lib/utils/style-calculator.js +113 -110
- package/dist/types/Inspector/Inspector.d.ts +95 -92
- package/dist/types/Inspector/Overlay.d.ts +61 -58
- package/dist/types/Inspector/hooks/index.d.ts +4 -3
- package/dist/types/Inspector/hooks/use-effect-event.d.ts +3 -1
- package/dist/types/Inspector/hooks/use-layout-effect.d.ts +5 -2
- package/dist/types/Inspector/hooks/use-mouse.d.ts +9 -8
- package/dist/types/Inspector/index.d.ts +4 -1
- package/dist/types/Inspector/utils/fiber.d.ts +12 -10
- package/dist/types/Inspector/utils/highlight.d.ts +7 -5
- package/dist/types/Inspector/utils/index.d.ts +4 -3
- package/dist/types/Inspector/utils/inspect.d.ts +45 -42
- package/dist/types/Inspector/utils/overlay.d.ts +24 -22
- package/dist/types/MiaodaInspector/MiaodaInspector.d.ts +42 -41
- package/dist/types/MiaodaInspector/index.d.ts +3 -1
- package/dist/types/config/ui-config.d.ts +42 -41
- package/dist/types/global.d.d.ts +17 -0
- package/dist/types/index.d.ts +5 -4
- package/dist/types/types/iframe-events.d.ts +133 -130
- package/dist/types/types/index.d.ts +2 -1
- package/dist/types/utils/config-mapper.d.ts +14 -11
- package/dist/types/utils/css.d.ts +5 -2
- package/dist/types/utils/index.d.ts +7 -3
- package/dist/types/utils/origin.d.ts +12 -8
- package/dist/types/utils/style-calculator.d.ts +20 -17
- package/package.json +13 -13
- package/dist/es/Inspector/hooks/use-effect-event.js +0 -15
- package/dist/es/Inspector/hooks/use-layout-effect.js +0 -3
- package/dist/es/Inspector/index.js +0 -1
- package/dist/es/Inspector/utils/fiber.js +0 -61
- package/dist/es/Inspector/utils/highlight.js +0 -74
- package/dist/es/Inspector/utils/inspect.js +0 -119
- package/dist/es/MiaodaInspector/MiaodaInspector.js +0 -397
- package/dist/es/MiaodaInspector/index.js +0 -1
- package/dist/es/index.js +0 -2
- package/dist/es/types/iframe-events.js +0 -1
- package/dist/es/types/index.js +0 -1
- package/dist/es/utils/index.js +0 -3
- package/dist/es/utils/origin.js +0 -19
- package/dist/es/utils/style-calculator.js +0 -158
- /package/dist/es/Inspector/hooks/{index.js → index.mjs} +0 -0
- /package/dist/es/Inspector/utils/{index.js → index.mjs} +0 -0
|
@@ -1,74 +1,44 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __defProps = Object.defineProperties;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
10
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
11
|
+
var __spreadValues = (a, b) => {
|
|
12
|
+
for (var prop in b || (b = {}))
|
|
13
|
+
if (__hasOwnProp.call(b, prop))
|
|
14
|
+
__defNormalProp(a, prop, b[prop]);
|
|
15
|
+
if (__getOwnPropSymbols)
|
|
16
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
17
|
+
if (__propIsEnum.call(b, prop))
|
|
18
|
+
__defNormalProp(a, prop, b[prop]);
|
|
19
|
+
}
|
|
20
|
+
return a;
|
|
21
|
+
};
|
|
22
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
23
|
+
var __export = (target, all) => {
|
|
6
24
|
for (var name in all)
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
return getStyleCalculationConfig;
|
|
15
|
-
},
|
|
16
|
-
getAllStyleConfigs: function() {
|
|
17
|
-
return getAllStyleConfigs;
|
|
25
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
26
|
+
};
|
|
27
|
+
var __copyProps = (to, from, except, desc) => {
|
|
28
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
29
|
+
for (let key of __getOwnPropNames(from))
|
|
30
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
31
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
32
|
}
|
|
33
|
+
return to;
|
|
34
|
+
};
|
|
35
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
36
|
+
var config_mapper_exports = {};
|
|
37
|
+
__export(config_mapper_exports, {
|
|
38
|
+
getAllStyleConfigs: () => getAllStyleConfigs,
|
|
39
|
+
getStyleCalculationConfig: () => getStyleCalculationConfig
|
|
19
40
|
});
|
|
20
|
-
|
|
21
|
-
if (key in obj) {
|
|
22
|
-
Object.defineProperty(obj, key, {
|
|
23
|
-
value,
|
|
24
|
-
enumerable: true,
|
|
25
|
-
configurable: true,
|
|
26
|
-
writable: true
|
|
27
|
-
});
|
|
28
|
-
} else {
|
|
29
|
-
obj[key] = value;
|
|
30
|
-
}
|
|
31
|
-
return obj;
|
|
32
|
-
}
|
|
33
|
-
function _object_spread(target) {
|
|
34
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
35
|
-
var source = arguments[i] != null ? arguments[i] : {};
|
|
36
|
-
var ownKeys2 = Object.keys(source);
|
|
37
|
-
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
38
|
-
ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
39
|
-
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
40
|
-
}));
|
|
41
|
-
}
|
|
42
|
-
ownKeys2.forEach(function(key) {
|
|
43
|
-
_define_property(target, key, source[key]);
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
return target;
|
|
47
|
-
}
|
|
48
|
-
function ownKeys(object, enumerableOnly) {
|
|
49
|
-
var keys = Object.keys(object);
|
|
50
|
-
if (Object.getOwnPropertySymbols) {
|
|
51
|
-
var symbols = Object.getOwnPropertySymbols(object);
|
|
52
|
-
if (enumerableOnly) {
|
|
53
|
-
symbols = symbols.filter(function(sym) {
|
|
54
|
-
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
keys.push.apply(keys, symbols);
|
|
58
|
-
}
|
|
59
|
-
return keys;
|
|
60
|
-
}
|
|
61
|
-
function _object_spread_props(target, source) {
|
|
62
|
-
source = source != null ? source : {};
|
|
63
|
-
if (Object.getOwnPropertyDescriptors) {
|
|
64
|
-
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
65
|
-
} else {
|
|
66
|
-
ownKeys(Object(source)).forEach(function(key) {
|
|
67
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
return target;
|
|
71
|
-
}
|
|
41
|
+
module.exports = __toCommonJS(config_mapper_exports);
|
|
72
42
|
function getColorStyleCalculationConfig(config, propertyName) {
|
|
73
43
|
const prefixMap = {
|
|
74
44
|
color: "text",
|
|
@@ -118,7 +88,9 @@ function getStyleCalculationConfig(config, propertyName) {
|
|
|
118
88
|
return getColorStyleCalculationConfig(config, propertyName);
|
|
119
89
|
}
|
|
120
90
|
if (uiComponent.type !== "select" && uiComponent.type !== "spacing") {
|
|
121
|
-
throw new Error(
|
|
91
|
+
throw new Error(
|
|
92
|
+
`Unsupported UI component type: ${uiComponent.type} for property: ${propertyName}`
|
|
93
|
+
);
|
|
122
94
|
}
|
|
123
95
|
const map = {};
|
|
124
96
|
for (const option of uiComponent.options) {
|
|
@@ -168,7 +140,7 @@ function getStyleCalculationConfig(config, propertyName) {
|
|
|
168
140
|
if (!baseConfig) {
|
|
169
141
|
throw new Error(`Unknown property: ${propertyName}`);
|
|
170
142
|
}
|
|
171
|
-
return
|
|
143
|
+
return __spreadProps(__spreadValues({}, baseConfig), {
|
|
172
144
|
map
|
|
173
145
|
});
|
|
174
146
|
}
|
package/dist/lib/utils/css.js
CHANGED
|
@@ -1,20 +1,38 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
Object.
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
9
17
|
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var css_exports = {};
|
|
30
|
+
__export(css_exports, {
|
|
31
|
+
cx: () => cx
|
|
10
32
|
});
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
return obj && obj.__esModule ? obj : {
|
|
15
|
-
default: obj
|
|
16
|
-
};
|
|
17
|
-
}
|
|
33
|
+
module.exports = __toCommonJS(css_exports);
|
|
34
|
+
var import_clsx = __toESM(require("clsx"));
|
|
35
|
+
var import_tailwind_merge = require("tailwind-merge");
|
|
18
36
|
function cx(...args) {
|
|
19
|
-
return (0,
|
|
37
|
+
return (0, import_tailwind_merge.twMerge)((0, import_clsx.default)(...args));
|
|
20
38
|
}
|
package/dist/lib/utils/index.js
CHANGED
|
@@ -1,61 +1,40 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
6
7
|
for (var name in all)
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
return _origin.getPreviewParentOrigin;
|
|
15
|
-
},
|
|
16
|
-
postMessage: function() {
|
|
17
|
-
return _origin.postMessage;
|
|
18
|
-
},
|
|
19
|
-
isIncomingMessage: function() {
|
|
20
|
-
return _origin.isIncomingMessage;
|
|
21
|
-
},
|
|
22
|
-
isOutgoingMessage: function() {
|
|
23
|
-
return _origin.isOutgoingMessage;
|
|
24
|
-
},
|
|
25
|
-
cx: function() {
|
|
26
|
-
return _css.cx;
|
|
27
|
-
},
|
|
28
|
-
calculateFontSizeInfo: function() {
|
|
29
|
-
return _stylecalculator.calculateFontSizeInfo;
|
|
30
|
-
},
|
|
31
|
-
calculateFontWeightInfo: function() {
|
|
32
|
-
return _stylecalculator.calculateFontWeightInfo;
|
|
33
|
-
},
|
|
34
|
-
calculateBorderRadiusInfo: function() {
|
|
35
|
-
return _stylecalculator.calculateBorderRadiusInfo;
|
|
36
|
-
},
|
|
37
|
-
calculateBorderWidthInfo: function() {
|
|
38
|
-
return _stylecalculator.calculateBorderWidthInfo;
|
|
39
|
-
},
|
|
40
|
-
calculateTextAlignInfo: function() {
|
|
41
|
-
return _stylecalculator.calculateTextAlignInfo;
|
|
42
|
-
},
|
|
43
|
-
calculatePaddingInfo: function() {
|
|
44
|
-
return _stylecalculator.calculatePaddingInfo;
|
|
45
|
-
},
|
|
46
|
-
calculateMarginInfo: function() {
|
|
47
|
-
return _stylecalculator.calculateMarginInfo;
|
|
48
|
-
},
|
|
49
|
-
calculateColorInfo: function() {
|
|
50
|
-
return _stylecalculator.calculateColorInfo;
|
|
51
|
-
},
|
|
52
|
-
calculateBackgroundColorInfo: function() {
|
|
53
|
-
return _stylecalculator.calculateBackgroundColorInfo;
|
|
54
|
-
},
|
|
55
|
-
calculateBorderColorInfo: function() {
|
|
56
|
-
return _stylecalculator.calculateBorderColorInfo;
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
57
15
|
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var utils_exports = {};
|
|
20
|
+
__export(utils_exports, {
|
|
21
|
+
calculateBackgroundColorInfo: () => import_style_calculator.calculateBackgroundColorInfo,
|
|
22
|
+
calculateBorderColorInfo: () => import_style_calculator.calculateBorderColorInfo,
|
|
23
|
+
calculateBorderRadiusInfo: () => import_style_calculator.calculateBorderRadiusInfo,
|
|
24
|
+
calculateBorderWidthInfo: () => import_style_calculator.calculateBorderWidthInfo,
|
|
25
|
+
calculateColorInfo: () => import_style_calculator.calculateColorInfo,
|
|
26
|
+
calculateFontSizeInfo: () => import_style_calculator.calculateFontSizeInfo,
|
|
27
|
+
calculateFontWeightInfo: () => import_style_calculator.calculateFontWeightInfo,
|
|
28
|
+
calculateMarginInfo: () => import_style_calculator.calculateMarginInfo,
|
|
29
|
+
calculatePaddingInfo: () => import_style_calculator.calculatePaddingInfo,
|
|
30
|
+
calculateTextAlignInfo: () => import_style_calculator.calculateTextAlignInfo,
|
|
31
|
+
cx: () => import_css.cx,
|
|
32
|
+
getPreviewParentOrigin: () => import_origin.getPreviewParentOrigin,
|
|
33
|
+
isIncomingMessage: () => import_origin.isIncomingMessage,
|
|
34
|
+
isOutgoingMessage: () => import_origin.isOutgoingMessage,
|
|
35
|
+
postMessage: () => import_origin.postMessage
|
|
58
36
|
});
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
37
|
+
module.exports = __toCommonJS(utils_exports);
|
|
38
|
+
var import_origin = require("./origin");
|
|
39
|
+
var import_css = require("./css");
|
|
40
|
+
var import_style_calculator = require("./style-calculator");
|
package/dist/lib/utils/origin.js
CHANGED
|
@@ -1,28 +1,29 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
6
7
|
for (var name in all)
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
return getPreviewParentOrigin;
|
|
15
|
-
},
|
|
16
|
-
postMessage: function() {
|
|
17
|
-
return postMessage;
|
|
18
|
-
},
|
|
19
|
-
isOutgoingMessage: function() {
|
|
20
|
-
return isOutgoingMessage;
|
|
21
|
-
},
|
|
22
|
-
isIncomingMessage: function() {
|
|
23
|
-
return isIncomingMessage;
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
24
15
|
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var origin_exports = {};
|
|
20
|
+
__export(origin_exports, {
|
|
21
|
+
getPreviewParentOrigin: () => getPreviewParentOrigin,
|
|
22
|
+
isIncomingMessage: () => isIncomingMessage,
|
|
23
|
+
isOutgoingMessage: () => isOutgoingMessage,
|
|
24
|
+
postMessage: () => postMessage
|
|
25
25
|
});
|
|
26
|
+
module.exports = __toCommonJS(origin_exports);
|
|
26
27
|
function getPreviewParentOrigin() {
|
|
27
28
|
const { origin } = window.location;
|
|
28
29
|
if (origin.includes("feishuapp.cn")) {
|
|
@@ -34,7 +35,7 @@ function getPreviewParentOrigin() {
|
|
|
34
35
|
return "https://miaoda.feishu-boe.cn";
|
|
35
36
|
}
|
|
36
37
|
function postMessage(message, targetOrigin) {
|
|
37
|
-
window.parent.postMessage(message, targetOrigin
|
|
38
|
+
window.parent.postMessage(message, targetOrigin != null ? targetOrigin : getPreviewParentOrigin());
|
|
38
39
|
}
|
|
39
40
|
function isOutgoingMessage(msg, type) {
|
|
40
41
|
return msg.type === type;
|
|
@@ -1,108 +1,57 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __defProps = Object.defineProperties;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
10
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
11
|
+
var __spreadValues = (a, b) => {
|
|
12
|
+
for (var prop in b || (b = {}))
|
|
13
|
+
if (__hasOwnProp.call(b, prop))
|
|
14
|
+
__defNormalProp(a, prop, b[prop]);
|
|
15
|
+
if (__getOwnPropSymbols)
|
|
16
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
17
|
+
if (__propIsEnum.call(b, prop))
|
|
18
|
+
__defNormalProp(a, prop, b[prop]);
|
|
19
|
+
}
|
|
20
|
+
return a;
|
|
21
|
+
};
|
|
22
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
23
|
+
var __export = (target, all) => {
|
|
6
24
|
for (var name in all)
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
return rgbaToHex;
|
|
15
|
-
},
|
|
16
|
-
calculateStyle: function() {
|
|
17
|
-
return calculateStyle;
|
|
18
|
-
},
|
|
19
|
-
calculateFontSizeInfo: function() {
|
|
20
|
-
return calculateFontSizeInfo;
|
|
21
|
-
},
|
|
22
|
-
calculateFontWeightInfo: function() {
|
|
23
|
-
return calculateFontWeightInfo;
|
|
24
|
-
},
|
|
25
|
-
calculateBorderRadiusInfo: function() {
|
|
26
|
-
return calculateBorderRadiusInfo;
|
|
27
|
-
},
|
|
28
|
-
calculateBorderWidthInfo: function() {
|
|
29
|
-
return calculateBorderWidthInfo;
|
|
30
|
-
},
|
|
31
|
-
calculateTextAlignInfo: function() {
|
|
32
|
-
return calculateTextAlignInfo;
|
|
33
|
-
},
|
|
34
|
-
calculatePaddingInfo: function() {
|
|
35
|
-
return calculatePaddingInfo;
|
|
36
|
-
},
|
|
37
|
-
calculateMarginInfo: function() {
|
|
38
|
-
return calculateMarginInfo;
|
|
39
|
-
},
|
|
40
|
-
calculateColorInfo: function() {
|
|
41
|
-
return calculateColorInfo;
|
|
42
|
-
},
|
|
43
|
-
calculateBackgroundColorInfo: function() {
|
|
44
|
-
return calculateBackgroundColorInfo;
|
|
45
|
-
},
|
|
46
|
-
calculateBorderColorInfo: function() {
|
|
47
|
-
return calculateBorderColorInfo;
|
|
25
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
26
|
+
};
|
|
27
|
+
var __copyProps = (to, from, except, desc) => {
|
|
28
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
29
|
+
for (let key of __getOwnPropNames(from))
|
|
30
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
31
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
48
32
|
}
|
|
33
|
+
return to;
|
|
34
|
+
};
|
|
35
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
36
|
+
var style_calculator_exports = {};
|
|
37
|
+
__export(style_calculator_exports, {
|
|
38
|
+
calculateBackgroundColorInfo: () => calculateBackgroundColorInfo,
|
|
39
|
+
calculateBorderColorInfo: () => calculateBorderColorInfo,
|
|
40
|
+
calculateBorderRadiusInfo: () => calculateBorderRadiusInfo,
|
|
41
|
+
calculateBorderWidthInfo: () => calculateBorderWidthInfo,
|
|
42
|
+
calculateColorInfo: () => calculateColorInfo,
|
|
43
|
+
calculateFontSizeInfo: () => calculateFontSizeInfo,
|
|
44
|
+
calculateFontWeightInfo: () => calculateFontWeightInfo,
|
|
45
|
+
calculateMarginInfo: () => calculateMarginInfo,
|
|
46
|
+
calculatePaddingInfo: () => calculatePaddingInfo,
|
|
47
|
+
calculateStyle: () => calculateStyle,
|
|
48
|
+
calculateTextAlignInfo: () => calculateTextAlignInfo,
|
|
49
|
+
rgbaToHex: () => rgbaToHex
|
|
49
50
|
});
|
|
50
|
-
|
|
51
|
-
if (key in obj) {
|
|
52
|
-
Object.defineProperty(obj, key, {
|
|
53
|
-
value,
|
|
54
|
-
enumerable: true,
|
|
55
|
-
configurable: true,
|
|
56
|
-
writable: true
|
|
57
|
-
});
|
|
58
|
-
} else {
|
|
59
|
-
obj[key] = value;
|
|
60
|
-
}
|
|
61
|
-
return obj;
|
|
62
|
-
}
|
|
63
|
-
function _object_spread(target) {
|
|
64
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
65
|
-
var source = arguments[i] != null ? arguments[i] : {};
|
|
66
|
-
var ownKeys2 = Object.keys(source);
|
|
67
|
-
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
68
|
-
ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
69
|
-
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
70
|
-
}));
|
|
71
|
-
}
|
|
72
|
-
ownKeys2.forEach(function(key) {
|
|
73
|
-
_define_property(target, key, source[key]);
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
return target;
|
|
77
|
-
}
|
|
78
|
-
function ownKeys(object, enumerableOnly) {
|
|
79
|
-
var keys = Object.keys(object);
|
|
80
|
-
if (Object.getOwnPropertySymbols) {
|
|
81
|
-
var symbols = Object.getOwnPropertySymbols(object);
|
|
82
|
-
if (enumerableOnly) {
|
|
83
|
-
symbols = symbols.filter(function(sym) {
|
|
84
|
-
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
keys.push.apply(keys, symbols);
|
|
88
|
-
}
|
|
89
|
-
return keys;
|
|
90
|
-
}
|
|
91
|
-
function _object_spread_props(target, source) {
|
|
92
|
-
source = source != null ? source : {};
|
|
93
|
-
if (Object.getOwnPropertyDescriptors) {
|
|
94
|
-
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
95
|
-
} else {
|
|
96
|
-
ownKeys(Object(source)).forEach(function(key) {
|
|
97
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
return target;
|
|
101
|
-
}
|
|
51
|
+
module.exports = __toCommonJS(style_calculator_exports);
|
|
102
52
|
function rgbaToHex(rgba) {
|
|
103
53
|
const match = rgba.match(/rgba?\(([^)]+)\)/);
|
|
104
|
-
if (!match)
|
|
105
|
-
return rgba;
|
|
54
|
+
if (!match) return rgba;
|
|
106
55
|
const values = match[1].split(",").map((v) => v.trim());
|
|
107
56
|
const r = parseInt(values[0], 10);
|
|
108
57
|
const g = parseInt(values[1], 10);
|
|
@@ -162,7 +111,11 @@ function calculateStyleProperty(element, config) {
|
|
|
162
111
|
tailwindClassName = config.map[colorValue] || `raw:${normalizedColor}`;
|
|
163
112
|
} else {
|
|
164
113
|
const numericValue = config.transformValue ? config.transformValue(currentValue) : parseFloat(currentValue);
|
|
165
|
-
const { className } = findClosestMatch(
|
|
114
|
+
const { className } = findClosestMatch(
|
|
115
|
+
numericValue,
|
|
116
|
+
config.map,
|
|
117
|
+
config.tolerance
|
|
118
|
+
);
|
|
166
119
|
tailwindClassName = className;
|
|
167
120
|
}
|
|
168
121
|
const inherited = config.tailwindPattern ? shouldBeInherited(element, config.cssProperty, config.tailwindPattern) : false;
|
|
@@ -180,16 +133,48 @@ function calculateStyle(styleName, element, componentName, canUseNewInspector, s
|
|
|
180
133
|
return null;
|
|
181
134
|
}
|
|
182
135
|
const config = styleConfigs[styleName];
|
|
183
|
-
const tailwindPattern = new RegExp(
|
|
184
|
-
|
|
136
|
+
const tailwindPattern = new RegExp(
|
|
137
|
+
`\\b${config.tailwindPrefix}-(${Object.keys(config.map).join("|")})\\b`
|
|
138
|
+
);
|
|
139
|
+
return calculateStyleProperty(element, __spreadProps(__spreadValues({}, config), {
|
|
185
140
|
tailwindPattern
|
|
186
141
|
}));
|
|
187
142
|
}
|
|
188
|
-
const calculateFontSizeInfo = (element, componentName, canUseNewInspector, styleConfigs) => calculateStyle(
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
143
|
+
const calculateFontSizeInfo = (element, componentName, canUseNewInspector, styleConfigs) => calculateStyle(
|
|
144
|
+
"fontSize",
|
|
145
|
+
element,
|
|
146
|
+
componentName,
|
|
147
|
+
canUseNewInspector,
|
|
148
|
+
styleConfigs
|
|
149
|
+
);
|
|
150
|
+
const calculateFontWeightInfo = (element, componentName, canUseNewInspector, styleConfigs) => calculateStyle(
|
|
151
|
+
"fontWeight",
|
|
152
|
+
element,
|
|
153
|
+
componentName,
|
|
154
|
+
canUseNewInspector,
|
|
155
|
+
styleConfigs
|
|
156
|
+
);
|
|
157
|
+
const calculateBorderRadiusInfo = (element, componentName, canUseNewInspector, styleConfigs) => calculateStyle(
|
|
158
|
+
"borderRadius",
|
|
159
|
+
element,
|
|
160
|
+
componentName,
|
|
161
|
+
canUseNewInspector,
|
|
162
|
+
styleConfigs
|
|
163
|
+
);
|
|
164
|
+
const calculateBorderWidthInfo = (element, componentName, canUseNewInspector, styleConfigs) => calculateStyle(
|
|
165
|
+
"borderWidth",
|
|
166
|
+
element,
|
|
167
|
+
componentName,
|
|
168
|
+
canUseNewInspector,
|
|
169
|
+
styleConfigs
|
|
170
|
+
);
|
|
171
|
+
const calculateTextAlignInfo = (element, componentName, canUseNewInspector, styleConfigs) => calculateStyle(
|
|
172
|
+
"textAlign",
|
|
173
|
+
element,
|
|
174
|
+
componentName,
|
|
175
|
+
canUseNewInspector,
|
|
176
|
+
styleConfigs
|
|
177
|
+
);
|
|
193
178
|
const calculatePaddingInfo = (element, componentName, canUseNewInspector, styleConfigs) => {
|
|
194
179
|
if (!isValidElementWithComponent(element, componentName, canUseNewInspector)) {
|
|
195
180
|
return null;
|
|
@@ -202,6 +187,24 @@ const calculateMarginInfo = (element, componentName, canUseNewInspector, styleCo
|
|
|
202
187
|
}
|
|
203
188
|
return calculateStyleProperty(element, styleConfigs.margin);
|
|
204
189
|
};
|
|
205
|
-
const calculateColorInfo = (element, componentName, canUseNewInspector, styleConfigs) => calculateStyle(
|
|
206
|
-
|
|
207
|
-
|
|
190
|
+
const calculateColorInfo = (element, componentName, canUseNewInspector, styleConfigs) => calculateStyle(
|
|
191
|
+
"color",
|
|
192
|
+
element,
|
|
193
|
+
componentName,
|
|
194
|
+
canUseNewInspector,
|
|
195
|
+
styleConfigs
|
|
196
|
+
);
|
|
197
|
+
const calculateBackgroundColorInfo = (element, componentName, canUseNewInspector, styleConfigs) => calculateStyle(
|
|
198
|
+
"backgroundColor",
|
|
199
|
+
element,
|
|
200
|
+
componentName,
|
|
201
|
+
canUseNewInspector,
|
|
202
|
+
styleConfigs
|
|
203
|
+
);
|
|
204
|
+
const calculateBorderColorInfo = (element, componentName, canUseNewInspector, styleConfigs) => calculateStyle(
|
|
205
|
+
"borderColor",
|
|
206
|
+
element,
|
|
207
|
+
componentName,
|
|
208
|
+
canUseNewInspector,
|
|
209
|
+
styleConfigs
|
|
210
|
+
);
|