@salesforce/ui-design-mode 12.17.0 → 13.0.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 (96) hide show
  1. package/dist/authoring/core/DesignPropertyPanelRoot.d.cts +4 -2
  2. package/dist/authoring/core/DesignPropertyPanelRoot.d.ts +4 -2
  3. package/dist/authoring/core/DesignPropertyPanelRoot.d.ts.map +1 -1
  4. package/dist/authoring/core/editors/BoxDimensionEditor.d.cts +20 -34
  5. package/dist/authoring/core/editors/BoxDimensionEditor.d.ts +20 -34
  6. package/dist/authoring/core/editors/BoxDimensionEditor.d.ts.map +1 -1
  7. package/dist/authoring/core/editors/ColorEditor.d.cts +8 -7
  8. package/dist/authoring/core/editors/ColorEditor.d.ts +8 -7
  9. package/dist/authoring/core/editors/ColorEditor.d.ts.map +1 -1
  10. package/dist/authoring/core/editors/DimensionEditor.d.ts.map +1 -1
  11. package/dist/authoring/core/editors/FieldNotice.d.cts +17 -0
  12. package/dist/authoring/core/editors/FieldNotice.d.ts +17 -0
  13. package/dist/authoring/core/editors/FieldNotice.d.ts.map +1 -0
  14. package/dist/authoring/core/editors/FontFamilyEditor.d.cts +4 -6
  15. package/dist/authoring/core/editors/FontFamilyEditor.d.ts +4 -6
  16. package/dist/authoring/core/editors/FontFamilyEditor.d.ts.map +1 -1
  17. package/dist/authoring/core/editors/FontWeightEditor.d.cts +6 -5
  18. package/dist/authoring/core/editors/FontWeightEditor.d.ts +6 -5
  19. package/dist/authoring/core/editors/FontWeightEditor.d.ts.map +1 -1
  20. package/dist/authoring/core/editors/ImageEditor.d.cts +21 -1
  21. package/dist/authoring/core/editors/ImageEditor.d.ts +21 -1
  22. package/dist/authoring/core/editors/ImageEditor.d.ts.map +1 -1
  23. package/dist/authoring/core/editors/PicklistEditor.d.cts +5 -21
  24. package/dist/authoring/core/editors/PicklistEditor.d.ts +5 -21
  25. package/dist/authoring/core/editors/PicklistEditor.d.ts.map +1 -1
  26. package/dist/authoring/core/history/changeSet.d.cts +28 -5
  27. package/dist/authoring/core/history/changeSet.d.ts +28 -5
  28. package/dist/authoring/core/history/changeSet.d.ts.map +1 -1
  29. package/dist/authoring/core/history/historyService.d.cts +1 -3
  30. package/dist/authoring/core/history/historyService.d.ts +1 -3
  31. package/dist/authoring/core/history/historyService.d.ts.map +1 -1
  32. package/dist/authoring/core/history/iframeCommandExecutor.d.cts +1 -1
  33. package/dist/authoring/core/history/iframeCommandExecutor.d.ts +1 -1
  34. package/dist/authoring/core/hooks/useRecentColors.d.cts +12 -0
  35. package/dist/authoring/core/hooks/useRecentColors.d.ts +12 -0
  36. package/dist/authoring/core/hooks/useRecentColors.d.ts.map +1 -0
  37. package/dist/authoring/core/labels/labels.d.cts +74 -97
  38. package/dist/authoring/core/labels/labels.d.ts +74 -97
  39. package/dist/authoring/core/labels/labels.d.ts.map +1 -1
  40. package/dist/authoring/core/utils/colorEditorModel.d.cts +18 -0
  41. package/dist/authoring/core/utils/colorEditorModel.d.ts +18 -0
  42. package/dist/authoring/core/utils/colorEditorModel.d.ts.map +1 -0
  43. package/dist/authoring/core/utils/colorOcclusion.d.cts +4 -20
  44. package/dist/authoring/core/utils/colorOcclusion.d.ts +4 -20
  45. package/dist/authoring/core/utils/colorOcclusion.d.ts.map +1 -1
  46. package/dist/authoring/core/utils/dimensionUtils.d.cts +0 -39
  47. package/dist/authoring/core/utils/dimensionUtils.d.ts +0 -39
  48. package/dist/authoring/core/utils/dimensionUtils.d.ts.map +1 -1
  49. package/dist/authoring/react/index.d.cts +1 -1
  50. package/dist/authoring/react/index.d.ts +1 -1
  51. package/dist/authoring/react/index.d.ts.map +1 -1
  52. package/dist/authoring/react/index.js +3 -3
  53. package/dist/authoring/react/styles.css +1 -1
  54. package/dist/authoring/web-component/index.d.cts +3 -1
  55. package/dist/authoring/web-component/index.d.ts +3 -1
  56. package/dist/authoring/web-component/index.d.ts.map +1 -1
  57. package/dist/authoring/web-component/index.js +290 -288
  58. package/dist/protocol/domAttributes.cjs +4 -0
  59. package/dist/protocol/domAttributes.d.cts +17 -0
  60. package/dist/protocol/domAttributes.d.ts +17 -0
  61. package/dist/protocol/domAttributes.d.ts.map +1 -1
  62. package/dist/protocol/domAttributes.js +4 -0
  63. package/dist/protocol/index.cjs +4 -0
  64. package/dist/protocol/index.js +6 -2
  65. package/dist/protocol/measuredStyleProperties.cjs +18 -0
  66. package/dist/protocol/measuredStyleProperties.d.cts +7 -0
  67. package/dist/protocol/measuredStyleProperties.d.ts +7 -0
  68. package/dist/protocol/measuredStyleProperties.d.ts.map +1 -1
  69. package/dist/protocol/measuredStyleProperties.js +18 -0
  70. package/dist/protocol/messageTypes.d.cts +27 -16
  71. package/dist/protocol/messageTypes.d.ts +27 -16
  72. package/dist/protocol/messageTypes.d.ts.map +1 -1
  73. package/dist/protocol/version.cjs +1 -1
  74. package/dist/protocol/version.js +1 -1
  75. package/dist/runtime/design-mode-interactions.js +198 -88
  76. package/dist/runtime/interactions/communicationManager.d.cts +2 -2
  77. package/dist/runtime/interactions/communicationManager.d.ts +2 -2
  78. package/dist/runtime/interactions/communicationManager.d.ts.map +1 -1
  79. package/dist/runtime/interactions/eventHandlers.d.cts +1 -1
  80. package/dist/runtime/interactions/eventHandlers.d.ts +1 -1
  81. package/dist/runtime/interactions/eventHandlers.d.ts.map +1 -1
  82. package/dist/runtime/interactions/interactionsController.d.cts +2 -0
  83. package/dist/runtime/interactions/interactionsController.d.ts +2 -0
  84. package/dist/runtime/interactions/interactionsController.d.ts.map +1 -1
  85. package/dist/runtime/interactions/propertyEditorCapabilities.d.cts +4 -0
  86. package/dist/runtime/interactions/propertyEditorCapabilities.d.ts +4 -0
  87. package/dist/runtime/interactions/propertyEditorCapabilities.d.ts.map +1 -0
  88. package/dist/runtime/interactions/utils/cssUtils.d.cts +3 -7
  89. package/dist/runtime/interactions/utils/cssUtils.d.ts +3 -7
  90. package/dist/runtime/interactions/utils/cssUtils.d.ts.map +1 -1
  91. package/dist/runtime/interactions/utils/sourceUtils.d.cts +1 -1
  92. package/dist/runtime/interactions/utils/sourceUtils.d.ts +1 -1
  93. package/dist/source-locator/react/babel/reactDesignTimeLocatorBabelPlugin.cjs +33 -0
  94. package/dist/source-locator/react/babel/reactDesignTimeLocatorBabelPlugin.d.ts.map +1 -1
  95. package/dist/source-locator/react/babel/reactDesignTimeLocatorBabelPlugin.js +34 -1
  96. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- import { SourceLocation } from '../../../protocol.js';
