@salesforce/ui-design-mode 12.16.0 → 12.18.0

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.
Files changed (81) hide show
  1. package/dist/authoring/core/DesignPropertyPanelRoot.d.cts +2 -2
  2. package/dist/authoring/core/DesignPropertyPanelRoot.d.ts +2 -2
  3. package/dist/authoring/core/DesignPropertyPanelRoot.d.ts.map +1 -1
  4. package/dist/authoring/core/editors/BoxDimensionEditor.d.cts +20 -34
  5. package/dist/authoring/core/editors/BoxDimensionEditor.d.ts +20 -34
  6. package/dist/authoring/core/editors/BoxDimensionEditor.d.ts.map +1 -1
  7. package/dist/authoring/core/editors/DimensionEditor.d.ts.map +1 -1
  8. package/dist/authoring/core/editors/FieldNotice.d.cts +17 -0
  9. package/dist/authoring/core/editors/FieldNotice.d.ts +17 -0
  10. package/dist/authoring/core/editors/FieldNotice.d.ts.map +1 -0
  11. package/dist/authoring/core/editors/FontFamilyEditor.d.cts +4 -6
  12. package/dist/authoring/core/editors/FontFamilyEditor.d.ts +4 -6
  13. package/dist/authoring/core/editors/FontFamilyEditor.d.ts.map +1 -1
  14. package/dist/authoring/core/editors/FontWeightEditor.d.cts +6 -5
  15. package/dist/authoring/core/editors/FontWeightEditor.d.ts +6 -5
  16. package/dist/authoring/core/editors/FontWeightEditor.d.ts.map +1 -1
  17. package/dist/authoring/core/editors/ImageEditor.d.cts +21 -1
  18. package/dist/authoring/core/editors/ImageEditor.d.ts +21 -1
  19. package/dist/authoring/core/editors/ImageEditor.d.ts.map +1 -1
  20. package/dist/authoring/core/editors/PicklistEditor.d.cts +5 -21
  21. package/dist/authoring/core/editors/PicklistEditor.d.ts +5 -21
  22. package/dist/authoring/core/editors/PicklistEditor.d.ts.map +1 -1
  23. package/dist/authoring/core/history/changeSet.d.cts +28 -5
  24. package/dist/authoring/core/history/changeSet.d.ts +28 -5
  25. package/dist/authoring/core/history/changeSet.d.ts.map +1 -1
  26. package/dist/authoring/core/history/historyService.d.cts +1 -3
  27. package/dist/authoring/core/history/historyService.d.ts +1 -3
  28. package/dist/authoring/core/history/historyService.d.ts.map +1 -1
  29. package/dist/authoring/core/history/iframeCommandExecutor.d.cts +1 -1
  30. package/dist/authoring/core/history/iframeCommandExecutor.d.ts +1 -1
  31. package/dist/authoring/core/labels/labels.d.cts +57 -93
  32. package/dist/authoring/core/labels/labels.d.ts +57 -93
  33. package/dist/authoring/core/labels/labels.d.ts.map +1 -1
  34. package/dist/authoring/core/utils/colorOcclusion.d.cts +4 -20
  35. package/dist/authoring/core/utils/colorOcclusion.d.ts +4 -20
  36. package/dist/authoring/core/utils/colorOcclusion.d.ts.map +1 -1
  37. package/dist/authoring/core/utils/dimensionUtils.d.cts +0 -39
  38. package/dist/authoring/core/utils/dimensionUtils.d.ts +0 -39
  39. package/dist/authoring/core/utils/dimensionUtils.d.ts.map +1 -1
  40. package/dist/authoring/react/index.d.cts +1 -1
  41. package/dist/authoring/react/index.d.ts +1 -1
  42. package/dist/authoring/react/index.d.ts.map +1 -1
  43. package/dist/authoring/react/index.js +4 -4
  44. package/dist/authoring/react/styles.css +1 -1
  45. package/dist/authoring/web-component/index.d.cts +1 -1
  46. package/dist/authoring/web-component/index.d.ts +1 -1
  47. package/dist/authoring/web-component/index.d.ts.map +1 -1
  48. package/dist/authoring/web-component/index.js +157 -137
  49. package/dist/protocol/domAttributes.cjs +4 -0
  50. package/dist/protocol/domAttributes.d.cts +17 -0
  51. package/dist/protocol/domAttributes.d.ts +17 -0
  52. package/dist/protocol/domAttributes.d.ts.map +1 -1
  53. package/dist/protocol/domAttributes.js +4 -0
  54. package/dist/protocol/index.cjs +4 -0
  55. package/dist/protocol/index.js +6 -2
  56. package/dist/protocol/measuredStyleProperties.cjs +18 -0
  57. package/dist/protocol/measuredStyleProperties.d.cts +7 -0
  58. package/dist/protocol/measuredStyleProperties.d.ts +7 -0
  59. package/dist/protocol/measuredStyleProperties.d.ts.map +1 -1
  60. package/dist/protocol/measuredStyleProperties.js +18 -0
  61. package/dist/protocol/messageTypes.d.cts +22 -16
  62. package/dist/protocol/messageTypes.d.ts +22 -16
  63. package/dist/protocol/messageTypes.d.ts.map +1 -1
  64. package/dist/protocol/version.cjs +1 -1
  65. package/dist/protocol/version.js +1 -1
  66. package/dist/runtime/design-mode-interactions.js +142 -84
  67. package/dist/runtime/interactions/communicationManager.d.cts +2 -2
  68. package/dist/runtime/interactions/communicationManager.d.ts +2 -2
  69. package/dist/runtime/interactions/communicationManager.d.ts.map +1 -1
  70. package/dist/runtime/interactions/interactionsController.d.cts +2 -0
  71. package/dist/runtime/interactions/interactionsController.d.ts +2 -0
  72. package/dist/runtime/interactions/interactionsController.d.ts.map +1 -1
  73. package/dist/runtime/interactions/utils/cssUtils.d.cts +3 -7
  74. package/dist/runtime/interactions/utils/cssUtils.d.ts +3 -7
  75. package/dist/runtime/interactions/utils/cssUtils.d.ts.map +1 -1
  76. package/dist/runtime/interactions/utils/sourceUtils.d.cts +1 -1
  77. package/dist/runtime/interactions/utils/sourceUtils.d.ts +1 -1
  78. package/dist/source-locator/react/babel/reactDesignTimeLocatorBabelPlugin.cjs +33 -0
  79. package/dist/source-locator/react/babel/reactDesignTimeLocatorBabelPlugin.d.ts.map +1 -1
  80. package/dist/source-locator/react/babel/reactDesignTimeLocatorBabelPlugin.js +34 -1
  81. package/package.json +1 -1
