@salesforce/ui-design-mode 10.2.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.
Files changed (60) hide show
  1. package/LICENSE.txt +82 -0
  2. package/dist/protocol/domAttributes.cjs +6 -0
  3. package/dist/protocol/domAttributes.d.cts +18 -0
  4. package/dist/protocol/domAttributes.d.ts +18 -0
  5. package/dist/protocol/domAttributes.d.ts.map +1 -0
  6. package/dist/protocol/domAttributes.js +6 -0
  7. package/dist/protocol/index.cjs +14 -0
  8. package/dist/protocol/index.d.cts +8 -0
  9. package/dist/protocol/index.d.ts +8 -0
  10. package/dist/protocol/index.d.ts.map +1 -0
  11. package/dist/protocol/index.js +14 -0
  12. package/dist/protocol/messageTypes.cjs +18 -0
  13. package/dist/protocol/messageTypes.d.cts +83 -0
  14. package/dist/protocol/messageTypes.d.ts +83 -0
  15. package/dist/protocol/messageTypes.d.ts.map +1 -0
  16. package/dist/protocol/messageTypes.js +18 -0
  17. package/dist/runtime/design-mode-interactions.js +842 -0
  18. package/dist/runtime/index.cjs +15 -0
  19. package/dist/runtime/index.d.cts +11 -0
  20. package/dist/runtime/index.d.ts +11 -0
  21. package/dist/runtime/index.d.ts.map +1 -0
  22. package/dist/runtime/index.js +14 -0
  23. package/dist/runtime/interactions/communicationManager.d.cts +57 -0
  24. package/dist/runtime/interactions/communicationManager.d.ts +57 -0
  25. package/dist/runtime/interactions/communicationManager.d.ts.map +1 -0
  26. package/dist/runtime/interactions/componentMatcher.d.cts +39 -0
  27. package/dist/runtime/interactions/componentMatcher.d.ts +39 -0
  28. package/dist/runtime/interactions/componentMatcher.d.ts.map +1 -0
  29. package/dist/runtime/interactions/editableManager.d.cts +25 -0
  30. package/dist/runtime/interactions/editableManager.d.ts +25 -0
  31. package/dist/runtime/interactions/editableManager.d.ts.map +1 -0
  32. package/dist/runtime/interactions/eventHandlers.d.cts +40 -0
  33. package/dist/runtime/interactions/eventHandlers.d.ts +40 -0
  34. package/dist/runtime/interactions/eventHandlers.d.ts.map +1 -0
  35. package/dist/runtime/interactions/index.d.cts +7 -0
  36. package/dist/runtime/interactions/index.d.ts +7 -0
  37. package/dist/runtime/interactions/index.d.ts.map +1 -0
  38. package/dist/runtime/interactions/interactionsController.d.cts +53 -0
  39. package/dist/runtime/interactions/interactionsController.d.ts +53 -0
  40. package/dist/runtime/interactions/interactionsController.d.ts.map +1 -0
  41. package/dist/runtime/interactions/styleManager.d.cts +49 -0
  42. package/dist/runtime/interactions/styleManager.d.ts +49 -0
  43. package/dist/runtime/interactions/styleManager.d.ts.map +1 -0
  44. package/dist/runtime/interactions/utils/cssUtils.d.cts +54 -0
  45. package/dist/runtime/interactions/utils/cssUtils.d.ts +54 -0
  46. package/dist/runtime/interactions/utils/cssUtils.d.ts.map +1 -0
  47. package/dist/runtime/interactions/utils/sourceUtils.d.cts +28 -0
  48. package/dist/runtime/interactions/utils/sourceUtils.d.ts +28 -0
  49. package/dist/runtime/interactions/utils/sourceUtils.d.ts.map +1 -0
  50. package/dist/source-locator/react/babel/reactDesignTimeLocatorBabelPlugin.cjs +90 -0
  51. package/dist/source-locator/react/babel/reactDesignTimeLocatorBabelPlugin.d.cts +13 -0
  52. package/dist/source-locator/react/babel/reactDesignTimeLocatorBabelPlugin.d.ts +13 -0
  53. package/dist/source-locator/react/babel/reactDesignTimeLocatorBabelPlugin.d.ts.map +1 -0
  54. package/dist/source-locator/react/babel/reactDesignTimeLocatorBabelPlugin.js +90 -0
  55. package/dist/source-locator/react/index.cjs +5 -0
  56. package/dist/source-locator/react/index.d.cts +4 -0
  57. package/dist/source-locator/react/index.d.ts +4 -0
  58. package/dist/source-locator/react/index.d.ts.map +1 -0
  59. package/dist/source-locator/react/index.js +5 -0
  60. package/package.json +70 -0
