@salesforce/ui-design-mode 10.13.1 → 10.14.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.
- package/dist/runtime/design-mode-interactions.js +234 -82
- package/dist/runtime/interactions/communicationManager.d.ts.map +1 -1
- package/dist/runtime/interactions/editableManager.d.cts +7 -1
- package/dist/runtime/interactions/editableManager.d.ts +7 -1
- package/dist/runtime/interactions/editableManager.d.ts.map +1 -1
- package/dist/runtime/interactions/eventHandlers.d.cts +17 -5
- package/dist/runtime/interactions/eventHandlers.d.ts +17 -5
- package/dist/runtime/interactions/eventHandlers.d.ts.map +1 -1
- package/dist/runtime/interactions/interactionsController.d.cts +1 -1
- package/dist/runtime/interactions/interactionsController.d.ts +1 -1
- package/dist/runtime/interactions/interactionsController.d.ts.map +1 -1
- package/dist/runtime/interactions/overlayManager.d.cts +60 -0
- package/dist/runtime/interactions/overlayManager.d.ts +60 -0
- package/dist/runtime/interactions/overlayManager.d.ts.map +1 -0
- package/package.json +1 -1
- package/dist/runtime/interactions/styleManager.d.cts +0 -49
- package/dist/runtime/interactions/styleManager.d.ts +0 -49
- package/dist/runtime/interactions/styleManager.d.ts.map +0 -1
|
@@ -110,13 +110,20 @@
|
|
|
110
110
|
// src/runtime/interactions/editableManager.ts
|
|
111
111
|
var TEXT_TAGS = EDITABLE_ELEMENT_TAGS;
|
|
112
112
|
var EditableManager = class {
|
|
113
|
-
|
|
113
|
+
/**
|
|
114
|
+
* @param onContentChange - Called whenever editing changes an element's
|
|
115
|
+
* content (live typing, blur, Escape revert), so the caller can recompute
|
|
116
|
+
* anything tied to the element's size — e.g. the selection overlay.
|
|
117
|
+
*/
|
|
118
|
+
constructor(communicationManager, onContentChange) {
|
|
114
119
|
__publicField(this, "communicationManager");
|
|
120
|
+
__publicField(this, "onContentChange");
|
|
115
121
|
__publicField(this, "boundHandleBlur");
|
|
116
122
|
__publicField(this, "boundHandleKeydown");
|
|
117
123
|
__publicField(this, "boundHandleInput");
|
|
118
124
|
__publicField(this, "editableGroup");
|
|
119
125
|
this.communicationManager = communicationManager;
|
|
126
|
+
this.onContentChange = onContentChange;
|
|
120
127
|
this.boundHandleBlur = this._handleBlur.bind(this);
|
|
121
128
|
this.boundHandleKeydown = this._handleKeydown.bind(this);
|
|
122
129
|
this.boundHandleInput = this._handleInput.bind(this);
|
|
@@ -159,6 +166,7 @@
|
|
|
159
166
|
for (let i = 1; i < this.editableGroup.length; i++) {
|
|
160
167
|
this.editableGroup[i].textContent = text;
|
|
161
168
|
}
|
|
169
|
+
this.onContentChange?.();
|
|
162
170
|
}
|
|
163
171
|
_handleBlur(e) {
|
|
164
172
|
const element = e.target;
|
|
@@ -186,6 +194,7 @@
|
|
|
186
194
|
el.textContent = el.dataset.originalText;
|
|
187
195
|
}
|
|
188
196
|
}
|
|
197
|
+
this.onContentChange?.();
|
|
189
198
|
element.blur();
|
|
190
199
|
}
|
|
191
200
|
}
|
|
@@ -279,14 +288,7 @@
|
|
|
279
288
|
*/
|
|
280
289
|
notifyComponentSelected(element) {
|
|
281
290
|
const label = getLabelFromSource(element);
|
|
282
|
-
const wasSelected = element.classList.contains("design-mode-selected");
|
|
283
|
-
if (wasSelected) {
|
|
284
|
-
element.classList.remove("design-mode-selected");
|
|
285
|
-
}
|
|
286
291
|
const styles = getElementStyles(element);
|
|
287
|
-
if (wasSelected) {
|
|
288
|
-
element.classList.add("design-mode-selected");
|
|
289
|
-
}
|
|
290
292
|
const debugSource = getSourceFromDataAttributes(element);
|
|
291
293
|
const textType = element.dataset?.textType ?? "none";
|
|
292
294
|
const hasNonEditableText = TEXT_TAGS.includes(element.tagName) && (textType === "dynamic" || textType === "mixed");
|
|
@@ -444,10 +446,10 @@
|
|
|
444
446
|
|
|
445
447
|
// src/runtime/interactions/eventHandlers.ts
|
|
446
448
|
var EventHandlers = class {
|
|
447
|
-
constructor(isInteractionsActive, componentMatcher,
|
|
449
|
+
constructor(isInteractionsActive, componentMatcher, overlayManager, editableManager, communicationManager) {
|
|
448
450
|
__publicField(this, "isInteractionsActive");
|
|
449
451
|
__publicField(this, "componentMatcher");
|
|
450
|
-
__publicField(this, "
|
|
452
|
+
__publicField(this, "overlayManager");
|
|
451
453
|
__publicField(this, "editableManager");
|
|
452
454
|
__publicField(this, "communicationManager");
|
|
453
455
|
__publicField(this, "currentHighlightedElements");
|
|
@@ -455,7 +457,7 @@
|
|
|
455
457
|
__publicField(this, "selectedElements");
|
|
456
458
|
this.isInteractionsActive = isInteractionsActive;
|
|
457
459
|
this.componentMatcher = componentMatcher;
|
|
458
|
-
this.
|
|
460
|
+
this.overlayManager = overlayManager;
|
|
459
461
|
this.editableManager = editableManager;
|
|
460
462
|
this.communicationManager = communicationManager;
|
|
461
463
|
this.currentHighlightedElements = [];
|
|
@@ -464,6 +466,26 @@
|
|
|
464
466
|
this.handleMouseOver = this.handleMouseOver.bind(this);
|
|
465
467
|
this.handleMouseLeave = this.handleMouseLeave.bind(this);
|
|
466
468
|
this.handleClick = this.handleClick.bind(this);
|
|
469
|
+
this.handlePointerDown = this.handlePointerDown.bind(this);
|
|
470
|
+
}
|
|
471
|
+
/**
|
|
472
|
+
* Swallow pointer/mouse-down so the previewed app cannot react to it (e.g.
|
|
473
|
+
* Radix opens dropdowns on `pointerdown`, before our `click` handler runs).
|
|
474
|
+
* In design mode the app is inspected, not driven; selection still happens on
|
|
475
|
+
* `click`. Exception: events inside the element being inline-text-edited pass
|
|
476
|
+
* through so the caret can be placed.
|
|
477
|
+
*/
|
|
478
|
+
handlePointerDown(e) {
|
|
479
|
+
if (!this.isInteractionsActive()) {
|
|
480
|
+
return;
|
|
481
|
+
}
|
|
482
|
+
const target = e.target;
|
|
483
|
+
if (target.isContentEditable) {
|
|
484
|
+
return;
|
|
485
|
+
}
|
|
486
|
+
e.preventDefault();
|
|
487
|
+
e.stopPropagation();
|
|
488
|
+
e.stopImmediatePropagation?.();
|
|
467
489
|
}
|
|
468
490
|
_findHighlightableElement(target) {
|
|
469
491
|
return this.componentMatcher.findHighlightableElement(target);
|
|
@@ -475,29 +497,34 @@
|
|
|
475
497
|
e.stopPropagation();
|
|
476
498
|
const target = e.target;
|
|
477
499
|
if (target.nodeType !== 1 || target.tagName === "HTML" || target.tagName === "BODY") {
|
|
500
|
+
this.clearHoverHighlight();
|
|
478
501
|
return;
|
|
479
502
|
}
|
|
480
503
|
const element = this._findHighlightableElement(target);
|
|
481
504
|
if (!element) {
|
|
505
|
+
this.clearHoverHighlight();
|
|
482
506
|
return;
|
|
483
507
|
}
|
|
484
508
|
if (this.currentHighlightedElements.includes(element) || this.selectedElement && this.selectedElement === element) {
|
|
485
509
|
return;
|
|
486
510
|
}
|
|
487
|
-
|
|
488
|
-
this.styleManager.unhighlightElements(this.currentHighlightedElements);
|
|
489
|
-
this.currentHighlightedElements = [];
|
|
490
|
-
}
|
|
511
|
+
this.clearHoverHighlight();
|
|
491
512
|
const allElements = findElementsBySourceLocation(getSourceFromDataAttributes(element));
|
|
492
|
-
this.
|
|
513
|
+
this.overlayManager.highlightElements(allElements);
|
|
493
514
|
this.currentHighlightedElements = allElements;
|
|
494
515
|
}
|
|
495
516
|
handleMouseLeave() {
|
|
496
517
|
if (!this.isInteractionsActive()) {
|
|
497
518
|
return;
|
|
498
519
|
}
|
|
499
|
-
|
|
500
|
-
|
|
520
|
+
this.clearHoverHighlight();
|
|
521
|
+
}
|
|
522
|
+
/**
|
|
523
|
+
* Remove the current hover highlight unless it belongs to the selected element.
|
|
524
|
+
*/
|
|
525
|
+
clearHoverHighlight() {
|
|
526
|
+
if (this.currentHighlightedElements.length > 0 && !this.selectedElements.includes(this.currentHighlightedElements[0])) {
|
|
527
|
+
this.overlayManager.unhighlightElements();
|
|
501
528
|
this.currentHighlightedElements = [];
|
|
502
529
|
}
|
|
503
530
|
}
|
|
@@ -519,27 +546,27 @@
|
|
|
519
546
|
return;
|
|
520
547
|
}
|
|
521
548
|
if (this.selectedElement) {
|
|
522
|
-
this.
|
|
549
|
+
this.overlayManager.deselectElements();
|
|
523
550
|
this.editableManager.removeEditable(this.selectedElement);
|
|
524
551
|
}
|
|
525
552
|
if (this.currentHighlightedElements.length > 0) {
|
|
526
|
-
this.
|
|
553
|
+
this.overlayManager.unhighlightElements();
|
|
527
554
|
this.currentHighlightedElements = [];
|
|
528
555
|
}
|
|
529
556
|
this.selectedElement = element;
|
|
530
557
|
const allElements = findElementsBySourceLocation(getSourceFromDataAttributes(element));
|
|
531
558
|
this.selectedElements = allElements;
|
|
532
|
-
this.
|
|
559
|
+
this.overlayManager.selectElements(allElements);
|
|
533
560
|
this.editableManager.makeEditableIfText(element);
|
|
534
561
|
this.communicationManager.notifyComponentSelected(element);
|
|
535
562
|
}
|
|
536
563
|
clearAll() {
|
|
537
564
|
if (this.currentHighlightedElements.length > 0) {
|
|
538
|
-
this.
|
|
565
|
+
this.overlayManager.unhighlightElements();
|
|
539
566
|
this.currentHighlightedElements = [];
|
|
540
567
|
}
|
|
541
568
|
if (this.selectedElement) {
|
|
542
|
-
this.
|
|
569
|
+
this.overlayManager.deselectElements();
|
|
543
570
|
this.editableManager.removeEditable(this.selectedElement);
|
|
544
571
|
this.selectedElement = null;
|
|
545
572
|
this.selectedElements = [];
|
|
@@ -550,92 +577,207 @@
|
|
|
550
577
|
}
|
|
551
578
|
};
|
|
552
579
|
|
|
553
|
-
// src/runtime/interactions/
|
|
554
|
-
var
|
|
580
|
+
// src/runtime/interactions/overlayManager.ts
|
|
581
|
+
var BORDER_WIDTH = 2;
|
|
582
|
+
var TAB_HEIGHT_ESTIMATE = 18;
|
|
583
|
+
var OVERLAY_Z_INDEX = 2147483647;
|
|
584
|
+
var COLOR_HOVER = "#005a9e";
|
|
585
|
+
var COLOR_SELECTED = "#c2410c";
|
|
586
|
+
var BORDER_INSET = BORDER_WIDTH / 2;
|
|
587
|
+
var raf = typeof requestAnimationFrame === "function" ? (cb) => requestAnimationFrame(cb) : (cb) => setTimeout(cb, 16);
|
|
588
|
+
var OverlayManager = class {
|
|
555
589
|
constructor() {
|
|
556
|
-
__publicField(this, "
|
|
557
|
-
__publicField(this, "
|
|
558
|
-
this
|
|
559
|
-
this
|
|
590
|
+
__publicField(this, "hostId");
|
|
591
|
+
__publicField(this, "host");
|
|
592
|
+
__publicField(this, "shadow");
|
|
593
|
+
__publicField(this, "hover");
|
|
594
|
+
__publicField(this, "selected");
|
|
595
|
+
__publicField(this, "repositionScheduled");
|
|
596
|
+
__publicField(this, "boundReposition");
|
|
597
|
+
this.hostId = "design-mode-overlay";
|
|
598
|
+
this.host = null;
|
|
599
|
+
this.shadow = null;
|
|
600
|
+
this.hover = { entries: /* @__PURE__ */ new Map() };
|
|
601
|
+
this.selected = { entries: /* @__PURE__ */ new Map() };
|
|
602
|
+
this.repositionScheduled = false;
|
|
603
|
+
this.boundReposition = this.scheduleReposition.bind(this);
|
|
560
604
|
}
|
|
561
605
|
/**
|
|
562
|
-
*
|
|
606
|
+
* Create the overlay host + shadow root and start tracking scroll/resize.
|
|
563
607
|
*/
|
|
564
|
-
|
|
565
|
-
if (this.
|
|
608
|
+
mountOverlay() {
|
|
609
|
+
if (this.host) {
|
|
566
610
|
return;
|
|
567
611
|
}
|
|
612
|
+
const host = document.createElement("div");
|
|
613
|
+
host.id = this.hostId;
|
|
614
|
+
host.style.cssText = "position:fixed;top:0;left:0;width:0;height:0;margin:0;padding:0;border:0;pointer-events:none;";
|
|
615
|
+
const shadow = host.attachShadow({ mode: "open" });
|
|
568
616
|
const style = document.createElement("style");
|
|
569
|
-
style.id = this.styleId;
|
|
570
617
|
style.textContent = this._getStyles();
|
|
571
|
-
|
|
572
|
-
|
|
618
|
+
shadow.appendChild(style);
|
|
619
|
+
document.documentElement.appendChild(host);
|
|
620
|
+
this.host = host;
|
|
621
|
+
this.shadow = shadow;
|
|
622
|
+
window.addEventListener("scroll", this.boundReposition, { capture: true, passive: true });
|
|
623
|
+
window.addEventListener("resize", this.boundReposition);
|
|
573
624
|
}
|
|
574
625
|
/**
|
|
575
|
-
*
|
|
626
|
+
* Tear down the overlay host and stop tracking scroll/resize.
|
|
576
627
|
*/
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
628
|
+
unmountOverlay() {
|
|
629
|
+
window.removeEventListener("scroll", this.boundReposition, true);
|
|
630
|
+
window.removeEventListener("resize", this.boundReposition);
|
|
631
|
+
this._clearLayer(this.hover);
|
|
632
|
+
this._clearLayer(this.selected);
|
|
633
|
+
this.host?.remove();
|
|
634
|
+
this.host = null;
|
|
635
|
+
this.shadow = null;
|
|
583
636
|
}
|
|
584
637
|
/**
|
|
585
|
-
*
|
|
586
|
-
*
|
|
587
|
-
*
|
|
638
|
+
* Shadow-root styles for the border box and tag tab. `:host { all: initial }`
|
|
639
|
+
* resets inherited properties (e.g. `text-transform`, `letter-spacing`) so the
|
|
640
|
+
* host app's typography never leaks into the tab.
|
|
588
641
|
*/
|
|
589
642
|
_getStyles() {
|
|
590
643
|
return `
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
}
|
|
598
|
-
.design-mode-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
position:
|
|
602
|
-
|
|
644
|
+
:host { all: initial; }
|
|
645
|
+
.design-mode-box {
|
|
646
|
+
position: fixed;
|
|
647
|
+
box-sizing: border-box;
|
|
648
|
+
pointer-events: none;
|
|
649
|
+
z-index: ${OVERLAY_Z_INDEX};
|
|
650
|
+
}
|
|
651
|
+
.design-mode-box.hover { border: ${BORDER_WIDTH}px solid ${COLOR_HOVER}; }
|
|
652
|
+
.design-mode-box.selected { border: ${BORDER_WIDTH}px solid ${COLOR_SELECTED}; }
|
|
653
|
+
.design-mode-tab {
|
|
654
|
+
position: fixed;
|
|
655
|
+
pointer-events: none;
|
|
656
|
+
z-index: ${OVERLAY_Z_INDEX};
|
|
657
|
+
white-space: nowrap;
|
|
658
|
+
width: auto;
|
|
659
|
+
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
|
|
660
|
+
font-size: 11px;
|
|
661
|
+
line-height: 1;
|
|
662
|
+
padding: 2px 6px;
|
|
663
|
+
color: #fff;
|
|
664
|
+
}
|
|
665
|
+
.design-mode-tab.hover { background: ${COLOR_HOVER}; }
|
|
666
|
+
.design-mode-tab.selected { background: ${COLOR_SELECTED}; }
|
|
603
667
|
`;
|
|
604
668
|
}
|
|
605
669
|
/**
|
|
606
|
-
*
|
|
607
|
-
* @param elements - The elements to highlight
|
|
670
|
+
* Show the hover overlay over `elements` — each gets a border box and tag tab.
|
|
608
671
|
*/
|
|
609
672
|
highlightElements(elements) {
|
|
610
|
-
|
|
611
|
-
el.classList.add("design-mode-highlight");
|
|
612
|
-
}
|
|
673
|
+
this._renderLayer(this.hover, "hover", elements);
|
|
613
674
|
}
|
|
614
675
|
/**
|
|
615
|
-
*
|
|
616
|
-
* @param elements - The elements to unhighlight
|
|
676
|
+
* Hide the hover overlay.
|
|
617
677
|
*/
|
|
618
|
-
unhighlightElements(
|
|
619
|
-
|
|
620
|
-
el.classList.remove("design-mode-highlight");
|
|
621
|
-
}
|
|
678
|
+
unhighlightElements() {
|
|
679
|
+
this._clearLayer(this.hover);
|
|
622
680
|
}
|
|
623
681
|
/**
|
|
624
|
-
*
|
|
625
|
-
* @param elements - The elements to select
|
|
682
|
+
* Show the selection overlay over `elements` — each gets a border box and tag tab.
|
|
626
683
|
*/
|
|
627
684
|
selectElements(elements) {
|
|
685
|
+
this._renderLayer(this.selected, "selected", elements);
|
|
686
|
+
}
|
|
687
|
+
/**
|
|
688
|
+
* Hide the selection overlay.
|
|
689
|
+
*/
|
|
690
|
+
deselectElements() {
|
|
691
|
+
this._clearLayer(this.selected);
|
|
692
|
+
}
|
|
693
|
+
_renderLayer(layer, kind, elements) {
|
|
694
|
+
if (!this.shadow) {
|
|
695
|
+
this.mountOverlay();
|
|
696
|
+
}
|
|
697
|
+
if (!this.shadow) {
|
|
698
|
+
return;
|
|
699
|
+
}
|
|
700
|
+
this._clearLayer(layer);
|
|
628
701
|
for (const el of elements) {
|
|
629
|
-
|
|
702
|
+
const box = document.createElement("div");
|
|
703
|
+
box.className = `design-mode-box ${kind}`;
|
|
704
|
+
const tab = document.createElement("div");
|
|
705
|
+
tab.className = `design-mode-tab ${kind}`;
|
|
706
|
+
tab.textContent = el.tagName.toLowerCase();
|
|
707
|
+
this.shadow.appendChild(box);
|
|
708
|
+
this.shadow.appendChild(tab);
|
|
709
|
+
layer.entries.set(el, { box, tab });
|
|
710
|
+
this._positionBox(box, el);
|
|
711
|
+
this._positionTab(tab, el);
|
|
712
|
+
}
|
|
713
|
+
}
|
|
714
|
+
_clearLayer(layer) {
|
|
715
|
+
for (const { box, tab } of layer.entries.values()) {
|
|
716
|
+
box.remove();
|
|
717
|
+
tab.remove();
|
|
718
|
+
}
|
|
719
|
+
layer.entries.clear();
|
|
720
|
+
}
|
|
721
|
+
/** True when the element's rect is fully outside the viewport (scrolled away). */
|
|
722
|
+
_isOffscreen(rect) {
|
|
723
|
+
return rect.bottom < 0 || rect.right < 0 || rect.top > window.innerHeight || rect.left > window.innerWidth;
|
|
724
|
+
}
|
|
725
|
+
_positionBox(box, el) {
|
|
726
|
+
const rect = el.getBoundingClientRect();
|
|
727
|
+
if (this._isOffscreen(rect)) {
|
|
728
|
+
box.style.display = "none";
|
|
729
|
+
return;
|
|
730
|
+
}
|
|
731
|
+
box.style.display = "";
|
|
732
|
+
box.style.top = `${rect.top - BORDER_INSET}px`;
|
|
733
|
+
box.style.left = `${rect.left - BORDER_INSET}px`;
|
|
734
|
+
box.style.width = `${rect.width + BORDER_INSET * 2}px`;
|
|
735
|
+
box.style.height = `${rect.height + BORDER_INSET * 2}px`;
|
|
736
|
+
}
|
|
737
|
+
_positionTab(tab, el) {
|
|
738
|
+
const rect = el.getBoundingClientRect();
|
|
739
|
+
if (this._isOffscreen(rect)) {
|
|
740
|
+
tab.style.display = "none";
|
|
741
|
+
return;
|
|
742
|
+
}
|
|
743
|
+
tab.style.display = "";
|
|
744
|
+
const tabHeight = tab.offsetHeight || TAB_HEIGHT_ESTIMATE;
|
|
745
|
+
const topAbove = rect.top - BORDER_INSET - tabHeight;
|
|
746
|
+
const flipBelow = topAbove < 0;
|
|
747
|
+
tab.style.top = flipBelow ? `${rect.bottom + BORDER_INSET}px` : `${topAbove}px`;
|
|
748
|
+
tab.style.borderRadius = flipBelow ? "0 0 2px 2px" : "2px 2px 0 0";
|
|
749
|
+
const tabWidth = tab.offsetWidth;
|
|
750
|
+
const leftAligned = rect.left - BORDER_INSET;
|
|
751
|
+
if (tabWidth > 0 && leftAligned + tabWidth > window.innerWidth) {
|
|
752
|
+
tab.style.left = `${rect.right + BORDER_INSET - tabWidth}px`;
|
|
753
|
+
} else {
|
|
754
|
+
tab.style.left = `${leftAligned}px`;
|
|
630
755
|
}
|
|
631
756
|
}
|
|
632
757
|
/**
|
|
633
|
-
*
|
|
634
|
-
*
|
|
758
|
+
* Recompute overlay geometry — call after a programmatic change (style/text/
|
|
759
|
+
* media edit) resizes or moves a highlighted element, since that does not fire
|
|
760
|
+
* scroll/resize. rAF-throttled and reads layout after the change is applied.
|
|
635
761
|
*/
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
762
|
+
reposition() {
|
|
763
|
+
this.scheduleReposition();
|
|
764
|
+
}
|
|
765
|
+
scheduleReposition() {
|
|
766
|
+
if (this.repositionScheduled) {
|
|
767
|
+
return;
|
|
768
|
+
}
|
|
769
|
+
this.repositionScheduled = true;
|
|
770
|
+
raf(() => {
|
|
771
|
+
this.repositionScheduled = false;
|
|
772
|
+
this._reposition();
|
|
773
|
+
});
|
|
774
|
+
}
|
|
775
|
+
_reposition() {
|
|
776
|
+
for (const layer of [this.hover, this.selected]) {
|
|
777
|
+
for (const [el, { box, tab }] of layer.entries) {
|
|
778
|
+
this._positionBox(box, el);
|
|
779
|
+
this._positionTab(tab, el);
|
|
780
|
+
}
|
|
639
781
|
}
|
|
640
782
|
}
|
|
641
783
|
};
|
|
@@ -665,7 +807,7 @@
|
|
|
665
807
|
__publicField(this, "enabled");
|
|
666
808
|
__publicField(this, "isActive");
|
|
667
809
|
__publicField(this, "componentMatcher");
|
|
668
|
-
__publicField(this, "
|
|
810
|
+
__publicField(this, "overlayManager");
|
|
669
811
|
__publicField(this, "communicationManager");
|
|
670
812
|
__publicField(this, "editableManager");
|
|
671
813
|
__publicField(this, "eventHandlers");
|
|
@@ -708,13 +850,16 @@
|
|
|
708
850
|
"img"
|
|
709
851
|
]
|
|
710
852
|
});
|
|
711
|
-
this.
|
|
853
|
+
this.overlayManager = new OverlayManager();
|
|
712
854
|
this.communicationManager = new CommunicationManager();
|
|
713
|
-
this.editableManager = new EditableManager(
|
|
855
|
+
this.editableManager = new EditableManager(
|
|
856
|
+
this.communicationManager,
|
|
857
|
+
() => this.overlayManager.reposition()
|
|
858
|
+
);
|
|
714
859
|
this.eventHandlers = new EventHandlers(
|
|
715
860
|
() => this.isActive,
|
|
716
861
|
this.componentMatcher,
|
|
717
|
-
this.
|
|
862
|
+
this.overlayManager,
|
|
718
863
|
this.editableManager,
|
|
719
864
|
this.communicationManager
|
|
720
865
|
);
|
|
@@ -728,9 +873,11 @@
|
|
|
728
873
|
return;
|
|
729
874
|
}
|
|
730
875
|
console.log("Initializing Design Mode Interactions...");
|
|
731
|
-
this.
|
|
876
|
+
this.overlayManager.mountOverlay();
|
|
732
877
|
document.addEventListener("mouseover", this.eventHandlers.handleMouseOver);
|
|
733
878
|
document.addEventListener("mouseleave", this.eventHandlers.handleMouseLeave);
|
|
879
|
+
document.addEventListener("pointerdown", this.eventHandlers.handlePointerDown, true);
|
|
880
|
+
document.addEventListener("mousedown", this.eventHandlers.handlePointerDown, true);
|
|
734
881
|
document.addEventListener("click", this.eventHandlers.handleClick, true);
|
|
735
882
|
console.log("Design Mode Interactions initialized!");
|
|
736
883
|
this.communicationManager.notifyInitializationComplete();
|
|
@@ -767,11 +914,13 @@
|
|
|
767
914
|
for (const el of this.resolveTargets(sourceLocation)) {
|
|
768
915
|
el.style[property] = value;
|
|
769
916
|
}
|
|
917
|
+
this.overlayManager.reposition();
|
|
770
918
|
}
|
|
771
919
|
applyTextChange(text, sourceLocation) {
|
|
772
920
|
for (const el of this.resolveTargets(sourceLocation)) {
|
|
773
921
|
el.textContent = text;
|
|
774
922
|
}
|
|
923
|
+
this.overlayManager.reposition();
|
|
775
924
|
}
|
|
776
925
|
/**
|
|
777
926
|
* Apply attribute changes to all elements at the given source location whose
|
|
@@ -797,6 +946,7 @@
|
|
|
797
946
|
if (el.tagName !== tagNameUpper) continue;
|
|
798
947
|
applier(el, attributes);
|
|
799
948
|
}
|
|
949
|
+
this.overlayManager.reposition();
|
|
800
950
|
}
|
|
801
951
|
/**
|
|
802
952
|
* Cleanup and remove event listeners
|
|
@@ -804,8 +954,10 @@
|
|
|
804
954
|
destroy() {
|
|
805
955
|
document.removeEventListener("mouseover", this.eventHandlers.handleMouseOver);
|
|
806
956
|
document.removeEventListener("mouseleave", this.eventHandlers.handleMouseLeave);
|
|
957
|
+
document.removeEventListener("pointerdown", this.eventHandlers.handlePointerDown, true);
|
|
958
|
+
document.removeEventListener("mousedown", this.eventHandlers.handlePointerDown, true);
|
|
807
959
|
document.removeEventListener("click", this.eventHandlers.handleClick, true);
|
|
808
|
-
this.
|
|
960
|
+
this.overlayManager.unmountOverlay();
|
|
809
961
|
this.eventHandlers.clearAll();
|
|
810
962
|
}
|
|
811
963
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"communicationManager.d.ts","sourceRoot":"","sources":["../../../src/runtime/interactions/communicationManager.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAQH,OAAO,EAIN,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;
|
|
1
|
+
{"version":3,"file":"communicationManager.d.ts","sourceRoot":"","sources":["../../../src/runtime/interactions/communicationManager.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAQH,OAAO,EAIN,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;CAepC"}
|
|
@@ -10,11 +10,17 @@ interface CommunicationManagerLike {
|
|
|
10
10
|
export declare const TEXT_TAGS: readonly string[];
|
|
11
11
|
export declare class EditableManager {
|
|
12
12
|
private communicationManager?;
|
|
13
|
+
private onContentChange?;
|
|
13
14
|
private boundHandleBlur;
|
|
14
15
|
private boundHandleKeydown;
|
|
15
16
|
private boundHandleInput;
|
|
16
17
|
private editableGroup;
|
|
17
|
-
|
|
18
|
+
/**
|
|
19
|
+
* @param onContentChange - Called whenever editing changes an element's
|
|
20
|
+
* content (live typing, blur, Escape revert), so the caller can recompute
|
|
21
|
+
* anything tied to the element's size — e.g. the selection overlay.
|
|
22
|
+
*/
|
|
23
|
+
constructor(communicationManager?: CommunicationManagerLike, onContentChange?: () => void);
|
|
18
24
|
makeEditableIfText(element: HTMLElement): void;
|
|
19
25
|
removeEditable(element: HTMLElement): void;
|
|
20
26
|
private _isTextElement;
|
|
@@ -10,11 +10,17 @@ interface CommunicationManagerLike {
|
|
|
10
10
|
export declare const TEXT_TAGS: readonly string[];
|
|
11
11
|
export declare class EditableManager {
|
|
12
12
|
private communicationManager?;
|
|
13
|
+
private onContentChange?;
|
|
13
14
|
private boundHandleBlur;
|
|
14
15
|
private boundHandleKeydown;
|
|
15
16
|
private boundHandleInput;
|
|
16
17
|
private editableGroup;
|
|
17
|
-
|
|
18
|
+
/**
|
|
19
|
+
* @param onContentChange - Called whenever editing changes an element's
|
|
20
|
+
* content (live typing, blur, Escape revert), so the caller can recompute
|
|
21
|
+
* anything tied to the element's size — e.g. the selection overlay.
|
|
22
|
+
*/
|
|
23
|
+
constructor(communicationManager?: CommunicationManagerLike, onContentChange?: () => void);
|
|
18
24
|
makeEditableIfText(element: HTMLElement): void;
|
|
19
25
|
removeEditable(element: HTMLElement): void;
|
|
20
26
|
private _isTextElement;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editableManager.d.ts","sourceRoot":"","sources":["../../../src/runtime/interactions/editableManager.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAWH,UAAU,wBAAwB;IACjC,gBAAgB,EAAE,CAAC,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CACxF;AAED,yGAAyG;AACzG,eAAO,MAAM,SAAS,mBAAwB,CAAC;AAE/C,qBAAa,eAAe;IAC3B,OAAO,CAAC,oBAAoB,CAAC,CAA2B;IACxD,OAAO,CAAC,eAAe,CAAqB;IAC5C,OAAO,CAAC,kBAAkB,CAA6B;IACvD,OAAO,CAAC,gBAAgB,CAAqB;IAC7C,OAAO,CAAC,aAAa,CAAgB;
|
|
1
|
+
{"version":3,"file":"editableManager.d.ts","sourceRoot":"","sources":["../../../src/runtime/interactions/editableManager.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAWH,UAAU,wBAAwB;IACjC,gBAAgB,EAAE,CAAC,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CACxF;AAED,yGAAyG;AACzG,eAAO,MAAM,SAAS,mBAAwB,CAAC;AAE/C,qBAAa,eAAe;IAC3B,OAAO,CAAC,oBAAoB,CAAC,CAA2B;IACxD,OAAO,CAAC,eAAe,CAAC,CAAa;IACrC,OAAO,CAAC,eAAe,CAAqB;IAC5C,OAAO,CAAC,kBAAkB,CAA6B;IACvD,OAAO,CAAC,gBAAgB,CAAqB;IAC7C,OAAO,CAAC,aAAa,CAAgB;IAErC;;;;OAIG;gBACS,oBAAoB,CAAC,EAAE,wBAAwB,EAAE,eAAe,CAAC,EAAE,MAAM,IAAI;IASzF,kBAAkB,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI;IAoB9C,cAAc,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI;IAe1C,OAAO,CAAC,cAAc;IAQtB,OAAO,CAAC,YAAY;IAUpB,OAAO,CAAC,WAAW;IAkBnB,OAAO,CAAC,cAAc;CAmBtB"}
|
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
interface ComponentMatcherLike {
|
|
7
7
|
findHighlightableElement: (target: HTMLElement) => HTMLElement | null;
|
|
8
8
|
}
|
|
9
|
-
interface
|
|
9
|
+
interface OverlayManagerLike {
|
|
10
10
|
highlightElements: (elements: HTMLElement[]) => void;
|
|
11
|
-
unhighlightElements: (
|
|
11
|
+
unhighlightElements: () => void;
|
|
12
12
|
selectElements: (elements: HTMLElement[]) => void;
|
|
13
|
-
deselectElements: (
|
|
13
|
+
deselectElements: () => void;
|
|
14
14
|
}
|
|
15
15
|
interface EditableManagerLike {
|
|
16
16
|
makeEditableIfText: (element: HTMLElement) => void;
|
|
@@ -22,16 +22,28 @@ interface CommunicationManagerLike {
|
|
|
22
22
|
export declare class EventHandlers {
|
|
23
23
|
private isInteractionsActive;
|
|
24
24
|
private componentMatcher;
|
|
25
|
-
private
|
|
25
|
+
private overlayManager;
|
|
26
26
|
private editableManager;
|
|
27
27
|
private communicationManager;
|
|
28
28
|
private currentHighlightedElements;
|
|
29
29
|
private selectedElement;
|
|
30
30
|
private selectedElements;
|
|
31
|
-
constructor(isInteractionsActive: () => boolean, componentMatcher: ComponentMatcherLike,
|
|
31
|
+
constructor(isInteractionsActive: () => boolean, componentMatcher: ComponentMatcherLike, overlayManager: OverlayManagerLike, editableManager: EditableManagerLike, communicationManager: CommunicationManagerLike);
|
|
32
|
+
/**
|
|
33
|
+
* Swallow pointer/mouse-down so the previewed app cannot react to it (e.g.
|
|
34
|
+
* Radix opens dropdowns on `pointerdown`, before our `click` handler runs).
|
|
35
|
+
* In design mode the app is inspected, not driven; selection still happens on
|
|
36
|
+
* `click`. Exception: events inside the element being inline-text-edited pass
|
|
37
|
+
* through so the caret can be placed.
|
|
38
|
+
*/
|
|
39
|
+
handlePointerDown(e: Event): void;
|
|
32
40
|
private _findHighlightableElement;
|
|
33
41
|
handleMouseOver(e: MouseEvent): void;
|
|
34
42
|
handleMouseLeave(): void;
|
|
43
|
+
/**
|
|
44
|
+
* Remove the current hover highlight unless it belongs to the selected element.
|
|
45
|
+
*/
|
|
46
|
+
private clearHoverHighlight;
|
|
35
47
|
handleClick(e: MouseEvent): void;
|
|
36
48
|
clearAll(): void;
|
|
37
49
|
getSelectedElement(): HTMLElement | null;
|
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
interface ComponentMatcherLike {
|
|
7
7
|
findHighlightableElement: (target: HTMLElement) => HTMLElement | null;
|
|
8
8
|
}
|
|
9
|
-
interface
|
|
9
|
+
interface OverlayManagerLike {
|
|
10
10
|
highlightElements: (elements: HTMLElement[]) => void;
|
|
11
|
-
unhighlightElements: (
|
|
11
|
+
unhighlightElements: () => void;
|
|
12
12
|
selectElements: (elements: HTMLElement[]) => void;
|
|
13
|
-
deselectElements: (
|
|
13
|
+
deselectElements: () => void;
|
|
14
14
|
}
|
|
15
15
|
interface EditableManagerLike {
|
|
16
16
|
makeEditableIfText: (element: HTMLElement) => void;
|
|
@@ -22,16 +22,28 @@ interface CommunicationManagerLike {
|
|
|
22
22
|
export declare class EventHandlers {
|
|
23
23
|
private isInteractionsActive;
|
|
24
24
|
private componentMatcher;
|
|
25
|
-
private
|
|
25
|
+
private overlayManager;
|
|
26
26
|
private editableManager;
|
|
27
27
|
private communicationManager;
|
|
28
28
|
private currentHighlightedElements;
|
|
29
29
|
private selectedElement;
|
|
30
30
|
private selectedElements;
|
|
31
|
-
constructor(isInteractionsActive: () => boolean, componentMatcher: ComponentMatcherLike,
|
|
31
|
+
constructor(isInteractionsActive: () => boolean, componentMatcher: ComponentMatcherLike, overlayManager: OverlayManagerLike, editableManager: EditableManagerLike, communicationManager: CommunicationManagerLike);
|
|
32
|
+
/**
|
|
33
|
+
* Swallow pointer/mouse-down so the previewed app cannot react to it (e.g.
|
|
34
|
+
* Radix opens dropdowns on `pointerdown`, before our `click` handler runs).
|
|
35
|
+
* In design mode the app is inspected, not driven; selection still happens on
|
|
36
|
+
* `click`. Exception: events inside the element being inline-text-edited pass
|
|
37
|
+
* through so the caret can be placed.
|
|
38
|
+
*/
|
|
39
|
+
handlePointerDown(e: Event): void;
|
|
32
40
|
private _findHighlightableElement;
|
|
33
41
|
handleMouseOver(e: MouseEvent): void;
|
|
34
42
|
handleMouseLeave(): void;
|
|
43
|
+
/**
|
|
44
|
+
* Remove the current hover highlight unless it belongs to the selected element.
|
|
45
|
+
*/
|
|
46
|
+
private clearHoverHighlight;
|
|
35
47
|
handleClick(e: MouseEvent): void;
|
|
36
48
|
clearAll(): void;
|
|
37
49
|
getSelectedElement(): HTMLElement | null;
|
|
@@ -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,
|
|
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,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;IA+ChC,QAAQ,IAAI,IAAI;IAchB,kBAAkB,IAAI,WAAW,GAAG,IAAI;CAGxC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interactionsController.d.ts","sourceRoot":"","sources":["../../../src/runtime/interactions/interactionsController.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAYH,OAAO,EAGN,KAAK,cAAc,EACnB,MAAM,qBAAqB,CAAC;AAuC7B,qBAAa,sBAAsB;IAClC,OAAO,CAAC,OAAO,CAAU;IACzB,OAAO,CAAC,QAAQ,CAAU;IAE1B,OAAO,CAAC,gBAAgB,CAAmB;IAC3C,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"interactionsController.d.ts","sourceRoot":"","sources":["../../../src/runtime/interactions/interactionsController.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAYH,OAAO,EAGN,KAAK,cAAc,EACnB,MAAM,qBAAqB,CAAC;AAuC7B,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;IAoBlB;;OAEG;IACH,MAAM,IAAI,IAAI;IAKd;;OAEG;IACH,OAAO,IAAI,IAAI;IAMf,OAAO,CAAC,cAAc;IAWtB;;;;OAIG;IACH,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,cAAc,GAAG,IAAI;IAOxF,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"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026, Salesforce, Inc.,
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
* For full license text, see the LICENSE.txt file
|
|
5
|
+
*/
|
|
6
|
+
export declare class OverlayManager {
|
|
7
|
+
private hostId;
|
|
8
|
+
private host;
|
|
9
|
+
private shadow;
|
|
10
|
+
private hover;
|
|
11
|
+
private selected;
|
|
12
|
+
private repositionScheduled;
|
|
13
|
+
private boundReposition;
|
|
14
|
+
constructor();
|
|
15
|
+
/**
|
|
16
|
+
* Create the overlay host + shadow root and start tracking scroll/resize.
|
|
17
|
+
*/
|
|
18
|
+
mountOverlay(): void;
|
|
19
|
+
/**
|
|
20
|
+
* Tear down the overlay host and stop tracking scroll/resize.
|
|
21
|
+
*/
|
|
22
|
+
unmountOverlay(): void;
|
|
23
|
+
/**
|
|
24
|
+
* Shadow-root styles for the border box and tag tab. `:host { all: initial }`
|
|
25
|
+
* resets inherited properties (e.g. `text-transform`, `letter-spacing`) so the
|
|
26
|
+
* host app's typography never leaks into the tab.
|
|
27
|
+
*/
|
|
28
|
+
private _getStyles;
|
|
29
|
+
/**
|
|
30
|
+
* Show the hover overlay over `elements` — each gets a border box and tag tab.
|
|
31
|
+
*/
|
|
32
|
+
highlightElements(elements: HTMLElement[]): void;
|
|
33
|
+
/**
|
|
34
|
+
* Hide the hover overlay.
|
|
35
|
+
*/
|
|
36
|
+
unhighlightElements(): void;
|
|
37
|
+
/**
|
|
38
|
+
* Show the selection overlay over `elements` — each gets a border box and tag tab.
|
|
39
|
+
*/
|
|
40
|
+
selectElements(elements: HTMLElement[]): void;
|
|
41
|
+
/**
|
|
42
|
+
* Hide the selection overlay.
|
|
43
|
+
*/
|
|
44
|
+
deselectElements(): void;
|
|
45
|
+
private _renderLayer;
|
|
46
|
+
private _clearLayer;
|
|
47
|
+
/** True when the element's rect is fully outside the viewport (scrolled away). */
|
|
48
|
+
private _isOffscreen;
|
|
49
|
+
private _positionBox;
|
|
50
|
+
private _positionTab;
|
|
51
|
+
/**
|
|
52
|
+
* Recompute overlay geometry — call after a programmatic change (style/text/
|
|
53
|
+
* media edit) resizes or moves a highlighted element, since that does not fire
|
|
54
|
+
* scroll/resize. rAF-throttled and reads layout after the change is applied.
|
|
55
|
+
*/
|
|
56
|
+
reposition(): void;
|
|
57
|
+
private scheduleReposition;
|
|
58
|
+
private _reposition;
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=overlayManager.d.ts.map
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026, Salesforce, Inc.,
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
* For full license text, see the LICENSE.txt file
|
|
5
|
+
*/
|
|
6
|
+
export declare class OverlayManager {
|
|
7
|
+
private hostId;
|
|
8
|
+
private host;
|
|
9
|
+
private shadow;
|
|
10
|
+
private hover;
|
|
11
|
+
private selected;
|
|
12
|
+
private repositionScheduled;
|
|
13
|
+
private boundReposition;
|
|
14
|
+
constructor();
|
|
15
|
+
/**
|
|
16
|
+
* Create the overlay host + shadow root and start tracking scroll/resize.
|
|
17
|
+
*/
|
|
18
|
+
mountOverlay(): void;
|
|
19
|
+
/**
|
|
20
|
+
* Tear down the overlay host and stop tracking scroll/resize.
|
|
21
|
+
*/
|
|
22
|
+
unmountOverlay(): void;
|
|
23
|
+
/**
|
|
24
|
+
* Shadow-root styles for the border box and tag tab. `:host { all: initial }`
|
|
25
|
+
* resets inherited properties (e.g. `text-transform`, `letter-spacing`) so the
|
|
26
|
+
* host app's typography never leaks into the tab.
|
|
27
|
+
*/
|
|
28
|
+
private _getStyles;
|
|
29
|
+
/**
|
|
30
|
+
* Show the hover overlay over `elements` — each gets a border box and tag tab.
|
|
31
|
+
*/
|
|
32
|
+
highlightElements(elements: HTMLElement[]): void;
|
|
33
|
+
/**
|
|
34
|
+
* Hide the hover overlay.
|
|
35
|
+
*/
|
|
36
|
+
unhighlightElements(): void;
|
|
37
|
+
/**
|
|
38
|
+
* Show the selection overlay over `elements` — each gets a border box and tag tab.
|
|
39
|
+
*/
|
|
40
|
+
selectElements(elements: HTMLElement[]): void;
|
|
41
|
+
/**
|
|
42
|
+
* Hide the selection overlay.
|
|
43
|
+
*/
|
|
44
|
+
deselectElements(): void;
|
|
45
|
+
private _renderLayer;
|
|
46
|
+
private _clearLayer;
|
|
47
|
+
/** True when the element's rect is fully outside the viewport (scrolled away). */
|
|
48
|
+
private _isOffscreen;
|
|
49
|
+
private _positionBox;
|
|
50
|
+
private _positionTab;
|
|
51
|
+
/**
|
|
52
|
+
* Recompute overlay geometry — call after a programmatic change (style/text/
|
|
53
|
+
* media edit) resizes or moves a highlighted element, since that does not fire
|
|
54
|
+
* scroll/resize. rAF-throttled and reads layout after the change is applied.
|
|
55
|
+
*/
|
|
56
|
+
reposition(): void;
|
|
57
|
+
private scheduleReposition;
|
|
58
|
+
private _reposition;
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=overlayManager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"overlayManager.d.ts","sourceRoot":"","sources":["../../../src/runtime/interactions/overlayManager.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAuCH,qBAAa,cAAc;IAC1B,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,IAAI,CAAqB;IACjC,OAAO,CAAC,MAAM,CAAoB;IAClC,OAAO,CAAC,KAAK,CAAe;IAC5B,OAAO,CAAC,QAAQ,CAAe;IAC/B,OAAO,CAAC,mBAAmB,CAAU;IACrC,OAAO,CAAC,eAAe,CAAa;;IAYpC;;OAEG;IACH,YAAY,IAAI,IAAI;IAyBpB;;OAEG;IACH,cAAc,IAAI,IAAI;IAYtB;;;;OAIG;IACH,OAAO,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,OAAO,CAAC,YAAY;IAapB,OAAO,CAAC,YAAY;IA6BpB;;;;OAIG;IACH,UAAU,IAAI,IAAI;IAIlB,OAAO,CAAC,kBAAkB;IAW1B,OAAO,CAAC,WAAW;CAQnB"}
|
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": "10.
|
|
4
|
+
"version": "10.14.1",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"exports": {
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2026, Salesforce, Inc.,
|
|
3
|
-
* All rights reserved.
|
|
4
|
-
* For full license text, see the LICENSE.txt file
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* Style Manager Module
|
|
8
|
-
* Handles CSS injection and style management for highlighting
|
|
9
|
-
*/
|
|
10
|
-
export declare class StyleManager {
|
|
11
|
-
private styleId;
|
|
12
|
-
private stylesAdded;
|
|
13
|
-
constructor();
|
|
14
|
-
/**
|
|
15
|
-
* Add CSS styles for highlighting to the document
|
|
16
|
-
*/
|
|
17
|
-
addHighlightStyles(): void;
|
|
18
|
-
/**
|
|
19
|
-
* Remove highlight styles from the document
|
|
20
|
-
*/
|
|
21
|
-
removeHighlightStyles(): void;
|
|
22
|
-
/**
|
|
23
|
-
* Get the CSS styles for highlighting
|
|
24
|
-
* @private
|
|
25
|
-
* @returns CSS styles
|
|
26
|
-
*/
|
|
27
|
-
private _getStyles;
|
|
28
|
-
/**
|
|
29
|
-
* Apply highlight class to one or more elements
|
|
30
|
-
* @param elements - The elements to highlight
|
|
31
|
-
*/
|
|
32
|
-
highlightElements(elements: HTMLElement[]): void;
|
|
33
|
-
/**
|
|
34
|
-
* Remove highlight class from one or more elements
|
|
35
|
-
* @param elements - The elements to unhighlight
|
|
36
|
-
*/
|
|
37
|
-
unhighlightElements(elements: HTMLElement[]): void;
|
|
38
|
-
/**
|
|
39
|
-
* Apply selected class to one or more elements
|
|
40
|
-
* @param elements - The elements to select
|
|
41
|
-
*/
|
|
42
|
-
selectElements(elements: HTMLElement[]): void;
|
|
43
|
-
/**
|
|
44
|
-
* Remove selected class from one or more elements
|
|
45
|
-
* @param elements - The elements to deselect
|
|
46
|
-
*/
|
|
47
|
-
deselectElements(elements: HTMLElement[]): void;
|
|
48
|
-
}
|
|
49
|
-
//# sourceMappingURL=styleManager.d.ts.map
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2026, Salesforce, Inc.,
|
|
3
|
-
* All rights reserved.
|
|
4
|
-
* For full license text, see the LICENSE.txt file
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* Style Manager Module
|
|
8
|
-
* Handles CSS injection and style management for highlighting
|
|
9
|
-
*/
|
|
10
|
-
export declare class StyleManager {
|
|
11
|
-
private styleId;
|
|
12
|
-
private stylesAdded;
|
|
13
|
-
constructor();
|
|
14
|
-
/**
|
|
15
|
-
* Add CSS styles for highlighting to the document
|
|
16
|
-
*/
|
|
17
|
-
addHighlightStyles(): void;
|
|
18
|
-
/**
|
|
19
|
-
* Remove highlight styles from the document
|
|
20
|
-
*/
|
|
21
|
-
removeHighlightStyles(): void;
|
|
22
|
-
/**
|
|
23
|
-
* Get the CSS styles for highlighting
|
|
24
|
-
* @private
|
|
25
|
-
* @returns CSS styles
|
|
26
|
-
*/
|
|
27
|
-
private _getStyles;
|
|
28
|
-
/**
|
|
29
|
-
* Apply highlight class to one or more elements
|
|
30
|
-
* @param elements - The elements to highlight
|
|
31
|
-
*/
|
|
32
|
-
highlightElements(elements: HTMLElement[]): void;
|
|
33
|
-
/**
|
|
34
|
-
* Remove highlight class from one or more elements
|
|
35
|
-
* @param elements - The elements to unhighlight
|
|
36
|
-
*/
|
|
37
|
-
unhighlightElements(elements: HTMLElement[]): void;
|
|
38
|
-
/**
|
|
39
|
-
* Apply selected class to one or more elements
|
|
40
|
-
* @param elements - The elements to select
|
|
41
|
-
*/
|
|
42
|
-
selectElements(elements: HTMLElement[]): void;
|
|
43
|
-
/**
|
|
44
|
-
* Remove selected class from one or more elements
|
|
45
|
-
* @param elements - The elements to deselect
|
|
46
|
-
*/
|
|
47
|
-
deselectElements(elements: HTMLElement[]): void;
|
|
48
|
-
}
|
|
49
|
-
//# sourceMappingURL=styleManager.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"styleManager.d.ts","sourceRoot":"","sources":["../../../src/runtime/interactions/styleManager.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;GAGG;AAEH,qBAAa,YAAY;IACxB,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,WAAW,CAAU;;IAO7B;;OAEG;IACH,kBAAkB,IAAI,IAAI;IAY1B;;OAEG;IACH,qBAAqB,IAAI,IAAI;IAQ7B;;;;OAIG;IACH,OAAO,CAAC,UAAU;IAiBlB;;;OAGG;IACH,iBAAiB,CAAC,QAAQ,EAAE,WAAW,EAAE,GAAG,IAAI;IAMhD;;;OAGG;IACH,mBAAmB,CAAC,QAAQ,EAAE,WAAW,EAAE,GAAG,IAAI;IAMlD;;;OAGG;IACH,cAAc,CAAC,QAAQ,EAAE,WAAW,EAAE,GAAG,IAAI;IAM7C;;;OAGG;IACH,gBAAgB,CAAC,QAAQ,EAAE,WAAW,EAAE,GAAG,IAAI;CAK/C"}
|