@lark-apaas/miaoda-inspector 0.1.0-alpha.5 → 0.1.0-alpha.7
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.mjs +4 -22
- package/dist/es/Inspector/Overlay.mjs +58 -32
- package/dist/es/Inspector/utils/inspect.mjs +80 -1
- package/dist/es/MiaodaInspector/MiaodaInspector.mjs +332 -173
- package/dist/es/config/ui-config.mjs +138 -136
- package/dist/es/index.mjs +2 -0
- package/dist/es/types/feature.mjs +0 -0
- package/dist/es/types/index.mjs +4 -0
- package/dist/es/utils/config-mapper.mjs +1 -3
- package/dist/es/utils/element-guards.mjs +36 -0
- package/dist/es/utils/index.mjs +1 -6
- package/dist/es/utils/style-calculator.mjs +17 -60
- package/dist/lib/Inspector/Inspector.js +4 -23
- package/dist/lib/Inspector/Overlay.js +57 -28
- package/dist/lib/Inspector/utils/inspect.js +90 -1
- package/dist/lib/MiaodaInspector/MiaodaInspector.js +337 -183
- package/dist/lib/config/ui-config.js +138 -136
- package/dist/lib/index.js +2 -0
- package/dist/lib/types/feature.js +16 -0
- package/dist/lib/types/index.js +3 -0
- package/dist/lib/utils/config-mapper.js +1 -3
- package/dist/lib/utils/element-guards.js +55 -0
- package/dist/lib/utils/style-calculator.js +17 -60
- package/dist/types/Inspector/Inspector.d.ts +8 -1
- package/dist/types/Inspector/Overlay.d.ts +9 -2
- package/dist/types/Inspector/utils/index.d.ts +1 -1
- package/dist/types/Inspector/utils/inspect.d.ts +8 -1
- package/dist/types/config/ui-config.d.ts +26 -3
- package/dist/types/global.d.d.ts +6 -0
- package/dist/types/index.d.ts +2 -1
- package/dist/types/types/feature.d.ts +6 -0
- package/dist/types/types/iframe-events.d.ts +44 -2
- package/dist/types/types/index.d.ts +2 -1
- package/dist/types/utils/element-guards.d.ts +7 -0
- package/dist/types/utils/index.d.ts +1 -0
- package/dist/types/utils/origin.d.ts +1 -0
- package/package.json +13 -12
|
@@ -46,21 +46,13 @@ const defaultUIConfig = {
|
|
|
46
46
|
type: "select",
|
|
47
47
|
options: [
|
|
48
48
|
{ value: "font-thin", label: "\u6781\u7EC6\uFF08Thin\uFF09", rawValue: "100" },
|
|
49
|
-
{
|
|
50
|
-
value: "font-extralight",
|
|
51
|
-
label: "\u6781\u8F7B\uFF08Extra Light\uFF09",
|
|
52
|
-
rawValue: "200"
|
|
53
|
-
},
|
|
49
|
+
{ value: "font-extralight", label: "\u6781\u8F7B\uFF08Extra Light\uFF09", rawValue: "200" },
|
|
54
50
|
{ value: "font-light", label: "\u8F7B\uFF08Light\uFF09", rawValue: "300" },
|
|
55
51
|
{ value: "font-normal", label: "\u5E38\u89C4\uFF08Normal\uFF09", rawValue: "400" },
|
|
56
52
|
{ value: "font-medium", label: "\u4E2D\u7C97\uFF08Medium\uFF09", rawValue: "500" },
|
|
57
53
|
{ value: "font-semibold", label: "\u534A\u7C97\uFF08Semi Bold\uFF09", rawValue: "600" },
|
|
58
54
|
{ value: "font-bold", label: "\u7C97\uFF08Bold\uFF09", rawValue: "700" },
|
|
59
|
-
{
|
|
60
|
-
value: "font-extrabold",
|
|
61
|
-
label: "\u6781\u7C97\uFF08Extra Bold\uFF09",
|
|
62
|
-
rawValue: "800"
|
|
63
|
-
},
|
|
55
|
+
{ value: "font-extrabold", label: "\u6781\u7C97\uFF08Extra Bold\uFF09", rawValue: "800" },
|
|
64
56
|
{ value: "font-black", label: "\u9ED1\u4F53\uFF08Black\uFF09", rawValue: "900" }
|
|
65
57
|
]
|
|
66
58
|
},
|
|
@@ -140,72 +132,22 @@ const defaultUIConfig = {
|
|
|
140
132
|
type: "tailwind",
|
|
141
133
|
rawValue: "#ffffff"
|
|
142
134
|
},
|
|
143
|
-
{
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
},
|
|
149
|
-
{
|
|
150
|
-
value: "text-neutral-100",
|
|
151
|
-
label: "neutral-100",
|
|
152
|
-
type: "tailwind",
|
|
153
|
-
rawValue: "#f2f3f5"
|
|
154
|
-
},
|
|
155
|
-
{
|
|
156
|
-
value: "text-neutral-200",
|
|
157
|
-
label: "neutral-200",
|
|
158
|
-
type: "tailwind",
|
|
159
|
-
rawValue: "#eff0f1"
|
|
160
|
-
},
|
|
161
|
-
{
|
|
162
|
-
value: "text-neutral-300",
|
|
163
|
-
label: "neutral-300",
|
|
164
|
-
type: "tailwind",
|
|
165
|
-
rawValue: "#dee0e3"
|
|
166
|
-
},
|
|
167
|
-
{
|
|
168
|
-
value: "text-neutral-400",
|
|
169
|
-
label: "neutral-400",
|
|
170
|
-
type: "tailwind",
|
|
171
|
-
rawValue: "#d0d3d6"
|
|
172
|
-
},
|
|
173
|
-
{
|
|
174
|
-
value: "text-neutral-500",
|
|
175
|
-
label: "neutral-500",
|
|
176
|
-
type: "tailwind",
|
|
177
|
-
rawValue: "#bbbfc4"
|
|
178
|
-
},
|
|
179
|
-
{
|
|
180
|
-
value: "text-neutral-600",
|
|
181
|
-
label: "neutral-600",
|
|
182
|
-
type: "tailwind",
|
|
183
|
-
rawValue: "#8f959e"
|
|
184
|
-
},
|
|
135
|
+
{ value: "text-neutral-50", label: "neutral-50", type: "tailwind", rawValue: "#f5f6f7" },
|
|
136
|
+
{ value: "text-neutral-100", label: "neutral-100", type: "tailwind", rawValue: "#f2f3f5" },
|
|
137
|
+
{ value: "text-neutral-200", label: "neutral-200", type: "tailwind", rawValue: "#eff0f1" },
|
|
138
|
+
{ value: "text-neutral-300", label: "neutral-300", type: "tailwind", rawValue: "#dee0e3" },
|
|
139
|
+
{ value: "text-neutral-400", label: "neutral-400", type: "tailwind", rawValue: "#d0d3d6" },
|
|
140
|
+
{ value: "text-neutral-500", label: "neutral-500", type: "tailwind", rawValue: "#bbbfc4" },
|
|
141
|
+
{ value: "text-neutral-600", label: "neutral-600", type: "tailwind", rawValue: "#8f959e" },
|
|
185
142
|
{
|
|
186
143
|
value: "text-neutral-650",
|
|
187
144
|
label: "neutral-650",
|
|
188
145
|
type: "tailwind",
|
|
189
146
|
rawValue: "#51565d"
|
|
190
147
|
},
|
|
191
|
-
{
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
type: "tailwind",
|
|
195
|
-
rawValue: "#646a73"
|
|
196
|
-
},
|
|
197
|
-
{
|
|
198
|
-
value: "text-neutral-800",
|
|
199
|
-
label: "neutral-800",
|
|
200
|
-
type: "tailwind",
|
|
201
|
-
rawValue: "#373c43"
|
|
202
|
-
},
|
|
203
|
-
{
|
|
204
|
-
value: "text-neutral-900",
|
|
205
|
-
label: "neutral-900",
|
|
206
|
-
type: "tailwind",
|
|
207
|
-
rawValue: "#2b2f36"
|
|
208
|
-
},
|
|
148
|
+
{ value: "text-neutral-700", label: "neutral-700", type: "tailwind", rawValue: "#646a73" },
|
|
149
|
+
{ value: "text-neutral-800", label: "neutral-800", type: "tailwind", rawValue: "#373c43" },
|
|
150
|
+
{ value: "text-neutral-900", label: "neutral-900", type: "tailwind", rawValue: "#2b2f36" },
|
|
209
151
|
{
|
|
210
152
|
value: "text-neutral-950",
|
|
211
153
|
label: "neutral-950",
|
|
@@ -234,72 +176,22 @@ const defaultUIConfig = {
|
|
|
234
176
|
type: "tailwind",
|
|
235
177
|
rawValue: "#ffffff"
|
|
236
178
|
},
|
|
237
|
-
{
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
},
|
|
243
|
-
{
|
|
244
|
-
value: "bg-neutral-100",
|
|
245
|
-
label: "neutral-100",
|
|
246
|
-
type: "tailwind",
|
|
247
|
-
rawValue: "#f2f3f5"
|
|
248
|
-
},
|
|
249
|
-
{
|
|
250
|
-
value: "bg-neutral-200",
|
|
251
|
-
label: "neutral-200",
|
|
252
|
-
type: "tailwind",
|
|
253
|
-
rawValue: "#eff0f1"
|
|
254
|
-
},
|
|
255
|
-
{
|
|
256
|
-
value: "bg-neutral-300",
|
|
257
|
-
label: "neutral-300",
|
|
258
|
-
type: "tailwind",
|
|
259
|
-
rawValue: "#dee0e3"
|
|
260
|
-
},
|
|
261
|
-
{
|
|
262
|
-
value: "bg-neutral-400",
|
|
263
|
-
label: "neutral-400",
|
|
264
|
-
type: "tailwind",
|
|
265
|
-
rawValue: "#d0d3d6"
|
|
266
|
-
},
|
|
267
|
-
{
|
|
268
|
-
value: "bg-neutral-500",
|
|
269
|
-
label: "neutral-500",
|
|
270
|
-
type: "tailwind",
|
|
271
|
-
rawValue: "#bbbfc4"
|
|
272
|
-
},
|
|
273
|
-
{
|
|
274
|
-
value: "bg-neutral-600",
|
|
275
|
-
label: "neutral-600",
|
|
276
|
-
type: "tailwind",
|
|
277
|
-
rawValue: "#8f959e"
|
|
278
|
-
},
|
|
179
|
+
{ value: "bg-neutral-50", label: "neutral-50", type: "tailwind", rawValue: "#f5f6f7" },
|
|
180
|
+
{ value: "bg-neutral-100", label: "neutral-100", type: "tailwind", rawValue: "#f2f3f5" },
|
|
181
|
+
{ value: "bg-neutral-200", label: "neutral-200", type: "tailwind", rawValue: "#eff0f1" },
|
|
182
|
+
{ value: "bg-neutral-300", label: "neutral-300", type: "tailwind", rawValue: "#dee0e3" },
|
|
183
|
+
{ value: "bg-neutral-400", label: "neutral-400", type: "tailwind", rawValue: "#d0d3d6" },
|
|
184
|
+
{ value: "bg-neutral-500", label: "neutral-500", type: "tailwind", rawValue: "#bbbfc4" },
|
|
185
|
+
{ value: "bg-neutral-600", label: "neutral-600", type: "tailwind", rawValue: "#8f959e" },
|
|
279
186
|
{
|
|
280
187
|
value: "bg-neutral-650",
|
|
281
188
|
label: "neutral-650",
|
|
282
189
|
type: "tailwind",
|
|
283
190
|
rawValue: "#51565d"
|
|
284
191
|
},
|
|
285
|
-
{
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
type: "tailwind",
|
|
289
|
-
rawValue: "#646a73"
|
|
290
|
-
},
|
|
291
|
-
{
|
|
292
|
-
value: "bg-neutral-800",
|
|
293
|
-
label: "neutral-800",
|
|
294
|
-
type: "tailwind",
|
|
295
|
-
rawValue: "#373c43"
|
|
296
|
-
},
|
|
297
|
-
{
|
|
298
|
-
value: "bg-neutral-900",
|
|
299
|
-
label: "neutral-900",
|
|
300
|
-
type: "tailwind",
|
|
301
|
-
rawValue: "#2b2f36"
|
|
302
|
-
},
|
|
192
|
+
{ value: "bg-neutral-700", label: "neutral-700", type: "tailwind", rawValue: "#646a73" },
|
|
193
|
+
{ value: "bg-neutral-800", label: "neutral-800", type: "tailwind", rawValue: "#373c43" },
|
|
194
|
+
{ value: "bg-neutral-900", label: "neutral-900", type: "tailwind", rawValue: "#2b2f36" },
|
|
303
195
|
{
|
|
304
196
|
value: "bg-neutral-950",
|
|
305
197
|
label: "neutral-950",
|
|
@@ -328,12 +220,7 @@ const defaultUIConfig = {
|
|
|
328
220
|
type: "tailwind",
|
|
329
221
|
rawValue: "#ffffff"
|
|
330
222
|
},
|
|
331
|
-
{
|
|
332
|
-
value: "border-neutral-50",
|
|
333
|
-
label: "neutral-50",
|
|
334
|
-
type: "tailwind",
|
|
335
|
-
rawValue: "#f5f6f7"
|
|
336
|
-
},
|
|
223
|
+
{ value: "border-neutral-50", label: "neutral-50", type: "tailwind", rawValue: "#f5f6f7" },
|
|
337
224
|
{
|
|
338
225
|
value: "border-neutral-100",
|
|
339
226
|
label: "neutral-100",
|
|
@@ -582,5 +469,120 @@ const defaultUIConfig = {
|
|
|
582
469
|
"cyan-800": "#0f587a",
|
|
583
470
|
"cyan-900": "#06415c",
|
|
584
471
|
"cyan-950": "#072b3d"
|
|
472
|
+
},
|
|
473
|
+
components: {
|
|
474
|
+
nativeTag: {
|
|
475
|
+
img: {
|
|
476
|
+
src: {
|
|
477
|
+
type: "image",
|
|
478
|
+
label: "\u56FE\u7247"
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
},
|
|
482
|
+
antd: {
|
|
483
|
+
Button: {
|
|
484
|
+
children: {
|
|
485
|
+
label: "\u6587\u6848",
|
|
486
|
+
type: "input"
|
|
487
|
+
},
|
|
488
|
+
icon: {
|
|
489
|
+
label: "\u56FE\u6807",
|
|
490
|
+
type: "icon-picker"
|
|
491
|
+
},
|
|
492
|
+
type: {
|
|
493
|
+
label: "\u7C7B\u578B",
|
|
494
|
+
type: "select",
|
|
495
|
+
options: [
|
|
496
|
+
{
|
|
497
|
+
value: "primary",
|
|
498
|
+
label: "\u4E3B\u8981\u6309\u94AE",
|
|
499
|
+
rawValue: "primary",
|
|
500
|
+
prefix: {
|
|
501
|
+
type: "tag",
|
|
502
|
+
value: "Button",
|
|
503
|
+
style: {
|
|
504
|
+
display: "inline-block",
|
|
505
|
+
backgroundColor: "#1456F0",
|
|
506
|
+
color: "#fff",
|
|
507
|
+
borderRadius: "5px",
|
|
508
|
+
padding: "2px 8px",
|
|
509
|
+
lineHeight: "20px"
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
},
|
|
513
|
+
{
|
|
514
|
+
value: "default",
|
|
515
|
+
label: "\u6B21\u8981\u6309\u94AE",
|
|
516
|
+
rawValue: "default",
|
|
517
|
+
prefix: {
|
|
518
|
+
type: "tag",
|
|
519
|
+
value: "Button",
|
|
520
|
+
style: {
|
|
521
|
+
display: "inline-block",
|
|
522
|
+
borderStyle: "solid",
|
|
523
|
+
borderColor: "#1456F0",
|
|
524
|
+
borderWidth: "1px",
|
|
525
|
+
color: "#1456F0",
|
|
526
|
+
borderRadius: "5px",
|
|
527
|
+
padding: "1px 7px",
|
|
528
|
+
lineHeight: "20px"
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
},
|
|
532
|
+
{
|
|
533
|
+
value: "text",
|
|
534
|
+
label: "\u6587\u5B57\u6309\u94AE",
|
|
535
|
+
rawValue: "text",
|
|
536
|
+
prefix: {
|
|
537
|
+
type: "tag",
|
|
538
|
+
value: "Button",
|
|
539
|
+
style: {
|
|
540
|
+
display: "inline-block",
|
|
541
|
+
color: "#1F2329",
|
|
542
|
+
padding: "2px 8px",
|
|
543
|
+
lineHeight: "20px"
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
},
|
|
547
|
+
{
|
|
548
|
+
value: "link",
|
|
549
|
+
label: "\u94FE\u63A5\u6309\u94AE",
|
|
550
|
+
rawValue: "link",
|
|
551
|
+
prefix: {
|
|
552
|
+
type: "tag",
|
|
553
|
+
value: "Button",
|
|
554
|
+
style: {
|
|
555
|
+
display: "inline-block",
|
|
556
|
+
color: "#1456F0",
|
|
557
|
+
padding: "2px 8px",
|
|
558
|
+
lineHeight: "20px"
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
],
|
|
563
|
+
defaultValue: "default"
|
|
564
|
+
},
|
|
565
|
+
shape: {
|
|
566
|
+
label: "\u5F62\u72B6",
|
|
567
|
+
type: "radioGroup",
|
|
568
|
+
options: [
|
|
569
|
+
{ value: "default", label: "\u77E9\u5F62", rawValue: "default" },
|
|
570
|
+
{ value: "circle", label: "\u5706\u5F62", rawValue: "circle" },
|
|
571
|
+
{ value: "round", label: "\u5706\u89D2", rawValue: "round" }
|
|
572
|
+
],
|
|
573
|
+
defaultValue: "default"
|
|
574
|
+
},
|
|
575
|
+
size: {
|
|
576
|
+
label: "\u5C3A\u5BF8",
|
|
577
|
+
type: "radioGroup",
|
|
578
|
+
options: [
|
|
579
|
+
{ value: "large", label: "\u5927", rawValue: "large" },
|
|
580
|
+
{ value: "middle", label: "\u4E2D", rawValue: "middle" },
|
|
581
|
+
{ value: "small", label: "\u5C0F", rawValue: "small" }
|
|
582
|
+
],
|
|
583
|
+
defaultValue: "middle"
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
}
|
|
585
587
|
}
|
|
586
588
|
};
|
package/dist/lib/index.js
CHANGED
|
@@ -19,8 +19,10 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
19
19
|
var index_exports = {};
|
|
20
20
|
__export(index_exports, {
|
|
21
21
|
MiaodaInspector: () => import_MiaodaInspector.MiaodaInspector,
|
|
22
|
+
defaultUIConfig: () => import_ui_config.defaultUIConfig,
|
|
22
23
|
isOutgoingMessage: () => import_utils.isOutgoingMessage
|
|
23
24
|
});
|
|
24
25
|
module.exports = __toCommonJS(index_exports);
|
|
25
26
|
var import_MiaodaInspector = require("./MiaodaInspector");
|
|
27
|
+
var import_ui_config = require("./config/ui-config");
|
|
26
28
|
var import_utils = require("./utils");
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
var feature_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(feature_exports);
|
package/dist/lib/types/index.js
CHANGED
|
@@ -19,9 +19,11 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
19
19
|
var types_exports = {};
|
|
20
20
|
__export(types_exports, {
|
|
21
21
|
ClearSelectedMessage: () => import_iframe_events.ClearSelectedMessage,
|
|
22
|
+
EditAttributesMessage: () => import_iframe_events.EditAttributesMessage,
|
|
22
23
|
EditClassNameMessage: () => import_iframe_events.EditClassNameMessage,
|
|
23
24
|
EditStyleMessage: () => import_iframe_events.EditStyleMessage,
|
|
24
25
|
EditTextMessage: () => import_iframe_events.EditTextMessage,
|
|
26
|
+
Feature: () => import_feature.Feature,
|
|
25
27
|
IncomingMessage: () => import_iframe_events.IncomingMessage,
|
|
26
28
|
InitConfigMessage: () => import_iframe_events.InitConfigMessage,
|
|
27
29
|
InspectorInfo: () => import_iframe_events.InspectorInfo,
|
|
@@ -32,3 +34,4 @@ __export(types_exports, {
|
|
|
32
34
|
});
|
|
33
35
|
module.exports = __toCommonJS(types_exports);
|
|
34
36
|
var import_iframe_events = require("./iframe-events");
|
|
37
|
+
var import_feature = require("./feature");
|
|
@@ -88,9 +88,7 @@ function getStyleCalculationConfig(config, propertyName) {
|
|
|
88
88
|
return getColorStyleCalculationConfig(config, propertyName);
|
|
89
89
|
}
|
|
90
90
|
if (uiComponent.type !== "select" && uiComponent.type !== "spacing") {
|
|
91
|
-
throw new Error(
|
|
92
|
-
`Unsupported UI component type: ${uiComponent.type} for property: ${propertyName}`
|
|
93
|
-
);
|
|
91
|
+
throw new Error(`Unsupported UI component type: ${uiComponent.type} for property: ${propertyName}`);
|
|
94
92
|
}
|
|
95
93
|
const map = {};
|
|
96
94
|
for (const option of uiComponent.options) {
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
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) => {
|
|
7
|
+
for (var name in all)
|
|
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 });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var element_guards_exports = {};
|
|
20
|
+
__export(element_guards_exports, {
|
|
21
|
+
getCompiledComponentName: () => getCompiledComponentName,
|
|
22
|
+
getImportSource: () => getImportSource,
|
|
23
|
+
hasNonEmptyText: () => hasNonEmptyText,
|
|
24
|
+
isAntdText: () => isAntdText,
|
|
25
|
+
isNativeElementName: () => isNativeElementName
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(element_guards_exports);
|
|
28
|
+
function getCompiledComponentName(element, fallback) {
|
|
29
|
+
return element.getAttribute("data-miaoda-component-name") || fallback;
|
|
30
|
+
}
|
|
31
|
+
function getImportSource(element) {
|
|
32
|
+
return element.getAttribute("data-miaoda-import-source");
|
|
33
|
+
}
|
|
34
|
+
function hasNonEmptyText(element) {
|
|
35
|
+
return typeof element.textContent === "string" && element.textContent.trim().length > 0;
|
|
36
|
+
}
|
|
37
|
+
function isNativeElementName(componentName) {
|
|
38
|
+
return Boolean(componentName && componentName[0] !== componentName[0].toUpperCase());
|
|
39
|
+
}
|
|
40
|
+
function isAntdText(element, componentName) {
|
|
41
|
+
const importSource = getImportSource(element);
|
|
42
|
+
const compiledName = getCompiledComponentName(element, componentName);
|
|
43
|
+
if (importSource !== "antd" || !compiledName) {
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
const textualNames = /* @__PURE__ */ new Set([
|
|
47
|
+
"Typography.Text",
|
|
48
|
+
"Text",
|
|
49
|
+
"Typography.Title",
|
|
50
|
+
"Title",
|
|
51
|
+
"Typography.Paragraph",
|
|
52
|
+
"Paragraph"
|
|
53
|
+
]);
|
|
54
|
+
return textualNames.has(compiledName);
|
|
55
|
+
}
|
|
@@ -49,6 +49,7 @@ __export(style_calculator_exports, {
|
|
|
49
49
|
rgbaToHex: () => rgbaToHex
|
|
50
50
|
});
|
|
51
51
|
module.exports = __toCommonJS(style_calculator_exports);
|
|
52
|
+
var import_element_guards = require("./element-guards");
|
|
52
53
|
function rgbaToHex(rgba) {
|
|
53
54
|
const match = rgba.match(/rgba?\(([^)]+)\)/);
|
|
54
55
|
if (!match) return rgba;
|
|
@@ -71,7 +72,13 @@ function rgbaToHex(rgba) {
|
|
|
71
72
|
return `#${toHex(r)}${toHex(g)}${toHex(b)}`;
|
|
72
73
|
}
|
|
73
74
|
function isValidElement(element, componentName, canUseNewInspector) {
|
|
74
|
-
|
|
75
|
+
if (!element || !componentName || !canUseNewInspector || element instanceof SVGElement) {
|
|
76
|
+
return false;
|
|
77
|
+
}
|
|
78
|
+
if ((0, import_element_guards.isNativeElementName)(componentName)) {
|
|
79
|
+
return true;
|
|
80
|
+
}
|
|
81
|
+
return (0, import_element_guards.isAntdText)(element, componentName);
|
|
75
82
|
}
|
|
76
83
|
function isValidElementWithComponent(element, componentName, canUseNewInspector) {
|
|
77
84
|
return !!(element && componentName && canUseNewInspector && !(element instanceof SVGElement));
|
|
@@ -133,48 +140,16 @@ function calculateStyle(styleName, element, componentName, canUseNewInspector, s
|
|
|
133
140
|
return null;
|
|
134
141
|
}
|
|
135
142
|
const config = styleConfigs[styleName];
|
|
136
|
-
const tailwindPattern = new RegExp(
|
|
137
|
-
`\\b${config.tailwindPrefix}-(${Object.keys(config.map).join("|")})\\b`
|
|
138
|
-
);
|
|
143
|
+
const tailwindPattern = new RegExp(`\\b${config.tailwindPrefix}-(${Object.keys(config.map).join("|")})\\b`);
|
|
139
144
|
return calculateStyleProperty(element, __spreadProps(__spreadValues({}, config), {
|
|
140
145
|
tailwindPattern
|
|
141
146
|
}));
|
|
142
147
|
}
|
|
143
|
-
const calculateFontSizeInfo = (element, componentName, canUseNewInspector, styleConfigs) => calculateStyle(
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
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
|
-
);
|
|
148
|
+
const calculateFontSizeInfo = (element, componentName, canUseNewInspector, styleConfigs) => calculateStyle("fontSize", element, componentName, canUseNewInspector, styleConfigs);
|
|
149
|
+
const calculateFontWeightInfo = (element, componentName, canUseNewInspector, styleConfigs) => calculateStyle("fontWeight", element, componentName, canUseNewInspector, styleConfigs);
|
|
150
|
+
const calculateBorderRadiusInfo = (element, componentName, canUseNewInspector, styleConfigs) => calculateStyle("borderRadius", element, componentName, canUseNewInspector, styleConfigs);
|
|
151
|
+
const calculateBorderWidthInfo = (element, componentName, canUseNewInspector, styleConfigs) => calculateStyle("borderWidth", element, componentName, canUseNewInspector, styleConfigs);
|
|
152
|
+
const calculateTextAlignInfo = (element, componentName, canUseNewInspector, styleConfigs) => calculateStyle("textAlign", element, componentName, canUseNewInspector, styleConfigs);
|
|
178
153
|
const calculatePaddingInfo = (element, componentName, canUseNewInspector, styleConfigs) => {
|
|
179
154
|
if (!isValidElementWithComponent(element, componentName, canUseNewInspector)) {
|
|
180
155
|
return null;
|
|
@@ -187,24 +162,6 @@ const calculateMarginInfo = (element, componentName, canUseNewInspector, styleCo
|
|
|
187
162
|
}
|
|
188
163
|
return calculateStyleProperty(element, styleConfigs.margin);
|
|
189
164
|
};
|
|
190
|
-
const calculateColorInfo = (element, componentName, canUseNewInspector, styleConfigs) => calculateStyle(
|
|
191
|
-
|
|
192
|
-
|
|
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
|
-
);
|
|
165
|
+
const calculateColorInfo = (element, componentName, canUseNewInspector, styleConfigs) => calculateStyle("color", element, componentName, canUseNewInspector, styleConfigs);
|
|
166
|
+
const calculateBackgroundColorInfo = (element, componentName, canUseNewInspector, styleConfigs) => calculateStyle("backgroundColor", element, componentName, canUseNewInspector, styleConfigs);
|
|
167
|
+
const calculateBorderColorInfo = (element, componentName, canUseNewInspector, styleConfigs) => calculateStyle("borderColor", element, componentName, canUseNewInspector, styleConfigs);
|
|
@@ -89,7 +89,14 @@ interface InspectorProps {
|
|
|
89
89
|
/**
|
|
90
90
|
* Callback when left-clicking on an element.
|
|
91
91
|
*/
|
|
92
|
-
onClickElement?: (params: InspectParams
|
|
92
|
+
onClickElement?: (params: InspectParams & {
|
|
93
|
+
componentProps?: Record<string, unknown & {
|
|
94
|
+
__miaoda_icon__?: {
|
|
95
|
+
source: 'lucide-react';
|
|
96
|
+
name: string;
|
|
97
|
+
};
|
|
98
|
+
}>;
|
|
99
|
+
}) => void;
|
|
93
100
|
/** any children of react nodes */
|
|
94
101
|
children?: ReactNode;
|
|
95
102
|
/**
|
|
@@ -64,11 +64,18 @@ declare class ClickOverlay {
|
|
|
64
64
|
currentElement: HTMLElement | null;
|
|
65
65
|
currentName: string | undefined;
|
|
66
66
|
positionUpdate?: () => void;
|
|
67
|
-
|
|
67
|
+
onElementRebind?: (el: HTMLElement) => void;
|
|
68
|
+
mutationObserver?: MutationObserver;
|
|
69
|
+
currentElementId?: string;
|
|
70
|
+
constructor(options?: (() => void) | {
|
|
71
|
+
positionUpdate?: () => void;
|
|
72
|
+
onElementRebind?: (el: HTMLElement) => void;
|
|
73
|
+
});
|
|
68
74
|
remove(): void;
|
|
69
|
-
highlight(element: HTMLElement, name?: string): void;
|
|
75
|
+
highlight(element: HTMLElement, name?: string, elementId?: string): void;
|
|
70
76
|
updatePosition(element: HTMLElement): void;
|
|
71
77
|
clearRect(): void;
|
|
78
|
+
private _rebind;
|
|
72
79
|
}
|
|
73
80
|
|
|
74
81
|
export { ClickOverlay, Overlay };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { StopFunction, setupHighlighter } from './highlight.js';
|
|
2
|
-
export { CodeDataAttribute, CodeInfo, getCodeInfoFromDebugSource, getCodeInfoFromFiber, getCodeInfoFromProps, getElementCodeInfo, getElementInspect, getNamedFiber, getReferenceFiber } from './inspect.js';
|
|
2
|
+
export { CodeDataAttribute, CodeInfo, extractPropsFromFiber, getCodeInfoFromDebugSource, getCodeInfoFromFiber, getCodeInfoFromProps, getElementCodeInfo, getElementInspect, getNamedFiber, getParentElement, getReferenceFiber } from './inspect.js';
|
|
3
3
|
export { BoxSizing, Rect, getElementDimensions, getNestedBoundingClientRect } from './overlay.js';
|
|
4
4
|
import 'react-reconciler';
|
|
@@ -109,5 +109,12 @@ declare const getElementInspect: (element: HTMLElement) => {
|
|
|
109
109
|
name?: string;
|
|
110
110
|
title: string;
|
|
111
111
|
};
|
|
112
|
+
declare const getParentElement: (element: HTMLElement) => HTMLElement | undefined;
|
|
113
|
+
declare const extractPropsFromFiber: (fiber?: Fiber) => Record<string, unknown & {
|
|
114
|
+
__miaoda_icon__?: {
|
|
115
|
+
source: "lucide-react";
|
|
116
|
+
name: string;
|
|
117
|
+
};
|
|
118
|
+
}>;
|
|
112
119
|
|
|
113
|
-
export { type CodeDataAttribute, type CodeInfo, getCodeInfoFromDebugSource, getCodeInfoFromFiber, getCodeInfoFromProps, getElementCodeInfo, getElementInspect, getNamedFiber, getReferenceFiber };
|
|
120
|
+
export { type CodeDataAttribute, type CodeInfo, extractPropsFromFiber, getCodeInfoFromDebugSource, getCodeInfoFromFiber, getCodeInfoFromProps, getElementCodeInfo, getElementInspect, getNamedFiber, getParentElement, getReferenceFiber };
|
|
@@ -1,11 +1,26 @@
|
|
|
1
|
+
interface SelectOptionPrefix {
|
|
2
|
+
type: 'tag';
|
|
3
|
+
value: string;
|
|
4
|
+
style?: Record<string, string>;
|
|
5
|
+
}
|
|
1
6
|
interface SelectOption {
|
|
2
7
|
label: string;
|
|
3
8
|
value: string;
|
|
4
9
|
rawValue: string;
|
|
10
|
+
prefix?: SelectOptionPrefix;
|
|
5
11
|
}
|
|
6
12
|
interface SelectUIConfig {
|
|
7
13
|
type: 'select';
|
|
8
14
|
options: SelectOption[];
|
|
15
|
+
defaultValue?: string;
|
|
16
|
+
}
|
|
17
|
+
interface RadioGroupConfig {
|
|
18
|
+
type: 'radioGroup';
|
|
19
|
+
options: SelectOption[];
|
|
20
|
+
defaultValue?: string;
|
|
21
|
+
}
|
|
22
|
+
interface InputConfig {
|
|
23
|
+
type: 'input';
|
|
9
24
|
}
|
|
10
25
|
interface SpacingUIConfig {
|
|
11
26
|
type: 'spacing';
|
|
@@ -27,7 +42,13 @@ interface ColorPickerUIConfig {
|
|
|
27
42
|
interface IconPickerUIConfig {
|
|
28
43
|
type: 'icon-picker';
|
|
29
44
|
}
|
|
30
|
-
|
|
45
|
+
interface ImageSetterUIConfig {
|
|
46
|
+
type: 'image';
|
|
47
|
+
}
|
|
48
|
+
type UIComponentConfig = SelectUIConfig | ColorPickerUIConfig | IconPickerUIConfig | SpacingUIConfig | RadioGroupConfig | InputConfig | ImageSetterUIConfig;
|
|
49
|
+
type ComponentConfig = Record<string, UIComponentConfig & {
|
|
50
|
+
label: string;
|
|
51
|
+
}>;
|
|
31
52
|
interface InspectorUIConfig {
|
|
32
53
|
version: string;
|
|
33
54
|
common: {
|
|
@@ -42,9 +63,11 @@ interface InspectorUIConfig {
|
|
|
42
63
|
borderColor: UIComponentConfig;
|
|
43
64
|
backgroundColor: UIComponentConfig;
|
|
44
65
|
};
|
|
45
|
-
components?: Record<string, Record<string, UIComponentConfig
|
|
66
|
+
components?: Record<string, Record<string, Record<string, UIComponentConfig & {
|
|
67
|
+
label: string;
|
|
68
|
+
}>>>;
|
|
46
69
|
tokens: Record<string, string>;
|
|
47
70
|
}
|
|
48
71
|
declare const defaultUIConfig: InspectorUIConfig;
|
|
49
72
|
|
|
50
|
-
export { type ColorPickerUIConfig, type IconPickerUIConfig, type InspectorUIConfig, type SelectOption, type SelectUIConfig, type SpacingUIConfig, type UIComponentConfig, defaultUIConfig };
|
|
73
|
+
export { type ColorPickerUIConfig, type ComponentConfig, type IconPickerUIConfig, type ImageSetterUIConfig, type InputConfig, type InspectorUIConfig, type RadioGroupConfig, type SelectOption, type SelectOptionPrefix, type SelectUIConfig, type SpacingUIConfig, type UIComponentConfig, defaultUIConfig };
|