@@ -26,6 +26,8 @@
26
26
 
27
27
  // src/protocol/domAttributes.ts
28
28
  var ATTR_SOURCE_FILE = "data-source-file";
29
+ var ATTR_SRC_KIND = "data-src-kind";
30
+ var ATTR_ALT_KIND = "data-alt-kind";
29
31
 
30
32
  // src/protocol/editableElementTags.ts
31
33
  var EDITABLE_ELEMENT_TAGS = [
@@ -56,14 +58,30 @@
56
58
  ];
57
59
 
58
60
  // src/protocol/version.ts
59
- var UI_DESIGN_MODE_VERSION = "12.16.0";
61
+ var UI_DESIGN_MODE_VERSION = "12.18.0";
60
62
 
61
63
  // src/protocol/measuredStyleProperties.ts
62
64
  var MEASURED_TYPOGRAPHY_PROPERTIES = /* @__PURE__ */ new Set([
65
+ "fontFamily",
66
+ "fontWeight",
63
67
  "fontSize",
64
68
  "lineHeight",
65
69
  "letterSpacing"
66
70
  ]);
71
+ var BOX_DIMENSION_LONGHANDS = {
72
+ padding: ["paddingTop", "paddingRight", "paddingBottom", "paddingLeft"],
73
+ margin: ["marginTop", "marginRight", "marginBottom", "marginLeft"],
74
+ borderRadius: [
75
+ "borderTopLeftRadius",
76
+ "borderTopRightRadius",
77
+ "borderBottomRightRadius",
78
+ "borderBottomLeftRadius"
79
+ ]
80
+ };
81
+ var MEASURED_BOX_PROPERTIES = /* @__PURE__ */ new Set([
82
+ ...Object.keys(BOX_DIMENSION_LONGHANDS),
83
+ ...Object.values(BOX_DIMENSION_LONGHANDS).flat()
84
+ ]);
67
85
 
68
86
  // src/runtime/interactions/utils/sourceUtils.ts
69
87
  function parseRequiredInt(value) {
@@ -261,13 +279,14 @@
261
279
  let inlineValue = inlineStyle[shorthand] || "";
262
280
  if (!inlineValue) {
263
281
  const iT = inlineStyle[top] || "", iR = inlineStyle[right] || "", iB = inlineStyle[bottom] || "", iL = inlineStyle[left] || "";
264
- if (iT || iR || iB || iL) {
265
- inlineValue = `${iT || "0px"} ${iR || "0px"} ${iB || "0px"} ${iL || "0px"}`;
282
+ if (iT && iR && iB && iL) {
283
+ inlineValue = `${iT} ${iR} ${iB} ${iL}`;
266
284
  }
267
285
  }
286
+ const measured = [top, right, bottom, left].map((side) => computed[side] || "");
268
287
  return {
269
288
  inline: inlineValue,
270
- computed: `${computed[top] || ""} ${computed[right] || ""} ${computed[bottom] || ""} ${computed[left] || ""}`
289
+ computed: measured.every(Boolean) ? measured.join(" ") : ""
271
290
  };
272
291
  };
273
292
  return {
@@ -278,28 +297,15 @@
278
297
  minHeight: prop("minHeight"),
279
298
  maxHeight: prop("maxHeight"),
280
299
  overflow: prop("overflow"),
281
- padding: box("padding", "paddingTop", "paddingRight", "paddingBottom", "paddingLeft"),
282
- margin: box("margin", "marginTop", "marginRight", "marginBottom", "marginLeft"),
300
+ padding: box("padding", ...BOX_DIMENSION_LONGHANDS.padding),
301
+ margin: box("margin", ...BOX_DIMENSION_LONGHANDS.margin),
283
302
  backgroundColor: prop("backgroundColor"),
284
303
  backgroundImage: prop("backgroundImage"),
285
304
  backgroundClip: prop("backgroundClip"),
286
- borderWidth: box(
287
- "borderWidth",
288
- "borderTopWidth",
289
- "borderRightWidth",
290
- "borderBottomWidth",
291
- "borderLeftWidth"
292
- ),
293
305
  borderStyle: prop("borderStyle", "borderTopStyle"),
294
306
  borderColor: prop("borderColor", "borderTopColor"),
295
307
  borderImageSource: prop("borderImageSource"),
296
- borderRadius: box(
297
- "borderRadius",
298
- "borderTopLeftRadius",
299
- "borderTopRightRadius",
300
- "borderBottomRightRadius",
301
- "borderBottomLeftRadius"
302
- ),
308
+ borderRadius: box("borderRadius", ...BOX_DIMENSION_LONGHANDS.borderRadius),
303
309
  color: prop("color"),
304
310
  webkitTextFillColor: prop("webkitTextFillColor"),
305
311
  fontFamily: prop("fontFamily"),
@@ -310,7 +316,10 @@
310
316
  letterSpacing: prop("letterSpacing"),
311
317
  textAlign: prop("textAlign"),
312
318
  textDecoration: prop("textDecoration", "textDecorationLine"),
313
- textTransform: prop("textTransform")
319
+ textTransform: prop("textTransform"),
320
+ ...Object.fromEntries(
321
+ Object.values(BOX_DIMENSION_LONGHANDS).flat().map((side) => [side, prop(side)])
322
+ )
314
323
  };
315
324
  }
316
325
 
@@ -348,14 +357,28 @@
348
357
  }
349
358
 
350
359
  // src/runtime/interactions/communicationManager.ts