1
+ import { SourceLocation } from '../../../protocol/index.js';
2
2
  export type { SourceLocation };
3
3
  /**
4
4
  * Extract source location information from data attributes.
@@ -2,6 +2,8 @@
2
2
  Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
3
  const helperPluginUtils = require("@babel/helper-plugin-utils");
4
4
  const domAttributes = require("../../../protocol/domAttributes.cjs");
5
+ require("../../../protocol/measuredStyleProperties.cjs");
6
+ const IMAGE_MODULE_RE = /\.(?:png|jpe?g|gif|svg|webp|avif|ico|bmp)(?:\?.*)?$/i;
5
7
  function resolveColumn(loc, babelCode, originalSource) {
6
8
  if (!originalSource || !babelCode) return loc.column;
7
9
  const babelLine = babelCode.split("\n")[loc.line - 1];
@@ -32,6 +34,31 @@ const reactDesignTimeLocatorBabelPlugin = helperPluginUtils.declare((api) => {
32
34
  return t.isJSXAttribute(attr) && t.isJSXIdentifier(attr.name) && attr.name.name === name;
33
35
  });
34
36
  }
37
+ function isStringValue(value) {
38
+ if (t.isStringLiteral(value)) return true;
39
+ if (!t.isJSXExpressionContainer(value)) return false;
40
+ const expr = value.expression;
41
+ return t.isStringLiteral(expr) || t.isTemplateLiteral(expr) && expr.expressions.length === 0;
42
+ }
43
+ function isImageAssetImport(path, value) {
44
+ if (!t.isJSXExpressionContainer(value) || !t.isIdentifier(value.expression)) return false;
45
+ const binding = path.scope.getBinding(value.expression.name);
46
+ return binding?.kind === "module" && t.isImportDefaultSpecifier(binding.path.node) && IMAGE_MODULE_RE.test(binding.path.parent.source.value);
47
+ }
48
+ function classifyMediaAttr(path, openingElement, name, allowAssetImport) {
49
+ const attrs = openingElement.attributes;
50
+ const index = attrs.findIndex(
51
+ (attr2) => t.isJSXAttribute(attr2) && t.isJSXIdentifier(attr2.name, { name })
52
+ );
53
+ if (attrs.slice(index + 1).some((attr2) => t.isJSXSpreadAttribute(attr2))) {
54
+ return "unknown";
55
+ }
56
+ const attr = attrs[index];
57
+ if (!attr) return "literal";
58
+ if (isStringValue(attr.value)) return "literal";
59
+ if (allowAssetImport && isImageAssetImport(path, attr.value)) return "asset-import";
60
+ return "unknown";
61
+ }
35
62
  function addAttr(openingElement, name, value) {
36
63
  if (hasAttr(openingElement, name)) return;
37
64
  openingElement.attributes.push(
@@ -83,6 +110,12 @@ const reactDesignTimeLocatorBabelPlugin = helperPluginUtils.declare((api) => {
83
110
  addAttr(openingElement, domAttributes.ATTR_SOURCE_FILE, source);
84
111
  }
85
112
  addAttr(openingElement, domAttributes.ATTR_TEXT_TYPE, textType);
113
+ if (t.isJSXIdentifier(openingElement.name, { name: "img" })) {
114
+ const srcKind = classifyMediaAttr(path, openingElement, "src", true);
115
+ const altKind = classifyMediaAttr(path, openingElement, "alt", false);
116
+ addAttr(openingElement, domAttributes.ATTR_SRC_KIND, srcKind);
117
+ addAttr(openingElement, domAttributes.ATTR_ALT_KIND, altKind);
118
+ }
86
119
  }
87
120
  }
88
121
  };
@@ -1 +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"}
1
+ {"version":3,"file":"reactDesignTimeLocatorBabelPlugin.d.ts","sourceRoot":"","sources":["../../../../src/source-locator/react/babel/reactDesignTimeLocatorBabelPlugin.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AA2DH,QAAA,MAAM,iCAAiC;;;iEA6EnB,GAAG,SAAS,GAAG;;CAoFjC,CAAC;AAEH,eAAe,iCAAiC,CAAC"}
@@ -1,5 +1,7 @@
1
1
  import { declare } from "@babel/helper-plugin-utils";
2
- import { ATTR_SOURCE_FILE, ATTR_TEXT_TYPE } from "../../../protocol/domAttributes.js";
2
+ import { ATTR_SOURCE_FILE, ATTR_TEXT_TYPE, ATTR_SRC_KIND, ATTR_ALT_KIND } from "../../../protocol/domAttributes.js";
3
+ import "../../../protocol/measuredStyleProperties.js";
4
+ const IMAGE_MODULE_RE = /\.(?:png|jpe?g|gif|svg|webp|avif|ico|bmp)(?:\?.*)?$/i;
3
5
  function resolveColumn(loc, babelCode, originalSource) {
4
6
  if (!originalSource || !babelCode) return loc.column;
5
7
  const babelLine = babelCode.split("\n")[loc.line - 1];
@@ -30,6 +32,31 @@ const reactDesignTimeLocatorBabelPlugin = declare((api) => {
30
32
  return t.isJSXAttribute(attr) && t.isJSXIdentifier(attr.name) && attr.name.name === name;
31
33
  });
32
34
  }
35
+ function isStringValue(value) {
36
+ if (t.isStringLiteral(value)) return true;
37
+ if (!t.isJSXExpressionContainer(value)) return false;
38
+ const expr = value.expression;
39
+ return t.isStringLiteral(expr) || t.isTemplateLiteral(expr) && expr.expressions.length === 0;
40
+ }
41
+ function isImageAssetImport(path, value) {
42
+ if (!t.isJSXExpressionContainer(value) || !t.isIdentifier(value.expression)) return false;
43
+ const binding = path.scope.getBinding(value.expression.name);
44
+ return binding?.kind === "module" && t.isImportDefaultSpecifier(binding.path.node) && IMAGE_MODULE_RE.test(binding.path.parent.source.value);
45
+ }
46
+ function classifyMediaAttr(path, openingElement, name, allowAssetImport) {
47
+ const attrs = openingElement.attributes;
48
+ const index = attrs.findIndex(
49
+ (attr2) => t.isJSXAttribute(attr2) && t.isJSXIdentifier(attr2.name, { name })
50
+ );
51
+ if (attrs.slice(index + 1).some((attr2) => t.isJSXSpreadAttribute(attr2))) {
52
+ return "unknown";
53
+ }
54
+ const attr = attrs[index];
55
+ if (!attr) return "literal";
56
+ if (isStringValue(attr.value)) return "literal";
57
+ if (allowAssetImport && isImageAssetImport(path, attr.value)) return "asset-import";
58
+ return "unknown";
59
+ }
33
60
  function addAttr(openingElement, name, value) {
34
61
  if (hasAttr(openingElement, name)) return;
35
62
  openingElement.attributes.push(
@@ -81,6 +108,12 @@ const reactDesignTimeLocatorBabelPlugin = declare((api) => {
81
108
  addAttr(openingElement, ATTR_SOURCE_FILE, source);
82
109
  }
83
110
  addAttr(openingElement, ATTR_TEXT_TYPE, textType);
111
+ if (t.isJSXIdentifier(openingElement.name, { name: "img" })) {
112
+ const srcKind = classifyMediaAttr(path, openingElement, "src", true);
113
+ const altKind = classifyMediaAttr(path, openingElement, "alt", false);
114
+ addAttr(openingElement, ATTR_SRC_KIND, srcKind);
115
+ addAttr(openingElement, ATTR_ALT_KIND, altKind);
116
+ }
84
117
  }
85
118
  }
86
119
  };
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": "12.17.0",
4
+ "version": "13.0.0",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "type": "module",
7
7
  "exports": {