@salesforce/ui-design-mode 11.43.2 → 11.44.1

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.
@@ -45,6 +45,15 @@ export interface StyleChangeMessage {
45
45
  property: string;
46
46
  value: string;
47
47
  sourceLocation?: SourceLocation;
48
+ /**
49
+ * True when this change is an undo/redo replay rather than a live edit.
50
+ * `sourceLocation` alone can't carry this distinction: a live edit is stamped
51
+ * with the source of the component it was made for too (W-23560967), so both
52
+ * paths can carry a `sourceLocation`. The runtime uses this flag — not
53
+ * `sourceLocation` presence — to decide whether a clear should re-notify the
54
+ * panel for a re-measure (see `applyStyleChange` in interactionsController.ts).
55
+ */
56
+ isReplay?: boolean;
48
57
  }
49
58
  export interface TextChangeMessage {
50
59
  type: "text-change";
@@ -45,6 +45,15 @@ export interface StyleChangeMessage {
45
45
  property: string;
46
46
  value: string;
47
47
  sourceLocation?: SourceLocation;
48
+ /**
49
+ * True when this change is an undo/redo replay rather than a live edit.
50
+ * `sourceLocation` alone can't carry this distinction: a live edit is stamped
51
+ * with the source of the component it was made for too (W-23560967), so both
52
+ * paths can carry a `sourceLocation`. The runtime uses this flag — not
53
+ * `sourceLocation` presence — to decide whether a clear should re-notify the
54
+ * panel for a re-measure (see `applyStyleChange` in interactionsController.ts).
55
+ */
56
+ isReplay?: boolean;
48
57
  }
49
58
  export interface TextChangeMessage {
50
59
  type: "text-change";
@@ -1 +1 @@
1
- {"version":3,"file":"messageTypes.d.ts","sourceRoot":"","sources":["../../src/protocol/messageTypes.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;GASG;AAEH;;;;;;;;GAQG;AACH,MAAM,WAAW,cAAc;IAC9B,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;CACrB;AAID,MAAM,WAAW,yBAAyB;IACzC,IAAI,EAAE,qBAAqB,CAAC;IAC5B;;;;;OA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M,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC;IAC7C,WAAW,CAAC,EAAE,cAAc,CAAC;IAC7B,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,KAAK,CAAC,EAAE,SAAS,CAAC;CAClB;AAED,MAAM,WAAW,UAAU;IAC1B,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,cAAc,CAAC;IAC7B,aAAa,CAAC,EAAE,MAAM,CAAC;CACvB;AAID,eAAO,MAAM,uBAAuB,EAAG,qBAA8B,CAAC;AACtE,eAAO,MAAM,wBAAwB,EAAG,sBAA+B,CAAC;AACxE,eAAO,MAAM,gBAAgB,EAAG,cAAuB,CAAC;AACxD,eAAO,MAAM,eAAe,EAAG,aAAsB,CAAC;AACtD,eAAO,MAAM,gBAAgB,EAAG,cAAuB,CAAC;AACxD,eAAO,MAAM,kBAAkB,EAAG,gBAAyB,CAAC;AAC5D,eAAO,MAAM,4BAA4B,EAAG,0BAAmC,CAAC;AAChF,eAAO,MAAM,sBAAsB,EAAG,oBAA6B,CAAC;AACpE,eAAO,MAAM,gBAAgB,EAAG,cAAuB,CAAC;AAIxD;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,EAAG,gBAAyB,CAAC"}
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const UI_DESIGN_MODE_VERSION = "11.43.2";
3
+ const UI_DESIGN_MODE_VERSION = "11.44.1";
4
4
  exports.UI_DESIGN_MODE_VERSION = UI_DESIGN_MODE_VERSION;
@@ -1,4 +1,4 @@
1
- const UI_DESIGN_MODE_VERSION = "11.43.2";
1
+ const UI_DESIGN_MODE_VERSION = "11.44.1";
2
2
  export {
3
3
  UI_DESIGN_MODE_VERSION
4
4
  };
@@ -44,7 +44,7 @@
44
44
  ];
45
45
 
46
46
  // src/protocol/version.ts
47
- var UI_DESIGN_MODE_VERSION = "11.43.2";
47
+ var UI_DESIGN_MODE_VERSION = "11.44.1";
48
48
 
49
49
  // src/runtime/interactions/utils/sourceUtils.ts
50
50
  function parseRequiredInt(value) {
@@ -565,6 +565,25 @@
565
565
  * In design mode the app is inspected, not driven; selection still happens on
566
566
  * `click`. Exception: events inside the element being inline-text-edited pass
567
567
  * through so the caret can be placed.
568
+ *
569
+ * Deliberately does NOT call `preventDefault()`. `stopPropagation` +
570
+ * `stopImmediatePropagation` are what keep the app from reacting; `preventDefault`
571
+ * additionally cancelled two *browser* default actions we do want:
572
+ *
573
+ * 1. The focus shift. In an embedded preview that is cross-document: a text
574
+ * field focused in the HOST panel never blurs, so the panel — which commits
575
+ * a typed draft on blur — silently discards the user's edit when they click
576
+ * another element in the canvas (W-23560967). Keyboard Tab/Enter still worked,
577
+ * because focus movement by keyboard is not a mousedown default action, which
578
+ * is exactly what made the bug look arbitrary.
579
+ * 2. Text-selection drag. That one we still want suppressed, so it is handled by
580
+ * a `user-select: none` rule the controller installs while interactions are
581
+ * active (exempting `[contenteditable="true"]` so inline text editing keeps
582
+ * its caret and selection). CSS is the right tool: it suppresses the drag
583
+ * without also cancelling focus.
584
+ *
585
+ * Note `preventDefault` on `pointerdown` ALONE also cancels the focus shift, so
586
+ * dropping it only for `mousedown` would not have fixed this.
568
587
  */
569
588
  handlePointerDown(e) {
570
589
  if (!this.isInteractionsActive()) {
@@ -574,7 +593,6 @@
574
593
  if (target.isContentEditable) {
575
594
  return;
576
595
  }
577
- e.preventDefault();
578
596
  e.stopPropagation();
579
597
  e.stopImmediatePropagation?.();
580
598
  }
@@ -682,12 +700,15 @@
682
700
  };
683
701
 
684
702
  // src/runtime/interactions/overlayManager.ts
685
- var BORDER_WIDTH = 2;
686
703
  var TAB_HEIGHT_ESTIMATE = 18;
687
704
  var OVERLAY_Z_INDEX = 2147483647;
688
- var COLOR_HOVER = "#005a9e";
689
- var COLOR_SELECTED = "#c2410c";
690
- var BORDER_INSET = BORDER_WIDTH / 2;
705
+ var COLOR_ACCENT = "#2864f6";
706
+ var COLOR_HOVER_FILL = "rgba(40, 100, 246, 0.08)";
707
+ var BORDER_WIDTH = { hover: 1, selected: 2 };
708
+ var BORDER_INSET = {
709
+ hover: 0,
710
+ selected: Math.round(BORDER_WIDTH.selected / 2)
711
+ };
691
712
  var raf = typeof requestAnimationFrame === "function" ? (cb) => requestAnimationFrame(cb) : (cb) => setTimeout(cb, 16);
692
713
  var OverlayManager = class {
693
714
  constructor() {
@@ -752,8 +773,8 @@
752
773
  pointer-events: none;
753
774
  z-index: ${OVERLAY_Z_INDEX};
754
775
  }
755
- .design-mode-box.hover { border: ${BORDER_WIDTH}px solid ${COLOR_HOVER}; }
756
- .design-mode-box.selected { border: ${BORDER_WIDTH}px solid ${COLOR_SELECTED}; }
776
+ .design-mode-box.hover { border: ${BORDER_WIDTH.hover}px solid ${COLOR_ACCENT}; background: ${COLOR_HOVER_FILL}; }
777
+ .design-mode-box.selected { border: ${BORDER_WIDTH.selected}px solid ${COLOR_ACCENT}; }
757
778
  .design-mode-tab {
758
779
  position: fixed;
759
780
  pointer-events: none;
@@ -766,8 +787,8 @@
766
787
  padding: 2px 6px;
767
788
  color: #fff;
768
789
  }
769
- .design-mode-tab.hover { background: ${COLOR_HOVER}; }
770
- .design-mode-tab.selected { background: ${COLOR_SELECTED}; }
790
+ .design-mode-tab.hover { background: ${COLOR_ACCENT}; }
791
+ .design-mode-tab.selected { background: ${COLOR_ACCENT}; }
771
792
  `;
772
793
  }
773
794
  /**
@@ -811,8 +832,8 @@
811
832
  this.shadow.appendChild(box);
812
833
  this.shadow.appendChild(tab);
813
834
  layer.entries.set(el, { box, tab });
814
- this._positionBox(box, el);
815
- this._positionTab(tab, el);
835
+ this._positionBox(box, el, kind);
836
+ this._positionTab(tab, el, kind);
816
837
  }
817
838
  }
818
839
  _clearLayer(layer) {
@@ -874,34 +895,36 @@
874
895
  toJSON: () => ({})
875
896
  };
876
897
  }
877
- _positionBox(box, el) {
898
+ _positionBox(box, el, kind) {
878
899
  const rect = this._visibleRect(el);
879
900
  if (this._isOffscreen(rect)) {
880
901
  box.style.display = "none";
881
902
  return;
882
903
  }
904
+ const inset = BORDER_INSET[kind];
883
905
  box.style.display = "";
884
- box.style.top = `${rect.top - BORDER_INSET}px`;
885
- box.style.left = `${rect.left - BORDER_INSET}px`;
886
- box.style.width = `${rect.width + BORDER_INSET * 2}px`;
887
- box.style.height = `${rect.height + BORDER_INSET * 2}px`;
906
+ box.style.top = `${rect.top - inset}px`;
907
+ box.style.left = `${rect.left - inset}px`;
908
+ box.style.width = `${rect.width + inset * 2}px`;
909
+ box.style.height = `${rect.height + inset * 2}px`;
888
910
  }
889
- _positionTab(tab, el) {
911
+ _positionTab(tab, el, kind) {
890
912
  const rect = this._visibleRect(el);
891
913
  if (this._isOffscreen(rect)) {
892
914
  tab.style.display = "none";
893
915
  return;
894
916
  }
917
+ const inset = BORDER_INSET[kind];
895
918
  tab.style.display = "";
896
919
  const tabHeight = tab.offsetHeight || TAB_HEIGHT_ESTIMATE;
897
- const topAbove = rect.top - BORDER_INSET - tabHeight;
920
+ const topAbove = rect.top - inset - tabHeight;
898
921
  const flipBelow = topAbove < 0;
899
- tab.style.top = flipBelow ? `${rect.bottom + BORDER_INSET}px` : `${topAbove}px`;
922
+ tab.style.top = flipBelow ? `${rect.bottom + inset}px` : `${topAbove}px`;
900
923
  tab.style.borderRadius = flipBelow ? "0 0 2px 2px" : "2px 2px 0 0";
901
924
  const tabWidth = tab.offsetWidth;
902
- const leftAligned = rect.left - BORDER_INSET;
925
+ const leftAligned = rect.left - inset;
903
926
  if (tabWidth > 0 && leftAligned + tabWidth > window.innerWidth) {
904
- tab.style.left = `${rect.right + BORDER_INSET - tabWidth}px`;
927
+ tab.style.left = `${rect.right + inset - tabWidth}px`;
905
928
  } else {
906
929
  tab.style.left = `${leftAligned}px`;
907
930
  }
@@ -925,10 +948,14 @@
925
948
  });
926
949
  }
927
950
  _reposition() {
928
- for (const layer of [this.hover, this.selected]) {
951
+ const layers = [
952
+ [this.hover, "hover"],
953
+ [this.selected, "selected"]
954
+ ];
955
+ for (const [layer, kind] of layers) {
929
956
  for (const [el, { box, tab }] of layer.entries) {
930
- this._positionBox(box, el);
931
- this._positionTab(tab, el);
957
+ this._positionBox(box, el, kind);
958
+ this._positionTab(tab, el, kind);
932
959
  }
933
960
  }
934
961
  }
@@ -936,6 +963,9 @@
936
963
 
937
964
  // src/runtime/interactions/interactionsController.ts
938
965
  var MAX_DRIFT_LINE_DELTA = 50;
966
+ var SELECT_SUPPRESS_STYLE_ID = "sfdc-design-mode-select-suppress";
967
+ var SELECT_SUPPRESS_CSS = `:root{-webkit-user-select:none;user-select:none;}
968
+ [contenteditable="true"],[contenteditable="true"] *{-webkit-user-select:text;user-select:text;}`;
939
969
  var mediaAppliers = {
940
970
  // Whitelist by construction: this applier reads only the attribute keys
941
971
  // valid for <img> and ignores anything else in `attrs`. The map is never
@@ -1040,6 +1070,7 @@
1040
1070
  enable(workspaceRoots = []) {
1041
1071
  this.componentMatcher.setWorkspaceRoots(workspaceRoots);
1042
1072
  this.isActive = true;
1073
+ this._mountSelectSuppression();
1043
1074
  }
1044
1075
  /**
1045
1076
  * Disable the design mode interactions
@@ -1047,6 +1078,25 @@
1047
1078
  disable() {
1048
1079
  this.isActive = false;
1049
1080
  this.eventHandlers.clearAll();
1081
+ this._unmountSelectSuppression();
1082
+ }
1083
+ /**
1084
+ * Install the text-selection suppression sheet (idempotent). Tied to
1085
+ * enable/disable rather than initialize/destroy so the previewed app selects
1086
+ * text normally whenever design mode is off.
1087
+ */
1088
+ _mountSelectSuppression() {
1089
+ if (typeof document === "undefined") return;
1090
+ if (document.getElementById(SELECT_SUPPRESS_STYLE_ID)) return;
1091
+ const style = document.createElement("style");
1092
+ style.id = SELECT_SUPPRESS_STYLE_ID;
1093
+ style.textContent = SELECT_SUPPRESS_CSS;
1094
+ document.head.appendChild(style);
1095
+ }
1096
+ /** Remove the suppression sheet so text is selectable again outside design mode. */
1097
+ _unmountSelectSuppression() {
1098
+ if (typeof document === "undefined") return;
1099
+ document.getElementById(SELECT_SUPPRESS_STYLE_ID)?.remove();
1050
1100
  }
1051
1101
  /**
1052
1102
  * Programmatically select an element by source identity — the runtime side of
@@ -1114,15 +1164,16 @@
1114
1164
  }
1115
1165
  /**
1116
1166
  * Apply a style change to all elements at the given source location.
1117
- * When sourceLocation is provided (undo/redo), it is used directly.
1118
- * Otherwise the source location is read from the currently selected element.
1167
+ * `sourceLocation`, when provided, is used directly (both a stamped live
1168
+ * edit and an undo/redo replay carry one — see `isReplay` below). Otherwise
1169
+ * the source location is read from the currently selected element.
1119
1170
  */
1120
- applyStyleChange(property, value, sourceLocation) {
1171
+ applyStyleChange(property, value, sourceLocation, isReplay) {
1121
1172
  for (const el of this.resolveTargets(sourceLocation)) {
1122
1173
  el.style[property] = value;
1123
1174
  }
1124
1175
  this.overlayManager.reposition();
1125
- if (value === "" && !sourceLocation) {
1176
+ if (value === "" && !isReplay) {
1126
1177
  const selected = this.eventHandlers.getSelectedElement();
1127
1178
  if (selected) this.communicationManager.notifyComponentSelected(selected);
1128
1179
  }
@@ -1204,7 +1255,8 @@
1204
1255
  interactions.applyStyleChange(
1205
1256
  String(typed.property ?? ""),
1206
1257
  String(typed.value ?? ""),
1207
- parseSourceLocation(typed.sourceLocation)
1258
+ parseSourceLocation(typed.sourceLocation),
1259
+ typed.isReplay === true
1208
1260
  );
1209
1261
  }
1210
1262
  if (typed && typed.type === MSG_TEXT_CHANGE) {
@@ -35,6 +35,25 @@ export declare class EventHandlers {
35
35
  * In design mode the app is inspected, not driven; selection still happens on
36
36
  * `click`. Exception: events inside the element being inline-text-edited pass
37
37
  * through so the caret can be placed.
38
+ *
39
+ * Deliberately does NOT call `preventDefault()`. `stopPropagation` +
40
+ * `stopImmediatePropagation` are what keep the app from reacting; `preventDefault`
41
+ * additionally cancelled two *browser* default actions we do want:
42
+ *
43
+ * 1. The focus shift. In an embedded preview that is cross-document: a text
44
+ * field focused in the HOST panel never blurs, so the panel — which commits
45
+ * a typed draft on blur — silently discards the user's edit when they click
46
+ * another element in the canvas (W-23560967). Keyboard Tab/Enter still worked,
47
+ * because focus movement by keyboard is not a mousedown default action, which
48
+ * is exactly what made the bug look arbitrary.
49
+ * 2. Text-selection drag. That one we still want suppressed, so it is handled by
50
+ * a `user-select: none` rule the controller installs while interactions are
51
+ * active (exempting `[contenteditable="true"]` so inline text editing keeps
52
+ * its caret and selection). CSS is the right tool: it suppresses the drag
53
+ * without also cancelling focus.
54
+ *
55
+ * Note `preventDefault` on `pointerdown` ALONE also cancels the focus shift, so
56
+ * dropping it only for `mousedown` would not have fixed this.
38
57
  */
39
58
  handlePointerDown(e: Event): void;
40
59
  private _findHighlightableElement;
@@ -35,6 +35,25 @@ export declare class EventHandlers {
35
35
  * In design mode the app is inspected, not driven; selection still happens on
36
36
  * `click`. Exception: events inside the element being inline-text-edited pass
37
37
  * through so the caret can be placed.
38
+ *
39
+ * Deliberately does NOT call `preventDefault()`. `stopPropagation` +
40
+ * `stopImmediatePropagation` are what keep the app from reacting; `preventDefault`
41
+ * additionally cancelled two *browser* default actions we do want:
42
+ *
43
+ * 1. The focus shift. In an embedded preview that is cross-document: a text
44
+ * field focused in the HOST panel never blurs, so the panel — which commits
45
+ * a typed draft on blur — silently discards the user's edit when they click
46
+ * another element in the canvas (W-23560967). Keyboard Tab/Enter still worked,
47
+ * because focus movement by keyboard is not a mousedown default action, which
48
+ * is exactly what made the bug look arbitrary.
49
+ * 2. Text-selection drag. That one we still want suppressed, so it is handled by
50
+ * a `user-select: none` rule the controller installs while interactions are
51
+ * active (exempting `[contenteditable="true"]` so inline text editing keeps
52
+ * its caret and selection). CSS is the right tool: it suppresses the drag
53
+ * without also cancelling focus.
54
+ *
55
+ * Note `preventDefault` on `pointerdown` ALONE also cancels the focus shift, so
56
+ * dropping it only for `mousedown` would not have fixed this.
38
57
  */
39
58
  handlePointerDown(e: Event): void;
40
59
  private _findHighlightableElement;
@@ -1 +1 @@
1
- {"version":3,"file":"eventHandlers.d.ts","sourceRoot":"","sources":["../../../src/runtime/interactions/eventHandlers.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AASH,UAAU,oBAAoB;IAC7B,wBAAwB,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,WAAW,GAAG,IAAI,CAAC;CACtE;AAED,UAAU,kBAAkB;IAC3B,iBAAiB,EAAE,CAAC,QAAQ,EAAE,WAAW,EAAE,KAAK,IAAI,CAAC;IACrD,mBAAmB,EAAE,MAAM,IAAI,CAAC;IAChC,cAAc,EAAE,CAAC,QAAQ,EAAE,WAAW,EAAE,KAAK,IAAI,CAAC;IAClD,gBAAgB,EAAE,MAAM,IAAI,CAAC;CAC7B;AAED,UAAU,mBAAmB;IAC5B,kBAAkB,EAAE,CAAC,OAAO,EAAE,WAAW,KAAK,IAAI,CAAC;IACnD,cAAc,EAAE,CAAC,OAAO,EAAE,WAAW,KAAK,IAAI,CAAC;CAC/C;AAED,UAAU,wBAAwB;IACjC,uBAAuB,EAAE,CAAC,OAAO,EAAE,WAAW,KAAK,IAAI,CAAC;CACxD;AAED,qBAAa,aAAa;IACzB,OAAO,CAAC,oBAAoB,CAAgB;IAC5C,OAAO,CAAC,gBAAgB,CAAuB;IAC/C,OAAO,CAAC,cAAc,CAAqB;IAC3C,OAAO,CAAC,eAAe,CAAsB;IAC7C,OAAO,CAAC,oBAAoB,CAA2B;IAEvD,OAAO,CAAC,0BAA0B,CAAgB;IAClD,OAAO,CAAC,eAAe,CAAqB;IAC5C,OAAO,CAAC,gBAAgB,CAAgB;gBAGvC,oBAAoB,EAAE,MAAM,OAAO,EACnC,gBAAgB,EAAE,oBAAoB,EACtC,cAAc,EAAE,kBAAkB,EAClC,eAAe,EAAE,mBAAmB,EACpC,oBAAoB,EAAE,wBAAwB;IAmB/C;;;;;;OAMG;IACH,iBAAiB,C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BAAoB,CAA2B;IAEvD,OAAO,CAAC,0BAA0B,CAAgB;IAClD,OAAO,CAAC,eAAe,CAAqB;IAC5C,OAAO,CAAC,gBAAgB,CAAgB;gBAGvC,oBAAoB,EAAE,MAAM,OAAO,EACnC,gBAAgB,EAAE,oBAAoB,EACtC,cAAc,EAAE,kBAAkB,EAClC,eAAe,EAAE,mBAAmB,EACpC,oBAAoB,EAAE,wBAAwB;IAmB/C;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACH,iBAAiB,CAAC,CAAC,EAAE,KAAK,GAAG,IAAI;IAcjC,OAAO,CAAC,yBAAyB;IAIjC,eAAe,CAAC,CAAC,EAAE,UAAU,GAAG,IAAI;IAmCpC,gBAAgB,IAAI,IAAI;IAQxB;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAU3B,WAAW,CAAC,CAAC,EAAE,UAAU,GAAG,IAAI;IAqBhC;;;;;;;;;OASG;IACH,aAAa,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI;IA8BzC,QAAQ,IAAI,IAAI;IAchB,kBAAkB,IAAI,WAAW,GAAG,IAAI;CAGxC"}
@@ -22,6 +22,14 @@ export declare class InteractionsController {
22
22
  * Disable the design mode interactions
23
23
  */
24
24
  disable(): void;
25
+ /**
26
+ * Install the text-selection suppression sheet (idempotent). Tied to
27
+ * enable/disable rather than initialize/destroy so the previewed app selects
28
+ * text normally whenever design mode is off.
29
+ */
30
+ private _mountSelectSuppression;
31
+ /** Remove the suppression sheet so text is selectable again outside design mode. */
32
+ private _unmountSelectSuppression;
25
33
  /**
26
34
  * Programmatically select an element by source identity — the runtime side of
27
35
  * {@link SelectElementMessage}. Used to re-select an element after an edit
@@ -57,10 +65,11 @@ export declare class InteractionsController {
57
65
  private resolveTargets;
58
66
  /**
59
67
  * Apply a style change to all elements at the given source location.
60
- * When sourceLocation is provided (undo/redo), it is used directly.
61
- * Otherwise the source location is read from the currently selected element.
68
+ * `sourceLocation`, when provided, is used directly (both a stamped live
69
+ * edit and an undo/redo replay carry one — see `isReplay` below). Otherwise
70
+ * the source location is read from the currently selected element.
62
71
  */
63
- applyStyleChange(property: string, value: string, sourceLocation?: SourceLocation): void;
72
+ applyStyleChange(property: string, value: string, sourceLocation?: SourceLocation, isReplay?: boolean): void;
64
73
  applyTextChange(text: string, sourceLocation?: SourceLocation): void;
65
74
  /**
66
75
  * Apply attribute changes to all elements at the given source location whose
@@ -22,6 +22,14 @@ export declare class InteractionsController {
22
22
  * Disable the design mode interactions
23
23
  */
24
24
  disable(): void;
25
+ /**
26
+ * Install the text-selection suppression sheet (idempotent). Tied to
27
+ * enable/disable rather than initialize/destroy so the previewed app selects
28
+ * text normally whenever design mode is off.
29
+ */
30
+ private _mountSelectSuppression;
31
+ /** Remove the suppression sheet so text is selectable again outside design mode. */
32
+ private _unmountSelectSuppression;
25
33
  /**
26
34
  * Programmatically select an element by source identity — the runtime side of
27
35
  * {@link SelectElementMessage}. Used to re-select an element after an edit
@@ -57,10 +65,11 @@ export declare class InteractionsController {
57
65
  private resolveTargets;
58
66
  /**
59
67
  * Apply a style change to all elements at the given source location.
60
- * When sourceLocation is provided (undo/redo), it is used directly.
61
- * Otherwise the source location is read from the currently selected element.
68
+ * `sourceLocation`, when provided, is used directly (both a stamped live
69
+ * edit and an undo/redo replay carry one — see `isReplay` below). Otherwise
70
+ * the source location is read from the currently selected element.
62
71
  */
63
- applyStyleChange(property: string, value: string, sourceLocation?: SourceLocation): void;
72
+ applyStyleChange(property: string, value: string, sourceLocation?: SourceLocation, isReplay?: boolean): void;
64
73
  applyTextChange(text: string, sourceLocation?: SourceLocation): void;
65
74
  /**
66
75
  * 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;AAYH,OAAO,EAIN,KAAK,cAAc,EACnB,MAAM,qBAAqB,CAAC;AAwD7B,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;gBAEzB,OAAO,UAAO;IA0D1B;;OAEG;IACH,UAAU,IAAI,IAAI;IAiBlB;;;;OAIG;IACH,MAAM,CAAC,cAAc,GAAE,SAAS,MAAM,EAAO,GAAG,IAAI;IAKpD;;OAEG;IACH,OAAO,IAAI,IAAI;IAKf;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8BG;IACH,gBAAgB,CAAC,cAAc,CAAC,EAAE,cAAc,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO;IAoCxE,OAAO,CAAC,cAAc;IAWtB;;;;OAIG;IACH,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,cAAc,GAAG,IAAI;IAqBxF,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,cAAc,GAAG,IAAI;IAOpE;;;;;;;;;;;;;;;OAeG;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;CASf"}
1
+ {"version":3,"file":"interactionsController.d.ts","sourceRoot":"","sources":["../../../src/runtime/interactions/interactionsController.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAYH,OAAO,EAIN,KAAK,cAAc,EACnB,MAAM,qBAAqB,CAAC;AAwE7B,qBAAa,sBAAsB;IAClC,OAAO,CAAC,OAAO,CAAU;IACzB,OAAO,CAAC,QAAQ,CAAU;IAE1B,OA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O,CAAC,UAAU;IA4BlB;;OAEG;IACH,iBAAiB,CAAC,QAAQ,EAAE,WAAW,EAAE,GAAG,IAAI;IAIhD;;OAEG;IACH,mBAAmB,IAAI,IAAI;IAI3B;;OAEG;IACH,cAAc,CAAC,QAAQ,EAAE,WAAW,EAAE,GAAG,IAAI;IAI7C;;OAEG;IACH,gBAAgB,IAAI,IAAI;IAIxB,OAAO,CAAC,YAAY;IA0BpB,OAAO,CAAC,WAAW;IAQnB,kFAAkF;IAClF,OAAO,CAAC,YAAY;IASpB;;;;;;;;;;;;;;;;;;;OAmBG;IACH,OAAO,CAAC,YAAY;IAkCpB,OAAO,CAAC,YAAY;IAcpB,OAAO,CAAC,YAAY;IA8BpB;;;;OAIG;IACH,UAAU,IAAI,IAAI;IAIlB,OAAO,CAAC,kBAAkB;IAW1B,OAAO,CAAC,WAAW;CAYnB"}
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": "11.43.2",
4
+ "version": "11.44.1",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "type": "module",
7
7
  "exports": {