@salesforce/ui-design-mode 11.40.0 → 11.41.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.
- package/dist/protocol/index.cjs +2 -0
- package/dist/protocol/index.js +3 -1
- package/dist/protocol/messageTypes.cjs +4 -0
- package/dist/protocol/messageTypes.d.cts +29 -1
- package/dist/protocol/messageTypes.d.ts +29 -1
- package/dist/protocol/messageTypes.d.ts.map +1 -1
- package/dist/protocol/messageTypes.js +4 -0
- package/dist/protocol/version.cjs +1 -1
- package/dist/protocol/version.js +1 -1
- package/dist/runtime/design-mode-interactions.js +98 -2
- package/dist/runtime/interactions/communicationManager.d.ts.map +1 -1
- package/dist/runtime/interactions/eventHandlers.d.cts +11 -0
- package/dist/runtime/interactions/eventHandlers.d.ts +11 -0
- package/dist/runtime/interactions/eventHandlers.d.ts.map +1 -1
- package/dist/runtime/interactions/interactionsController.d.cts +32 -0
- package/dist/runtime/interactions/interactionsController.d.ts +32 -0
- package/dist/runtime/interactions/interactionsController.d.ts.map +1 -1
- package/dist/runtime/interactions/utils/sourceUtils.d.cts +18 -0
- package/dist/runtime/interactions/utils/sourceUtils.d.ts +18 -0
- package/dist/runtime/interactions/utils/sourceUtils.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/protocol/index.cjs
CHANGED
|
@@ -4,11 +4,13 @@ const messageTypes = require("./messageTypes.cjs");
|
|
|
4
4
|
const domAttributes = require("./domAttributes.cjs");
|
|
5
5
|
const editableElementTags = require("./editableElementTags.cjs");
|
|
6
6
|
const version = require("./version.cjs");
|
|
7
|
+
exports.CAP_SELECT_ELEMENT = messageTypes.CAP_SELECT_ELEMENT;
|
|
7
8
|
exports.MSG_COMPONENT_SELECTED = messageTypes.MSG_COMPONENT_SELECTED;
|
|
8
9
|
exports.MSG_DISABLE_INTERACTIONS = messageTypes.MSG_DISABLE_INTERACTIONS;
|
|
9
10
|
exports.MSG_ENABLE_INTERACTIONS = messageTypes.MSG_ENABLE_INTERACTIONS;
|
|
10
11
|
exports.MSG_INTERACTIONS_INITIALIZED = messageTypes.MSG_INTERACTIONS_INITIALIZED;
|
|
11
12
|
exports.MSG_MEDIA_CHANGE = messageTypes.MSG_MEDIA_CHANGE;
|
|
13
|
+
exports.MSG_SELECT_ELEMENT = messageTypes.MSG_SELECT_ELEMENT;
|
|
12
14
|
exports.MSG_STYLE_CHANGE = messageTypes.MSG_STYLE_CHANGE;
|
|
13
15
|
exports.MSG_TEXT_CHANGE = messageTypes.MSG_TEXT_CHANGE;
|
|
14
16
|
exports.MSG_TEXT_CHANGED = messageTypes.MSG_TEXT_CHANGED;
|
package/dist/protocol/index.js
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
|
-
import { MSG_COMPONENT_SELECTED, MSG_DISABLE_INTERACTIONS, MSG_ENABLE_INTERACTIONS, MSG_INTERACTIONS_INITIALIZED, MSG_MEDIA_CHANGE, MSG_STYLE_CHANGE, MSG_TEXT_CHANGE, MSG_TEXT_CHANGED } from "./messageTypes.js";
|
|
1
|
+
import { CAP_SELECT_ELEMENT, MSG_COMPONENT_SELECTED, MSG_DISABLE_INTERACTIONS, MSG_ENABLE_INTERACTIONS, MSG_INTERACTIONS_INITIALIZED, MSG_MEDIA_CHANGE, MSG_SELECT_ELEMENT, MSG_STYLE_CHANGE, MSG_TEXT_CHANGE, MSG_TEXT_CHANGED } from "./messageTypes.js";
|
|
2
2
|
import { ATTR_SOURCE_FILE, ATTR_TEXT_TYPE } from "./domAttributes.js";
|
|
3
3
|
import { EDITABLE_ELEMENT_TAGS } from "./editableElementTags.js";
|
|
4
4
|
import { UI_DESIGN_MODE_VERSION } from "./version.js";
|
|
5
5
|
export {
|
|
6
6
|
ATTR_SOURCE_FILE,
|
|
7
7
|
ATTR_TEXT_TYPE,
|
|
8
|
+
CAP_SELECT_ELEMENT,
|
|
8
9
|
EDITABLE_ELEMENT_TAGS,
|
|
9
10
|
MSG_COMPONENT_SELECTED,
|
|
10
11
|
MSG_DISABLE_INTERACTIONS,
|
|
11
12
|
MSG_ENABLE_INTERACTIONS,
|
|
12
13
|
MSG_INTERACTIONS_INITIALIZED,
|
|
13
14
|
MSG_MEDIA_CHANGE,
|
|
15
|
+
MSG_SELECT_ELEMENT,
|
|
14
16
|
MSG_STYLE_CHANGE,
|
|
15
17
|
MSG_TEXT_CHANGE,
|
|
16
18
|
MSG_TEXT_CHANGED,
|
|
@@ -5,14 +5,18 @@ const MSG_DISABLE_INTERACTIONS = "disable-interactions";
|
|
|
5
5
|
const MSG_STYLE_CHANGE = "style-change";
|
|
6
6
|
const MSG_TEXT_CHANGE = "text-change";
|
|
7
7
|
const MSG_MEDIA_CHANGE = "media-change";
|
|
8
|
+
const MSG_SELECT_ELEMENT = "select-element";
|
|
8
9
|
const MSG_INTERACTIONS_INITIALIZED = "interactions-initialized";
|
|
9
10
|
const MSG_COMPONENT_SELECTED = "component-selected";
|
|
10
11
|
const MSG_TEXT_CHANGED = "text-changed";
|
|
12
|
+
const CAP_SELECT_ELEMENT = "select-element";
|
|
13
|
+
exports.CAP_SELECT_ELEMENT = CAP_SELECT_ELEMENT;
|
|
11
14
|
exports.MSG_COMPONENT_SELECTED = MSG_COMPONENT_SELECTED;
|
|
12
15
|
exports.MSG_DISABLE_INTERACTIONS = MSG_DISABLE_INTERACTIONS;
|
|
13
16
|
exports.MSG_ENABLE_INTERACTIONS = MSG_ENABLE_INTERACTIONS;
|
|
14
17
|
exports.MSG_INTERACTIONS_INITIALIZED = MSG_INTERACTIONS_INITIALIZED;
|
|
15
18
|
exports.MSG_MEDIA_CHANGE = MSG_MEDIA_CHANGE;
|
|
19
|
+
exports.MSG_SELECT_ELEMENT = MSG_SELECT_ELEMENT;
|
|
16
20
|
exports.MSG_STYLE_CHANGE = MSG_STYLE_CHANGE;
|
|
17
21
|
exports.MSG_TEXT_CHANGE = MSG_TEXT_CHANGE;
|
|
18
22
|
exports.MSG_TEXT_CHANGED = MSG_TEXT_CHANGED;
|
|
@@ -70,7 +70,28 @@ export interface MediaChangeMessage {
|
|
|
70
70
|
attributes: Record<string, string | undefined>;
|
|
71
71
|
sourceLocation?: SourceLocation;
|
|
72
72
|
}
|
|
73
|
-
|
|
73
|
+
/**
|
|
74
|
+
* Request that the runtime programmatically select an element — the first-class
|
|
75
|
+
* alternative to a host-side synthetic click, used to re-select an element after
|
|
76
|
+
* an edit regenerates the preview.
|
|
77
|
+
*
|
|
78
|
+
* Resolution is best-effort and corroborated: the runtime resolves the target by
|
|
79
|
+
* `sourceLocation` (the `file:line:col` triple) and corroborates the match by
|
|
80
|
+
* `tag` when supplied. A resolved element is selected only if it still passes the
|
|
81
|
+
* runtime's authorization gate; on an uncorroborated/failed match the runtime
|
|
82
|
+
* clears the selection rather than guessing.
|
|
83
|
+
*
|
|
84
|
+
* Gated behind the `select-element` capability advertised on
|
|
85
|
+
* `InteractionsInitializedMessage` — hosts must feature-detect before posting.
|
|
86
|
+
*/
|
|
87
|
+
export interface SelectElementMessage {
|
|
88
|
+
type: "select-element";
|
|
89
|
+
/** Optional corroboration: the expected DOM tag name (e.g. "DIV"). */
|
|
90
|
+
tag?: string;
|
|
91
|
+
/** The element's source identity (the `file:line:col` triple). */
|
|
92
|
+
sourceLocation?: SourceLocation;
|
|
93
|
+
}
|
|
94
|
+
export type HostToIframeMessage = EnableInteractionsMessage | DisableInteractionsMessage | StyleChangeMessage | TextChangeMessage | MediaChangeMessage | SelectElementMessage;
|
|
74
95
|
export interface InteractionsInitializedMessage {
|
|
75
96
|
type: "interactions-initialized";
|
|
76
97
|
/**
|
|
@@ -149,7 +170,14 @@ export declare const MSG_DISABLE_INTERACTIONS: "disable-interactions";
|
|
|
149
170
|
export declare const MSG_STYLE_CHANGE: "style-change";
|
|
150
171
|
export declare const MSG_TEXT_CHANGE: "text-change";
|
|
151
172
|
export declare const MSG_MEDIA_CHANGE: "media-change";
|
|
173
|
+
export declare const MSG_SELECT_ELEMENT: "select-element";
|
|
152
174
|
export declare const MSG_INTERACTIONS_INITIALIZED: "interactions-initialized";
|
|
153
175
|
export declare const MSG_COMPONENT_SELECTED: "component-selected";
|
|
154
176
|
export declare const MSG_TEXT_CHANGED: "text-changed";
|
|
177
|
+
/**
|
|
178
|
+
* Advertised when the runtime understands {@link SelectElementMessage}. Hosts
|
|
179
|
+
* must see this in `capabilities` before posting `select-element`; otherwise they
|
|
180
|
+
* fall back to a host-side synthetic click.
|
|
181
|
+
*/
|
|
182
|
+
export declare const CAP_SELECT_ELEMENT: "select-element";
|
|
155
183
|
//# sourceMappingURL=messageTypes.d.ts.map
|
|
@@ -70,7 +70,28 @@ export interface MediaChangeMessage {
|
|
|
70
70
|
attributes: Record<string, string | undefined>;
|
|
71
71
|
sourceLocation?: SourceLocation;
|
|
72
72
|
}
|
|
73
|
-
|
|
73
|
+
/**
|
|
74
|
+
* Request that the runtime programmatically select an element — the first-class
|
|
75
|
+
* alternative to a host-side synthetic click, used to re-select an element after
|
|
76
|
+
* an edit regenerates the preview.
|
|
77
|
+
*
|
|
78
|
+
* Resolution is best-effort and corroborated: the runtime resolves the target by
|
|
79
|
+
* `sourceLocation` (the `file:line:col` triple) and corroborates the match by
|
|
80
|
+
* `tag` when supplied. A resolved element is selected only if it still passes the
|
|
81
|
+
* runtime's authorization gate; on an uncorroborated/failed match the runtime
|
|
82
|
+
* clears the selection rather than guessing.
|
|
83
|
+
*
|
|
84
|
+
* Gated behind the `select-element` capability advertised on
|
|
85
|
+
* `InteractionsInitializedMessage` — hosts must feature-detect before posting.
|
|
86
|
+
*/
|
|
87
|
+
export interface SelectElementMessage {
|
|
88
|
+
type: "select-element";
|
|
89
|
+
/** Optional corroboration: the expected DOM tag name (e.g. "DIV"). */
|
|
90
|
+
tag?: string;
|
|
91
|
+
/** The element's source identity (the `file:line:col` triple). */
|
|
92
|
+
sourceLocation?: SourceLocation;
|
|
93
|
+
}
|
|
94
|
+
export type HostToIframeMessage = EnableInteractionsMessage | DisableInteractionsMessage | StyleChangeMessage | TextChangeMessage | MediaChangeMessage | SelectElementMessage;
|
|
74
95
|
export interface InteractionsInitializedMessage {
|
|
75
96
|
type: "interactions-initialized";
|
|
76
97
|
/**
|
|
@@ -149,7 +170,14 @@ export declare const MSG_DISABLE_INTERACTIONS: "disable-interactions";
|
|
|
149
170
|
export declare const MSG_STYLE_CHANGE: "style-change";
|
|
150
171
|
export declare const MSG_TEXT_CHANGE: "text-change";
|
|
151
172
|
export declare const MSG_MEDIA_CHANGE: "media-change";
|
|
173
|
+
export declare const MSG_SELECT_ELEMENT: "select-element";
|
|
152
174
|
export declare const MSG_INTERACTIONS_INITIALIZED: "interactions-initialized";
|
|
153
175
|
export declare const MSG_COMPONENT_SELECTED: "component-selected";
|
|
154
176
|
export declare const MSG_TEXT_CHANGED: "text-changed";
|
|
177
|
+
/**
|
|
178
|
+
* Advertised when the runtime understands {@link SelectElementMessage}. Hosts
|
|
179
|
+
* must see this in `capabilities` before posting `select-element`; otherwise they
|
|
180
|
+
* fall back to a host-side synthetic click.
|
|
181
|
+
*/
|
|
182
|
+
export declare const CAP_SELECT_ELEMENT: "select-element";
|
|
155
183
|
//# sourceMappingURL=messageTypes.d.ts.map
|
|
@@ -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;;;;;OAKG;IACH,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;CAC1B;AAED,MAAM,WAAW,0BAA0B;IAC1C,IAAI,EAAE,sBAAsB,CAAC;CAC7B;AAED,MAAM,WAAW,kBAAkB;IAClC,IAAI,EAAE,cAAc,C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_CHANGE = "style-change";
|
|
4
4
|
const MSG_TEXT_CHANGE = "text-change";
|
|
5
5
|
const MSG_MEDIA_CHANGE = "media-change";
|
|
6
|
+
const MSG_SELECT_ELEMENT = "select-element";
|
|
6
7
|
const MSG_INTERACTIONS_INITIALIZED = "interactions-initialized";
|
|
7
8
|
const MSG_COMPONENT_SELECTED = "component-selected";
|
|
8
9
|
const MSG_TEXT_CHANGED = "text-changed";
|
|
10
|
+
const CAP_SELECT_ELEMENT = "select-element";
|
|
9
11
|
export {
|
|
12
|
+
CAP_SELECT_ELEMENT,
|
|
10
13
|
MSG_COMPONENT_SELECTED,
|
|
11
14
|
MSG_DISABLE_INTERACTIONS,
|
|
12
15
|
MSG_ENABLE_INTERACTIONS,
|
|
13
16
|
MSG_INTERACTIONS_INITIALIZED,
|
|
14
17
|
MSG_MEDIA_CHANGE,
|
|
18
|
+
MSG_SELECT_ELEMENT,
|
|
15
19
|
MSG_STYLE_CHANGE,
|
|
16
20
|
MSG_TEXT_CHANGE,
|
|
17
21
|
MSG_TEXT_CHANGED
|
package/dist/protocol/version.js
CHANGED
|
@@ -18,9 +18,11 @@
|
|
|
18
18
|
var MSG_STYLE_CHANGE = "style-change";
|
|
19
19
|
var MSG_TEXT_CHANGE = "text-change";
|
|
20
20
|
var MSG_MEDIA_CHANGE = "media-change";
|
|
21
|
+
var MSG_SELECT_ELEMENT = "select-element";
|
|
21
22
|
var MSG_INTERACTIONS_INITIALIZED = "interactions-initialized";
|
|
22
23
|
var MSG_COMPONENT_SELECTED = "component-selected";
|
|
23
24
|
var MSG_TEXT_CHANGED = "text-changed";
|
|
25
|
+
var CAP_SELECT_ELEMENT = "select-element";
|
|
24
26
|
|
|
25
27
|
// src/protocol/domAttributes.ts
|
|
26
28
|
var ATTR_SOURCE_FILE = "data-source-file";
|
|
@@ -42,7 +44,7 @@
|
|
|
42
44
|
];
|
|
43
45
|
|
|
44
46
|
// src/protocol/version.ts
|
|
45
|
-
var UI_DESIGN_MODE_VERSION = "11.
|
|
47
|
+
var UI_DESIGN_MODE_VERSION = "11.41.0";
|
|
46
48
|
|
|
47
49
|
// src/runtime/interactions/utils/sourceUtils.ts
|
|
48
50
|
function parseRequiredInt(value) {
|
|
@@ -85,6 +87,23 @@
|
|
|
85
87
|
}
|
|
86
88
|
return results;
|
|
87
89
|
}
|
|
90
|
+
function findElementsByDriftedSource(location, maxLineDelta) {
|
|
91
|
+
const matches = [];
|
|
92
|
+
const elements = document.querySelectorAll(`[${ATTR_SOURCE_FILE}]`);
|
|
93
|
+
for (const el of elements) {
|
|
94
|
+
const elSource = getSourceFromDataAttributes(el);
|
|
95
|
+
if (!elSource || elSource.sourceFile !== location.sourceFile || elSource.columnNumber !== location.columnNumber) {
|
|
96
|
+
continue;
|
|
97
|
+
}
|
|
98
|
+
const delta = Math.abs(elSource.lineNumber - location.lineNumber);
|
|
99
|
+
if (delta > maxLineDelta) {
|
|
100
|
+
continue;
|
|
101
|
+
}
|
|
102
|
+
matches.push({ el, delta });
|
|
103
|
+
}
|
|
104
|
+
matches.sort((a, b) => a.delta - b.delta);
|
|
105
|
+
return matches.map((m) => m.el);
|
|
106
|
+
}
|
|
88
107
|
function parseSourceLocation(sl) {
|
|
89
108
|
if (!sl || typeof sl !== "object") return void 0;
|
|
90
109
|
const obj = sl;
|
|
@@ -364,7 +383,10 @@
|
|
|
364
383
|
window.parent.postMessage(
|
|
365
384
|
{
|
|
366
385
|
type: MSG_INTERACTIONS_INITIALIZED,
|
|
367
|
-
uiDesignModeVersion: UI_DESIGN_MODE_VERSION
|
|
386
|
+
uiDesignModeVersion: UI_DESIGN_MODE_VERSION,
|
|
387
|
+
// Advertise runtime capabilities so hosts feature-detect the
|
|
388
|
+
// programmatic select-element path rather than comparing versions.
|
|
389
|
+
capabilities: [CAP_SELECT_ELEMENT]
|
|
368
390
|
},
|
|
369
391
|
"*"
|
|
370
392
|
);
|
|
@@ -611,6 +633,19 @@
|
|
|
611
633
|
if (!element) {
|
|
612
634
|
return;
|
|
613
635
|
}
|
|
636
|
+
this.selectElement(element);
|
|
637
|
+
}
|
|
638
|
+
/**
|
|
639
|
+
* Select an already-resolved element: deselect any prior selection, clear the
|
|
640
|
+
* hover highlight, select the element and all others sharing its source
|
|
641
|
+
* location, make it editable if it's text, and notify the host.
|
|
642
|
+
*
|
|
643
|
+
* This is the shared selection routine for both a user click (`handleClick`)
|
|
644
|
+
* and a programmatic `select-element` request (controller `selectByIdentity`).
|
|
645
|
+
* Callers are responsible for resolving `element` to a highlightable node
|
|
646
|
+
* (authorization gate); this method assumes that has already happened.
|
|
647
|
+
*/
|
|
648
|
+
selectElement(element) {
|
|
614
649
|
if (this.selectedElement && this.selectedElement === element) {
|
|
615
650
|
return;
|
|
616
651
|
}
|
|
@@ -900,6 +935,7 @@
|
|
|
900
935
|
};
|
|
901
936
|
|
|
902
937
|
// src/runtime/interactions/interactionsController.ts
|
|
938
|
+
var MAX_DRIFT_LINE_DELTA = 50;
|
|
903
939
|
var mediaAppliers = {
|
|
904
940
|
// Whitelist by construction: this applier reads only the attribute keys
|
|
905
941
|
// valid for <img> and ignores anything else in `attrs`. The map is never
|
|
@@ -1012,6 +1048,62 @@
|
|
|
1012
1048
|
this.isActive = false;
|
|
1013
1049
|
this.eventHandlers.clearAll();
|
|
1014
1050
|
}
|
|
1051
|
+
/**
|
|
1052
|
+
* Programmatically select an element by source identity — the runtime side of
|
|
1053
|
+
* {@link SelectElementMessage}. Used to re-select an element after an edit
|
|
1054
|
+
* regenerates the preview, without a host-side synthetic click.
|
|
1055
|
+
*
|
|
1056
|
+
* The target is resolved by `sourceLocation` (the `file:line:col` triple) and
|
|
1057
|
+
* corroborated by `tag` when supplied — a match whose tag differs from the
|
|
1058
|
+
* expected one is rejected rather than mis-selected. Resolution is TWO-STAGE,
|
|
1059
|
+
* mirroring the host's legacy synthetic-click fallback so the capability path
|
|
1060
|
+
* is no less drift-tolerant than the path it replaces:
|
|
1061
|
+
*
|
|
1062
|
+
* 1. EXACT — the element is still at the remembered `file:line:col` triple
|
|
1063
|
+
* (an in-place edit, or no edit above it).
|
|
1064
|
+
* 2. DRIFTED — the exact triple missed. A line-shifting edit above the target
|
|
1065
|
+
* (add/remove lines) moves its injected `lineNumber` while leaving its file
|
|
1066
|
+
* and column (indentation) intact, so we match same-file + same-column
|
|
1067
|
+
* (+ same-tag, when supplied) and take the NEAREST line within
|
|
1068
|
+
* {@link MAX_DRIFT_LINE_DELTA}. This is the "second consecutive prompt edit
|
|
1069
|
+
* deselects" case (W-22860966): without it the exact match regresses the
|
|
1070
|
+
* very bug this feature targets. `tag` is REQUIRED to attempt the drift
|
|
1071
|
+
* stage — without it a bare same-column line-shift is too weak a signal to
|
|
1072
|
+
* risk a mis-select, so an untagged request is exact-only.
|
|
1073
|
+
*
|
|
1074
|
+
* Authorization is unchanged in both stages: every candidate must still pass
|
|
1075
|
+
* `componentMatcher.isHighlightableElement` (valid, in-workspace
|
|
1076
|
+
* `data-source-file`) before it can be selected. On no corroborated, authorized
|
|
1077
|
+
* match this is a clean no-op — the host then clears its stale selection rather
|
|
1078
|
+
* than selecting the wrong element.
|
|
1079
|
+
*
|
|
1080
|
+
* @returns true if an element was selected, false on a clean miss.
|
|
1081
|
+
*/
|
|
1082
|
+
selectByIdentity(sourceLocation, tag) {
|
|
1083
|
+
if (!this.isActive) {
|
|
1084
|
+
return false;
|
|
1085
|
+
}
|
|
1086
|
+
if (!sourceLocation?.sourceFile) {
|
|
1087
|
+
return false;
|
|
1088
|
+
}
|
|
1089
|
+
const expectedTag = tag ? tag.toUpperCase() : void 0;
|
|
1090
|
+
const authorizedWithTag = (el) => (!expectedTag || el.tagName === expectedTag) && this.componentMatcher.isHighlightableElement(el);
|
|
1091
|
+
const exact = findElementsBySourceLocation(sourceLocation).find(authorizedWithTag);
|
|
1092
|
+
if (exact) {
|
|
1093
|
+
this.eventHandlers.selectElement(exact);
|
|
1094
|
+
return true;
|
|
1095
|
+
}
|
|
1096
|
+
if (expectedTag) {
|
|
1097
|
+
const drifted = findElementsByDriftedSource(sourceLocation, MAX_DRIFT_LINE_DELTA).find(
|
|
1098
|
+
authorizedWithTag
|
|
1099
|
+
);
|
|
1100
|
+
if (drifted) {
|
|
1101
|
+
this.eventHandlers.selectElement(drifted);
|
|
1102
|
+
return true;
|
|
1103
|
+
}
|
|
1104
|
+
}
|
|
1105
|
+
return false;
|
|
1106
|
+
}
|
|
1015
1107
|
resolveTargets(sourceLocation) {
|
|
1016
1108
|
let location = sourceLocation ?? null;
|
|
1017
1109
|
if (!location?.sourceFile) {
|
|
@@ -1139,6 +1231,10 @@
|
|
|
1139
1231
|
if (typed && typed.type === MSG_DISABLE_INTERACTIONS) {
|
|
1140
1232
|
window.disableInteractions?.();
|
|
1141
1233
|
}
|
|
1234
|
+
if (typed && typed.type === MSG_SELECT_ELEMENT) {
|
|
1235
|
+
const tag = typeof typed.tag === "string" ? typed.tag : void 0;
|
|
1236
|
+
interactions.selectByIdentity(parseSourceLocation(typed.sourceLocation), tag);
|
|
1237
|
+
}
|
|
1142
1238
|
});
|
|
1143
1239
|
}
|
|
1144
1240
|
})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"communicationManager.d.ts","sourceRoot":"","sources":["../../../src/runtime/interactions/communicationManager.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAQH,OAAO,
|
|
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;AAUxB,YAAY,EAAE,SAAS,EAAE,CAAC;AAE1B;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,WAAW,GAAG,SAAS,GAAG,SAAS,CAexE;AAED,qBAAa,oBAAoB;;IAKhC;;;OAGG;IACH,uBAAuB,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI;IAiDnD;;;;;OAKG;IACH,gBAAgB,CAAC,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI;IAyBnF;;OAEG;IACH,4BAA4B,IAAI,IAAI;CAmBpC"}
|
|
@@ -45,6 +45,17 @@ export declare class EventHandlers {
|
|
|
45
45
|
*/
|
|
46
46
|
private clearHoverHighlight;
|
|
47
47
|
handleClick(e: MouseEvent): void;
|
|
48
|
+
/**
|
|
49
|
+
* Select an already-resolved element: deselect any prior selection, clear the
|
|
50
|
+
* hover highlight, select the element and all others sharing its source
|
|
51
|
+
* location, make it editable if it's text, and notify the host.
|
|
52
|
+
*
|
|
53
|
+
* This is the shared selection routine for both a user click (`handleClick`)
|
|
54
|
+
* and a programmatic `select-element` request (controller `selectByIdentity`).
|
|
55
|
+
* Callers are responsible for resolving `element` to a highlightable node
|
|
56
|
+
* (authorization gate); this method assumes that has already happened.
|
|
57
|
+
*/
|
|
58
|
+
selectElement(element: HTMLElement): void;
|
|
48
59
|
clearAll(): void;
|
|
49
60
|
getSelectedElement(): HTMLElement | null;
|
|
50
61
|
}
|
|
@@ -45,6 +45,17 @@ export declare class EventHandlers {
|
|
|
45
45
|
*/
|
|
46
46
|
private clearHoverHighlight;
|
|
47
47
|
handleClick(e: MouseEvent): void;
|
|
48
|
+
/**
|
|
49
|
+
* Select an already-resolved element: deselect any prior selection, clear the
|
|
50
|
+
* hover highlight, select the element and all others sharing its source
|
|
51
|
+
* location, make it editable if it's text, and notify the host.
|
|
52
|
+
*
|
|
53
|
+
* This is the shared selection routine for both a user click (`handleClick`)
|
|
54
|
+
* and a programmatic `select-element` request (controller `selectByIdentity`).
|
|
55
|
+
* Callers are responsible for resolving `element` to a highlightable node
|
|
56
|
+
* (authorization gate); this method assumes that has already happened.
|
|
57
|
+
*/
|
|
58
|
+
selectElement(element: HTMLElement): void;
|
|
48
59
|
clearAll(): void;
|
|
49
60
|
getSelectedElement(): HTMLElement | null;
|
|
50
61
|
}
|
|
@@ -1 +1 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kB,EAClC,eAAe,EAAE,mBAAmB,EACpC,oBAAoB,EAAE,wBAAwB;IAmB/C;;;;;;OAMG;IACH,iBAAiB,CAAC,CAAC,EAAE,KAAK,GAAG,IAAI;IAejC,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,38 @@ export declare class InteractionsController {
|
|
|
22
22
|
* Disable the design mode interactions
|
|
23
23
|
*/
|
|
24
24
|
disable(): void;
|
|
25
|
+
/**
|
|
26
|
+
* Programmatically select an element by source identity — the runtime side of
|
|
27
|
+
* {@link SelectElementMessage}. Used to re-select an element after an edit
|
|
28
|
+
* regenerates the preview, without a host-side synthetic click.
|
|
29
|
+
*
|
|
30
|
+
* The target is resolved by `sourceLocation` (the `file:line:col` triple) and
|
|
31
|
+
* corroborated by `tag` when supplied — a match whose tag differs from the
|
|
32
|
+
* expected one is rejected rather than mis-selected. Resolution is TWO-STAGE,
|
|
33
|
+
* mirroring the host's legacy synthetic-click fallback so the capability path
|
|
34
|
+
* is no less drift-tolerant than the path it replaces:
|
|
35
|
+
*
|
|
36
|
+
* 1. EXACT — the element is still at the remembered `file:line:col` triple
|
|
37
|
+
* (an in-place edit, or no edit above it).
|
|
38
|
+
* 2. DRIFTED — the exact triple missed. A line-shifting edit above the target
|
|
39
|
+
* (add/remove lines) moves its injected `lineNumber` while leaving its file
|
|
40
|
+
* and column (indentation) intact, so we match same-file + same-column
|
|
41
|
+
* (+ same-tag, when supplied) and take the NEAREST line within
|
|
42
|
+
* {@link MAX_DRIFT_LINE_DELTA}. This is the "second consecutive prompt edit
|
|
43
|
+
* deselects" case (W-22860966): without it the exact match regresses the
|
|
44
|
+
* very bug this feature targets. `tag` is REQUIRED to attempt the drift
|
|
45
|
+
* stage — without it a bare same-column line-shift is too weak a signal to
|
|
46
|
+
* risk a mis-select, so an untagged request is exact-only.
|
|
47
|
+
*
|
|
48
|
+
* Authorization is unchanged in both stages: every candidate must still pass
|
|
49
|
+
* `componentMatcher.isHighlightableElement` (valid, in-workspace
|
|
50
|
+
* `data-source-file`) before it can be selected. On no corroborated, authorized
|
|
51
|
+
* match this is a clean no-op — the host then clears its stale selection rather
|
|
52
|
+
* than selecting the wrong element.
|
|
53
|
+
*
|
|
54
|
+
* @returns true if an element was selected, false on a clean miss.
|
|
55
|
+
*/
|
|
56
|
+
selectByIdentity(sourceLocation?: SourceLocation, tag?: string): boolean;
|
|
25
57
|
private resolveTargets;
|
|
26
58
|
/**
|
|
27
59
|
* Apply a style change to all elements at the given source location.
|
|
@@ -22,6 +22,38 @@ export declare class InteractionsController {
|
|
|
22
22
|
* Disable the design mode interactions
|
|
23
23
|
*/
|
|
24
24
|
disable(): void;
|
|
25
|
+
/**
|
|
26
|
+
* Programmatically select an element by source identity — the runtime side of
|
|
27
|
+
* {@link SelectElementMessage}. Used to re-select an element after an edit
|
|
28
|
+
* regenerates the preview, without a host-side synthetic click.
|
|
29
|
+
*
|
|
30
|
+
* The target is resolved by `sourceLocation` (the `file:line:col` triple) and
|
|
31
|
+
* corroborated by `tag` when supplied — a match whose tag differs from the
|
|
32
|
+
* expected one is rejected rather than mis-selected. Resolution is TWO-STAGE,
|
|
33
|
+
* mirroring the host's legacy synthetic-click fallback so the capability path
|
|
34
|
+
* is no less drift-tolerant than the path it replaces:
|
|
35
|
+
*
|
|
36
|
+
* 1. EXACT — the element is still at the remembered `file:line:col` triple
|
|
37
|
+
* (an in-place edit, or no edit above it).
|
|
38
|
+
* 2. DRIFTED — the exact triple missed. A line-shifting edit above the target
|
|
39
|
+
* (add/remove lines) moves its injected `lineNumber` while leaving its file
|
|
40
|
+
* and column (indentation) intact, so we match same-file + same-column
|
|
41
|
+
* (+ same-tag, when supplied) and take the NEAREST line within
|
|
42
|
+
* {@link MAX_DRIFT_LINE_DELTA}. This is the "second consecutive prompt edit
|
|
43
|
+
* deselects" case (W-22860966): without it the exact match regresses the
|
|
44
|
+
* very bug this feature targets. `tag` is REQUIRED to attempt the drift
|
|
45
|
+
* stage — without it a bare same-column line-shift is too weak a signal to
|
|
46
|
+
* risk a mis-select, so an untagged request is exact-only.
|
|
47
|
+
*
|
|
48
|
+
* Authorization is unchanged in both stages: every candidate must still pass
|
|
49
|
+
* `componentMatcher.isHighlightableElement` (valid, in-workspace
|
|
50
|
+
* `data-source-file`) before it can be selected. On no corroborated, authorized
|
|
51
|
+
* match this is a clean no-op — the host then clears its stale selection rather
|
|
52
|
+
* than selecting the wrong element.
|
|
53
|
+
*
|
|
54
|
+
* @returns true if an element was selected, false on a clean miss.
|
|
55
|
+
*/
|
|
56
|
+
selectByIdentity(sourceLocation?: SourceLocation, tag?: string): boolean;
|
|
25
57
|
private resolveTargets;
|
|
26
58
|
/**
|
|
27
59
|
* Apply a style change to all elements at the given source location.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interactionsController.d.ts","sourceRoot":"","sources":["../../../src/runtime/interactions/interactionsController.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAYH,OAAO,
|
|
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"}
|
|
@@ -12,6 +12,24 @@ export declare function getSourceFromDataAttributes(element: HTMLElement | null
|
|
|
12
12
|
* @returns All matching elements (may be empty)
|
|
13
13
|
*/
|
|
14
14
|
export declare function findElementsBySourceLocation(location: SourceLocation): HTMLElement[];
|
|
15
|
+
/**
|
|
16
|
+
* Find DOM elements whose `data-source-file` matches the given location in the
|
|
17
|
+
* SAME file at the SAME column, but on a possibly-DRIFTED line — the recovery
|
|
18
|
+
* path for a line-shifting edit.
|
|
19
|
+
*
|
|
20
|
+
* `data-source-file` is injected at transform time, so an edit that adds/removes
|
|
21
|
+
* lines ABOVE the target shifts its `lineNumber`: the exact triple
|
|
22
|
+
* ({@link findElementsBySourceLocation}) no longer matches even though the
|
|
23
|
+
* element is unchanged. A pure line-shift leaves the element's COLUMN (its source
|
|
24
|
+
* indentation) untouched, so we match same-file + same-column and pick the
|
|
25
|
+
* nearest line. Callers corroborate further (tag, authorization) and cap how far
|
|
26
|
+
* a drift is believable via `maxLineDelta` — beyond that a same-column element is
|
|
27
|
+
* more likely a DIFFERENT element than our shifted one, so it's excluded.
|
|
28
|
+
*
|
|
29
|
+
* Returned NEAREST-line-first (ties keep document order, since `Array.sort` is
|
|
30
|
+
* stable); callers take the first that passes their remaining filters.
|
|
31
|
+
*/
|
|
32
|
+
export declare function findElementsByDriftedSource(location: SourceLocation, maxLineDelta: number): HTMLElement[];
|
|
15
33
|
/**
|
|
16
34
|
* Parse an untyped message payload object into a SourceLocation.
|
|
17
35
|
* Used by the entry point to convert raw postMessage data into typed values.
|
|
@@ -12,6 +12,24 @@ export declare function getSourceFromDataAttributes(element: HTMLElement | null
|
|
|
12
12
|
* @returns All matching elements (may be empty)
|
|
13
13
|
*/
|
|
14
14
|
export declare function findElementsBySourceLocation(location: SourceLocation): HTMLElement[];
|
|
15
|
+
/**
|
|
16
|
+
* Find DOM elements whose `data-source-file` matches the given location in the
|
|
17
|
+
* SAME file at the SAME column, but on a possibly-DRIFTED line — the recovery
|
|
18
|
+
* path for a line-shifting edit.
|
|
19
|
+
*
|
|
20
|
+
* `data-source-file` is injected at transform time, so an edit that adds/removes
|
|
21
|
+
* lines ABOVE the target shifts its `lineNumber`: the exact triple
|
|
22
|
+
* ({@link findElementsBySourceLocation}) no longer matches even though the
|
|
23
|
+
* element is unchanged. A pure line-shift leaves the element's COLUMN (its source
|
|
24
|
+
* indentation) untouched, so we match same-file + same-column and pick the
|
|
25
|
+
* nearest line. Callers corroborate further (tag, authorization) and cap how far
|
|
26
|
+
* a drift is believable via `maxLineDelta` — beyond that a same-column element is
|
|
27
|
+
* more likely a DIFFERENT element than our shifted one, so it's excluded.
|
|
28
|
+
*
|
|
29
|
+
* Returned NEAREST-line-first (ties keep document order, since `Array.sort` is
|
|
30
|
+
* stable); callers take the first that passes their remaining filters.
|
|
31
|
+
*/
|
|
32
|
+
export declare function findElementsByDriftedSource(location: SourceLocation, maxLineDelta: number): HTMLElement[];
|
|
15
33
|
/**
|
|
16
34
|
* Parse an untyped message payload object into a SourceLocation.
|
|
17
35
|
* Used by the entry point to convert raw postMessage data into typed values.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sourceUtils.d.ts","sourceRoot":"","sources":["../../../../src/runtime/interactions/utils/sourceUtils.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;GAGG;AAEH,OAAO,EAAoB,KAAK,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAE1E,YAAY,EAAE,cAAc,EAAE,CAAC;AAkC/B;;;;GAIG;AACH,wBAAgB,2BAA2B,CAC1C,OAAO,EAAE,WAAW,GAAG,IAAI,GAAG,SAAS,GACrC,cAAc,GAAG,IAAI,CAWvB;AAED;;;;GAIG;AACH,wBAAgB,4BAA4B,CAAC,QAAQ,EAAE,cAAc,GAAG,WAAW,EAAE,CAepF;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,EAAE,EAAE,OAAO,GAAG,cAAc,GAAG,SAAS,CAgB3E;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CAgBlF"}
|
|
1
|
+
{"version":3,"file":"sourceUtils.d.ts","sourceRoot":"","sources":["../../../../src/runtime/interactions/utils/sourceUtils.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;GAGG;AAEH,OAAO,EAAoB,KAAK,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAE1E,YAAY,EAAE,cAAc,EAAE,CAAC;AAkC/B;;;;GAIG;AACH,wBAAgB,2BAA2B,CAC1C,OAAO,EAAE,WAAW,GAAG,IAAI,GAAG,SAAS,GACrC,cAAc,GAAG,IAAI,CAWvB;AAED;;;;GAIG;AACH,wBAAgB,4BAA4B,CAAC,QAAQ,EAAE,cAAc,GAAG,WAAW,EAAE,CAepF;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,2BAA2B,CAC1C,QAAQ,EAAE,cAAc,EACxB,YAAY,EAAE,MAAM,GAClB,WAAW,EAAE,CAoBf;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,EAAE,EAAE,OAAO,GAAG,cAAc,GAAG,SAAS,CAgB3E;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CAgBlF"}
|
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.
|
|
4
|
+
"version": "11.41.0",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"exports": {
|