360
+ var MEDIA_VALUE_KINDS = [
361
+ "literal",
362
+ "asset-import",
363
+ "unknown"
364
+ ];
365
+ function readMediaValueKind(element, attribute) {
366
+ const kind = element.getAttribute(attribute);
367
+ if (kind == null) return void 0;
368
+ return MEDIA_VALUE_KINDS.includes(kind) ? kind : "unknown";
369
+ }
351
370
  function getMediaInfo(element, styles) {
352
371
  switch (element.tagName) {
353
372
  case "IMG": {
354
373
  const img = element;
374
+ const srcKind = readMediaValueKind(img, ATTR_SRC_KIND);
375
+ const altKind = readMediaValueKind(img, ATTR_ALT_KIND);
355
376
  return {
356
377
  tag: "img",
357
378
  src: img.getAttribute("src") ?? "",
358
- alt: img.getAttribute("alt") ?? ""
379
+ alt: img.getAttribute("alt") ?? "",
380
+ ...srcKind ? { srcKind } : {},
381
+ ...altKind ? { altKind } : {}
359
382
  };
360
383
  }
361
384
  }
@@ -377,7 +400,8 @@
377
400
  const label = getLabelFromSource(element);
378
401
  const styles = getElementStyles(element);
379
402
  const debugSource = getSourceFromDataAttributes(element);
380
- const instanceIndex = debugSource ? findElementsBySourceLocation(debugSource).indexOf(element) : -1;
403
+ const instances = debugSource ? findElementsBySourceLocation(debugSource) : [];
404
+ const instanceIndex = instances.indexOf(element);
381
405
  const textType = element.dataset?.textType ?? "none";
382
406
  const hasNonEditableText = TEXT_TAGS.includes(element.tagName) && (textType === "dynamic" || textType === "mixed");
383
407
  const media = getMediaInfo(element, styles);
@@ -394,7 +418,7 @@
394
418
  ...styles
395
419
  },
396
420
  debugSource,
397
- ...instanceIndex >= 0 ? { instanceIndex } : {},
421
+ ...instanceIndex >= 0 ? { instanceIndex, instanceCount: instances.length } : {},
398
422
  hasNonEditableText,
399
423
  ...media ? { media } : {}
400
424
  }
@@ -1414,6 +1438,11 @@
1414
1438
 
1415
1439
  // src/runtime/interactions/interactionsController.ts
1416
1440
  var MAX_DRIFT_LINE_DELTA = 50;