@@ -0,0 +1,54 @@
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 value with both inline and computed values.
8
+ * - inline: the raw value from element.style (what was explicitly set via
9
+ * the style attribute).
10
+ * - computed: the browser-resolved value after the full cascade.
11
+ */
12
+ interface StyleValue {
13
+ inline: string;
14
+ computed: string;
15
+ }
16
+ /**
17
+ * Complete element styles snapshot
18
+ */
19
+ interface ElementStyles {
20
+ width: StyleValue;
21
+ minWidth: StyleValue;
22
+ maxWidth: StyleValue;
23
+ height: StyleValue;
24
+ minHeight: StyleValue;
25
+ maxHeight: StyleValue;
26
+ overflow: StyleValue;
27
+ padding: StyleValue;
28
+ margin: StyleValue;
29
+ backgroundColor: StyleValue;
30
+ borderWidth: StyleValue;
31
+ borderStyle: StyleValue;
32
+ borderColor: StyleValue;
33
+ borderRadius: StyleValue;
34
+ color: StyleValue;
35
+ fontFamily: StyleValue;
36
+ fontSize: StyleValue;
37
+ fontWeight: StyleValue;
38
+ fontStyle: StyleValue;
39
+ lineHeight: StyleValue;
40
+ letterSpacing: StyleValue;
41
+ textAlign: StyleValue;
42
+ textDecoration: StyleValue;
43
+ textTransform: StyleValue;
44
+ }
45
+ /**
46
+ * Get all style values relevant to UI controls for an element.
47
+ * Each property returns { inline, computed } where inline is the raw
48
+ * element.style value and computed is the browser-resolved value.
49
+ * @param element - The HTML element to extract styles from
50
+ * @returns Plain-object snapshot safe for postMessage
51
+ */
52
+ export declare function getElementStyles(element: HTMLElement | null | undefined): Partial<ElementStyles>;
53
+ export {};
54
+ //# sourceMappingURL=cssUtils.d.ts.map
@@ -0,0 +1,54 @@
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 value with both inline and computed values.
8
+ * - inline: the raw value from element.style (what was explicitly set via
9
+ * the style attribute).
10
+ * - computed: the browser-resolved value after the full cascade.
11
+ */
12
+ interface StyleValue {
13
+ inline: string;
14
+ computed: string;
15
+ }
16
+ /**
17
+ * Complete element styles snapshot
18
+ */
19
+ interface ElementStyles {
20
+ width: StyleValue;
21
+ minWidth: StyleValue;
22
+ maxWidth: StyleValue;
23
+ height: StyleValue;
24
+ minHeight: StyleValue;
25
+ maxHeight: StyleValue;
26
+ overflow: StyleValue;
27
+ padding: StyleValue;
28
+ margin: StyleValue;
29
+ backgroundColor: StyleValue;
30
+ borderWidth: StyleValue;
31
+ borderStyle: StyleValue;
32
+ borderColor: StyleValue;
33
+ borderRadius: StyleValue;
34
+ color: StyleValue;
35
+ fontFamily: StyleValue;
36
+ fontSize: StyleValue;
37
+ fontWeight: StyleValue;
38
+ fontStyle: StyleValue;
39
+ lineHeight: StyleValue;
40
+ letterSpacing: StyleValue;
41
+ textAlign: StyleValue;
42
+ textDecoration: StyleValue;
43
+ textTransform: StyleValue;
44
+ }
45
+ /**
46
+ * Get all style values relevant to UI controls for an element.
47
+ * Each property returns { inline, computed } where inline is the raw
48
+ * element.style value and computed is the browser-resolved value.
49
+ * @param element - The HTML element to extract styles from
50
+ * @returns Plain-object snapshot safe for postMessage
51
+ */
52
+ export declare function getElementStyles(element: HTMLElement | null | undefined): Partial<ElementStyles>;
53
+ export {};
54
+ //# sourceMappingURL=cssUtils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cssUtils.d.ts","sourceRoot":"","sources":["../../../../src/runtime/interactions/utils/cssUtils.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;GAKG;AACH,UAAU,UAAU;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;CACjB;AAID;;GAEG;AACH,UAAU,aAAa;IACtB,KAAK,EAAE,UAAU,CAAC;IAClB,QAAQ,EAAE,UAAU,CAAC;IACrB,QAAQ,EAAE,UAAU,CAAC;IACrB,MAAM,EAAE,UAAU,CAAC;IACnB,SAAS,EAAE,UAAU,CAAC;IACtB,SAAS,EAAE,UAAU,CAAC;IACtB,QAAQ,EAAE,UAAU,CAAC;IACrB,OAAO,EAAE,UAAU,CAAC;IACpB,MAAM,EAAE,UAAU,CAAC;IACnB,eAAe,EAAE,UAAU,CAAC;IAC5B,WAAW,EAAE,UAAU,CAAC;IACxB,WAAW,EAAE,UAAU,CAAC;IACxB,WAAW,EAAE,UAAU,CAAC;IACxB,YAAY,EAAE,UAAU,CAAC;IACzB,KAAK,EAAE,UAAU,CAAC;IAClB,UAAU,EAAE,UAAU,CAAC;IACvB,QAAQ,EAAE,UAAU,CAAC;IACrB,UAAU,EAAE,UAAU,CAAC;IACvB,SAAS,EAAE,UAAU,CAAC;IACtB,UAAU,EAAE,UAAU,CAAC;IACvB,aAAa,EAAE,UAAU,CAAC;IAC1B,SAAS,EAAE,UAAU,CAAC;IACtB,cAAc,EAAE,UAAU,CAAC;IAC3B,aAAa,EAAE,UAAU,CAAC;CAC1B;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAAC,aAAa,CAAC,CAmFhG"}
@@ -0,0 +1,28 @@
1
+ import { SourceLocation } from '../../../protocol.cjs';
2
+ export type { SourceLocation };
3
+ /**
4
+ * Extract source location information from data attributes.
5
+ * @param element - The DOM element
6
+ * @returns Source location information, or null if missing.
7
+ */
8
+ export declare function getSourceFromDataAttributes(element: HTMLElement | null | undefined): SourceLocation | null;
9
+ /**
10
+ * Find all DOM elements whose `data-source-file` attribute matches the given source location.
11
+ * @param location - The source location to match against
12
+ * @returns All matching elements (may be empty)
13
+ */
14
+ export declare function findElementsBySourceLocation(location: SourceLocation): HTMLElement[];
15
+ /**
16
+ * Parse an untyped message payload object into a SourceLocation.
17
+ * Used by the entry point to convert raw postMessage data into typed values.
18
+ * @param sl - The raw source location object from a message payload
19
+ * @returns A SourceLocation, or undefined if the input is not a valid object
20
+ */
21
+ export declare function parseSourceLocation(sl: unknown): SourceLocation | undefined;
22
+ /**
23
+ * Derive a human-readable label from the injected source file name, if present.
24
+ * @param element - The DOM element
25
+ * @returns A label suitable for UI display
26
+ */
27
+ export declare function getLabelFromSource(element: HTMLElement | null | undefined): string;
28
+ //# sourceMappingURL=sourceUtils.d.ts.map
@@ -0,0 +1,28 @@
1
+ import { SourceLocation } from '../../../protocol.js';
2
+ export type { SourceLocation };
3
+ /**
4
+ * Extract source location information from data attributes.
5
+ * @param element - The DOM element
6
+ * @returns Source location information, or null if missing.
7
+ */
8
+ export declare function getSourceFromDataAttributes(element: HTMLElement | null | undefined): SourceLocation | null;
9
+ /**
10
+ * Find all DOM elements whose `data-source-file` attribute matches the given source location.
11
+ * @param location - The source location to match against
12
+ * @returns All matching elements (may be empty)
13
+ */
14
+ export declare function findElementsBySourceLocation(location: SourceLocation): HTMLElement[];
15
+ /**
16
+ * Parse an untyped message payload object into a SourceLocation.
17
+ * Used by the entry point to convert raw postMessage data into typed values.
18
+ * @param sl - The raw source location object from a message payload
19
+ * @returns A SourceLocation, or undefined if the input is not a valid object
20
+ */
21
+ export declare function parseSourceLocation(sl: unknown): SourceLocation | undefined;
22
+ /**
23
+ * Derive a human-readable label from the injected source file name, if present.
24
+ * @param element - The DOM element
25
+ * @returns A label suitable for UI display
26
+ */
27
+ export declare function getLabelFromSource(element: HTMLElement | null | undefined): string;
28
+ //# sourceMappingURL=sourceUtils.d.ts.map
@@ -0,0 +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;AAyB/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;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,EAAE,EAAE,OAAO,GAAG,cAAc,GAAG,SAAS,CAQ3E;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CAgBlF"}
@@ -0,0 +1,90 @@
1
+ "use strict";
2
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
+ const helperPluginUtils = require("@babel/helper-plugin-utils");
4
+ const domAttributes = require("../../../protocol/domAttributes.cjs");
5
+ function resolveColumn(loc, babelCode, originalSource) {
6
+ if (!originalSource || !babelCode) return loc.column;
7
+ const babelLine = babelCode.split("\n")[loc.line - 1];
8
+ const originalLine = originalSource.split("\n")[loc.line - 1];
9
+ if (!babelLine || !originalLine) return loc.column;
10
+ const contentFromColumn = babelLine.slice(loc.column);
11
+ if (contentFromColumn) {
12
+ const idx = originalLine.indexOf(contentFromColumn);
13
+ if (idx >= 0) return idx;
14
+ }
15
+ const babelIndent = babelLine.length - babelLine.trimStart().length;
16
+ const originalIndent = originalLine.length - originalLine.trimStart().length;
17
+ const offset = babelIndent - originalIndent;
18
+ return Math.max(0, loc.column - offset);
19
+ }
20
+ const reactDesignTimeLocatorBabelPlugin = helperPluginUtils.declare((api) => {
21
+ api.assertVersion(7);
22
+ const t = api.types;
23
+ function isReactFragmentName(nameNode) {
24
+ if (t.isJSXIdentifier(nameNode) && nameNode.name === "Fragment") return true;
25
+ if (t.isJSXMemberExpression(nameNode) && t.isJSXIdentifier(nameNode.object, { name: "React" }) && t.isJSXIdentifier(nameNode.property, { name: "Fragment" })) {
26
+ return true;
27
+ }
28
+ return false;
29
+ }
30
+ function hasAttr(openingElement, name) {
31
+ return openingElement.attributes.some((attr) => {
32
+ return t.isJSXAttribute(attr) && t.isJSXIdentifier(attr.name) && attr.name.name === name;
33
+ });
34
+ }
35
+ function addAttr(openingElement, name, value) {
36
+ if (hasAttr(openingElement, name)) return;
37
+ openingElement.attributes.push(
38
+ t.jsxAttribute(t.jsxIdentifier(name), t.stringLiteral(String(value)))
39
+ );
40
+ }
41
+ return {
42
+ name: "babel-plugin-react-design-time-locator",
43
+ visitor: {
44
+ JSXElement(path, state) {
45
+ const openingElement = path.node.openingElement;
46
+ if (isReactFragmentName(openingElement.name)) return;
47
+ if (!t.isJSXIdentifier(openingElement.name) && !t.isJSXMemberExpression(openingElement.name)) {
48
+ return;
49
+ }
50
+ let tagHead = "";
51
+ if (t.isJSXIdentifier(openingElement.name)) {
52
+ tagHead = openingElement.name.name;
53
+ } else if (t.isJSXMemberExpression(openingElement.name)) {
54
+ tagHead = openingElement.name.property?.name ?? "";
55
+ }
56
+ if (!tagHead) return;
57
+ const filename = state?.file?.opts?.filename;
58
+ if (!filename || filename.includes("node_modules")) return;
59
+ const excludePaths = state.opts?.excludePaths ?? [];
60
+ if (excludePaths.some((p) => filename.includes(p))) return;
61
+ const children = path.node.children ?? [];
62
+ const relevantChildren = children.filter((child) => {
63
+ return !(t.isJSXText(child) && child.value.trim() === "");
64
+ });
65
+ let textType = "none";
66
+ if (relevantChildren.length === 1) {
67
+ const child = relevantChildren[0];
68
+ if (t.isJSXText(child)) {
69
+ textType = "static";
70
+ } else if (t.isJSXExpressionContainer(child)) {
71
+ textType = "dynamic";
72
+ } else {
73
+ textType = "element";
74
+ }
75
+ } else if (relevantChildren.length > 1) {
76
+ textType = "mixed";
77
+ }
78
+ const loc = path.node.loc;
79
+ if (loc?.start) {
80
+ const originalSource = state.opts?.originalSource;
81
+ const column = resolveColumn(loc.start, state.file?.code, originalSource);
82
+ const source = `${filename}:${loc.start.line}:${column}`;
83
+ addAttr(openingElement, domAttributes.ATTR_SOURCE_FILE, source);
84
+ }
85
+ addAttr(openingElement, domAttributes.ATTR_TEXT_TYPE, textType);
86
+ }
87
+ }
88
+ };
89
+ });
90
+ exports.default = reactDesignTimeLocatorBabelPlugin;
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Copyright (c) 2026, Salesforce, Inc.,
3
+ * All rights reserved.
4
+ * For full license text, see the LICENSE.txt file
5
+ */
6
+ declare const reactDesignTimeLocatorBabelPlugin: (api: object, options: Record<string, any> | null | undefined, dirname: string) => {
7
+ name: string;
8
+ visitor: {
9
+ JSXElement(this: import('@babel/core').PluginPass, path: any, state: any): void;
10
+ };
11
+ };
12
+ export default reactDesignTimeLocatorBabelPlugin;
13
+ //# sourceMappingURL=reactDesignTimeLocatorBabelPlugin.d.ts.map
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Copyright (c) 2026, Salesforce, Inc.,
3
+ * All rights reserved.
4
+ * For full license text, see the LICENSE.txt file
5
+ */
6
+ declare const reactDesignTimeLocatorBabelPlugin: (api: object, options: Record<string, any> | null | undefined, dirname: string) => {
7
+ name: string;
8
+ visitor: {
9
+ JSXElement(this: import('@babel/core').PluginPass, path: any, state: any): void;
10
+ };
11
+ };
12
+ export default reactDesignTimeLocatorBabelPlugin;
13
+ //# sourceMappingURL=reactDesignTimeLocatorBabelPlugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reactDesignTimeLocatorBabelPlugin.d.ts","sourceRoot":"","sources":["../../../../src/source-locator/react/babel/reactDesignTimeLocatorBabelPlugin.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AA6CH,QAAA,MAAM,iCAAiC;;;iEAiCnB,GAAG,SAAS,GAAG;;CA0EjC,CAAC;AAEH,eAAe,iCAAiC,CAAC"}
@@ -0,0 +1,90 @@
1
+ import { declare } from "@babel/helper-plugin-utils";
2
+ import { ATTR_SOURCE_FILE, ATTR_TEXT_TYPE } from "../../../protocol/domAttributes.js";
3
+ function resolveColumn(loc, babelCode, originalSource) {
4
+ if (!originalSource || !babelCode) return loc.column;
5
+ const babelLine = babelCode.split("\n")[loc.line - 1];
6
+ const originalLine = originalSource.split("\n")[loc.line - 1];
7
+ if (!babelLine || !originalLine) return loc.column;
8
+ const contentFromColumn = babelLine.slice(loc.column);
9
+ if (contentFromColumn) {
10
+ const idx = originalLine.indexOf(contentFromColumn);
11
+ if (idx >= 0) return idx;
12
+ }
13
+ const babelIndent = babelLine.length - babelLine.trimStart().length;
14
+ const originalIndent = originalLine.length - originalLine.trimStart().length;
15
+ const offset = babelIndent - originalIndent;
16
+ return Math.max(0, loc.column - offset);
17
+ }
18
+ const reactDesignTimeLocatorBabelPlugin = declare((api) => {
19
+ api.assertVersion(7);
20
+ const t = api.types;
21
+ function isReactFragmentName(nameNode) {
22
+ if (t.isJSXIdentifier(nameNode) && nameNode.name === "Fragment") return true;
23
+ if (t.isJSXMemberExpression(nameNode) && t.isJSXIdentifier(nameNode.object, { name: "React" }) && t.isJSXIdentifier(nameNode.property, { name: "Fragment" })) {
24
+ return true;
25
+ }
26
+ return false;
27
+ }
28
+ function hasAttr(openingElement, name) {
29
+ return openingElement.attributes.some((attr) => {
30
+ return t.isJSXAttribute(attr) && t.isJSXIdentifier(attr.name) && attr.name.name === name;
31
+ });
32
+ }
33
+ function addAttr(openingElement, name, value) {
34
+ if (hasAttr(openingElement, name)) return;
35
+ openingElement.attributes.push(
36
+ t.jsxAttribute(t.jsxIdentifier(name), t.stringLiteral(String(value)))
37
+ );
38
+ }
39
+ return {
40
+ name: "babel-plugin-react-design-time-locator",
41
+ visitor: {
42
+ JSXElement(path, state) {
43
+ const openingElement = path.node.openingElement;
44
+ if (isReactFragmentName(openingElement.name)) return;
45
+ if (!t.isJSXIdentifier(openingElement.name) && !t.isJSXMemberExpression(openingElement.name)) {
46
+ return;
47
+ }
48
+ let tagHead = "";
49
+ if (t.isJSXIdentifier(openingElement.name)) {
50
+ tagHead = openingElement.name.name;
51
+ } else if (t.isJSXMemberExpression(openingElement.name)) {
52
+ tagHead = openingElement.name.property?.name ?? "";
53
+ }
54
+ if (!tagHead) return;
55
+ const filename = state?.file?.opts?.filename;
56
+ if (!filename || filename.includes("node_modules")) return;
57
+ const excludePaths = state.opts?.excludePaths ?? [];
58
+ if (excludePaths.some((p) => filename.includes(p))) return;
59
+ const children = path.node.children ?? [];
60
+ const relevantChildren = children.filter((child) => {
61
+ return !(t.isJSXText(child) && child.value.trim() === "");
62
+ });
63
+ let textType = "none";
64
+ if (relevantChildren.length === 1) {
65
+ const child = relevantChildren[0];
66
+ if (t.isJSXText(child)) {
67
+ textType = "static";
68
+ } else if (t.isJSXExpressionContainer(child)) {
69
+ textType = "dynamic";
70
+ } else {
71
+ textType = "element";
72
+ }
73
+ } else if (relevantChildren.length > 1) {
74
+ textType = "mixed";
75
+ }
76
+ const loc = path.node.loc;
77
+ if (loc?.start) {
78
+ const originalSource = state.opts?.originalSource;
79
+ const column = resolveColumn(loc.start, state.file?.code, originalSource);
80
+ const source = `${filename}:${loc.start.line}:${column}`;
81
+ addAttr(openingElement, ATTR_SOURCE_FILE, source);
82
+ }
83
+ addAttr(openingElement, ATTR_TEXT_TYPE, textType);
84
+ }
85
+ }
86
+ };
87
+ });
88
+ export {
89
+ reactDesignTimeLocatorBabelPlugin as default
90
+ };
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
+ const reactDesignTimeLocatorBabelPlugin = require("./babel/reactDesignTimeLocatorBabelPlugin.cjs");
4
+ exports.default = reactDesignTimeLocatorBabelPlugin.default;
5
+ exports.reactDesignTimeLocatorBabelPlugin = reactDesignTimeLocatorBabelPlugin.default;
@@ -0,0 +1,4 @@
1
+ import { default as reactDesignTimeLocatorBabelPlugin } from './babel/reactDesignTimeLocatorBabelPlugin.cjs';
2
+ export { reactDesignTimeLocatorBabelPlugin };
3
+ export default reactDesignTimeLocatorBabelPlugin;
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,4 @@
1
+ import { default as reactDesignTimeLocatorBabelPlugin } from './babel/reactDesignTimeLocatorBabelPlugin.js';
2
+ export { reactDesignTimeLocatorBabelPlugin };
3
+ export default reactDesignTimeLocatorBabelPlugin;
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/source-locator/react/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,iCAAiC,MAAM,2CAA2C,CAAC;AAE1F,OAAO,EAAE,iCAAiC,EAAE,CAAC;AAC7C,eAAe,iCAAiC,CAAC"}
@@ -0,0 +1,5 @@
1
+ import reactDesignTimeLocatorBabelPlugin from "./babel/reactDesignTimeLocatorBabelPlugin.js";
2
+ export {
3
+ reactDesignTimeLocatorBabelPlugin as default,
4
+ reactDesignTimeLocatorBabelPlugin
5
+ };
package/package.json ADDED
@@ -0,0 +1,70 @@
1
+ {
2
+ "name": "@salesforce/ui-design-mode",
3
+ "description": "Hybrid editor (design-mode) authoring UI, iframe runtime, source-locator, and protocol for Salesforce UI Bundles",
4
+ "version": "10.2.0",
5
+ "license": "SEE LICENSE IN LICENSE.txt",
6
+ "type": "module",
7
+ "exports": {
8
+ "./protocol": {
9
+ "import": {
10
+ "types": "./dist/protocol/index.d.ts",
11
+ "default": "./dist/protocol/index.js"
12
+ },
13
+ "require": {
14
+ "types": "./dist/protocol/index.d.cts",
15
+ "default": "./dist/protocol/index.cjs"
16
+ }
17
+ },
18
+ "./source-locator/react": {
19
+ "import": {
20
+ "types": "./dist/source-locator/react/index.d.ts",
21
+ "default": "./dist/source-locator/react/index.js"
22
+ },
23
+ "require": {
24
+ "types": "./dist/source-locator/react/index.d.cts",
25
+ "default": "./dist/source-locator/react/index.cjs"
26
+ }
27
+ },
28
+ "./runtime": {
29
+ "import": {
30
+ "types": "./dist/runtime/index.d.ts",
31
+ "default": "./dist/runtime/index.js"
32
+ },
33
+ "require": {
34
+ "types": "./dist/runtime/index.d.cts",
35
+ "default": "./dist/runtime/index.cjs"
36
+ }
37
+ },
38
+ "./package.json": "./package.json"
39
+ },
40
+ "files": [
41
+ "dist"
42
+ ],
43
+ "scripts": {
44
+ "build": "vite build && node scripts/fix-dts-extensions.mjs && node src/runtime/bundle-runtime.mjs",
45
+ "clean": "rm -rf dist",
46
+ "dev": "vite build --watch",
47
+ "test": "vitest run",
48
+ "test:watch": "vitest",
49
+ "test:coverage": "vitest run --coverage"
50
+ },
51
+ "dependencies": {
52
+ "@babel/helper-plugin-utils": "^7.28.3"
53
+ },
54
+ "devDependencies": {
55
+ "@babel/core": "^7.28.4",
56
+ "@types/babel__core": "^7.20.5",
57
+ "@types/babel__helper-plugin-utils": "^7.10.3",
58
+ "esbuild": "^0.24.0",
59
+ "ts-morph": "^25.0.0",
60
+ "vite": "^7.3.1",
61
+ "vite-plugin-dts": "^4.5.4",
62
+ "vitest": "^4.0.6"
63
+ },
64
+ "engines": {
65
+ "node": ">=20.0.0"
66
+ },
67
+ "publishConfig": {
68
+ "access": "public"
69
+ }
70
+ }