@salesforce/webapp-experimental 1.56.1 → 1.57.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 +51 -2
- package/dist/design/interactions/componentMatcher.d.ts +6 -0
- package/dist/design/interactions/componentMatcher.d.ts.map +1 -1
- package/dist/design/interactions/componentMatcher.js +14 -5
- package/dist/design/interactions/interactionsController.d.ts.map +1 -1
- package/dist/design/interactions/interactionsController.js +37 -1
- package/package.json +3 -3
|
@@ -189,6 +189,10 @@
|
|
|
189
189
|
|
|
190
190
|
// src/design/interactions/componentMatcher.ts
|
|
191
191
|
var ComponentMatcher = class {
|
|
192
|
+
constructor(options = {}) {
|
|
193
|
+
__publicField(this, "allowlist");
|
|
194
|
+
this.allowlist = options.allowlist ?? [];
|
|
195
|
+
}
|
|
192
196
|
/**
|
|
193
197
|
* Check whether an element contains compile-time source metadata attributes.
|
|
194
198
|
* @param element - The element to check
|
|
@@ -200,6 +204,9 @@
|
|
|
200
204
|
}
|
|
201
205
|
return element.hasAttribute("data-source-file");
|
|
202
206
|
}
|
|
207
|
+
matchesList(element, selectors) {
|
|
208
|
+
return selectors.some((selector) => element.matches(selector));
|
|
209
|
+
}
|
|
203
210
|
/**
|
|
204
211
|
* Checks if a label represents a component name (not a fallback like tag name, ID, or text content)
|
|
205
212
|
* @param label - The label to check
|
|
@@ -218,7 +225,13 @@
|
|
|
218
225
|
if (!element || element === document.body || element === document.documentElement) {
|
|
219
226
|
return false;
|
|
220
227
|
}
|
|
221
|
-
|
|
228
|
+
if (!this.hasSourceMetadata(element)) {
|
|
229
|
+
return false;
|
|
230
|
+
}
|
|
231
|
+
if (this.allowlist.length > 0) {
|
|
232
|
+
return this.matchesList(element, this.allowlist);
|
|
233
|
+
}
|
|
234
|
+
return true;
|
|
222
235
|
}
|
|
223
236
|
/**
|
|
224
237
|
* Find the nearest highlightable element by walking up the DOM tree
|
|
@@ -545,7 +558,43 @@
|
|
|
545
558
|
__publicField(this, "eventHandlers");
|
|
546
559
|
this.enabled = enabled;
|
|
547
560
|
this.isActive = false;
|
|
548
|
-
this.componentMatcher = new ComponentMatcher(
|
|
561
|
+
this.componentMatcher = new ComponentMatcher({
|
|
562
|
+
allowlist: [
|
|
563
|
+
"div",
|
|
564
|
+
"p",
|
|
565
|
+
"span",
|
|
566
|
+
"h1",
|
|
567
|
+
"h2",
|
|
568
|
+
"h3",
|
|
569
|
+
"h4",
|
|
570
|
+
"h5",
|
|
571
|
+
"h6",
|
|
572
|
+
"a",
|
|
573
|
+
"button",
|
|
574
|
+
"input",
|
|
575
|
+
"select",
|
|
576
|
+
"textarea",
|
|
577
|
+
"label",
|
|
578
|
+
"section",
|
|
579
|
+
"article",
|
|
580
|
+
"main",
|
|
581
|
+
"aside",
|
|
582
|
+
"header",
|
|
583
|
+
"footer",
|
|
584
|
+
"nav",
|
|
585
|
+
"figure",
|
|
586
|
+
"figcaption",
|
|
587
|
+
"ul",
|
|
588
|
+
"ol",
|
|
589
|
+
"li",
|
|
590
|
+
"table",
|
|
591
|
+
"tr",
|
|
592
|
+
"td",
|
|
593
|
+
"th",
|
|
594
|
+
"blockquote",
|
|
595
|
+
"img"
|
|
596
|
+
]
|
|
597
|
+
});
|
|
549
598
|
this.styleManager = new StyleManager();
|
|
550
599
|
this.communicationManager = new CommunicationManager();
|
|
551
600
|
this.editableManager = new EditableManager(this.communicationManager);
|
|
@@ -7,13 +7,19 @@
|
|
|
7
7
|
* Component Matcher Module
|
|
8
8
|
* Handles mapping DOM elements to source-locatable elements (data-source-*).
|
|
9
9
|
*/
|
|
10
|
+
export interface ComponentMatcherOptions {
|
|
11
|
+
allowlist?: string[];
|
|
12
|
+
}
|
|
10
13
|
export declare class ComponentMatcher {
|
|
14
|
+
private allowlist;
|
|
15
|
+
constructor(options?: ComponentMatcherOptions);
|
|
11
16
|
/**
|
|
12
17
|
* Check whether an element contains compile-time source metadata attributes.
|
|
13
18
|
* @param element - The element to check
|
|
14
19
|
* @returns True if the data-source-file attribute is present
|
|
15
20
|
*/
|
|
16
21
|
hasSourceMetadata(element: HTMLElement | null | undefined): boolean;
|
|
22
|
+
private matchesList;
|
|
17
23
|
/**
|
|
18
24
|
* Checks if a label represents a component name (not a fallback like tag name, ID, or text content)
|
|
19
25
|
* @param label - The label to check
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"componentMatcher.d.ts","sourceRoot":"","sources":["../../../src/design/interactions/componentMatcher.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;GAGG;AAEH,qBAAa,gBAAgB;IAC5B;;;;OAIG;IACH,iBAAiB,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO;IAOnE;;;;;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;
|
|
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;CA0BpF"}
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
* All rights reserved.
|
|
4
4
|
* For full license text, see the LICENSE.txt file
|
|
5
5
|
*/
|
|
6
|
-
/**
|
|
7
|
-
* Component Matcher Module
|
|
8
|
-
* Handles mapping DOM elements to source-locatable elements (data-source-*).
|
|
9
|
-
*/
|
|
10
6
|
export class ComponentMatcher {
|
|
7
|
+
allowlist;
|
|
8
|
+
constructor(options = {}) {
|
|
9
|
+
this.allowlist = options.allowlist ?? [];
|
|
10
|
+
}
|
|
11
11
|
/**
|
|
12
12
|
* Check whether an element contains compile-time source metadata attributes.
|
|
13
13
|
* @param element - The element to check
|
|
@@ -19,6 +19,9 @@ export class ComponentMatcher {
|
|
|
19
19
|
}
|
|
20
20
|
return element.hasAttribute("data-source-file");
|
|
21
21
|
}
|
|
22
|
+
matchesList(element, selectors) {
|
|
23
|
+
return selectors.some((selector) => element.matches(selector));
|
|
24
|
+
}
|
|
22
25
|
/**
|
|
23
26
|
* Checks if a label represents a component name (not a fallback like tag name, ID, or text content)
|
|
24
27
|
* @param label - The label to check
|
|
@@ -37,7 +40,13 @@ export class ComponentMatcher {
|
|
|
37
40
|
if (!element || element === document.body || element === document.documentElement) {
|
|
38
41
|
return false;
|
|
39
42
|
}
|
|
40
|
-
|
|
43
|
+
if (!this.hasSourceMetadata(element)) {
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
if (this.allowlist.length > 0) {
|
|
47
|
+
return this.matchesList(element, this.allowlist);
|
|
48
|
+
}
|
|
49
|
+
return true;
|
|
41
50
|
}
|
|
42
51
|
/**
|
|
43
52
|
* Find the nearest highlightable element by walking up the DOM tree
|
|
@@ -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;
|
|
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;IAOvD;;OAEG;IACH,OAAO,IAAI,IAAI;CAOf"}
|
|
@@ -24,7 +24,43 @@ export class InteractionsController {
|
|
|
24
24
|
this.enabled = enabled;
|
|
25
25
|
this.isActive = false;
|
|
26
26
|
// Initialize modules
|
|
27
|
-
this.componentMatcher = new ComponentMatcher(
|
|
27
|
+
this.componentMatcher = new ComponentMatcher({
|
|
28
|
+
allowlist: [
|
|
29
|
+
"div",
|
|
30
|
+
"p",
|
|
31
|
+
"span",
|
|
32
|
+
"h1",
|
|
33
|
+
"h2",
|
|
34
|
+
"h3",
|
|
35
|
+
"h4",
|
|
36
|
+
"h5",
|
|
37
|
+
"h6",
|
|
38
|
+
"a",
|
|
39
|
+
"button",
|
|
40
|
+
"input",
|
|
41
|
+
"select",
|
|
42
|
+
"textarea",
|
|
43
|
+
"label",
|
|
44
|
+
"section",
|
|
45
|
+
"article",
|
|
46
|
+
"main",
|
|
47
|
+
"aside",
|
|
48
|
+
"header",
|
|
49
|
+
"footer",
|
|
50
|
+
"nav",
|
|
51
|
+
"figure",
|
|
52
|
+
"figcaption",
|
|
53
|
+
"ul",
|
|
54
|
+
"ol",
|
|
55
|
+
"li",
|
|
56
|
+
"table",
|
|
57
|
+
"tr",
|
|
58
|
+
"td",
|
|
59
|
+
"th",
|
|
60
|
+
"blockquote",
|
|
61
|
+
"img",
|
|
62
|
+
],
|
|
63
|
+
});
|
|
28
64
|
this.styleManager = new StyleManager();
|
|
29
65
|
this.communicationManager = new CommunicationManager();
|
|
30
66
|
this.editableManager = new EditableManager(this.communicationManager);
|
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.57.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.57.0",
|
|
49
49
|
"axios": "^1.7.7",
|
|
50
50
|
"micromatch": "^4.0.8",
|
|
51
51
|
"path-to-regexp": "^8.3.0"
|
|
@@ -61,5 +61,5 @@
|
|
|
61
61
|
"publishConfig": {
|
|
62
62
|
"access": "public"
|
|
63
63
|
},
|
|
64
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "79d48250f085dbf33512c356b0ff5fb6acd239d3"
|
|
65
65
|
}
|