@lark-apaas/miaoda-inspector 0.1.0-alpha.1 → 0.1.0-alpha.2
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,47 +1,48 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import { InspectorUIConfig } from '../config/ui-config.js';
|
|
3
|
+
|
|
4
4
|
interface IThemeMeta {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
5
|
+
themeColors: {
|
|
6
|
+
title: string;
|
|
7
|
+
options: {
|
|
8
|
+
value: string;
|
|
9
|
+
color: string;
|
|
10
|
+
}[];
|
|
11
|
+
};
|
|
12
|
+
themeRadius: {
|
|
13
|
+
title: string;
|
|
14
|
+
options: {
|
|
15
|
+
value: {
|
|
16
|
+
pixel: string;
|
|
17
|
+
rem: string;
|
|
18
|
+
};
|
|
19
|
+
iconUrl: string;
|
|
20
|
+
size: string;
|
|
21
|
+
}[];
|
|
22
|
+
};
|
|
23
|
+
themeSpaces: {
|
|
24
|
+
title: string;
|
|
25
|
+
options: {
|
|
26
|
+
value: {
|
|
27
|
+
pixel: string;
|
|
28
|
+
rem: string;
|
|
29
|
+
};
|
|
30
|
+
iconUrl: string;
|
|
31
|
+
size: string;
|
|
32
|
+
}[];
|
|
33
|
+
};
|
|
34
34
|
}
|
|
35
35
|
interface MiaodaInspectorProps {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
36
|
+
cwd: string;
|
|
37
|
+
theme: {
|
|
38
|
+
themeColorTokenMap: {
|
|
39
|
+
light: Record<string, string>;
|
|
40
|
+
dark: Record<string, string>;
|
|
41
|
+
};
|
|
42
|
+
themeMetaOptions: Omit<IThemeMeta, 'colorPrimary' | 'borderRadius' | 'spacing'>;
|
|
43
|
+
themeToken: InspectorUIConfig;
|
|
41
44
|
};
|
|
42
|
-
themeMetaOptions: Omit<IThemeMeta, 'colorPrimary' | 'borderRadius' | 'spacing'>;
|
|
43
|
-
themeToken: InspectorUIConfig;
|
|
44
|
-
};
|
|
45
45
|
}
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
declare function MiaodaInspector(props: MiaodaInspectorProps): React.JSX.Element;
|
|
47
|
+
|
|
48
|
+
export { MiaodaInspector };
|
|
@@ -1,49 +1,50 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
interface SelectOption {
|
|
2
|
+
label: string;
|
|
3
|
+
value: string;
|
|
4
|
+
rawValue: string;
|
|
5
5
|
}
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
interface SelectUIConfig {
|
|
7
|
+
type: 'select';
|
|
8
|
+
options: SelectOption[];
|
|
9
9
|
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
interface SpacingUIConfig {
|
|
11
|
+
type: 'spacing';
|
|
12
|
+
options: SelectOption[];
|
|
13
13
|
}
|
|
14
14
|
interface Color {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
label: string;
|
|
16
|
+
value: string;
|
|
17
|
+
type?: 'tailwind' | 'style';
|
|
18
|
+
rawValue?: string;
|
|
19
19
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
20
|
+
interface ColorPickerUIConfig {
|
|
21
|
+
type: 'color-picker';
|
|
22
|
+
recommendColors: {
|
|
23
|
+
title: string;
|
|
24
|
+
options: Color[];
|
|
25
|
+
}[];
|
|
26
26
|
}
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
interface IconPickerUIConfig {
|
|
28
|
+
type: 'icon-picker';
|
|
29
29
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
30
|
+
type UIComponentConfig = SelectUIConfig | ColorPickerUIConfig | IconPickerUIConfig | SpacingUIConfig;
|
|
31
|
+
interface InspectorUIConfig {
|
|
32
|
+
version: string;
|
|
33
|
+
common: {
|
|
34
|
+
fontSize: UIComponentConfig;
|
|
35
|
+
fontWeight: UIComponentConfig;
|
|
36
|
+
borderRadius: UIComponentConfig;
|
|
37
|
+
borderWidth: UIComponentConfig;
|
|
38
|
+
textAlign: UIComponentConfig;
|
|
39
|
+
padding: UIComponentConfig;
|
|
40
|
+
margin: UIComponentConfig;
|
|
41
|
+
color: UIComponentConfig;
|
|
42
|
+
borderColor: UIComponentConfig;
|
|
43
|
+
backgroundColor: UIComponentConfig;
|
|
44
|
+
};
|
|
45
|
+
components?: Record<string, Record<string, UIComponentConfig>>;
|
|
46
|
+
tokens: Record<string, string>;
|
|
47
47
|
}
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
declare const defaultUIConfig: InspectorUIConfig;
|
|
49
|
+
|
|
50
|
+
export { type ColorPickerUIConfig, type IconPickerUIConfig, type InspectorUIConfig, type SelectOption, type SelectUIConfig, type SpacingUIConfig, type UIComponentConfig, defaultUIConfig };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
declare module 'global' {
|
|
2
|
+
global {
|
|
3
|
+
interface Window {
|
|
4
|
+
/**
|
|
5
|
+
* @import { DevToolsHook } from 'https://github.com/facebook/react/blob/v16.13.1/packages/react-devtools-shared/src/backend/types.js'
|
|
6
|
+
* @type DevToolsHook
|
|
7
|
+
*/
|
|
8
|
+
__REACT_DEVTOOLS_GLOBAL_HOOK__: any;
|
|
9
|
+
|
|
10
|
+
__REACT_DEVTOOLS_TARGET_WINDOW__: Window;
|
|
11
|
+
|
|
12
|
+
MIAODA_APP_ID?: string;
|
|
13
|
+
MIAODA_BUILTIN_TTT?: string;
|
|
14
|
+
token?: string;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export { MiaodaInspector } from './MiaodaInspector';
|
|
2
|
-
export
|
|
3
|
-
export { isOutgoingMessage } from './utils';
|
|
4
|
-
export
|
|
1
|
+
export { MiaodaInspector } from './MiaodaInspector/MiaodaInspector.js';
|
|
2
|
+
export { ClearSelectedMessage, EditClassNameMessage, EditStyleMessage, EditTextMessage, IncomingMessage, InitConfigMessage, InspectorInfo, PageMountedMessage, SelectInspectorElementMessage, TextUpdateMessage } from './types/iframe-events.js';
|
|
3
|
+
export { isOutgoingMessage } from './utils/origin.js';
|
|
4
|
+
export { InspectorUIConfig } from './config/ui-config.js';
|
|
5
|
+
import 'react';
|
|
@@ -1,155 +1,158 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { InspectorUIConfig } from '../config/ui-config.js';
|
|
2
|
+
|
|
2
3
|
/**
|
|
3
4
|
* Iframe message event types for inspector communication
|
|
4
5
|
*/
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
interface IframeMessage<T = unknown> {
|
|
7
|
+
type: string;
|
|
8
|
+
data: T;
|
|
8
9
|
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
interface EditClassNameMessage extends IframeMessage<{
|
|
11
|
+
elementId: string;
|
|
12
|
+
className: string;
|
|
12
13
|
}> {
|
|
13
|
-
|
|
14
|
+
type: 'EditClassName';
|
|
14
15
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
16
|
+
type IncomingMessage = InitConfigMessage | ClearSelectedMessage | EditTextMessage | EditStyleMessage | EditClassNameMessage;
|
|
17
|
+
interface InitConfigMessage extends IframeMessage<{
|
|
18
|
+
inspectorActive?: boolean;
|
|
19
|
+
userToken?: string;
|
|
20
|
+
appId?: string;
|
|
21
|
+
inspectorVersion?: string;
|
|
21
22
|
}> {
|
|
22
|
-
|
|
23
|
+
type: 'InitConfig';
|
|
23
24
|
}
|
|
24
|
-
|
|
25
|
-
|
|
25
|
+
interface ClearSelectedMessage extends IframeMessage<{
|
|
26
|
+
keepModifications?: boolean;
|
|
26
27
|
}> {
|
|
27
|
-
|
|
28
|
+
type: 'ClearSelected';
|
|
28
29
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
interface EditTextMessage extends IframeMessage<{
|
|
31
|
+
elementId: string;
|
|
32
|
+
textContent: string;
|
|
32
33
|
}> {
|
|
33
|
-
|
|
34
|
+
type: 'EditText';
|
|
34
35
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
interface EditStyleMessage extends IframeMessage<{
|
|
37
|
+
elementId: string;
|
|
38
|
+
styles: Record<string, string>;
|
|
38
39
|
}> {
|
|
39
|
-
|
|
40
|
+
type: 'EditStyle';
|
|
40
41
|
}
|
|
41
|
-
|
|
42
|
-
|
|
42
|
+
interface PageMountedMessage extends IframeMessage<{
|
|
43
|
+
version?: string;
|
|
43
44
|
}> {
|
|
44
|
-
|
|
45
|
+
type: 'PageMounted';
|
|
45
46
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
interface TextUpdateMessage extends IframeMessage<{
|
|
48
|
+
elementId: string;
|
|
49
|
+
textContent: string | null;
|
|
49
50
|
}> {
|
|
50
|
-
|
|
51
|
+
type: 'TextUpdate';
|
|
51
52
|
}
|
|
52
|
-
|
|
53
|
-
|
|
53
|
+
interface PageScrollMessage extends IframeMessage<Record<string, never>> {
|
|
54
|
+
type: 'PageScroll';
|
|
54
55
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
56
|
+
interface ElementResizeMessage extends IframeMessage<{
|
|
57
|
+
elementId: string;
|
|
58
|
+
width: number;
|
|
59
|
+
height: number;
|
|
60
|
+
top: number;
|
|
61
|
+
left: number;
|
|
62
|
+
right: number;
|
|
63
|
+
bottom: number;
|
|
63
64
|
}> {
|
|
64
|
-
|
|
65
|
+
type: 'ElementResize';
|
|
65
66
|
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
67
|
+
interface InspectorInfo {
|
|
68
|
+
columnNumber: string;
|
|
69
|
+
lineNumber: string;
|
|
70
|
+
relativePath: string;
|
|
71
|
+
tagName: string;
|
|
72
|
+
componentName: string;
|
|
73
|
+
className: string;
|
|
74
|
+
x?: number;
|
|
75
|
+
y?: number;
|
|
76
|
+
top?: number;
|
|
77
|
+
bottom?: number;
|
|
78
|
+
right?: number;
|
|
79
|
+
left?: number;
|
|
80
|
+
width?: number;
|
|
81
|
+
height?: number;
|
|
82
|
+
textContent?: string;
|
|
83
|
+
elementId: string;
|
|
84
|
+
fontSize?: {
|
|
85
|
+
value: string;
|
|
86
|
+
inherited: boolean;
|
|
87
|
+
tailwindClassName: string;
|
|
88
|
+
};
|
|
89
|
+
fontWeight?: {
|
|
90
|
+
value: string;
|
|
91
|
+
inherited: boolean;
|
|
92
|
+
tailwindClassName: string;
|
|
93
|
+
};
|
|
94
|
+
borderRadius?: {
|
|
95
|
+
value: string;
|
|
96
|
+
inherited: boolean;
|
|
97
|
+
tailwindClassName: string;
|
|
98
|
+
};
|
|
99
|
+
borderWidth?: {
|
|
100
|
+
value: string;
|
|
101
|
+
inherited: boolean;
|
|
102
|
+
tailwindClassName: string;
|
|
103
|
+
};
|
|
104
|
+
textAlign?: {
|
|
105
|
+
value: string;
|
|
106
|
+
inherited: boolean;
|
|
107
|
+
tailwindClassName: string;
|
|
108
|
+
};
|
|
109
|
+
padding?: {
|
|
110
|
+
value: string;
|
|
111
|
+
inherited: boolean;
|
|
112
|
+
tailwindClassName: string;
|
|
113
|
+
};
|
|
114
|
+
margin?: {
|
|
115
|
+
value: string;
|
|
116
|
+
inherited: boolean;
|
|
117
|
+
tailwindClassName: string;
|
|
118
|
+
};
|
|
119
|
+
color?: {
|
|
120
|
+
value: string;
|
|
121
|
+
inherited: boolean;
|
|
122
|
+
tailwindClassName: string;
|
|
123
|
+
};
|
|
124
|
+
backgroundColor?: {
|
|
125
|
+
value: string;
|
|
126
|
+
inherited: boolean;
|
|
127
|
+
tailwindClassName: string;
|
|
128
|
+
};
|
|
129
|
+
borderColor?: {
|
|
130
|
+
value: string;
|
|
131
|
+
inherited: boolean;
|
|
132
|
+
tailwindClassName: string;
|
|
133
|
+
};
|
|
134
|
+
/**
|
|
135
|
+
* metadata information from babel plugin
|
|
136
|
+
*/
|
|
137
|
+
metadata?: {
|
|
138
|
+
elementStart: number;
|
|
139
|
+
elementEnd: number;
|
|
140
|
+
tagStart: number;
|
|
141
|
+
tagEnd: number;
|
|
142
|
+
classNameLiteral: boolean;
|
|
143
|
+
};
|
|
143
144
|
}
|
|
144
|
-
|
|
145
|
-
|
|
145
|
+
interface SelectInspectorElementMessage extends IframeMessage<InspectorInfo> {
|
|
146
|
+
type: 'SelectInspectorElement';
|
|
146
147
|
}
|
|
147
|
-
|
|
148
|
-
|
|
148
|
+
interface InspectorUIConfigMessage extends IframeMessage<InspectorUIConfig> {
|
|
149
|
+
type: 'InspectorUIConfig';
|
|
149
150
|
}
|
|
150
|
-
|
|
151
|
+
type OutgoingMessage = PageMountedMessage | TextUpdateMessage | PageScrollMessage | ElementResizeMessage | SelectInspectorElementMessage | InspectorUIConfigMessage;
|
|
151
152
|
declare global {
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
}
|
|
153
|
+
interface WindowEventMap {
|
|
154
|
+
message: MessageEvent<IframeMessage>;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
export type { ClearSelectedMessage, EditClassNameMessage, EditStyleMessage, EditTextMessage, ElementResizeMessage, IframeMessage, IncomingMessage, InitConfigMessage, InspectorInfo, InspectorUIConfigMessage, OutgoingMessage, PageMountedMessage, PageScrollMessage, SelectInspectorElementMessage, TextUpdateMessage };
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { ClearSelectedMessage, EditClassNameMessage, EditStyleMessage, EditTextMessage, IncomingMessage, InitConfigMessage, InspectorInfo, OutgoingMessage, PageMountedMessage, SelectInspectorElementMessage, TextUpdateMessage } from './iframe-events.js';
|
|
2
|
+
import '../config/ui-config.js';
|
|
@@ -1,12 +1,15 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import { InspectorUIConfig } from '../config/ui-config.js';
|
|
2
|
+
|
|
3
|
+
interface StyleCalculationConfig {
|
|
4
|
+
cssProperty: string;
|
|
5
|
+
tailwindPrefix: string;
|
|
6
|
+
map: Record<string | number, string>;
|
|
7
|
+
defaultValue?: string;
|
|
8
|
+
transformValue?: (value: string) => string | number;
|
|
9
|
+
tolerance?: number;
|
|
10
|
+
skipTailwind?: boolean;
|
|
10
11
|
}
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
declare function getStyleCalculationConfig(config: InspectorUIConfig, propertyName: keyof InspectorUIConfig['common']): StyleCalculationConfig;
|
|
13
|
+
declare function getAllStyleConfigs(config: InspectorUIConfig): Record<string, StyleCalculationConfig>;
|
|
14
|
+
|
|
15
|
+
export { type StyleCalculationConfig, getAllStyleConfigs, getStyleCalculationConfig };
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
-
export { getPreviewParentOrigin,
|
|
2
|
-
export { cx } from './css';
|
|
3
|
-
export {
|
|
1
|
+
export { getPreviewParentOrigin, isIncomingMessage, isOutgoingMessage, postMessage } from './origin.js';
|
|
2
|
+
export { cx } from './css.js';
|
|
3
|
+
export { calculateBackgroundColorInfo, calculateBorderColorInfo, calculateBorderRadiusInfo, calculateBorderWidthInfo, calculateColorInfo, calculateFontSizeInfo, calculateFontWeightInfo, calculateMarginInfo, calculatePaddingInfo, calculateTextAlignInfo } from './style-calculator.js';
|
|
4
|
+
import '../types/iframe-events.js';
|
|
5
|
+
import '../config/ui-config.js';
|
|
6
|
+
import 'clsx';
|
|
7
|
+
import './config-mapper.js';
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { OutgoingMessage, IncomingMessage } from '../types/iframe-events.js';
|
|
2
|
+
import '../config/ui-config.js';
|
|
3
|
+
|
|
4
|
+
declare function getPreviewParentOrigin(): string;
|
|
5
|
+
declare function postMessage<T extends OutgoingMessage>(message: T, targetOrigin?: string): void;
|
|
6
|
+
declare function isOutgoingMessage<T extends OutgoingMessage['type']>(msg: OutgoingMessage, type: T): msg is Extract<OutgoingMessage, {
|
|
7
|
+
type: T;
|
|
6
8
|
}>;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}>;
|
|
9
|
+
declare function isIncomingMessage<T extends IncomingMessage['type']>(msg: IncomingMessage, type: T): msg is Extract<IncomingMessage, {
|
|
10
|
+
type: T;
|
|
11
|
+
}>;
|
|
12
|
+
|
|
13
|
+
export { getPreviewParentOrigin, isIncomingMessage, isOutgoingMessage, postMessage };
|
|
@@ -1,19 +1,22 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { StyleCalculationConfig } from './config-mapper.js';
|
|
2
|
+
import '../config/ui-config.js';
|
|
3
|
+
|
|
2
4
|
interface StyleCalculationResult {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
5
|
+
value: string;
|
|
6
|
+
inherited: boolean;
|
|
7
|
+
tailwindClassName: string;
|
|
6
8
|
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
9
|
+
declare function rgbaToHex(rgba: string): string;
|
|
10
|
+
declare function calculateStyle(styleName: string, element: HTMLElement, componentName: string, canUseNewInspector: boolean, styleConfigs: Record<string, StyleCalculationConfig>): StyleCalculationResult | null;
|
|
11
|
+
declare const calculateFontSizeInfo: (element: HTMLElement, componentName: string, canUseNewInspector: boolean, styleConfigs: Record<string, StyleCalculationConfig>) => StyleCalculationResult | null;
|
|
12
|
+
declare const calculateFontWeightInfo: (element: HTMLElement, componentName: string, canUseNewInspector: boolean, styleConfigs: Record<string, StyleCalculationConfig>) => StyleCalculationResult | null;
|
|
13
|
+
declare const calculateBorderRadiusInfo: (element: HTMLElement, componentName: string, canUseNewInspector: boolean, styleConfigs: Record<string, StyleCalculationConfig>) => StyleCalculationResult | null;
|
|
14
|
+
declare const calculateBorderWidthInfo: (element: HTMLElement, componentName: string, canUseNewInspector: boolean, styleConfigs: Record<string, StyleCalculationConfig>) => StyleCalculationResult | null;
|
|
15
|
+
declare const calculateTextAlignInfo: (element: HTMLElement, componentName: string, canUseNewInspector: boolean, styleConfigs: Record<string, StyleCalculationConfig>) => StyleCalculationResult | null;
|
|
16
|
+
declare const calculatePaddingInfo: (element: HTMLElement, componentName: string, canUseNewInspector: boolean, styleConfigs: Record<string, StyleCalculationConfig>) => StyleCalculationResult | null;
|
|
17
|
+
declare const calculateMarginInfo: (element: HTMLElement, componentName: string, canUseNewInspector: boolean, styleConfigs: Record<string, StyleCalculationConfig>) => StyleCalculationResult | null;
|
|
18
|
+
declare const calculateColorInfo: (element: HTMLElement, componentName: string, canUseNewInspector: boolean, styleConfigs: Record<string, StyleCalculationConfig>) => StyleCalculationResult | null;
|
|
19
|
+
declare const calculateBackgroundColorInfo: (element: HTMLElement, componentName: string, canUseNewInspector: boolean, styleConfigs: Record<string, StyleCalculationConfig>) => StyleCalculationResult | null;
|
|
20
|
+
declare const calculateBorderColorInfo: (element: HTMLElement, componentName: string, canUseNewInspector: boolean, styleConfigs: Record<string, StyleCalculationConfig>) => StyleCalculationResult | null;
|
|
21
|
+
|
|
22
|
+
export { calculateBackgroundColorInfo, calculateBorderColorInfo, calculateBorderRadiusInfo, calculateBorderWidthInfo, calculateColorInfo, calculateFontSizeInfo, calculateFontWeightInfo, calculateMarginInfo, calculatePaddingInfo, calculateStyle, calculateTextAlignInfo, rgbaToHex };
|