@salesforce/webapp-experimental 1.66.0 → 1.67.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/design/design-mode-interactions.js +91 -26
- package/dist/design/interactions/componentMatcher.d.ts +7 -0
- package/dist/design/interactions/componentMatcher.d.ts.map +1 -1
- package/dist/design/interactions/componentMatcher.js +24 -1
- package/dist/design/interactions/eventHandlers.d.ts +12 -4
- package/dist/design/interactions/eventHandlers.d.ts.map +1 -1
- package/dist/design/interactions/eventHandlers.js +43 -11
- package/dist/design/interactions/interactionsController.d.ts.map +1 -1
- package/dist/design/interactions/interactionsController.js +3 -0
- package/dist/design/interactions/styleManager.d.ts +12 -12
- package/dist/design/interactions/styleManager.d.ts.map +1 -1
- package/dist/design/interactions/styleManager.js +24 -16
- package/package.json +2 -2
|
@@ -233,6 +233,28 @@
|
|
|
233
233
|
}
|
|
234
234
|
return true;
|
|
235
235
|
}
|
|
236
|
+
/**
|
|
237
|
+
* Find all same elements that share the same data-source-file value.
|
|
238
|
+
* These are elements rendered by the same component at the same source location.
|
|
239
|
+
* @param element - The reference element
|
|
240
|
+
* @returns Array of same elements (excludes the element itself)
|
|
241
|
+
*/
|
|
242
|
+
findSameElements(element) {
|
|
243
|
+
const sourceFile = element.getAttribute("data-source-file");
|
|
244
|
+
if (!sourceFile) {
|
|
245
|
+
return [];
|
|
246
|
+
}
|
|
247
|
+
const all = document.querySelectorAll(
|
|
248
|
+
`[data-source-file="${CSS.escape(sourceFile)}"]`
|
|
249
|
+
);
|
|
250
|
+
const sameElements = [];
|
|
251
|
+
for (const el of all) {
|
|
252
|
+
if (el !== element) {
|
|
253
|
+
sameElements.push(el);
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
return sameElements;
|
|
257
|
+
}
|
|
236
258
|
/**
|
|
237
259
|
* Find the nearest highlightable element by walking up the DOM tree
|
|
238
260
|
* @param target - The target element
|
|
@@ -243,7 +265,7 @@
|
|
|
243
265
|
return null;
|
|
244
266
|
}
|
|
245
267
|
const closest = typeof target.closest === "function" ? target.closest("[data-source-file]") : null;
|
|
246
|
-
if (closest && closest !== document.body && closest !== document.documentElement) {
|
|
268
|
+
if (closest && closest !== document.body && closest !== document.documentElement && this.isHighlightableElement(closest)) {
|
|
247
269
|
return closest;
|
|
248
270
|
}
|
|
249
271
|
let current = target;
|
|
@@ -349,14 +371,18 @@
|
|
|
349
371
|
__publicField(this, "editableManager");
|
|
350
372
|
__publicField(this, "communicationManager");
|
|
351
373
|
__publicField(this, "currentHighlighted");
|
|
374
|
+
__publicField(this, "currentHighlightedSameElements");
|
|
352
375
|
__publicField(this, "selectedElement");
|
|
376
|
+
__publicField(this, "selectedSameElements");
|
|
353
377
|
this.isInteractionsActive = isInteractionsActive;
|
|
354
378
|
this.componentMatcher = componentMatcher;
|
|
355
379
|
this.styleManager = styleManager;
|
|
356
380
|
this.editableManager = editableManager;
|
|
357
381
|
this.communicationManager = communicationManager;
|
|
358
382
|
this.currentHighlighted = null;
|
|
383
|
+
this.currentHighlightedSameElements = [];
|
|
359
384
|
this.selectedElement = null;
|
|
385
|
+
this.selectedSameElements = [];
|
|
360
386
|
this.handleMouseOver = this.handleMouseOver.bind(this);
|
|
361
387
|
this.handleMouseLeave = this.handleMouseLeave.bind(this);
|
|
362
388
|
this.handleClick = this.handleClick.bind(this);
|
|
@@ -390,10 +416,16 @@
|
|
|
390
416
|
return;
|
|
391
417
|
}
|
|
392
418
|
if (this.currentHighlighted && !this.currentHighlighted.classList.contains("design-mode-selected")) {
|
|
393
|
-
this.styleManager.
|
|
394
|
-
|
|
395
|
-
|
|
419
|
+
this.styleManager.unhighlightElements([
|
|
420
|
+
this.currentHighlighted,
|
|
421
|
+
...this.currentHighlightedSameElements
|
|
422
|
+
]);
|
|
423
|
+
this.currentHighlightedSameElements = [];
|
|
424
|
+
}
|
|
425
|
+
const sameElements = this.componentMatcher.findSameElements(element);
|
|
426
|
+
this.styleManager.highlightElements([element, ...sameElements]);
|
|
396
427
|
this.currentHighlighted = element;
|
|
428
|
+
this.currentHighlightedSameElements = sameElements;
|
|
397
429
|
}
|
|
398
430
|
/**
|
|
399
431
|
* Handle mouseleave event
|
|
@@ -403,8 +435,12 @@
|
|
|
403
435
|
return;
|
|
404
436
|
}
|
|
405
437
|
if (this.currentHighlighted && !this.currentHighlighted.classList.contains("design-mode-selected")) {
|
|
406
|
-
this.styleManager.
|
|
438
|
+
this.styleManager.unhighlightElements([
|
|
439
|
+
this.currentHighlighted,
|
|
440
|
+
...this.currentHighlightedSameElements
|
|
441
|
+
]);
|
|
407
442
|
this.currentHighlighted = null;
|
|
443
|
+
this.currentHighlightedSameElements = [];
|
|
408
444
|
}
|
|
409
445
|
}
|
|
410
446
|
/**
|
|
@@ -429,15 +465,21 @@
|
|
|
429
465
|
return;
|
|
430
466
|
}
|
|
431
467
|
if (this.selectedElement) {
|
|
432
|
-
this.styleManager.
|
|
468
|
+
this.styleManager.deselectElements([this.selectedElement, ...this.selectedSameElements]);
|
|
433
469
|
this.editableManager.removeEditable(this.selectedElement);
|
|
434
470
|
}
|
|
435
471
|
if (this.currentHighlighted) {
|
|
436
|
-
this.styleManager.
|
|
472
|
+
this.styleManager.unhighlightElements([
|
|
473
|
+
this.currentHighlighted,
|
|
474
|
+
...this.currentHighlightedSameElements
|
|
475
|
+
]);
|
|
437
476
|
this.currentHighlighted = null;
|
|
477
|
+
this.currentHighlightedSameElements = [];
|
|
438
478
|
}
|
|
439
479
|
this.selectedElement = element;
|
|
440
|
-
this.
|
|
480
|
+
const sameElements = this.componentMatcher.findSameElements(element);
|
|
481
|
+
this.selectedSameElements = sameElements;
|
|
482
|
+
this.styleManager.selectElements([element, ...sameElements]);
|
|
441
483
|
this.editableManager.makeEditableIfText(element);
|
|
442
484
|
this.communicationManager.notifyComponentSelected(element);
|
|
443
485
|
}
|
|
@@ -446,13 +488,18 @@
|
|
|
446
488
|
*/
|
|
447
489
|
clearAll() {
|
|
448
490
|
if (this.currentHighlighted) {
|
|
449
|
-
this.styleManager.
|
|
491
|
+
this.styleManager.unhighlightElements([
|
|
492
|
+
this.currentHighlighted,
|
|
493
|
+
...this.currentHighlightedSameElements
|
|
494
|
+
]);
|
|
450
495
|
this.currentHighlighted = null;
|
|
496
|
+
this.currentHighlightedSameElements = [];
|
|
451
497
|
}
|
|
452
498
|
if (this.selectedElement) {
|
|
453
|
-
this.styleManager.
|
|
499
|
+
this.styleManager.deselectElements([this.selectedElement, ...this.selectedSameElements]);
|
|
454
500
|
this.editableManager.removeEditable(this.selectedElement);
|
|
455
501
|
this.selectedElement = null;
|
|
502
|
+
this.selectedSameElements = [];
|
|
456
503
|
}
|
|
457
504
|
}
|
|
458
505
|
/**
|
|
@@ -462,6 +509,13 @@
|
|
|
462
509
|
getSelectedElement() {
|
|
463
510
|
return this.selectedElement;
|
|
464
511
|
}
|
|
512
|
+
/**
|
|
513
|
+
* Get the same elements of the currently selected element
|
|
514
|
+
* @returns Array of same elements
|
|
515
|
+
*/
|
|
516
|
+
getSelectedSameElements() {
|
|
517
|
+
return this.selectedSameElements;
|
|
518
|
+
}
|
|
465
519
|
};
|
|
466
520
|
|
|
467
521
|
// src/design/interactions/styleManager.ts
|
|
@@ -517,32 +571,40 @@
|
|
|
517
571
|
`;
|
|
518
572
|
}
|
|
519
573
|
/**
|
|
520
|
-
* Apply highlight class to
|
|
521
|
-
* @param
|
|
574
|
+
* Apply highlight class to one or more elements
|
|
575
|
+
* @param elements - The elements to highlight
|
|
522
576
|
*/
|
|
523
|
-
|
|
524
|
-
|
|
577
|
+
highlightElements(elements) {
|
|
578
|
+
for (const el of elements) {
|
|
579
|
+
el.classList.add("design-mode-highlight");
|
|
580
|
+
}
|
|
525
581
|
}
|
|
526
582
|
/**
|
|
527
|
-
* Remove highlight class from
|
|
528
|
-
* @param
|
|
583
|
+
* Remove highlight class from one or more elements
|
|
584
|
+
* @param elements - The elements to unhighlight
|
|
529
585
|
*/
|
|
530
|
-
|
|
531
|
-
|
|
586
|
+
unhighlightElements(elements) {
|
|
587
|
+
for (const el of elements) {
|
|
588
|
+
el.classList.remove("design-mode-highlight");
|
|
589
|
+
}
|
|
532
590
|
}
|
|
533
591
|
/**
|
|
534
|
-
* Apply selected class to
|
|
535
|
-
* @param
|
|
592
|
+
* Apply selected class to one or more elements
|
|
593
|
+
* @param elements - The elements to select
|
|
536
594
|
*/
|
|
537
|
-
|
|
538
|
-
|
|
595
|
+
selectElements(elements) {
|
|
596
|
+
for (const el of elements) {
|
|
597
|
+
el.classList.add("design-mode-selected");
|
|
598
|
+
}
|
|
539
599
|
}
|
|
540
600
|
/**
|
|
541
|
-
* Remove selected class from
|
|
542
|
-
* @param
|
|
601
|
+
* Remove selected class from one or more elements
|
|
602
|
+
* @param elements - The elements to deselect
|
|
543
603
|
*/
|
|
544
|
-
|
|
545
|
-
|
|
604
|
+
deselectElements(elements) {
|
|
605
|
+
for (const el of elements) {
|
|
606
|
+
el.classList.remove("design-mode-selected");
|
|
607
|
+
}
|
|
546
608
|
}
|
|
547
609
|
};
|
|
548
610
|
|
|
@@ -646,6 +708,9 @@
|
|
|
646
708
|
const selectedElement = this.eventHandlers.getSelectedElement();
|
|
647
709
|
if (selectedElement) {
|
|
648
710
|
selectedElement.style[property] = value;
|
|
711
|
+
for (const sameElement of this.eventHandlers.getSelectedSameElements()) {
|
|
712
|
+
sameElement.style[property] = value;
|
|
713
|
+
}
|
|
649
714
|
}
|
|
650
715
|
}
|
|
651
716
|
/**
|
|
@@ -33,6 +33,13 @@ export declare class ComponentMatcher {
|
|
|
33
33
|
* @returns True if the element should be highlighted
|
|
34
34
|
*/
|
|
35
35
|
isHighlightableElement(element: HTMLElement | null | undefined): boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Find all same elements that share the same data-source-file value.
|
|
38
|
+
* These are elements rendered by the same component at the same source location.
|
|
39
|
+
* @param element - The reference element
|
|
40
|
+
* @returns Array of same elements (excludes the element itself)
|
|
41
|
+
*/
|
|
42
|
+
findSameElements(element: HTMLElement): HTMLElement[];
|
|
36
43
|
/**
|
|
37
44
|
* Find the nearest highlightable element by walking up the DOM tree
|
|
38
45
|
* @param target - The target element
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"componentMatcher.d.ts","sourceRoot":"","sources":["../../../src/design/interactions/componentMatcher.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;GAGG;AAEH,MAAM,WAAW,uBAAuB;IAEvC,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;CACrB;AAED,qBAAa,gBAAgB;IAC5B,OAAO,CAAC,SAAS,CAAW;gBAEhB,OAAO,GAAE,uBAA4B;IAIjD;;;;OAIG;IACH,iBAAiB,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO;IAOnE,OAAO,CAAC,WAAW;IAInB;;;;;OAKG;IACH,oBAAoB,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO;IAM7D;;;;OAIG;IACH,sBAAsB,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO;IAgBxE;;;;OAIG;IACH,wBAAwB,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI,GAAG,SAAS,GAAG,WAAW,GAAG,IAAI;
|
|
1
|
+
{"version":3,"file":"componentMatcher.d.ts","sourceRoot":"","sources":["../../../src/design/interactions/componentMatcher.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;GAGG;AAEH,MAAM,WAAW,uBAAuB;IAEvC,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;CACrB;AAED,qBAAa,gBAAgB;IAC5B,OAAO,CAAC,SAAS,CAAW;gBAEhB,OAAO,GAAE,uBAA4B;IAIjD;;;;OAIG;IACH,iBAAiB,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO;IAOnE,OAAO,CAAC,WAAW;IAInB;;;;;OAKG;IACH,oBAAoB,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO;IAM7D;;;;OAIG;IACH,sBAAsB,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO;IAgBxE;;;;;OAKG;IACH,gBAAgB,CAAC,OAAO,EAAE,WAAW,GAAG,WAAW,EAAE;IAmBrD;;;;OAIG;IACH,wBAAwB,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI,GAAG,SAAS,GAAG,WAAW,GAAG,IAAI;CA+BpF"}
|
|
@@ -48,6 +48,26 @@ export class ComponentMatcher {
|
|
|
48
48
|
}
|
|
49
49
|
return true;
|
|
50
50
|
}
|
|
51
|
+
/**
|
|
52
|
+
* Find all same elements that share the same data-source-file value.
|
|
53
|
+
* These are elements rendered by the same component at the same source location.
|
|
54
|
+
* @param element - The reference element
|
|
55
|
+
* @returns Array of same elements (excludes the element itself)
|
|
56
|
+
*/
|
|
57
|
+
findSameElements(element) {
|
|
58
|
+
const sourceFile = element.getAttribute("data-source-file");
|
|
59
|
+
if (!sourceFile) {
|
|
60
|
+
return [];
|
|
61
|
+
}
|
|
62
|
+
const all = document.querySelectorAll(`[data-source-file="${CSS.escape(sourceFile)}"]`);
|
|
63
|
+
const sameElements = [];
|
|
64
|
+
for (const el of all) {
|
|
65
|
+
if (el !== element) {
|
|
66
|
+
sameElements.push(el);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return sameElements;
|
|
70
|
+
}
|
|
51
71
|
/**
|
|
52
72
|
* Find the nearest highlightable element by walking up the DOM tree
|
|
53
73
|
* @param target - The target element
|
|
@@ -61,7 +81,10 @@ export class ComponentMatcher {
|
|
|
61
81
|
const closest = typeof target.closest === "function"
|
|
62
82
|
? target.closest("[data-source-file]")
|
|
63
83
|
: null;
|
|
64
|
-
if (closest &&
|
|
84
|
+
if (closest &&
|
|
85
|
+
closest !== document.body &&
|
|
86
|
+
closest !== document.documentElement &&
|
|
87
|
+
this.isHighlightableElement(closest)) {
|
|
65
88
|
return closest;
|
|
66
89
|
}
|
|
67
90
|
// Fallback: manual walk.
|
|
@@ -9,12 +9,13 @@
|
|
|
9
9
|
*/
|
|
10
10
|
interface ComponentMatcherLike {
|
|
11
11
|
findHighlightableElement: (target: HTMLElement) => HTMLElement | null;
|
|
12
|
+
findSameElements: (element: HTMLElement) => HTMLElement[];
|
|
12
13
|
}
|
|
13
14
|
interface StyleManagerLike {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
highlightElements: (elements: HTMLElement[]) => void;
|
|
16
|
+
unhighlightElements: (elements: HTMLElement[]) => void;
|
|
17
|
+
selectElements: (elements: HTMLElement[]) => void;
|
|
18
|
+
deselectElements: (elements: HTMLElement[]) => void;
|
|
18
19
|
}
|
|
19
20
|
interface EditableManagerLike {
|
|
20
21
|
makeEditableIfText: (element: HTMLElement) => void;
|
|
@@ -30,7 +31,9 @@ export declare class EventHandlers {
|
|
|
30
31
|
private editableManager;
|
|
31
32
|
private communicationManager;
|
|
32
33
|
private currentHighlighted;
|
|
34
|
+
private currentHighlightedSameElements;
|
|
33
35
|
private selectedElement;
|
|
36
|
+
private selectedSameElements;
|
|
34
37
|
constructor(isInteractionsActive: () => boolean, componentMatcher: ComponentMatcherLike, styleManager: StyleManagerLike, editableManager: EditableManagerLike, communicationManager: CommunicationManagerLike);
|
|
35
38
|
/**
|
|
36
39
|
* Find the nearest highlightable element by walking up the DOM tree
|
|
@@ -61,6 +64,11 @@ export declare class EventHandlers {
|
|
|
61
64
|
* @returns The selected element
|
|
62
65
|
*/
|
|
63
66
|
getSelectedElement(): HTMLElement | null;
|
|
67
|
+
/**
|
|
68
|
+
* Get the same elements of the currently selected element
|
|
69
|
+
* @returns Array of same elements
|
|
70
|
+
*/
|
|
71
|
+
getSelectedSameElements(): HTMLElement[];
|
|
64
72
|
}
|
|
65
73
|
export {};
|
|
66
74
|
//# sourceMappingURL=eventHandlers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eventHandlers.d.ts","sourceRoot":"","sources":["../../../src/design/interactions/eventHandlers.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;GAGG;AAEH,UAAU,oBAAoB;IAC7B,wBAAwB,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,WAAW,GAAG,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"eventHandlers.d.ts","sourceRoot":"","sources":["../../../src/design/interactions/eventHandlers.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;GAGG;AAEH,UAAU,oBAAoB;IAC7B,wBAAwB,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,WAAW,GAAG,IAAI,CAAC;IACtE,gBAAgB,EAAE,CAAC,OAAO,EAAE,WAAW,KAAK,WAAW,EAAE,CAAC;CAC1D;AAED,UAAU,gBAAgB;IACzB,iBAAiB,EAAE,CAAC,QAAQ,EAAE,WAAW,EAAE,KAAK,IAAI,CAAC;IACrD,mBAAmB,EAAE,CAAC,QAAQ,EAAE,WAAW,EAAE,KAAK,IAAI,CAAC;IACvD,cAAc,EAAE,CAAC,QAAQ,EAAE,WAAW,EAAE,KAAK,IAAI,CAAC;IAClD,gBAAgB,EAAE,CAAC,QAAQ,EAAE,WAAW,EAAE,KAAK,IAAI,CAAC;CACpD;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,YAAY,CAAmB;IACvC,OAAO,CAAC,eAAe,CAAsB;IAC7C,OAAO,CAAC,oBAAoB,CAA2B;IAEvD,OAAO,CAAC,kBAAkB,CAAqB;IAC/C,OAAO,CAAC,8BAA8B,CAAgB;IACtD,OAAO,CAAC,eAAe,CAAqB;IAC5C,OAAO,CAAC,oBAAoB,CAAgB;gBAG3C,oBAAoB,EAAE,MAAM,OAAO,EACnC,gBAAgB,EAAE,oBAAoB,EACtC,YAAY,EAAE,gBAAgB,EAC9B,eAAe,EAAE,mBAAmB,EACpC,oBAAoB,EAAE,wBAAwB;IAmB/C;;;;OAIG;IACH,OAAO,CAAC,yBAAyB;IAIjC;;;OAGG;IACH,eAAe,CAAC,CAAC,EAAE,UAAU,GAAG,IAAI;IAyCpC;;OAEG;IACH,gBAAgB,IAAI,IAAI;IAkBxB;;;OAGG;IACH,WAAW,CAAC,CAAC,EAAE,UAAU,GAAG,IAAI;IAmDhC;;OAEG;IACH,QAAQ,IAAI,IAAI;IAkBhB;;;OAGG;IACH,kBAAkB,IAAI,WAAW,GAAG,IAAI;IAIxC;;;OAGG;IACH,uBAAuB,IAAI,WAAW,EAAE;CAGxC"}
|
|
@@ -10,7 +10,9 @@ export class EventHandlers {
|
|
|
10
10
|
editableManager;
|
|
11
11
|
communicationManager;
|
|
12
12
|
currentHighlighted;
|
|
13
|
+
currentHighlightedSameElements;
|
|
13
14
|
selectedElement;
|
|
15
|
+
selectedSameElements;
|
|
14
16
|
constructor(isInteractionsActive, componentMatcher, styleManager, editableManager, communicationManager) {
|
|
15
17
|
this.isInteractionsActive = isInteractionsActive;
|
|
16
18
|
this.componentMatcher = componentMatcher;
|
|
@@ -18,7 +20,9 @@ export class EventHandlers {
|
|
|
18
20
|
this.editableManager = editableManager;
|
|
19
21
|
this.communicationManager = communicationManager;
|
|
20
22
|
this.currentHighlighted = null;
|
|
23
|
+
this.currentHighlightedSameElements = [];
|
|
21
24
|
this.selectedElement = null;
|
|
25
|
+
this.selectedSameElements = [];
|
|
22
26
|
// Bind methods to preserve 'this' context
|
|
23
27
|
this.handleMouseOver = this.handleMouseOver.bind(this);
|
|
24
28
|
this.handleMouseLeave = this.handleMouseLeave.bind(this);
|
|
@@ -55,10 +59,16 @@ export class EventHandlers {
|
|
|
55
59
|
}
|
|
56
60
|
if (this.currentHighlighted &&
|
|
57
61
|
!this.currentHighlighted.classList.contains("design-mode-selected")) {
|
|
58
|
-
this.styleManager.
|
|
62
|
+
this.styleManager.unhighlightElements([
|
|
63
|
+
this.currentHighlighted,
|
|
64
|
+
...this.currentHighlightedSameElements,
|
|
65
|
+
]);
|
|
66
|
+
this.currentHighlightedSameElements = [];
|
|
59
67
|
}
|
|
60
|
-
this.
|
|
68
|
+
const sameElements = this.componentMatcher.findSameElements(element);
|
|
69
|
+
this.styleManager.highlightElements([element, ...sameElements]);
|
|
61
70
|
this.currentHighlighted = element;
|
|
71
|
+
this.currentHighlightedSameElements = sameElements;
|
|
62
72
|
}
|
|
63
73
|
/**
|
|
64
74
|
* Handle mouseleave event
|
|
@@ -69,8 +79,12 @@ export class EventHandlers {
|
|
|
69
79
|
}
|
|
70
80
|
if (this.currentHighlighted &&
|
|
71
81
|
!this.currentHighlighted.classList.contains("design-mode-selected")) {
|
|
72
|
-
this.styleManager.
|
|
82
|
+
this.styleManager.unhighlightElements([
|
|
83
|
+
this.currentHighlighted,
|
|
84
|
+
...this.currentHighlightedSameElements,
|
|
85
|
+
]);
|
|
73
86
|
this.currentHighlighted = null;
|
|
87
|
+
this.currentHighlightedSameElements = [];
|
|
74
88
|
}
|
|
75
89
|
}
|
|
76
90
|
/**
|
|
@@ -94,19 +108,25 @@ export class EventHandlers {
|
|
|
94
108
|
if (this.selectedElement && this.selectedElement === element) {
|
|
95
109
|
return;
|
|
96
110
|
}
|
|
97
|
-
// Deselect previous element
|
|
111
|
+
// Deselect previous element and its same elements
|
|
98
112
|
if (this.selectedElement) {
|
|
99
|
-
this.styleManager.
|
|
113
|
+
this.styleManager.deselectElements([this.selectedElement, ...this.selectedSameElements]);
|
|
100
114
|
this.editableManager.removeEditable(this.selectedElement);
|
|
101
115
|
}
|
|
102
|
-
// Remove highlight from current highlighted
|
|
116
|
+
// Remove highlight from current highlighted and its same elements
|
|
103
117
|
if (this.currentHighlighted) {
|
|
104
|
-
this.styleManager.
|
|
118
|
+
this.styleManager.unhighlightElements([
|
|
119
|
+
this.currentHighlighted,
|
|
120
|
+
...this.currentHighlightedSameElements,
|
|
121
|
+
]);
|
|
105
122
|
this.currentHighlighted = null;
|
|
123
|
+
this.currentHighlightedSameElements = [];
|
|
106
124
|
}
|
|
107
|
-
// Select new element
|
|
125
|
+
// Select new element and its same elements
|
|
108
126
|
this.selectedElement = element;
|
|
109
|
-
this.
|
|
127
|
+
const sameElements = this.componentMatcher.findSameElements(element);
|
|
128
|
+
this.selectedSameElements = sameElements;
|
|
129
|
+
this.styleManager.selectElements([element, ...sameElements]);
|
|
110
130
|
// Make text elements editable
|
|
111
131
|
this.editableManager.makeEditableIfText(element);
|
|
112
132
|
// Notify extension
|
|
@@ -117,13 +137,18 @@ export class EventHandlers {
|
|
|
117
137
|
*/
|
|
118
138
|
clearAll() {
|
|
119
139
|
if (this.currentHighlighted) {
|
|
120
|
-
this.styleManager.
|
|
140
|
+
this.styleManager.unhighlightElements([
|
|
141
|
+
this.currentHighlighted,
|
|
142
|
+
...this.currentHighlightedSameElements,
|
|
143
|
+
]);
|
|
121
144
|
this.currentHighlighted = null;
|
|
145
|
+
this.currentHighlightedSameElements = [];
|
|
122
146
|
}
|
|
123
147
|
if (this.selectedElement) {
|
|
124
|
-
this.styleManager.
|
|
148
|
+
this.styleManager.deselectElements([this.selectedElement, ...this.selectedSameElements]);
|
|
125
149
|
this.editableManager.removeEditable(this.selectedElement);
|
|
126
150
|
this.selectedElement = null;
|
|
151
|
+
this.selectedSameElements = [];
|
|
127
152
|
}
|
|
128
153
|
}
|
|
129
154
|
/**
|
|
@@ -133,4 +158,11 @@ export class EventHandlers {
|
|
|
133
158
|
getSelectedElement() {
|
|
134
159
|
return this.selectedElement;
|
|
135
160
|
}
|
|
161
|
+
/**
|
|
162
|
+
* Get the same elements of the currently selected element
|
|
163
|
+
* @returns Array of same elements
|
|
164
|
+
*/
|
|
165
|
+
getSelectedSameElements() {
|
|
166
|
+
return this.selectedSameElements;
|
|
167
|
+
}
|
|
136
168
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interactionsController.d.ts","sourceRoot":"","sources":["../../../src/design/interactions/interactionsController.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAaH,qBAAa,sBAAsB;IAClC,OAAO,CAAC,OAAO,CAAU;IACzB,OAAO,CAAC,QAAQ,CAAU;IAE1B,OAAO,CAAC,gBAAgB,CAAmB;IAC3C,OAAO,CAAC,YAAY,CAAe;IACnC,OAAO,CAAC,oBAAoB,CAAuB;IACnD,OAAO,CAAC,eAAe,CAAkB;IACzC,OAAO,CAAC,aAAa,CAAgB;gBAEzB,OAAO,UAAO;IAwD1B;;OAEG;IACH,UAAU,IAAI,IAAI;IAiBlB;;OAEG;IACH,MAAM,IAAI,IAAI;IAKd;;OAEG;IACH,OAAO,IAAI,IAAI;IAMf;;;;OAIG;IACH,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;
|
|
1
|
+
{"version":3,"file":"interactionsController.d.ts","sourceRoot":"","sources":["../../../src/design/interactions/interactionsController.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAaH,qBAAa,sBAAsB;IAClC,OAAO,CAAC,OAAO,CAAU;IACzB,OAAO,CAAC,QAAQ,CAAU;IAE1B,OAAO,CAAC,gBAAgB,CAAmB;IAC3C,OAAO,CAAC,YAAY,CAAe;IACnC,OAAO,CAAC,oBAAoB,CAAuB;IACnD,OAAO,CAAC,eAAe,CAAkB;IACzC,OAAO,CAAC,aAAa,CAAgB;gBAEzB,OAAO,UAAO;IAwD1B;;OAEG;IACH,UAAU,IAAI,IAAI;IAiBlB;;OAEG;IACH,MAAM,IAAI,IAAI;IAKd;;OAEG;IACH,OAAO,IAAI,IAAI;IAMf;;;;OAIG;IACH,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;IAWvD;;OAEG;IACH,OAAO,IAAI,IAAI;CAOf"}
|
|
@@ -107,6 +107,9 @@ export class InteractionsController {
|
|
|
107
107
|
const selectedElement = this.eventHandlers.getSelectedElement();
|
|
108
108
|
if (selectedElement) {
|
|
109
109
|
selectedElement.style[property] = value;
|
|
110
|
+
for (const sameElement of this.eventHandlers.getSelectedSameElements()) {
|
|
111
|
+
sameElement.style[property] = value;
|
|
112
|
+
}
|
|
110
113
|
}
|
|
111
114
|
}
|
|
112
115
|
/**
|
|
@@ -26,24 +26,24 @@ export declare class StyleManager {
|
|
|
26
26
|
*/
|
|
27
27
|
private _getStyles;
|
|
28
28
|
/**
|
|
29
|
-
* Apply highlight class to
|
|
30
|
-
* @param
|
|
29
|
+
* Apply highlight class to one or more elements
|
|
30
|
+
* @param elements - The elements to highlight
|
|
31
31
|
*/
|
|
32
|
-
|
|
32
|
+
highlightElements(elements: HTMLElement[]): void;
|
|
33
33
|
/**
|
|
34
|
-
* Remove highlight class from
|
|
35
|
-
* @param
|
|
34
|
+
* Remove highlight class from one or more elements
|
|
35
|
+
* @param elements - The elements to unhighlight
|
|
36
36
|
*/
|
|
37
|
-
|
|
37
|
+
unhighlightElements(elements: HTMLElement[]): void;
|
|
38
38
|
/**
|
|
39
|
-
* Apply selected class to
|
|
40
|
-
* @param
|
|
39
|
+
* Apply selected class to one or more elements
|
|
40
|
+
* @param elements - The elements to select
|
|
41
41
|
*/
|
|
42
|
-
|
|
42
|
+
selectElements(elements: HTMLElement[]): void;
|
|
43
43
|
/**
|
|
44
|
-
* Remove selected class from
|
|
45
|
-
* @param
|
|
44
|
+
* Remove selected class from one or more elements
|
|
45
|
+
* @param elements - The elements to deselect
|
|
46
46
|
*/
|
|
47
|
-
|
|
47
|
+
deselectElements(elements: HTMLElement[]): void;
|
|
48
48
|
}
|
|
49
49
|
//# sourceMappingURL=styleManager.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styleManager.d.ts","sourceRoot":"","sources":["../../../src/design/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,
|
|
1
|
+
{"version":3,"file":"styleManager.d.ts","sourceRoot":"","sources":["../../../src/design/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"}
|
|
@@ -59,31 +59,39 @@ export class StyleManager {
|
|
|
59
59
|
`;
|
|
60
60
|
}
|
|
61
61
|
/**
|
|
62
|
-
* Apply highlight class to
|
|
63
|
-
* @param
|
|
62
|
+
* Apply highlight class to one or more elements
|
|
63
|
+
* @param elements - The elements to highlight
|
|
64
64
|
*/
|
|
65
|
-
|
|
66
|
-
|
|
65
|
+
highlightElements(elements) {
|
|
66
|
+
for (const el of elements) {
|
|
67
|
+
el.classList.add("design-mode-highlight");
|
|
68
|
+
}
|
|
67
69
|
}
|
|
68
70
|
/**
|
|
69
|
-
* Remove highlight class from
|
|
70
|
-
* @param
|
|
71
|
+
* Remove highlight class from one or more elements
|
|
72
|
+
* @param elements - The elements to unhighlight
|
|
71
73
|
*/
|
|
72
|
-
|
|
73
|
-
|
|
74
|
+
unhighlightElements(elements) {
|
|
75
|
+
for (const el of elements) {
|
|
76
|
+
el.classList.remove("design-mode-highlight");
|
|
77
|
+
}
|
|
74
78
|
}
|
|
75
79
|
/**
|
|
76
|
-
* Apply selected class to
|
|
77
|
-
* @param
|
|
80
|
+
* Apply selected class to one or more elements
|
|
81
|
+
* @param elements - The elements to select
|
|
78
82
|
*/
|
|
79
|
-
|
|
80
|
-
|
|
83
|
+
selectElements(elements) {
|
|
84
|
+
for (const el of elements) {
|
|
85
|
+
el.classList.add("design-mode-selected");
|
|
86
|
+
}
|
|
81
87
|
}
|
|
82
88
|
/**
|
|
83
|
-
* Remove selected class from
|
|
84
|
-
* @param
|
|
89
|
+
* Remove selected class from one or more elements
|
|
90
|
+
* @param elements - The elements to deselect
|
|
85
91
|
*/
|
|
86
|
-
|
|
87
|
-
|
|
92
|
+
deselectElements(elements) {
|
|
93
|
+
for (const el of elements) {
|
|
94
|
+
el.classList.remove("design-mode-selected");
|
|
95
|
+
}
|
|
88
96
|
}
|
|
89
97
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/webapp-experimental",
|
|
3
3
|
"description": "[experimental] Core package for Salesforce Web Applications",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.67.0",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "./dist/index.js",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"@salesforce/core": "^8.23.4",
|
|
48
|
-
"@salesforce/sdk-data": "^1.
|
|
48
|
+
"@salesforce/sdk-data": "^1.67.0",
|
|
49
49
|
"axios": "^1.7.7",
|
|
50
50
|
"micromatch": "^4.0.8",
|
|
51
51
|
"path-to-regexp": "^8.3.0"
|