1441
+ var REMEASURE_TRIGGER_PROPERTIES = /* @__PURE__ */ new Set([
1442
+ "fontFamily",
1443
+ "fontWeight",
1444
+ "fontStyle"
1445
+ ]);
1417
1446
  var mediaAppliers = {
1418
1447
  // Whitelist by construction: this applier reads only the attribute keys
1419
1448
  // valid for <img> and ignores anything else in `attrs`. The map is never
@@ -1435,6 +1464,7 @@
1435
1464
  __publicField(this, "editableManager");
1436
1465
  __publicField(this, "eventHandlers");
1437
1466
  __publicField(this, "interceptOverlay");
1467
+ __publicField(this, "boxRefreshFrame", null);
1438
1468
  this.enabled = enabled;
1439
1469
  this.isActive = false;
1440
1470
  this.componentMatcher = new ComponentMatcher({
@@ -1528,6 +1558,7 @@
1528
1558
  * Disable the design mode interactions
1529
1559
  */
1530
1560
  disable() {
1561
+ this.flushBoxRefresh();
1531
1562
  this.isActive = false;
1532
1563
  this.eventHandlers.clearAll();
1533
1564
  this.interceptOverlay.unmount();
@@ -1603,15 +1634,39 @@
1603
1634
  * the source location is read from the currently selected element.
1604
1635
  */
1605
1636
  applyStyleChange(property, value, sourceLocation) {
1637
+ const name = property.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`).replace(/^webkit-/, "-webkit-");
1606
1638
  for (const el of this.resolveTargets(sourceLocation)) {
1607
- el.style[property] = value;
1639
+ const style = el.style;
1640
+ if (typeof style.setProperty === "function") {
1641
+ const priority = style.getPropertyPriority(name);
1642
+ const sides = Object.hasOwn(BOX_DIMENSION_LONGHANDS, property) ? BOX_DIMENSION_LONGHANDS[property] : void 0;
1643
+ const importantSides = !priority ? sides?.map((side) => side.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`)).filter((side) => style.getPropertyPriority(side) === "important") : void 0;
1644
+ style.setProperty(name, value, priority);
1645
+ for (const side of importantSides ?? []) {
1646
+ const sideValue = style.getPropertyValue(side);
1647
+ if (sideValue) style.setProperty(side, sideValue, "important");
1648
+ }
1649
+ } else {
1650
+ style[property] = value;
1651
+ }
1608
1652
  }
1609
1653
  this.overlayManager.reposition();
1610
- if (value === "" || MEASURED_TYPOGRAPHY_PROPERTIES.has(property)) {
1654
+ if (MEASURED_BOX_PROPERTIES.has(property)) {
1655
+ if (this.boxRefreshFrame === null && this.eventHandlers.getSelectedElement()) {
1656
+ this.boxRefreshFrame = requestAnimationFrame(() => this.flushBoxRefresh());
1657
+ }
1658
+ } else if (value === "" || MEASURED_TYPOGRAPHY_PROPERTIES.has(property) || REMEASURE_TRIGGER_PROPERTIES.has(property)) {
1611
1659
  const selected = this.eventHandlers.getSelectedElement();
1612
1660
  if (selected) this.communicationManager.notifyComponentSelected(selected, true);
1613
1661
  }
1614
1662
  }
1663
+ flushBoxRefresh() {
1664
+ if (this.boxRefreshFrame === null) return;
1665
+ cancelAnimationFrame(this.boxRefreshFrame);
1666
+ this.boxRefreshFrame = null;
1667
+ const selected = this.eventHandlers.getSelectedElement();
1668
+ if (selected) this.communicationManager.notifyComponentSelected(selected, true);
1669
+ }
1615
1670
  applyTextChange(text, sourceLocation) {
1616
1671
  for (const el of this.resolveTargets(sourceLocation)) {
1617
1672
  el.textContent = text;
@@ -1647,6 +1702,7 @@
1647
1702
  * Cleanup and remove event listeners
1648
1703
  */
1649
1704
  destroy() {
1705
+ this.flushBoxRefresh();
1650
1706
  this.interceptOverlay.unmount();
1651
1707
  this.overlayManager.unmountOverlay();
1652
1708
  this.eventHandlers.clearAll();
@@ -1654,68 +1710,70 @@
1654
1710
  };
1655
1711
 
1656
1712
  // src/runtime/interactions/index.ts
1657
- var interactions = new InteractionsController(true);
1658
- if (typeof document !== "undefined") {
1659
- if (document.readyState === "loading") {
1660
- document.addEventListener("DOMContentLoaded", () => {
1713
+ if (typeof window === "undefined" || !window.__uiDesignMode__) {
1714
+ const interactions = new InteractionsController(true);
1715
+ if (typeof document !== "undefined") {
1716
+ if (document.readyState === "loading") {
1717
+ document.addEventListener("DOMContentLoaded", () => {
1718
+ interactions.initialize();
1719
+ });
1720
+ } else {
1661
1721
  interactions.initialize();
1662
- });
1663
- } else {
1664
- interactions.initialize();
1665
- }
1666
- }
1667
- if (typeof window !== "undefined") {
1668
- const win = window;
1669
- win.__uiDesignMode__ = {
1670
- getVersion() {
1671
- return UI_DESIGN_MODE_VERSION;
1672
- }
1673
- };
1674
- window.enableInteractions = function(workspaceRoots = []) {
1675
- interactions.enable(workspaceRoots);
1676
- };
1677
- window.disableInteractions = function() {
1678
- interactions.disable();
1679
- };
1680
- window.addEventListener("message", function(event) {
1681
- const data = event.data;
1682
- const typed = data && typeof data === "object" ? data : null;
1683
- if (typed && typed.type === MSG_STYLE_CHANGE) {
1684
- interactions.applyStyleChange(
1685
- String(typed.property ?? ""),
1686
- String(typed.value ?? ""),
1687
- parseSourceLocation(typed.sourceLocation)
1688
- );
1689
- }
1690
- if (typed && typed.type === MSG_TEXT_CHANGE) {
1691
- interactions.applyTextChange(
1692
- String(typed.text ?? ""),
1693
- parseSourceLocation(typed.sourceLocation)
1694
- );
1695
1722
  }
1696
- if (typed && typed.type === MSG_MEDIA_CHANGE) {
1697
- const tag = typeof typed.tag === "string" ? typed.tag : "";
1698
- const rawAttributes = typed.attributes && typeof typed.attributes === "object" ? typed.attributes : {};
1699
- const attributes = {};
1700
- for (const [key, raw] of Object.entries(rawAttributes)) {
1701
- attributes[key] = raw === void 0 ? void 0 : String(raw);
1723
+ }
1724
+ if (typeof window !== "undefined") {
1725
+ const win = window;
1726
+ win.__uiDesignMode__ = {
1727
+ getVersion() {
1728
+ return UI_DESIGN_MODE_VERSION;
1702
1729
  }
1703
- if (tag) {
1704
- interactions.applyMediaChange(tag, attributes, parseSourceLocation(typed.sourceLocation));
1730
+ };
1731
+ window.enableInteractions = function(workspaceRoots = []) {
1732
+ interactions.enable(workspaceRoots);
1733
+ };
1734
+ window.disableInteractions = function() {
1735
+ interactions.disable();
1736
+ };
1737
+ window.addEventListener("message", function(event) {
1738
+ const data = event.data;
1739
+ const typed = data && typeof data === "object" ? data : null;
1740
+ if (typed && typed.type === MSG_STYLE_CHANGE) {
1741
+ interactions.applyStyleChange(
1742
+ String(typed.property ?? ""),
1743
+ String(typed.value ?? ""),
1744
+ parseSourceLocation(typed.sourceLocation)
1745
+ );
1705
1746
  }
1706
- }
1707
- if (typed && typed.type === MSG_ENABLE_INTERACTIONS) {
1708
- const roots = Array.isArray(typed.workspaceRoots) ? typed.workspaceRoots.filter((r) => typeof r === "string") : [];
1709
- window.enableInteractions?.(roots);
1710
- }
1711
- if (typed && typed.type === MSG_DISABLE_INTERACTIONS) {
1712
- window.disableInteractions?.();
1713
- }
1714
- if (typed && typed.type === MSG_SELECT_ELEMENT) {
1715
- const tag = typeof typed.tag === "string" ? typed.tag : void 0;
1716
- interactions.selectByIdentity(parseSourceLocation(typed.sourceLocation), tag);
1717
- }
1718
- });
1747
+ if (typed && typed.type === MSG_TEXT_CHANGE) {
1748
+ interactions.applyTextChange(
1749
+ String(typed.text ?? ""),
1750
+ parseSourceLocation(typed.sourceLocation)
1751
+ );
1752
+ }
1753
+ if (typed && typed.type === MSG_MEDIA_CHANGE) {
1754
+ const tag = typeof typed.tag === "string" ? typed.tag : "";
1755
+ const rawAttributes = typed.attributes && typeof typed.attributes === "object" ? typed.attributes : {};
1756
+ const attributes = {};
1757
+ for (const [key, raw] of Object.entries(rawAttributes)) {
1758
+ attributes[key] = raw === void 0 ? void 0 : String(raw);
1759
+ }
1760
+ if (tag) {
1761
+ interactions.applyMediaChange(tag, attributes, parseSourceLocation(typed.sourceLocation));
1762
+ }
1763
+ }
1764
+ if (typed && typed.type === MSG_ENABLE_INTERACTIONS) {
1765
+ const roots = Array.isArray(typed.workspaceRoots) ? typed.workspaceRoots.filter((r) => typeof r === "string") : [];
1766
+ window.enableInteractions?.(roots);
1767
+ }
1768
+ if (typed && typed.type === MSG_DISABLE_INTERACTIONS) {
1769
+ window.disableInteractions?.();
1770
+ }
1771
+ if (typed && typed.type === MSG_SELECT_ELEMENT) {
1772
+ const tag = typeof typed.tag === "string" ? typed.tag : void 0;
1773
+ interactions.selectByIdentity(parseSourceLocation(typed.sourceLocation), tag);
1774
+ }
1775
+ });
1776
+ }
1719
1777
  }
1720
1778
  })();
1721
1779
 
@@ -1,10 +1,10 @@
1
- import { MediaInfo } from '../../protocol.cjs';
1
+ import { MediaInfo } from '../../protocol/index.cjs';
2
2
  import { getElementStyles } from './utils/cssUtils.cjs';
3
3
  export type { MediaInfo };
4
4
  /**
5
5
  * Editable media metadata for a selected element, or `undefined` if none (the
6
6
  * caller then omits `media` from the payload):
7
- * 1. `<img>` → `img` variant (raw `src`/`alt`/`width`/`height`).
7
+ * 1. `<img>` → `img` variant (raw `src`/`alt`, plus their source kinds when stamped).
8
8
  * 2. Any other element painting a `background-image` `url()` layer →
9
9
  * `background-image` variant. Read inline-if-set-else-computed, matching the
10
10
  * Background Color editor; gradient-only backgrounds have no `url()`, so none.
@@ -1,10 +1,10 @@
1
- import { MediaInfo } from '../../protocol.js';
1
+ import { MediaInfo } from '../../protocol/index.js';
2
2
  import { getElementStyles } from './utils/cssUtils.js';
3
3
  export type { MediaInfo };
4
4
  /**
5
5
  * Editable media metadata for a selected element, or `undefined` if none (the
6
6
  * caller then omits `media` from the payload):
7
- * 1. `<img>` → `img` variant (raw `src`/`alt`/`width`/`height`).
7
+ * 1. `<img>` → `img` variant (raw `src`/`alt`, plus their source kinds when stamped).
8
8
  * 2. Any other element painting a `background-image` `url()` layer →
9
9
  * `background-image` variant. Read inline-if-set-else-computed, matching the
10
10
  * Background Color editor; gradient-only backgrounds have no `url()`, so none.
@@ -1 +1 @@
1
- {"version":3,"file":"communicationManager.d.ts","sourceRoot":"","sources":["../../../src/runtime/interactions/communicationManager.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAQH,OAAO,EAMN,KAAK,SAAS,EACd,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAcpD,YAAY,EAAE,SAAS,EAAE,CAAC;AAE1B;;;;;;;;;;GAUG;AACH,wBAAgB,YAAY,CAC3B,OAAO,EAAE,WAAW,EACpB,MAAM,CAAC,EAAE,UAAU,CAAC,OAAO,gBAAgB,CAAC,GAC1C,SAAS,GAAG,SAAS,CAkBvB;AAED,qBAAa,oBAAoB;;IAKhC;;;OAGG;IACH,uBAAuB,CAAC,OAAO,EAAE,WAAW,EAAE,YAAY,CAAC,EAAE,OAAO,GAAG,IAAI;IAsD3E;;;;;OAKG;IACH,gBAAgB,CAAC,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI;IAyBnF;;OAEG;IACH,4BAA4B,IAAI,IAAI;CAmBpC"}
1
+ {"version":3,"file":"communicationManager.d.ts","sourceRoot":"","sources":["../../../src/runtime/interactions/communicationManager.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAQH,OAAO,EAQN,KAAK,SAAS,EAEd,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAcpD,YAAY,EAAE,SAAS,EAAE,CAAC;AAkB1B;;;;;;;;;;GAUG;AACH,wBAAgB,YAAY,CAC3B,OAAO,EAAE,WAAW,EACpB,MAAM,CAAC,EAAE,UAAU,CAAC,OAAO,gBAAgB,CAAC,GAC1C,SAAS,GAAG,SAAS,CAsBvB;AAED,qBAAa,oBAAoB;;IAKhC;;;OAGG;IACH,uBAAuB,CAAC,OAAO,EAAE,WAAW,EAAE,YAAY,CAAC,EAAE,OAAO,GAAG,IAAI;IAqD3E;;;;;OAKG;IACH,gBAAgB,CAAC,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI;IAyBnF;;OAEG;IACH,4BAA4B,IAAI,IAAI;CAmBpC"}
@@ -8,6 +8,7 @@ export declare class InteractionsController {
8
8
  private editableManager;
9
9
  private eventHandlers;
10
10
  private interceptOverlay;
11
+ private boxRefreshFrame;
11
12
  constructor(enabled?: boolean);
12
13
  /**
13
14
  * Initialize the design mode interactions
@@ -63,6 +64,7 @@ export declare class InteractionsController {
63
64
  * the source location is read from the currently selected element.
64
65
  */
65
66
  applyStyleChange(property: string, value: string, sourceLocation?: SourceLocation): void;
67
+ private flushBoxRefresh;
66
68
  applyTextChange(text: string, sourceLocation?: SourceLocation): void;
67
69
  /**
68
70
  * Apply attribute changes to all elements at the given source location whose
@@ -8,6 +8,7 @@ export declare class InteractionsController {
8
8
  private editableManager;
9
9
  private eventHandlers;
10
10
  private interceptOverlay;
11
+ private boxRefreshFrame;
11
12
  constructor(enabled?: boolean);
12
13
  /**
13
14
  * Initialize the design mode interactions
@@ -63,6 +64,7 @@ export declare class InteractionsController {
63
64
  * the source location is read from the currently selected element.
64
65
  */
65
66
  applyStyleChange(property: string, value: string, sourceLocation?: SourceLocation): void;
67
+ private flushBoxRefresh;
66
68
  applyTextChange(text: string, sourceLocation?: SourceLocation): void;
67
69
  /**
68
70
  * Apply attribute changes to all elements at the given source location whose
@@ -1 +1 @@
1
- {"version":3,"file":"interactionsController.d.ts","sourceRoot":"","sources":["../../../src/runtime/interactions/interactionsController.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAcH,OAAO,EAIN,KAAK,cAAc,EACnB,MAAM,qBAAqB,CAAC;AA6C7B,qBAAa,sBAAsB;IAClC,OAAO,CAAC,OAAO,CAAU;IACzB,OAAO,CAAC,QAAQ,CAAU;IAE1B,OAAO,CAAC,gBAAgB,CAAmB;IAC3C,OAAO,CAAC,cAAc,CAAiB;IACvC,OAAO,CAAC,oBAAoB,CAAuB;IACnD,OAAO,CAAC,eAAe,CAAkB;IACzC,OAAO,CAAC,aAAa,CAAgB;IACrC,OAAO,CAAC,gBAAgB,CAAmB;gBAE/B,OAAO,UAAO;IA2E1B;;OAEG;IACH,UAAU,IAAI,IAAI;IAalB;;;;OAIG;IACH,MAAM,CAAC,cAAc,GAAE,SAAS,MAAM,EAAO,GAAG,IAAI;IAMpD;;OAEG;IACH,OAAO,IAAI,IAAI;IAMf;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8BG;IACH,gBAAgB,CAAC,cAAc,CAAC,EAAE,cAAc,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO;IAoCxE,OAAO,CAAC,cAAc;IAWtB;;;;;OAKG;IACH,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,cAAc,GAAG,IAAI;IAgBxF,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,cAAc,GAAG,IAAI;IAOpE;;;;;;;;;;;;;;OAcG;IACH,gBAAgB,CACf,GAAG,EAAE,MAAM,EACX,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,EAC9C,cAAc,CAAC,EAAE,cAAc,GAC7B,IAAI;IAWP;;OAEG;IACH,OAAO,IAAI,IAAI;CAKf"}
1
+ {"version":3,"file":"interactionsController.d.ts","sourceRoot":"","sources":["../../../src/runtime/interactions/interactionsController.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAkBH,OAAO,EAIN,KAAK,cAAc,EACnB,MAAM,qBAAqB,CAAC;AAoD7B,qBAAa,sBAAsB;IAClC,OAAO,CAAC,OAAO,CAAU;IACzB,OAAO,CAAC,QAAQ,CAAU;IAE1B,OAAO,CAAC,gBAAgB,CAAmB;IAC3C,OAAO,CAAC,cAAc,CAAiB;IACvC,OAAO,CAAC,oBAAoB,CAAuB;IACnD,OAAO,CAAC,eAAe,CAAkB;IACzC,OAAO,CAAC,aAAa,CAAgB;IACrC,OAAO,CAAC,gBAAgB,CAAmB;IAC3C,OAAO,CAAC,eAAe,CAAuB;gBAElC,OAAO,UAAO;IA2E1B;;OAEG;IACH,UAAU,IAAI,IAAI;IAalB;;;;OAIG;IACH,MAAM,CAAC,cAAc,GAAE,SAAS,MAAM,EAAO,GAAG,IAAI;IAMpD;;OAEG;IACH,OAAO,IAAI,IAAI;IAOf;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8BG;IACH,gBAAgB,CAAC,cAAc,CAAC,EAAE,cAAc,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO;IAoCxE,OAAO,CAAC,cAAc;IAWtB;;;;;OAKG;IACH,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,cAAc,GAAG,IAAI;IAgDxF,OAAO,CAAC,eAAe;IAQvB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,cAAc,GAAG,IAAI;IAOpE;;;;;;;;;;;;;;OAcG;IACH,gBAAgB,CACf,GAAG,EAAE,MAAM,EACX,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,EAC9C,cAAc,CAAC,EAAE,cAAc,GAC7B,IAAI;IAWP;;OAEG;IACH,OAAO,IAAI,IAAI;CAMf"}
@@ -1,8 +1,4 @@
1
- /**
2
- * Copyright (c) 2026, Salesforce, Inc.,
3
- * All rights reserved.
4
- * For full license text, see the LICENSE.txt file
5
- */
1
+ import { BOX_DIMENSION_LONGHANDS } from '../../../protocol/index.cjs';
6
2
  /**
7
3
  * Style value with both inline and computed values.
8
4
  * - inline: the raw value from element.style (what was explicitly set via
@@ -16,7 +12,7 @@ interface StyleValue {
16
12
  /**
17
13
  * Complete element styles snapshot
18
14
  */
19
- interface ElementStyles {
15
+ interface ElementStyles extends Record<BoxLonghand, StyleValue> {
20
16
  width: StyleValue;
21
17
  minWidth: StyleValue;
22
18
  maxWidth: StyleValue;
@@ -40,7 +36,6 @@ interface ElementStyles {
40
36
  * from an unrelated decorative background-image on a text element.
41
37
  */
42
38
  backgroundClip: StyleValue;
43
- borderWidth: StyleValue;
44
39
  borderStyle: StyleValue;
45
40
  borderColor: StyleValue;
46
41
  /**
@@ -70,6 +65,7 @@ interface ElementStyles {
70
65
  textDecoration: StyleValue;
71
66
  textTransform: StyleValue;
72
67
  }
68
+ type BoxLonghand = (typeof BOX_DIMENSION_LONGHANDS)[keyof typeof BOX_DIMENSION_LONGHANDS][number];
73
69
  /**
74
70
  * Get all style values relevant to UI controls for an element.
75
71
  * Each property returns { inline, computed } where inline is the raw
@@ -1,8 +1,4 @@
1
- /**
2
- * Copyright (c) 2026, Salesforce, Inc.,
3
- * All rights reserved.
4
- * For full license text, see the LICENSE.txt file
5
- */
1
+ import { BOX_DIMENSION_LONGHANDS } from '../../../protocol/index.js';
6
2
  /**
7
3
  * Style value with both inline and computed values.
8
4
  * - inline: the raw value from element.style (what was explicitly set via
@@ -16,7 +12,7 @@ interface StyleValue {
16
12
  /**
17
13
  * Complete element styles snapshot
18
14
  */
19
- interface ElementStyles {
15
+ interface ElementStyles extends Record<BoxLonghand, StyleValue> {
20
16
  width: StyleValue;
21
17
  minWidth: StyleValue;
22
18
  maxWidth: StyleValue;
@@ -40,7 +36,6 @@ interface ElementStyles {
40
36
  * from an unrelated decorative background-image on a text element.
41
37
  */
42
38
  backgroundClip: StyleValue;
43
- borderWidth: StyleValue;
44
39
  borderStyle: StyleValue;
45
40
  borderColor: StyleValue;
46
41
  /**
@@ -70,6 +65,7 @@ interface ElementStyles {
70
65
  textDecoration: StyleValue;
71
66
  textTransform: StyleValue;
72
67
  }
68
+ type BoxLonghand = (typeof BOX_DIMENSION_LONGHANDS)[keyof typeof BOX_DIMENSION_LONGHANDS][number];
73
69
  /**
74
70
  * Get all style values relevant to UI controls for an element.
75
71
  * Each property returns { inline, computed } where inline is the raw
@@ -1 +1 @@
1
- {"version":3,"file":"cssUtils.d.ts","sourceRoot":"","sources":["../../../../src/runtime/interactions/utils/cssUtils.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;GAKG;AACH,UAAU,UAAU;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;CACjB;AAID;;GAEG;AACH,UAAU,aAAa;IACtB,KAAK,EAAE,UAAU,CAAC;IAClB,QAAQ,EAAE,UAAU,CAAC;IACrB,QAAQ,EAAE,UAAU,CAAC;IACrB,MAAM,EAAE,UAAU,CAAC;IACnB,SAAS,EAAE,UAAU,CAAC;IACtB,SAAS,EAAE,UAAU,CAAC;IACtB,QAAQ,EAAE,UAAU,CAAC;IACrB,OAAO,EAAE,UAAU,CAAC;IACpB,MAAM,EAAE,UAAU,CAAC;IACnB,eAAe,EAAE,UAAU,CAAC;IAC5B;;;;OAIG;IACH,eAAe,EAAE,UAAU,CAAC;IAC5B;;;;;OAKG;IACH,cAAc,EAAE,UAAU,CAAC;IAC3B,WAAW,EAAE,UAAU,CAAC;IACxB,WAAW,EAAE,UAAU,CAAC;IACxB,WAAW,EAAE,UAAU,CAAC;IACxB;;;;;OAKG;IACH,iBAAiB,EAAE,UAAU,CAAC;IAC9B,YAAY,EAAE,UAAU,CAAC;IACzB,KAAK,EAAE,UAAU,CAAC;IAClB;;;;;;OAMG;IACH,mBAAmB,EAAE,UAAU,CAAC;IAChC,UAAU,EAAE,UAAU,CAAC;IACvB,QAAQ,EAAE,UAAU,CAAC;IACrB,UAAU,EAAE,UAAU,CAAC;IACvB,SAAS,EAAE,UAAU,CAAC;IACtB,UAAU,EAAE,UAAU,CAAC;IACvB,aAAa,EAAE,UAAU,CAAC;IAC1B,SAAS,EAAE,UAAU,CAAC;IACtB,cAAc,EAAE,UAAU,CAAC;IAC3B,aAAa,EAAE,UAAU,CAAC;CAC1B;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAAC,aAAa,CAAC,CAuFhG"}
1
+ {"version":3,"file":"cssUtils.d.ts","sourceRoot":"","sources":["../../../../src/runtime/interactions/utils/cssUtils.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAE5D;;;;;GAKG;AACH,UAAU,UAAU;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;CACjB;AAID;;GAEG;AACH,UAAU,aAAc,SAAQ,MAAM,CAAC,WAAW,EAAE,UAAU,CAAC;IAC9D,KAAK,EAAE,UAAU,CAAC;IAClB,QAAQ,EAAE,UAAU,CAAC;IACrB,QAAQ,EAAE,UAAU,CAAC;IACrB,MAAM,EAAE,UAAU,CAAC;IACnB,SAAS,EAAE,UAAU,CAAC;IACtB,SAAS,EAAE,UAAU,CAAC;IACtB,QAAQ,EAAE,UAAU,CAAC;IACrB,OAAO,EAAE,UAAU,CAAC;IACpB,MAAM,EAAE,UAAU,CAAC;IACnB,eAAe,EAAE,UAAU,CAAC;IAC5B;;;;OAIG;IACH,eAAe,EAAE,UAAU,CAAC;IAC5B;;;;;OAKG;IACH,cAAc,EAAE,UAAU,CAAC;IAC3B,WAAW,EAAE,UAAU,CAAC;IACxB,WAAW,EAAE,UAAU,CAAC;IACxB;;;;;OAKG;IACH,iBAAiB,EAAE,UAAU,CAAC;IAC9B,YAAY,EAAE,UAAU,CAAC;IACzB,KAAK,EAAE,UAAU,CAAC;IAClB;;;;;;OAMG;IACH,mBAAmB,EAAE,UAAU,CAAC;IAChC,UAAU,EAAE,UAAU,CAAC;IACvB,QAAQ,EAAE,UAAU,CAAC;IACrB,UAAU,EAAE,UAAU,CAAC;IACvB,SAAS,EAAE,UAAU,CAAC;IACtB,UAAU,EAAE,UAAU,CAAC;IACvB,aAAa,EAAE,UAAU,CAAC;IAC1B,SAAS,EAAE,UAAU,CAAC;IACtB,cAAc,EAAE,UAAU,CAAC;IAC3B,aAAa,EAAE,UAAU,CAAC;CAC1B;AAED,KAAK,WAAW,GAAG,CAAC,OAAO,uBAAuB,CAAC,CAAC,MAAM,OAAO,uBAAuB,CAAC,CAAC,MAAM,CAAC,CAAC;AAElG;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAAC,aAAa,CAAC,CAgFhG"}
@@ -1,4 +1,4 @@
1
- import { SourceLocation } from '../../../protocol.cjs';
1
+ import { SourceLocation } from '../../../protocol/index.cjs';
2
2
  export type { SourceLocation };
3
3
  /**
4
4
  * Extract source location information from data attributes.
@@ -1,4 +1,4 @@
1
- import { SourceLocation } from '../../../protocol.js';
1
+ import { SourceLocation } from '../../../protocol/index.js';
2
2
  export type { SourceLocation };
3
3
  /**
4
4
  * Extract source location information from data attributes.
@@ -2,6 +2,8 @@
2
2
  Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
3
  const helperPluginUtils = require("@babel/helper-plugin-utils");
4
4
  const domAttributes = require("../../../protocol/domAttributes.cjs");
5
+ require("../../../protocol/measuredStyleProperties.cjs");
6
+ const IMAGE_MODULE_RE = /\.(?:png|jpe?g|gif|svg|webp|avif|ico|bmp)(?:\?.*)?$/i;
5
7
  function resolveColumn(loc, babelCode, originalSource) {
6
8
  if (!originalSource || !babelCode) return loc.column;
7
9
  const babelLine = babelCode.split("\n")[loc.line - 1];
@@ -32,6 +34,31 @@ const reactDesignTimeLocatorBabelPlugin = helperPluginUtils.declare((api) => {
32
34
  return t.isJSXAttribute(attr) && t.isJSXIdentifier(attr.name) && attr.name.name === name;
33
35
  });
34
36
  }
37
+ function isStringValue(value) {
38
+ if (t.isStringLiteral(value)) return true;
39
+ if (!t.isJSXExpressionContainer(value)) return false;
40
+ const expr = value.expression;
41
+ return t.isStringLiteral(expr) || t.isTemplateLiteral(expr) && expr.expressions.length === 0;
42
+ }
43
+ function isImageAssetImport(path, value) {
44
+ if (!t.isJSXExpressionContainer(value) || !t.isIdentifier(value.expression)) return false;
45
+ const binding = path.scope.getBinding(value.expression.name);
46
+ return binding?.kind === "module" && t.isImportDefaultSpecifier(binding.path.node) && IMAGE_MODULE_RE.test(binding.path.parent.source.value);
47
+ }
48
+ function classifyMediaAttr(path, openingElement, name, allowAssetImport) {
49
+ const attrs = openingElement.attributes;
50
+ const index = attrs.findIndex(
51
+ (attr2) => t.isJSXAttribute(attr2) && t.isJSXIdentifier(attr2.name, { name })
52
+ );
53
+ if (attrs.slice(index + 1).some((attr2) => t.isJSXSpreadAttribute(attr2))) {
54
+ return "unknown";
55
+ }
56
+ const attr = attrs[index];
57
+ if (!attr) return "literal";
58
+ if (isStringValue(attr.value)) return "literal";
59
+ if (allowAssetImport && isImageAssetImport(path, attr.value)) return "asset-import";
60
+ return "unknown";
61
+ }
35
62
  function addAttr(openingElement, name, value) {
36
63
  if (hasAttr(openingElement, name)) return;
37
64
  openingElement.attributes.push(
@@ -83,6 +110,12 @@ const reactDesignTimeLocatorBabelPlugin = helperPluginUtils.declare((api) => {
83
110
  addAttr(openingElement, domAttributes.ATTR_SOURCE_FILE, source);
84
111
  }
85
112
  addAttr(openingElement, domAttributes.ATTR_TEXT_TYPE, textType);
113
+ if (t.isJSXIdentifier(openingElement.name, { name: "img" })) {
114
+ const srcKind = classifyMediaAttr(path, openingElement, "src", true);
115
+ const altKind = classifyMediaAttr(path, openingElement, "alt", false);
116
+ addAttr(openingElement, domAttributes.ATTR_SRC_KIND, srcKind);
117
+ addAttr(openingElement, domAttributes.ATTR_ALT_KIND, altKind);
118
+ }
86
119
  }
87
120
  }
88
121
  };
@@ -1 +1 @@
1
- {"version":3,"file":"reactDesignTimeLocatorBabelPlugin.d.ts","sourceRoot":"","sources":["../../../../src/source-locator/react/babel/reactDesignTimeLocatorBabelPlugin.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AA6CH,QAAA,MAAM,iCAAiC;;;iEAiCnB,GAAG,SAAS,GAAG;;CA0EjC,CAAC;AAEH,eAAe,iCAAiC,CAAC"}
1
+ {"version":3,"file":"reactDesignTimeLocatorBabelPlugin.d.ts","sourceRoot":"","sources":["../../../../src/source-locator/react/babel/reactDesignTimeLocatorBabelPlugin.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AA2DH,QAAA,MAAM,iCAAiC;;;iEA6EnB,GAAG,SAAS,GAAG;;CAoFjC,CAAC;AAEH,eAAe,iCAAiC,CAAC"}
@@ -1,5 +1,7 @@
1
1
  import { declare } from "@babel/helper-plugin-utils";
2
- import { ATTR_SOURCE_FILE, ATTR_TEXT_TYPE } from "../../../protocol/domAttributes.js";
2
+ import { ATTR_SOURCE_FILE, ATTR_TEXT_TYPE, ATTR_SRC_KIND, ATTR_ALT_KIND } from "../../../protocol/domAttributes.js";
3
+ import "../../../protocol/measuredStyleProperties.js";
4
+ const IMAGE_MODULE_RE = /\.(?:png|jpe?g|gif|svg|webp|avif|ico|bmp)(?:\?.*)?$/i;
3
5
  function resolveColumn(loc, babelCode, originalSource) {
4
6
  if (!originalSource || !babelCode) return loc.column;
5
7
  const babelLine = babelCode.split("\n")[loc.line - 1];
@@ -30,6 +32,31 @@ const reactDesignTimeLocatorBabelPlugin = declare((api) => {
30
32
  return t.isJSXAttribute(attr) && t.isJSXIdentifier(attr.name) && attr.name.name === name;
31
33
  });
32
34
  }
35
+ function isStringValue(value) {
36
+ if (t.isStringLiteral(value)) return true;
37
+ if (!t.isJSXExpressionContainer(value)) return false;
38
+ const expr = value.expression;
39
+ return t.isStringLiteral(expr) || t.isTemplateLiteral(expr) && expr.expressions.length === 0;
40
+ }
41
+ function isImageAssetImport(path, value) {
42
+ if (!t.isJSXExpressionContainer(value) || !t.isIdentifier(value.expression)) return false;
43
+ const binding = path.scope.getBinding(value.expression.name);
44
+ return binding?.kind === "module" && t.isImportDefaultSpecifier(binding.path.node) && IMAGE_MODULE_RE.test(binding.path.parent.source.value);
45
+ }
46
+ function classifyMediaAttr(path, openingElement, name, allowAssetImport) {
47
+ const attrs = openingElement.attributes;
48
+ const index = attrs.findIndex(
49
+ (attr2) => t.isJSXAttribute(attr2) && t.isJSXIdentifier(attr2.name, { name })
50
+ );
51
+ if (attrs.slice(index + 1).some((attr2) => t.isJSXSpreadAttribute(attr2))) {
52
+ return "unknown";
53
+ }
54
+ const attr = attrs[index];
55
+ if (!attr) return "literal";
56
+ if (isStringValue(attr.value)) return "literal";
57
+ if (allowAssetImport && isImageAssetImport(path, attr.value)) return "asset-import";
58
+ return "unknown";
59
+ }
33
60
  function addAttr(openingElement, name, value) {
34
61
  if (hasAttr(openingElement, name)) return;
35
62
  openingElement.attributes.push(
@@ -81,6 +108,12 @@ const reactDesignTimeLocatorBabelPlugin = declare((api) => {
81
108
  addAttr(openingElement, ATTR_SOURCE_FILE, source);
82
109
  }
83
110
  addAttr(openingElement, ATTR_TEXT_TYPE, textType);
111
+ if (t.isJSXIdentifier(openingElement.name, { name: "img" })) {
112
+ const srcKind = classifyMediaAttr(path, openingElement, "src", true);
113
+ const altKind = classifyMediaAttr(path, openingElement, "alt", false);
114
+ addAttr(openingElement, ATTR_SRC_KIND, srcKind);
115
+ addAttr(openingElement, ATTR_ALT_KIND, altKind);
116
+ }
84
117
  }
85
118
  }
86
119
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@salesforce/ui-design-mode",
3
3
  "description": "Hybrid editor (design-mode) authoring UI, iframe runtime, source-locator, and protocol for Salesforce UI Bundles",
4
- "version": "12.16.0",
4
+ "version": "12.18.0",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "type": "module",
7
7
  "exports": {