@lark-apaas/miaoda-inspector 1.0.1 → 1.0.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.
@@ -36,7 +36,8 @@ const getCodeInfoFromProps = (fiber) => {
36
36
  "data-miaoda-column": columnNumber,
37
37
  "data-miaoda-relative-path": relativePath,
38
38
  "data-miaoda-component-name": name,
39
- "data-miaoda-metadata": metadataStr
39
+ "data-miaoda-metadata": metadataStr,
40
+ "data-ai-section-type": sectionType
40
41
  } = fiber.pendingProps;
41
42
  let metadata;
42
43
  if (metadataStr) {
@@ -52,7 +53,8 @@ const getCodeInfoFromProps = (fiber) => {
52
53
  lineNumber,
53
54
  columnNumber,
54
55
  relativePath,
55
- metadata
56
+ metadata,
57
+ sectionType: sectionType != null ? sectionType : ""
56
58
  };
57
59
  }
58
60
  return void 0;
@@ -136,7 +136,7 @@ function MiaodaInspector(props) {
136
136
  const clickOverlay = new ClickOverlay({
137
137
  positionUpdate: () => {
138
138
  var _a2;
139
- const el = ((_a2 = selectedElementMap.get(id)) == null ? void 0 : _a2.element) || element;
139
+ const el = element || ((_a2 = selectedElementMap.get(id)) == null ? void 0 : _a2.element);
140
140
  const _coords = getElementCoordinates(el);
141
141
  postMessage({
142
142
  type: "ElementResize",
@@ -190,24 +190,23 @@ function MiaodaInspector(props) {
190
190
  const imageInfo = extractImageInfo(element);
191
191
  const dataMiaodaId = element.getAttribute("data-miaoda-id");
192
192
  const id = dataMiaodaId || elementInfoToKey(codeInfo.relativePath, codeInfo.lineNumber, codeInfo.columnNumber);
193
- const selectElement = selectedElementMap.has(id);
194
- if (!selectElement) {
195
- const originalState = {
196
- textContent: textInfo.textContent,
197
- styles: {},
198
- attributes: {},
199
- className: safeClassName(element)
200
- };
201
- if (element instanceof HTMLImageElement) {
202
- originalState.attributes.src = (_b = (_a = element.getAttribute("src")) != null ? _a : element.currentSrc) != null ? _b : null;
203
- }
204
- selectedElementMap.set(id, {
205
- elementId: id,
206
- element,
207
- title,
208
- originalState
209
- });
193
+ const originalState = {
194
+ textContent: textInfo.textContent,
195
+ styles: {},
196
+ attributes: {},
197
+ className: safeClassName(element),
198
+ props: {},
199
+ iconProps: {}
200
+ };
201
+ if (element instanceof HTMLImageElement) {
202
+ originalState.attributes.src = (_b = (_a = element.getAttribute("src")) != null ? _a : element.currentSrc) != null ? _b : null;
210
203
  }
204
+ selectedElementMap.set(id, {
205
+ elementId: id,
206
+ element,
207
+ title,
208
+ originalState
209
+ });
211
210
  const importSourceAttr = element.getAttribute("data-miaoda-import-source");
212
211
  const isAntdComponent = importSourceAttr === "antd" && window.__MIAODA_DEVTOOLS_GLOBAL_HOOK__ && window.__MIAODA_DEVTOOLS_GLOBAL_HOOK__.setProps;
213
212
  const isNativeTagImage = (imageInfo == null ? void 0 : imageInfo.type) === "img" && !isAntdComponent;
@@ -321,7 +320,7 @@ function MiaodaInspector(props) {
321
320
  const updateIntervalRef = useRef(500);
322
321
  const handleMessage = useCallback(
323
322
  (event) => {
324
- var _a, _b, _c;
323
+ var _a, _b, _c, _d, _e;
325
324
  const { data } = event;
326
325
  if (isIncomingMessage(data, "InitConfig")) {
327
326
  const { inspectorActive, userToken, appId, inspectorVersion, updateInterval } = data.data;
@@ -352,34 +351,45 @@ function MiaodaInspector(props) {
352
351
  const { keepModifications = false } = data.data;
353
352
  (_b = clickOverlayRef.current) == null ? void 0 : _b.remove();
354
353
  clickOverlayRef.current = null;
355
- if (canUseNewInspector.current && !keepModifications) {
356
- for (const [_, selectedElement] of selectedElementMap.entries()) {
357
- if (selectedElement.element) {
358
- if (selectedElement.originalState.textContent) {
359
- selectedElement.element.textContent = selectedElement.originalState.textContent;
360
- }
361
- if (selectedElement.originalState.className && !(selectedElement.element instanceof SVGElement)) {
362
- selectedElement.element.className = selectedElement.originalState.className;
363
- }
354
+ if (canUseNewInspector.current) {
355
+ if (!keepModifications) {
356
+ for (const selectedElement of selectedElementMap.values()) {
357
+ (_c = selectedElement.dispose) == null ? void 0 : _c.call(selectedElement);
364
358
  }
365
- if (selectedElement.dispose) {
366
- selectedElement.dispose();
359
+ selectedElementMap.clear();
360
+ } else {
361
+ for (const selectedElement of selectedElementMap.values()) {
362
+ (_d = selectedElement.commit) == null ? void 0 : _d.call(selectedElement);
367
363
  }
368
364
  }
369
- selectedElementMap.clear();
370
365
  }
371
366
  } else if (isIncomingMessage(data, "ClearModification")) {
372
367
  const { elementId } = data.data;
373
368
  const selectedElement = selectedElementMap.get(elementId);
374
369
  if (selectedElement && selectedElement.element) {
375
370
  selectedElementMap.delete(elementId);
376
- (_c = selectedElement.dispose) == null ? void 0 : _c.call(selectedElement);
371
+ (_e = selectedElement.dispose) == null ? void 0 : _e.call(selectedElement);
377
372
  }
378
373
  } else if (isIncomingMessage(data, "EditText")) {
379
374
  const { elementId, textContent } = data.data;
380
375
  const selectedElement = selectedElementMap.get(elementId);
381
376
  if (selectedElement && selectedElement.element) {
382
- selectedElement.element.textContent = textContent;
377
+ const { element } = selectedElement;
378
+ element.textContent = textContent;
379
+ const existingDispose = selectedElement.dispose;
380
+ selectedElement.dispose = () => {
381
+ if (selectedElement.originalState.textContent) {
382
+ element.textContent = selectedElement.originalState.textContent;
383
+ }
384
+ existingDispose == null ? void 0 : existingDispose();
385
+ };
386
+ const existingCommit = selectedElement.commit;
387
+ selectedElement.commit = () => {
388
+ existingCommit == null ? void 0 : existingCommit();
389
+ if (selectedElement.originalState.textContent != null) {
390
+ selectedElement.originalState.textContent = element.textContent;
391
+ }
392
+ };
383
393
  }
384
394
  } else if (isIncomingMessage(data, "EditStyle")) {
385
395
  const { elementId, styles } = data.data;
@@ -410,6 +420,13 @@ function MiaodaInspector(props) {
410
420
  existingDispose();
411
421
  }
412
422
  };
423
+ const existingCommit = selectedElement.commit;
424
+ selectedElement.commit = () => {
425
+ existingCommit == null ? void 0 : existingCommit();
426
+ for (const property of Object.keys(selectedElement.originalState.styles)) {
427
+ selectedElement.originalState.styles[property] = element.style.getPropertyValue(property);
428
+ }
429
+ };
413
430
  }
414
431
  } else if (isIncomingMessage(data, "EditClassName")) {
415
432
  const { elementId, className } = data.data;
@@ -419,11 +436,19 @@ function MiaodaInspector(props) {
419
436
  if (selectedElement.originalState.className === void 0) {
420
437
  selectedElement.originalState.className = safeClassName(element);
421
438
  }
422
- element.className = cx(element.className, className);
439
+ if (!(element instanceof SVGElement)) {
440
+ element.className = cx(element.className, className);
441
+ } else {
442
+ element.className.baseVal = cx(element.className.baseVal, className);
443
+ }
423
444
  const existingDispose = selectedElement.dispose;
424
445
  const classDispose = () => {
425
446
  if (selectedElement.originalState.className) {
426
- element.className = selectedElement.originalState.className;
447
+ if (!(element instanceof SVGElement)) {
448
+ element.className = selectedElement.originalState.className;
449
+ } else {
450
+ element.className.baseVal = selectedElement.originalState.className;
451
+ }
427
452
  }
428
453
  };
429
454
  selectedElement.dispose = () => {
@@ -432,6 +457,11 @@ function MiaodaInspector(props) {
432
457
  existingDispose();
433
458
  }
434
459
  };
460
+ const existingCommit = selectedElement.commit;
461
+ selectedElement.commit = () => {
462
+ existingCommit == null ? void 0 : existingCommit();
463
+ selectedElement.originalState.className = safeClassName(element);
464
+ };
435
465
  }
436
466
  } else if (isIncomingMessage(data, "EditProps")) {
437
467
  const { elementId, props: _props } = data.data;
@@ -466,6 +496,9 @@ function MiaodaInspector(props) {
466
496
  const { elementId, prop, value } = data.data;
467
497
  const selectedElement = selectedElementMap.get(elementId);
468
498
  if (selectedElement && selectedElement.element) {
499
+ if (!(prop in selectedElement.originalState.iconProps)) {
500
+ selectedElement.originalState.iconProps[prop] = value;
501
+ }
469
502
  if (window.__MIAODA_DEVTOOLS_GLOBAL_HOOK__ && typeof window.__MIAODA_DEVTOOLS_GLOBAL_HOOK__.setIconProps === "function") {
470
503
  window.__MIAODA_DEVTOOLS_GLOBAL_HOOK__.setIconProps(elementId, prop, value);
471
504
  } else {
@@ -479,9 +512,13 @@ function MiaodaInspector(props) {
479
512
  const existingDispose = selectedElement.dispose;
480
513
  const iconDispose = () => {
481
514
  if (window.__MIAODA_DEVTOOLS_GLOBAL_HOOK__ && typeof window.__MIAODA_DEVTOOLS_GLOBAL_HOOK__.setIconProps === "function") {
482
- window.__MIAODA_DEVTOOLS_GLOBAL_HOOK__.setIconProps(elementId, prop, void 0);
515
+ window.__MIAODA_DEVTOOLS_GLOBAL_HOOK__.setIconProps(elementId, prop, selectedElement.originalState.iconProps[prop]);
483
516
  } else if (selectedElement.element) {
484
- selectedElement.element.removeAttribute(`data-${prop}`);
517
+ if (selectedElement.originalState.iconProps[prop]) {
518
+ selectedElement.element.setAttribute(`data-${prop}`, String(selectedElement.originalState.iconProps[prop]));
519
+ } else {
520
+ selectedElement.element.removeAttribute(`data-${prop}`);
521
+ }
485
522
  }
486
523
  };
487
524
  selectedElement.dispose = () => {
@@ -490,11 +527,19 @@ function MiaodaInspector(props) {
490
527
  existingDispose();
491
528
  }
492
529
  };
530
+ const existingCommit = selectedElement.commit;
531
+ selectedElement.commit = () => {
532
+ existingCommit == null ? void 0 : existingCommit();
533
+ selectedElement.originalState.iconProps[prop] = value;
534
+ };
493
535
  }
494
536
  } else if (isIncomingMessage(data, "ReverseSelect")) {
495
537
  const { elementId } = data.data;
496
538
  const selectedElement = selectedElementMap.get(elementId);
497
539
  if (selectedElement && selectedElement.element) {
540
+ selectedElement.element.scrollIntoView({
541
+ block: "center"
542
+ });
498
543
  updateClickOverlay(selectedElement.element, selectedElement.title, selectedElement.elementId);
499
544
  }
500
545
  } else if (isIncomingMessage(data, "SelectParent")) {
@@ -537,6 +582,13 @@ function MiaodaInspector(props) {
537
582
  existingDispose();
538
583
  }
539
584
  };
585
+ const existingCommit = selectedElement.commit;
586
+ selectedElement.commit = () => {
587
+ existingCommit == null ? void 0 : existingCommit();
588
+ for (const attr of Object.keys(selectedElement.originalState.attributes)) {
589
+ selectedElement.originalState.attributes[attr] = element.getAttribute(attr);
590
+ }
591
+ };
540
592
  }
541
593
  }
542
594
  },
@@ -571,7 +623,7 @@ function MiaodaInspector(props) {
571
623
  postMessage({
572
624
  type: "PageMounted",
573
625
  data: {
574
- version: "1.0.1",
626
+ version: "1.0.3",
575
627
  feature: {
576
628
  selectParent: true,
577
629
  reverseSelect: true
@@ -69,7 +69,8 @@ const getCodeInfoFromProps = (fiber) => {
69
69
  "data-miaoda-column": columnNumber,
70
70
  "data-miaoda-relative-path": relativePath,
71
71
  "data-miaoda-component-name": name,
72
- "data-miaoda-metadata": metadataStr
72
+ "data-miaoda-metadata": metadataStr,
73
+ "data-ai-section-type": sectionType
73
74
  } = fiber.pendingProps;
74
75
  let metadata;
75
76
  if (metadataStr) {
@@ -85,7 +86,8 @@ const getCodeInfoFromProps = (fiber) => {
85
86
  lineNumber,
86
87
  columnNumber,
87
88
  relativePath,
88
- metadata
89
+ metadata,
90
+ sectionType: sectionType != null ? sectionType : ""
89
91
  };
90
92
  }
91
93
  return void 0;
@@ -153,7 +153,7 @@ function MiaodaInspector(props) {
153
153
  const clickOverlay = new import_Overlay.ClickOverlay({
154
154
  positionUpdate: () => {
155
155
  var _a2;
156
- const el = ((_a2 = selectedElementMap.get(id)) == null ? void 0 : _a2.element) || element;
156
+ const el = element || ((_a2 = selectedElementMap.get(id)) == null ? void 0 : _a2.element);
157
157
  const _coords = getElementCoordinates(el);
158
158
  (0, import_utils2.postMessage)({
159
159
  type: "ElementResize",
@@ -207,24 +207,23 @@ function MiaodaInspector(props) {
207
207
  const imageInfo = extractImageInfo(element);
208
208
  const dataMiaodaId = element.getAttribute("data-miaoda-id");
209
209
  const id = dataMiaodaId || elementInfoToKey(codeInfo.relativePath, codeInfo.lineNumber, codeInfo.columnNumber);
210
- const selectElement = selectedElementMap.has(id);
211
- if (!selectElement) {
212
- const originalState = {
213
- textContent: textInfo.textContent,
214
- styles: {},
215
- attributes: {},
216
- className: safeClassName(element)
217
- };
218
- if (element instanceof HTMLImageElement) {
219
- originalState.attributes.src = (_b = (_a = element.getAttribute("src")) != null ? _a : element.currentSrc) != null ? _b : null;
220
- }
221
- selectedElementMap.set(id, {
222
- elementId: id,
223
- element,
224
- title,
225
- originalState
226
- });
210
+ const originalState = {
211
+ textContent: textInfo.textContent,
212
+ styles: {},
213
+ attributes: {},
214
+ className: safeClassName(element),
215
+ props: {},
216
+ iconProps: {}
217
+ };
218
+ if (element instanceof HTMLImageElement) {
219
+ originalState.attributes.src = (_b = (_a = element.getAttribute("src")) != null ? _a : element.currentSrc) != null ? _b : null;
227
220
  }
221
+ selectedElementMap.set(id, {
222
+ elementId: id,
223
+ element,
224
+ title,
225
+ originalState
226
+ });
228
227
  const importSourceAttr = element.getAttribute("data-miaoda-import-source");
229
228
  const isAntdComponent = importSourceAttr === "antd" && window.__MIAODA_DEVTOOLS_GLOBAL_HOOK__ && window.__MIAODA_DEVTOOLS_GLOBAL_HOOK__.setProps;
230
229
  const isNativeTagImage = (imageInfo == null ? void 0 : imageInfo.type) === "img" && !isAntdComponent;
@@ -338,7 +337,7 @@ function MiaodaInspector(props) {
338
337
  const updateIntervalRef = (0, import_react.useRef)(500);
339
338
  const handleMessage = (0, import_react.useCallback)(
340
339
  (event) => {
341
- var _a, _b, _c;
340
+ var _a, _b, _c, _d, _e;
342
341
  const { data } = event;
343
342
  if ((0, import_utils2.isIncomingMessage)(data, "InitConfig")) {
344
343
  const { inspectorActive, userToken, appId, inspectorVersion, updateInterval } = data.data;
@@ -369,34 +368,45 @@ function MiaodaInspector(props) {
369
368
  const { keepModifications = false } = data.data;
370
369
  (_b = clickOverlayRef.current) == null ? void 0 : _b.remove();
371
370
  clickOverlayRef.current = null;
372
- if (canUseNewInspector.current && !keepModifications) {
373
- for (const [_, selectedElement] of selectedElementMap.entries()) {
374
- if (selectedElement.element) {
375
- if (selectedElement.originalState.textContent) {
376
- selectedElement.element.textContent = selectedElement.originalState.textContent;
377
- }
378
- if (selectedElement.originalState.className && !(selectedElement.element instanceof SVGElement)) {
379
- selectedElement.element.className = selectedElement.originalState.className;
380
- }
371
+ if (canUseNewInspector.current) {
372
+ if (!keepModifications) {
373
+ for (const selectedElement of selectedElementMap.values()) {
374
+ (_c = selectedElement.dispose) == null ? void 0 : _c.call(selectedElement);
381
375
  }
382
- if (selectedElement.dispose) {
383
- selectedElement.dispose();
376
+ selectedElementMap.clear();
377
+ } else {
378
+ for (const selectedElement of selectedElementMap.values()) {
379
+ (_d = selectedElement.commit) == null ? void 0 : _d.call(selectedElement);
384
380
  }
385
381
  }
386
- selectedElementMap.clear();
387
382
  }
388
383
  } else if ((0, import_utils2.isIncomingMessage)(data, "ClearModification")) {
389
384
  const { elementId } = data.data;
390
385
  const selectedElement = selectedElementMap.get(elementId);
391
386
  if (selectedElement && selectedElement.element) {
392
387
  selectedElementMap.delete(elementId);
393
- (_c = selectedElement.dispose) == null ? void 0 : _c.call(selectedElement);
388
+ (_e = selectedElement.dispose) == null ? void 0 : _e.call(selectedElement);
394
389
  }
395
390
  } else if ((0, import_utils2.isIncomingMessage)(data, "EditText")) {
396
391
  const { elementId, textContent } = data.data;
397
392
  const selectedElement = selectedElementMap.get(elementId);
398
393
  if (selectedElement && selectedElement.element) {
399
- selectedElement.element.textContent = textContent;
394
+ const { element } = selectedElement;
395
+ element.textContent = textContent;
396
+ const existingDispose = selectedElement.dispose;
397
+ selectedElement.dispose = () => {
398
+ if (selectedElement.originalState.textContent) {
399
+ element.textContent = selectedElement.originalState.textContent;
400
+ }
401
+ existingDispose == null ? void 0 : existingDispose();
402
+ };
403
+ const existingCommit = selectedElement.commit;
404
+ selectedElement.commit = () => {
405
+ existingCommit == null ? void 0 : existingCommit();
406
+ if (selectedElement.originalState.textContent != null) {
407
+ selectedElement.originalState.textContent = element.textContent;
408
+ }
409
+ };
400
410
  }
401
411
  } else if ((0, import_utils2.isIncomingMessage)(data, "EditStyle")) {
402
412
  const { elementId, styles } = data.data;
@@ -427,6 +437,13 @@ function MiaodaInspector(props) {
427
437
  existingDispose();
428
438
  }
429
439
  };
440
+ const existingCommit = selectedElement.commit;
441
+ selectedElement.commit = () => {
442
+ existingCommit == null ? void 0 : existingCommit();
443
+ for (const property of Object.keys(selectedElement.originalState.styles)) {
444
+ selectedElement.originalState.styles[property] = element.style.getPropertyValue(property);
445
+ }
446
+ };
430
447
  }
431
448
  } else if ((0, import_utils2.isIncomingMessage)(data, "EditClassName")) {
432
449
  const { elementId, className } = data.data;
@@ -436,11 +453,19 @@ function MiaodaInspector(props) {
436
453
  if (selectedElement.originalState.className === void 0) {
437
454
  selectedElement.originalState.className = safeClassName(element);
438
455
  }
439
- element.className = (0, import_utils2.cx)(element.className, className);
456
+ if (!(element instanceof SVGElement)) {
457
+ element.className = (0, import_utils2.cx)(element.className, className);
458
+ } else {
459
+ element.className.baseVal = (0, import_utils2.cx)(element.className.baseVal, className);
460
+ }
440
461
  const existingDispose = selectedElement.dispose;
441
462
  const classDispose = () => {
442
463
  if (selectedElement.originalState.className) {
443
- element.className = selectedElement.originalState.className;
464
+ if (!(element instanceof SVGElement)) {
465
+ element.className = selectedElement.originalState.className;
466
+ } else {
467
+ element.className.baseVal = selectedElement.originalState.className;
468
+ }
444
469
  }
445
470
  };
446
471
  selectedElement.dispose = () => {
@@ -449,6 +474,11 @@ function MiaodaInspector(props) {
449
474
  existingDispose();
450
475
  }
451
476
  };
477
+ const existingCommit = selectedElement.commit;
478
+ selectedElement.commit = () => {
479
+ existingCommit == null ? void 0 : existingCommit();
480
+ selectedElement.originalState.className = safeClassName(element);
481
+ };
452
482
  }
453
483
  } else if ((0, import_utils2.isIncomingMessage)(data, "EditProps")) {
454
484
  const { elementId, props: _props } = data.data;
@@ -483,6 +513,9 @@ function MiaodaInspector(props) {
483
513
  const { elementId, prop, value } = data.data;
484
514
  const selectedElement = selectedElementMap.get(elementId);
485
515
  if (selectedElement && selectedElement.element) {
516
+ if (!(prop in selectedElement.originalState.iconProps)) {
517
+ selectedElement.originalState.iconProps[prop] = value;
518
+ }
486
519
  if (window.__MIAODA_DEVTOOLS_GLOBAL_HOOK__ && typeof window.__MIAODA_DEVTOOLS_GLOBAL_HOOK__.setIconProps === "function") {
487
520
  window.__MIAODA_DEVTOOLS_GLOBAL_HOOK__.setIconProps(elementId, prop, value);
488
521
  } else {
@@ -496,9 +529,13 @@ function MiaodaInspector(props) {
496
529
  const existingDispose = selectedElement.dispose;
497
530
  const iconDispose = () => {
498
531
  if (window.__MIAODA_DEVTOOLS_GLOBAL_HOOK__ && typeof window.__MIAODA_DEVTOOLS_GLOBAL_HOOK__.setIconProps === "function") {
499
- window.__MIAODA_DEVTOOLS_GLOBAL_HOOK__.setIconProps(elementId, prop, void 0);
532
+ window.__MIAODA_DEVTOOLS_GLOBAL_HOOK__.setIconProps(elementId, prop, selectedElement.originalState.iconProps[prop]);
500
533
  } else if (selectedElement.element) {
501
- selectedElement.element.removeAttribute(`data-${prop}`);
534
+ if (selectedElement.originalState.iconProps[prop]) {
535
+ selectedElement.element.setAttribute(`data-${prop}`, String(selectedElement.originalState.iconProps[prop]));
536
+ } else {
537
+ selectedElement.element.removeAttribute(`data-${prop}`);
538
+ }
502
539
  }
503
540
  };
504
541
  selectedElement.dispose = () => {
@@ -507,11 +544,19 @@ function MiaodaInspector(props) {
507
544
  existingDispose();
508
545
  }
509
546
  };
547
+ const existingCommit = selectedElement.commit;
548
+ selectedElement.commit = () => {
549
+ existingCommit == null ? void 0 : existingCommit();
550
+ selectedElement.originalState.iconProps[prop] = value;
551
+ };
510
552
  }
511
553
  } else if ((0, import_utils2.isIncomingMessage)(data, "ReverseSelect")) {
512
554
  const { elementId } = data.data;
513
555
  const selectedElement = selectedElementMap.get(elementId);
514
556
  if (selectedElement && selectedElement.element) {
557
+ selectedElement.element.scrollIntoView({
558
+ block: "center"
559
+ });
515
560
  updateClickOverlay(selectedElement.element, selectedElement.title, selectedElement.elementId);
516
561
  }
517
562
  } else if ((0, import_utils2.isIncomingMessage)(data, "SelectParent")) {
@@ -554,6 +599,13 @@ function MiaodaInspector(props) {
554
599
  existingDispose();
555
600
  }
556
601
  };
602
+ const existingCommit = selectedElement.commit;
603
+ selectedElement.commit = () => {
604
+ existingCommit == null ? void 0 : existingCommit();
605
+ for (const attr of Object.keys(selectedElement.originalState.attributes)) {
606
+ selectedElement.originalState.attributes[attr] = element.getAttribute(attr);
607
+ }
608
+ };
557
609
  }
558
610
  }
559
611
  },
@@ -588,7 +640,7 @@ function MiaodaInspector(props) {
588
640
  (0, import_utils2.postMessage)({
589
641
  type: "PageMounted",
590
642
  data: {
591
- version: "1.0.1",
643
+ version: "1.0.3",
592
644
  feature: {
593
645
  selectParent: true,
594
646
  reverseSelect: true
@@ -4,6 +4,7 @@ interface CodeInfo {
4
4
  name?: string;
5
5
  lineNumber: string;
6
6
  columnNumber: string;
7
+ sectionType?: string;
7
8
  /**
8
9
  * code source file relative path to dev-server cwd(current working directory)
9
10
  * need use with `react-dev-inspector/plugins/babel`
@@ -37,6 +38,7 @@ interface CodeDataAttribute {
37
38
  'data-miaoda-relative-path': string;
38
39
  'data-miaoda-component-name'?: string;
39
40
  'data-miaoda-metadata'?: string;
41
+ 'data-ai-section-type'?: string;
40
42
  }
41
43
  /**
42
44
  * react fiber property `_debugSource` created by `@babel/plugin-transform-react-jsx-source`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lark-apaas/miaoda-inspector",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "Inspector for Lark Apaas",
5
5
  "sideEffects": [
6
6
  "*.css"