@salesforce/metadata-core-sdk 1.4.0 → 1.6.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 (144) hide show
  1. package/README.md +25 -0
  2. package/dist/index.d.ts +5 -2
  3. package/dist/index.d.ts.map +1 -1
  4. package/dist/index.js +27 -1
  5. package/dist/index.js.map +1 -1
  6. package/dist/sdk/abstractions/core/IPlatformContext.d.ts +1 -1
  7. package/dist/sdk/abstractions/core/IPlatformContext.js +1 -1
  8. package/dist/sdk/abstractions/core/index.d.ts +1 -1
  9. package/dist/sdk/abstractions/core/index.js +1 -1
  10. package/dist/sdk/abstractions/index.d.ts +1 -1
  11. package/dist/sdk/abstractions/index.js +1 -1
  12. package/dist/sdk/abstractions/services/IFileSystem.d.ts +1 -1
  13. package/dist/sdk/abstractions/services/IFileSystem.js +1 -1
  14. package/dist/sdk/abstractions/services/ILogger.d.ts +1 -1
  15. package/dist/sdk/abstractions/services/ILogger.js +1 -1
  16. package/dist/sdk/abstractions/services/ITelemetry.d.ts +1 -1
  17. package/dist/sdk/abstractions/services/ITelemetry.js +1 -1
  18. package/dist/sdk/abstractions/services/index.d.ts +1 -1
  19. package/dist/sdk/abstractions/services/index.js +1 -1
  20. package/dist/sdk/abstractions/types/FileMetadata.d.ts +1 -1
  21. package/dist/sdk/abstractions/types/FileMetadata.js +1 -1
  22. package/dist/sdk/abstractions/types/Result.d.ts +1 -1
  23. package/dist/sdk/abstractions/types/Result.js +1 -1
  24. package/dist/sdk/abstractions/types/index.d.ts +1 -1
  25. package/dist/sdk/abstractions/types/index.js +1 -1
  26. package/dist/sdk/components/LegendPanel/index.d.ts +1 -1
  27. package/dist/sdk/components/LegendPanel/index.js +1 -1
  28. package/dist/sdk/components/ZoomBar/ZoomBar.d.ts.map +1 -1
  29. package/dist/sdk/components/ZoomBar/ZoomBar.js +2 -1
  30. package/dist/sdk/components/ZoomBar/ZoomBar.js.map +1 -1
  31. package/dist/sdk/components/ZoomBar/index.d.ts +1 -1
  32. package/dist/sdk/components/ZoomBar/index.js +1 -1
  33. package/dist/sdk/components/index.d.ts +1 -1
  34. package/dist/sdk/components/index.js +1 -1
  35. package/dist/sdk/constants.d.ts +1 -1
  36. package/dist/sdk/constants.js +1 -1
  37. package/dist/sdk/contracts/core/IMetadataParser.d.ts +23 -1
  38. package/dist/sdk/contracts/core/IMetadataParser.d.ts.map +1 -1
  39. package/dist/sdk/contracts/core/IMetadataParser.js +1 -1
  40. package/dist/sdk/contracts/core/IVisualizationPlugin.d.ts +1 -1
  41. package/dist/sdk/contracts/core/IVisualizationPlugin.js +1 -1
  42. package/dist/sdk/contracts/core/index.d.ts +1 -1
  43. package/dist/sdk/contracts/core/index.js +1 -1
  44. package/dist/sdk/contracts/index.d.ts +1 -1
  45. package/dist/sdk/contracts/index.js +1 -1
  46. package/dist/sdk/contracts/types/MetadataFileInfo.d.ts +1 -1
  47. package/dist/sdk/contracts/types/MetadataFileInfo.js +1 -1
  48. package/dist/sdk/contracts/types/MetadataPluginInfo.d.ts +1 -1
  49. package/dist/sdk/contracts/types/MetadataPluginInfo.js +1 -1
  50. package/dist/sdk/contracts/types/PluginConfig.d.ts +1 -1
  51. package/dist/sdk/contracts/types/PluginConfig.js +1 -1
  52. package/dist/sdk/contracts/types/PluginContext.d.ts +1 -1
  53. package/dist/sdk/contracts/types/PluginContext.js +1 -1
  54. package/dist/sdk/contracts/types/PluginError.d.ts +1 -1
  55. package/dist/sdk/contracts/types/PluginError.js +1 -1
  56. package/dist/sdk/contracts/types/SelectableNode.d.ts +62 -0
  57. package/dist/sdk/contracts/types/SelectableNode.d.ts.map +1 -0
  58. package/dist/sdk/contracts/types/SelectableNode.js +8 -0
  59. package/dist/sdk/contracts/types/SelectableNode.js.map +1 -0
  60. package/dist/sdk/contracts/types/ValidationResult.d.ts +1 -1
  61. package/dist/sdk/contracts/types/ValidationResult.js +1 -1
  62. package/dist/sdk/contracts/types/VersionInfo.d.ts +1 -1
  63. package/dist/sdk/contracts/types/VersionInfo.js +1 -1
  64. package/dist/sdk/contracts/types/index.d.ts +2 -1
  65. package/dist/sdk/contracts/types/index.d.ts.map +1 -1
  66. package/dist/sdk/contracts/types/index.js +2 -1
  67. package/dist/sdk/contracts/types/index.js.map +1 -1
  68. package/dist/sdk/design-system/index.d.ts +3 -1
  69. package/dist/sdk/design-system/index.d.ts.map +1 -1
  70. package/dist/sdk/design-system/index.js +3 -1
  71. package/dist/sdk/design-system/index.js.map +1 -1
  72. package/dist/sdk/design-system/light-design-system.css +724 -0
  73. package/dist/sdk/design-system/themes.d.ts +32 -0
  74. package/dist/sdk/design-system/themes.d.ts.map +1 -0
  75. package/dist/sdk/design-system/themes.js +32 -0
  76. package/dist/sdk/design-system/themes.js.map +1 -0
  77. package/dist/sdk/design-system/tokens/colors.d.ts +1 -1
  78. package/dist/sdk/design-system/tokens/colors.js +1 -1
  79. package/dist/sdk/design-system/tokens/spacing.d.ts +1 -1
  80. package/dist/sdk/design-system/tokens/spacing.js +1 -1
  81. package/dist/sdk/design-system/tokens/typography.d.ts +1 -1
  82. package/dist/sdk/design-system/tokens/typography.js +1 -1
  83. package/dist/sdk/design-system/utils.d.ts +1 -1
  84. package/dist/sdk/design-system/utils.js +1 -1
  85. package/dist/sdk/hooks/vibe-edit/index.d.ts +39 -0
  86. package/dist/sdk/hooks/vibe-edit/index.d.ts.map +1 -0
  87. package/dist/sdk/hooks/vibe-edit/index.js +42 -0
  88. package/dist/sdk/hooks/vibe-edit/index.js.map +1 -0
  89. package/dist/sdk/hooks/vibe-edit/selection/selectionGeometry.d.ts +56 -0
  90. package/dist/sdk/hooks/vibe-edit/selection/selectionGeometry.d.ts.map +1 -0
  91. package/dist/sdk/hooks/vibe-edit/selection/selectionGeometry.js +138 -0
  92. package/dist/sdk/hooks/vibe-edit/selection/selectionGeometry.js.map +1 -0
  93. package/dist/sdk/hooks/vibe-edit/selection/selectionGraph.d.ts +66 -0
  94. package/dist/sdk/hooks/vibe-edit/selection/selectionGraph.d.ts.map +1 -0
  95. package/dist/sdk/hooks/vibe-edit/selection/selectionGraph.js +73 -0
  96. package/dist/sdk/hooks/vibe-edit/selection/selectionGraph.js.map +1 -0
  97. package/dist/sdk/hooks/vibe-edit/selection/selectionGraphEngine.d.ts +64 -0
  98. package/dist/sdk/hooks/vibe-edit/selection/selectionGraphEngine.d.ts.map +1 -0
  99. package/dist/sdk/hooks/vibe-edit/selection/selectionGraphEngine.js +161 -0
  100. package/dist/sdk/hooks/vibe-edit/selection/selectionGraphEngine.js.map +1 -0
  101. package/dist/sdk/hooks/vibe-edit/selection/types.d.ts +47 -0
  102. package/dist/sdk/hooks/vibe-edit/selection/types.d.ts.map +1 -0
  103. package/dist/sdk/hooks/vibe-edit/selection/types.js +40 -0
  104. package/dist/sdk/hooks/vibe-edit/selection/types.js.map +1 -0
  105. package/dist/sdk/hooks/vibe-edit/selection/useMarqueeSelection.d.ts +30 -0
  106. package/dist/sdk/hooks/vibe-edit/selection/useMarqueeSelection.d.ts.map +1 -0
  107. package/dist/sdk/hooks/vibe-edit/selection/useMarqueeSelection.js +50 -0
  108. package/dist/sdk/hooks/vibe-edit/selection/useMarqueeSelection.js.map +1 -0
  109. package/dist/sdk/hooks/vibe-edit/ui/MarqueeSelection.css +26 -0
  110. package/dist/sdk/hooks/vibe-edit/ui/MarqueeSelection.d.ts +84 -0
  111. package/dist/sdk/hooks/vibe-edit/ui/MarqueeSelection.d.ts.map +1 -0
  112. package/dist/sdk/hooks/vibe-edit/ui/MarqueeSelection.js +256 -0
  113. package/dist/sdk/hooks/vibe-edit/ui/MarqueeSelection.js.map +1 -0
  114. package/dist/sdk/hooks/vibe-edit/ui/VibeEditPanel.css +207 -0
  115. package/dist/sdk/hooks/vibe-edit/ui/VibeEditPanel.d.ts +43 -0
  116. package/dist/sdk/hooks/vibe-edit/ui/VibeEditPanel.d.ts.map +1 -0
  117. package/dist/sdk/hooks/vibe-edit/ui/VibeEditPanel.js +80 -0
  118. package/dist/sdk/hooks/vibe-edit/ui/VibeEditPanel.js.map +1 -0
  119. package/dist/sdk/hooks/vibe-edit/ui/useVibeEdit.css +79 -0
  120. package/dist/sdk/hooks/vibe-edit/ui/useVibeEdit.d.ts +116 -0
  121. package/dist/sdk/hooks/vibe-edit/ui/useVibeEdit.d.ts.map +1 -0
  122. package/dist/sdk/hooks/vibe-edit/ui/useVibeEdit.js +264 -0
  123. package/dist/sdk/hooks/vibe-edit/ui/useVibeEdit.js.map +1 -0
  124. package/dist/sdk/utils/HostCommunicationUtils.d.ts +1 -1
  125. package/dist/sdk/utils/HostCommunicationUtils.js +1 -1
  126. package/dist/sdk/utils/errors/ErrorBuilder.d.ts +1 -1
  127. package/dist/sdk/utils/errors/ErrorBuilder.js +1 -1
  128. package/dist/sdk/utils/errors/setupHandlers.d.ts +1 -1
  129. package/dist/sdk/utils/errors/setupHandlers.js +1 -1
  130. package/dist/sdk/utils/logger.d.ts +1 -1
  131. package/dist/sdk/utils/logger.js +1 -1
  132. package/dist/sdk/utils/test-helpers/architecture-test-utils.d.ts +1 -1
  133. package/dist/sdk/utils/test-helpers/architecture-test-utils.js +1 -1
  134. package/dist/sdk/utils/test-helpers/index.d.ts +1 -1
  135. package/dist/sdk/utils/test-helpers/index.js +1 -1
  136. package/dist/sdk/utils/xmlParser.d.ts +1 -1
  137. package/dist/sdk/utils/xmlParser.js +1 -1
  138. package/dist/sdk/webviewMessageTypes.d.ts +78 -1
  139. package/dist/sdk/webviewMessageTypes.d.ts.map +1 -1
  140. package/dist/sdk/webviewMessageTypes.js +8 -5
  141. package/dist/sdk/webviewMessageTypes.js.map +1 -1
  142. package/package.json +11 -3
  143. package/src/sdk/utils/test-helpers/architecture-test-utils.ts +1 -1
  144. package/src/sdk/utils/test-helpers/index.ts +1 -1
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Copyright (c) 2026, Salesforce, Inc.
3
+ * All rights reserved.
4
+ * Licensed under the BSD 3-Clause license.
5
+ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
6
+ **/
7
+ /**
8
+ * Available design system themes.
9
+ * Each theme provides a full `--vscode-*` variable layer that the base
10
+ * sheet (`vscode-design-system.css`) reads for its `--mv-*` token definitions.
11
+ *
12
+ * Dark is intentionally absent: it is not a theme file. The base sheet's own
13
+ * inline `var(--vscode-*, <dark-fallback>)` defaults render dark when nothing
14
+ * declares the `--vscode-*` layer, so the default (no-theme) sheet is dark.
15
+ */
16
+ export declare const DESIGN_SYSTEM_THEMES: readonly ["light"];
17
+ /**
18
+ * Union of valid theme names.
19
+ */
20
+ export type DesignSystemTheme = (typeof DESIGN_SYSTEM_THEMES)[number];
21
+ /**
22
+ * Type guard: checks if a value is a valid theme name.
23
+ * Use this to validate user input before passing to theme-aware APIs.
24
+ */
25
+ export declare function isDesignSystemTheme(val: unknown): val is DesignSystemTheme;
26
+ /**
27
+ * Resolve a theme to its CSS filename.
28
+ * @param theme - Optional theme name. Undefined resolves to the default (dark-fallback) sheet.
29
+ * @returns CSS filename (`'platform.css'` for undefined, `'<theme>-design-system.css'` otherwise)
30
+ */
31
+ export declare function designSystemCssFileName(theme?: DesignSystemTheme): string;
32
+ //# sourceMappingURL=themes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"themes.d.ts","sourceRoot":"","sources":["../../../src/sdk/design-system/themes.ts"],"names":[],"mappings":"AAAA;;;;;IAKI;AAEJ;;;;;;;;GAQG;AACH,eAAO,MAAM,oBAAoB,oBAAqB,CAAC;AAEvD;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,oBAAoB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEtE;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,iBAAiB,CAE1E;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,CAAC,EAAE,iBAAiB,GAAG,MAAM,CAEzE"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Copyright (c) 2026, Salesforce, Inc.
3
+ * All rights reserved.
4
+ * Licensed under the BSD 3-Clause license.
5
+ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
6
+ **/
7
+ /**
8
+ * Available design system themes.
9
+ * Each theme provides a full `--vscode-*` variable layer that the base
10
+ * sheet (`vscode-design-system.css`) reads for its `--mv-*` token definitions.
11
+ *
12
+ * Dark is intentionally absent: it is not a theme file. The base sheet's own
13
+ * inline `var(--vscode-*, <dark-fallback>)` defaults render dark when nothing
14
+ * declares the `--vscode-*` layer, so the default (no-theme) sheet is dark.
15
+ */
16
+ export const DESIGN_SYSTEM_THEMES = ['light'];
17
+ /**
18
+ * Type guard: checks if a value is a valid theme name.
19
+ * Use this to validate user input before passing to theme-aware APIs.
20
+ */
21
+ export function isDesignSystemTheme(val) {
22
+ return typeof val === 'string' && DESIGN_SYSTEM_THEMES.includes(val);
23
+ }
24
+ /**
25
+ * Resolve a theme to its CSS filename.
26
+ * @param theme - Optional theme name. Undefined resolves to the default (dark-fallback) sheet.
27
+ * @returns CSS filename (`'platform.css'` for undefined, `'<theme>-design-system.css'` otherwise)
28
+ */
29
+ export function designSystemCssFileName(theme) {
30
+ return theme ? `${theme}-design-system.css` : 'platform.css';
31
+ }
32
+ //# sourceMappingURL=themes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"themes.js","sourceRoot":"","sources":["../../../src/sdk/design-system/themes.ts"],"names":[],"mappings":"AAAA;;;;;IAKI;AAEJ;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,OAAO,CAAU,CAAC;AAOvD;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CAAC,GAAY;IAC9C,OAAO,OAAO,GAAG,KAAK,QAAQ,IAAK,oBAA0C,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;AAC9F,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,uBAAuB,CAAC,KAAyB;IAC/D,OAAO,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,oBAAoB,CAAC,CAAC,CAAC,cAAc,CAAC;AAC/D,CAAC"}
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright (c) 2025, Salesforce, Inc.
2
+ * Copyright (c) 2026, Salesforce, Inc.
3
3
  * All rights reserved.
4
4
  * Licensed under the BSD 3-Clause license.
5
5
  * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright (c) 2025, Salesforce, Inc.
2
+ * Copyright (c) 2026, Salesforce, Inc.
3
3
  * All rights reserved.
4
4
  * Licensed under the BSD 3-Clause license.
5
5
  * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright (c) 2025, Salesforce, Inc.
2
+ * Copyright (c) 2026, Salesforce, Inc.
3
3
  * All rights reserved.
4
4
  * Licensed under the BSD 3-Clause license.
5
5
  * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright (c) 2025, Salesforce, Inc.
2
+ * Copyright (c) 2026, Salesforce, Inc.
3
3
  * All rights reserved.
4
4
  * Licensed under the BSD 3-Clause license.
5
5
  * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright (c) 2025, Salesforce, Inc.
2
+ * Copyright (c) 2026, Salesforce, Inc.
3
3
  * All rights reserved.
4
4
  * Licensed under the BSD 3-Clause license.
5
5
  * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright (c) 2025, Salesforce, Inc.
2
+ * Copyright (c) 2026, Salesforce, Inc.
3
3
  * All rights reserved.
4
4
  * Licensed under the BSD 3-Clause license.
5
5
  * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright (c) 2025, Salesforce, Inc.
2
+ * Copyright (c) 2026, Salesforce, Inc.
3
3
  * All rights reserved.
4
4
  * Licensed under the BSD 3-Clause license.
5
5
  * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright (c) 2025, Salesforce, Inc.
2
+ * Copyright (c) 2026, Salesforce, Inc.
3
3
  * All rights reserved.
4
4
  * Licensed under the BSD 3-Clause license.
5
5
  * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Copyright (c) 2026, Salesforce, Inc.
3
+ * All rights reserved.
4
+ * Licensed under the BSD 3-Clause license.
5
+ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
6
+ **/
7
+ /**
8
+ * Vibe-edit feature barrel.
9
+ *
10
+ * ONE consumer-facing hook — `useVibeEdit` — owns the whole flow: it composes
11
+ * the internal selection machinery (state machine + overlay + graph engine +
12
+ * geometry) with the prompt panel and the SUBMIT_EDIT handoff. Everything else
13
+ * exported here is a lower-level primitive kept public for advanced callers.
14
+ *
15
+ * Layout (separation of concern, and the whole feature removable as one dir):
16
+ * ui/ — the JSX/CSS layer (useVibeEdit, VibeEditPanel, MarqueeSelection)
17
+ * selection/ — the logic layer (SelectionGraph contract + engine, geometry,
18
+ * selection state machine, shared types)
19
+ *
20
+ * This subpath is a BROWSER/BUNDLER-ONLY entry: it transitively imports React and
21
+ * a side-effect `.css`, so importing it in a plain Node ESM runtime throws. The
22
+ * inverter (`buildContextsFromNodes` / `nodeToSpatialContext`) runs in the plugin
23
+ * iframe against live marquee selection — there is no server-side inversion. The
24
+ * framework/web-adapter only PRODUCE `SelectableNode[]` and forward them verbatim
25
+ * as postMessage data; they never construct a SpatialContext. So do NOT import
26
+ * from here in a headless/server consumer — the react-free node helpers a parser
27
+ * needs (`SelectableNode`, `sfdxPath`, `structuralId`, `hashString`) are also on
28
+ * the main barrel, which stays React/CSS-free.
29
+ */
30
+ export { useVibeEdit, isVibeEditAvailable } from './ui/useVibeEdit.js';
31
+ export type { UseVibeEditResult, UseVibeEditOptions } from './ui/useVibeEdit.js';
32
+ export { VibeEditPanel, type VibeEditChip } from './ui/VibeEditPanel.js';
33
+ export { MarqueeSelection } from './ui/MarqueeSelection.js';
34
+ export { useMarqueeSelection, type MarqueeSelectionApi } from './selection/useMarqueeSelection.js';
35
+ export { itemKey } from './selection/selectionGeometry.js';
36
+ export { SELECTABLE_ATTR, TYPE_ATTR, ID_ATTR, SELECTED_ATTR, HOVER_ATTR, COVERAGE_THRESHOLD, CLICK_THRESHOLD_PX, type SelectedItem, } from './selection/types.js';
37
+ export { type SelectableNode, type SfdxPathInput, sfdxPath, hashString, structuralId, } from './selection/selectionGraph.js';
38
+ export { tagSelectionGraphLive, buildContextsFromNodes, nodeToSpatialContext, indexNodes, } from './selection/selectionGraphEngine.js';
39
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/sdk/hooks/vibe-edit/index.ts"],"names":[],"mappings":"AAAA;;;;;IAKI;AAEJ;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAGH,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AACvE,YAAY,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACjF,OAAO,EAAE,aAAa,EAAE,KAAK,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACzE,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAG5D,OAAO,EAAE,mBAAmB,EAAE,KAAK,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACnG,OAAO,EAAE,OAAO,EAAE,MAAM,kCAAkC,CAAC;AAC3D,OAAO,EACL,eAAe,EACf,SAAS,EACT,OAAO,EACP,aAAa,EACb,UAAU,EACV,kBAAkB,EAClB,kBAAkB,EAClB,KAAK,YAAY,GAClB,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,QAAQ,EACR,UAAU,EACV,YAAY,GACb,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,qBAAqB,EACrB,sBAAsB,EACtB,oBAAoB,EACpB,UAAU,GACX,MAAM,qCAAqC,CAAC"}
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Copyright (c) 2026, Salesforce, Inc.
3
+ * All rights reserved.
4
+ * Licensed under the BSD 3-Clause license.
5
+ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
6
+ **/
7
+ /**
8
+ * Vibe-edit feature barrel.
9
+ *
10
+ * ONE consumer-facing hook — `useVibeEdit` — owns the whole flow: it composes
11
+ * the internal selection machinery (state machine + overlay + graph engine +
12
+ * geometry) with the prompt panel and the SUBMIT_EDIT handoff. Everything else
13
+ * exported here is a lower-level primitive kept public for advanced callers.
14
+ *
15
+ * Layout (separation of concern, and the whole feature removable as one dir):
16
+ * ui/ — the JSX/CSS layer (useVibeEdit, VibeEditPanel, MarqueeSelection)
17
+ * selection/ — the logic layer (SelectionGraph contract + engine, geometry,
18
+ * selection state machine, shared types)
19
+ *
20
+ * This subpath is a BROWSER/BUNDLER-ONLY entry: it transitively imports React and
21
+ * a side-effect `.css`, so importing it in a plain Node ESM runtime throws. The
22
+ * inverter (`buildContextsFromNodes` / `nodeToSpatialContext`) runs in the plugin
23
+ * iframe against live marquee selection — there is no server-side inversion. The
24
+ * framework/web-adapter only PRODUCE `SelectableNode[]` and forward them verbatim
25
+ * as postMessage data; they never construct a SpatialContext. So do NOT import
26
+ * from here in a headless/server consumer — the react-free node helpers a parser
27
+ * needs (`SelectableNode`, `sfdxPath`, `structuralId`, `hashString`) are also on
28
+ * the main barrel, which stays React/CSS-free.
29
+ */
30
+ // --- ui layer ---
31
+ export { useVibeEdit, isVibeEditAvailable } from './ui/useVibeEdit.js';
32
+ export { VibeEditPanel } from './ui/VibeEditPanel.js';
33
+ export { MarqueeSelection } from './ui/MarqueeSelection.js';
34
+ // --- selection layer (logic) ---
35
+ export { useMarqueeSelection } from './selection/useMarqueeSelection.js';
36
+ export { itemKey } from './selection/selectionGeometry.js';
37
+ export { SELECTABLE_ATTR, TYPE_ATTR, ID_ATTR, SELECTED_ATTR, HOVER_ATTR, COVERAGE_THRESHOLD, CLICK_THRESHOLD_PX, } from './selection/types.js';
38
+ // SelectionGraph (C1 + C4): the normalized SelectableNode contract + the shared
39
+ // deterministic-id and SFDX-path helpers a plugin parser uses to emit it.
40
+ export { sfdxPath, hashString, structuralId, } from './selection/selectionGraph.js';
41
+ export { tagSelectionGraphLive, buildContextsFromNodes, nodeToSpatialContext, indexNodes, } from './selection/selectionGraphEngine.js';
42
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/sdk/hooks/vibe-edit/index.ts"],"names":[],"mappings":"AAAA;;;;;IAKI;AAEJ;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,mBAAmB;AACnB,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAEvE,OAAO,EAAE,aAAa,EAAqB,MAAM,uBAAuB,CAAC;AACzE,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAE5D,kCAAkC;AAClC,OAAO,EAAE,mBAAmB,EAA4B,MAAM,oCAAoC,CAAC;AACnG,OAAO,EAAE,OAAO,EAAE,MAAM,kCAAkC,CAAC;AAC3D,OAAO,EACL,eAAe,EACf,SAAS,EACT,OAAO,EACP,aAAa,EACb,UAAU,EACV,kBAAkB,EAClB,kBAAkB,GAEnB,MAAM,sBAAsB,CAAC;AAC9B,gFAAgF;AAChF,0EAA0E;AAC1E,OAAO,EAGL,QAAQ,EACR,UAAU,EACV,YAAY,GACb,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,qBAAqB,EACrB,sBAAsB,EACtB,oBAAoB,EACpB,UAAU,GACX,MAAM,qCAAqC,CAAC"}
@@ -0,0 +1,56 @@
1
+ /**
2
+ * Copyright (c) 2026, Salesforce, Inc.
3
+ * All rights reserved.
4
+ * Licensed under the BSD 3-Clause license.
5
+ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
6
+ **/
7
+ import { type SelectedItem } from './types.js';
8
+ /** A rectangle in client coordinates. */
9
+ export interface Rect {
10
+ left: number;
11
+ top: number;
12
+ right: number;
13
+ bottom: number;
14
+ }
15
+ /** Build a normalized Rect from two drag points. */
16
+ export declare function rectFromPoints(x1: number, y1: number, x2: number, y2: number): Rect;
17
+ /**
18
+ * Fraction (0..1) of `el`'s area covered by `marquee`. This is the
19
+ * intersection-over-element-area used by the >=50% selection rule.
20
+ */
21
+ export declare function coverage(marquee: Rect, el: Rect): number;
22
+ /** Read the SelectedItem identity from a tagged element. */
23
+ export declare function itemOf(el: Element): SelectedItem | null;
24
+ /** Stable key for a SelectedItem: `type::id`. */
25
+ export declare function itemKey(item: SelectedItem): string;
26
+ /**
27
+ * Find every selectable element under `root` whose area is >= threshold-covered
28
+ * by the marquee, applying the **ancestor-wins** rule:
29
+ *
30
+ * Selectable elements nest (a field row lives inside an object card). When the
31
+ * marquee covers an element AND its selectable ancestor, we keep only the
32
+ * ancestor — dragging a box over a whole card selects the object, not the
33
+ * object plus all its fields. Dragging a box over just a few rows (not enough
34
+ * of the card) selects those fields. This gives intuitive granularity from a
35
+ * single gesture.
36
+ */
37
+ export declare function selectInMarquee(root: ParentNode, marquee: Rect, threshold?: number): SelectedItem[];
38
+ /**
39
+ * Every selectable element under `root` whose area is >= threshold-covered by
40
+ * the marquee — WITHOUT the ancestor-wins collapse. Where {@link selectInMarquee}
41
+ * returns only the outermost covered element (what actually gets selected), this
42
+ * returns the full covered set including the finer nested elements (a card's
43
+ * label / description rows as well as the card itself).
44
+ *
45
+ * Used only for the live drag preview highlight: while dragging a box over a
46
+ * whole tile, the user sees the tile AND its inner label/description light up,
47
+ * making the finer selectables visible — even though release still selects just
48
+ * the tile (ancestor-wins). Purely visual; never fed to the edit handoff.
49
+ */
50
+ export declare function coveredInMarquee(root: ParentNode, marquee: Rect, threshold?: number): SelectedItem[];
51
+ /**
52
+ * Resolve the most-specific selectable element at a point (for click): the
53
+ * innermost tagged element containing the point. Returns null if none.
54
+ */
55
+ export declare function selectAtPoint(root: ParentNode, x: number, y: number): SelectedItem | null;
56
+ //# sourceMappingURL=selectionGeometry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"selectionGeometry.d.ts","sourceRoot":"","sources":["../../../../../src/sdk/hooks/vibe-edit/selection/selectionGeometry.ts"],"names":[],"mappings":"AAAA;;;;;IAKI;AAEJ,OAAO,EAKL,KAAK,YAAY,EAClB,MAAM,YAAY,CAAC;AAEpB,yCAAyC;AACzC,MAAM,WAAW,IAAI;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,oDAAoD;AACpD,wBAAgB,cAAc,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,IAAI,CAOnF;AAcD;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,GAAG,MAAM,CAMxD;AAED,4DAA4D;AAC5D,wBAAgB,MAAM,CAAC,EAAE,EAAE,OAAO,GAAG,YAAY,GAAG,IAAI,CAOvD;AAED,iDAAiD;AACjD,wBAAgB,OAAO,CAAC,IAAI,EAAE,YAAY,GAAG,MAAM,CAElD;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAC7B,IAAI,EAAE,UAAU,EAChB,OAAO,EAAE,IAAI,EACb,SAAS,GAAE,MAA2B,GACrC,YAAY,EAAE,CAiChB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,UAAU,EAChB,OAAO,EAAE,IAAI,EACb,SAAS,GAAE,MAA2B,GACrC,YAAY,EAAE,CAehB;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,UAAU,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,YAAY,GAAG,IAAI,CAezF"}
@@ -0,0 +1,138 @@
1
+ /**
2
+ * Copyright (c) 2026, Salesforce, Inc.
3
+ * All rights reserved.
4
+ * Licensed under the BSD 3-Clause license.
5
+ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
6
+ **/
7
+ import { SELECTABLE_ATTR, TYPE_ATTR, ID_ATTR, COVERAGE_THRESHOLD, } from './types.js';
8
+ /** Build a normalized Rect from two drag points. */
9
+ export function rectFromPoints(x1, y1, x2, y2) {
10
+ return {
11
+ left: Math.min(x1, x2),
12
+ top: Math.min(y1, y2),
13
+ right: Math.max(x1, x2),
14
+ bottom: Math.max(y1, y2),
15
+ };
16
+ }
17
+ /** Area of the intersection of two rects (0 if they don't overlap). */
18
+ function intersectionArea(a, b) {
19
+ const w = Math.max(0, Math.min(a.right, b.right) - Math.max(a.left, b.left));
20
+ const h = Math.max(0, Math.min(a.bottom, b.bottom) - Math.max(a.top, b.top));
21
+ return w * h;
22
+ }
23
+ /** Area of a rect. */
24
+ function area(r) {
25
+ return Math.max(0, r.right - r.left) * Math.max(0, r.bottom - r.top);
26
+ }
27
+ /**
28
+ * Fraction (0..1) of `el`'s area covered by `marquee`. This is the
29
+ * intersection-over-element-area used by the >=50% selection rule.
30
+ */
31
+ export function coverage(marquee, el) {
32
+ const elArea = area(el);
33
+ if (elArea <= 0) {
34
+ return 0;
35
+ }
36
+ return intersectionArea(marquee, el) / elArea;
37
+ }
38
+ /** Read the SelectedItem identity from a tagged element. */
39
+ export function itemOf(el) {
40
+ const type = el.getAttribute(TYPE_ATTR);
41
+ const id = el.getAttribute(ID_ATTR);
42
+ if (!type || !id) {
43
+ return null;
44
+ }
45
+ return { type, id };
46
+ }
47
+ /** Stable key for a SelectedItem: `type::id`. */
48
+ export function itemKey(item) {
49
+ return `${item.type}::${item.id}`;
50
+ }
51
+ /**
52
+ * Find every selectable element under `root` whose area is >= threshold-covered
53
+ * by the marquee, applying the **ancestor-wins** rule:
54
+ *
55
+ * Selectable elements nest (a field row lives inside an object card). When the
56
+ * marquee covers an element AND its selectable ancestor, we keep only the
57
+ * ancestor — dragging a box over a whole card selects the object, not the
58
+ * object plus all its fields. Dragging a box over just a few rows (not enough
59
+ * of the card) selects those fields. This gives intuitive granularity from a
60
+ * single gesture.
61
+ */
62
+ export function selectInMarquee(root, marquee, threshold = COVERAGE_THRESHOLD) {
63
+ const els = Array.from(root.querySelectorAll(`[${SELECTABLE_ATTR}]`));
64
+ // Elements that pass the coverage threshold.
65
+ const covered = els.filter((el) => {
66
+ const r = el.getBoundingClientRect();
67
+ return (coverage(marquee, { left: r.left, top: r.top, right: r.right, bottom: r.bottom }) >= threshold);
68
+ });
69
+ const coveredSet = new Set(covered);
70
+ // Ancestor-wins: drop any covered element that has a covered selectable ancestor.
71
+ const result = [];
72
+ for (const el of covered) {
73
+ let parent = el.parentElement;
74
+ let hasCoveredAncestor = false;
75
+ while (parent) {
76
+ if (coveredSet.has(parent)) {
77
+ hasCoveredAncestor = true;
78
+ break;
79
+ }
80
+ parent = parent.parentElement;
81
+ }
82
+ if (hasCoveredAncestor) {
83
+ continue;
84
+ }
85
+ const item = itemOf(el);
86
+ if (item) {
87
+ result.push(item);
88
+ }
89
+ }
90
+ return result;
91
+ }
92
+ /**
93
+ * Every selectable element under `root` whose area is >= threshold-covered by
94
+ * the marquee — WITHOUT the ancestor-wins collapse. Where {@link selectInMarquee}
95
+ * returns only the outermost covered element (what actually gets selected), this
96
+ * returns the full covered set including the finer nested elements (a card's
97
+ * label / description rows as well as the card itself).
98
+ *
99
+ * Used only for the live drag preview highlight: while dragging a box over a
100
+ * whole tile, the user sees the tile AND its inner label/description light up,
101
+ * making the finer selectables visible — even though release still selects just
102
+ * the tile (ancestor-wins). Purely visual; never fed to the edit handoff.
103
+ */
104
+ export function coveredInMarquee(root, marquee, threshold = COVERAGE_THRESHOLD) {
105
+ const els = Array.from(root.querySelectorAll(`[${SELECTABLE_ATTR}]`));
106
+ const result = [];
107
+ for (const el of els) {
108
+ const r = el.getBoundingClientRect();
109
+ if (coverage(marquee, { left: r.left, top: r.top, right: r.right, bottom: r.bottom }) >= threshold) {
110
+ const item = itemOf(el);
111
+ if (item) {
112
+ result.push(item);
113
+ }
114
+ }
115
+ }
116
+ return result;
117
+ }
118
+ /**
119
+ * Resolve the most-specific selectable element at a point (for click): the
120
+ * innermost tagged element containing the point. Returns null if none.
121
+ */
122
+ export function selectAtPoint(root, x, y) {
123
+ const els = Array.from(root.querySelectorAll(`[${SELECTABLE_ATTR}]`));
124
+ let best = null;
125
+ for (const el of els) {
126
+ const r = el.getBoundingClientRect();
127
+ if (x < r.left || x > r.right || y < r.top || y > r.bottom) {
128
+ continue;
129
+ }
130
+ const a = (r.right - r.left) * (r.bottom - r.top);
131
+ // Smallest containing box = most specific (innermost) element.
132
+ if (!best || a < best.area) {
133
+ best = { el, area: a };
134
+ }
135
+ }
136
+ return best ? itemOf(best.el) : null;
137
+ }
138
+ //# sourceMappingURL=selectionGeometry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"selectionGeometry.js","sourceRoot":"","sources":["../../../../../src/sdk/hooks/vibe-edit/selection/selectionGeometry.ts"],"names":[],"mappings":"AAAA;;;;;IAKI;AAEJ,OAAO,EACL,eAAe,EACf,SAAS,EACT,OAAO,EACP,kBAAkB,GAEn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IAAI,CAAC;AACvC,CAAC"}
@@ -0,0 +1,66 @@
1
+ /**
2
+ * Copyright (c) 2026, Salesforce, Inc.
3
+ * All rights reserved.
4
+ * Licensed under the BSD 3-Clause license.
5
+ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
6
+ **/
7
+ /**
8
+ * SelectionGraph — the runtime helpers over the normalized node contract (C1 + C4).
9
+ *
10
+ * A plugin's parser emits `SelectableNode[]` as it walks its own tree (which it
11
+ * already does to render). The framework/host holds this flat, uniform array and
12
+ * the selection engine resolves a selected DOM element to its node by a single
13
+ * `Map.get(id)` — it never introspects the plugin's opaque parsed shape.
14
+ *
15
+ * This dissolves the consumption side of the shape-opacity blocker (B1) and, via
16
+ * deterministic ids (C4), the FlexiPage `Math.random()` render-time-id wall (B3):
17
+ * the DOM's `data-mv-id` is set to `node.id` at render time, so selection inverts
18
+ * by lookup, never by re-deriving a plugin-invented encoding.
19
+ *
20
+ * What remains plugin-authored (the irreducible, one-time, feature-agnostic
21
+ * residue): the parser must PROJECT its bespoke shape into these nodes (B1
22
+ * production side) and supply a few Salesforce convention primitives (B2) —
23
+ * `sfdxPath` below turns those primitives into the file path so the plugin never
24
+ * hand-writes path strings.
25
+ *
26
+ * The node TYPES ({@link SelectableNode}, {@link SfdxPathInput}) live in the
27
+ * contracts layer (`contracts/types/SelectableNode.ts`) because
28
+ * `IMetadataParser.getSelectableNodes()` returns them and contracts must not
29
+ * import from hooks/. They're re-exported here so the selection layer stays the
30
+ * one-stop import for both the types and the helpers that operate on them.
31
+ */
32
+ import type { SelectableNode, SfdxPathInput } from '../../../contracts/types/SelectableNode.js';
33
+ export type { SelectableNode, SfdxPathInput };
34
+ /**
35
+ * Compute the SFDX metadata file path for a node from its convention primitives.
36
+ * Encapsulates the Salesforce source-format layout (`objects/<Api>/<Api>.object-meta.xml`,
37
+ * decomposed fields at `objects/<Obj>/fields/<Field>.field-meta.xml`, inline
38
+ * fields inheriting the object file) so no plugin hand-writes these strings.
39
+ *
40
+ * Returns undefined only when there isn't enough information to place the node;
41
+ * callers may leave `filePath` unset (the agent can still locate by name).
42
+ */
43
+ export declare function sfdxPath(input: SfdxPathInput): string | undefined;
44
+ /**
45
+ * Deterministic 32-bit FNV-1a hash → zero-padded 8-char hex. Pure and
46
+ * environment-independent (no Web/Node crypto), so the parser (host) and any
47
+ * render-time consumer (iframe) compute identical ids.
48
+ */
49
+ export declare function hashString(input: string): string;
50
+ /**
51
+ * Deterministic id from a node's position in the DATA tree — NOT the DOM. The
52
+ * host is DOM-less, so the id must be derivable from parsed-data structure alone
53
+ * (this is the C4 correction: the old DOM-based `inspectPath` could not be
54
+ * reproduced host-side). Same inputs → same id at parse time and render time.
55
+ *
56
+ * The path is `<parentId>/<type>:<apiName>#<index>` where `index` disambiguates
57
+ * same-(type,apiName) siblings under one parent. Callers pass a per-parent
58
+ * running index (0 when apiName is already unique among siblings).
59
+ *
60
+ * @param parentId parent node's id ('' for a root)
61
+ * @param type node kind
62
+ * @param apiName node api name
63
+ * @param index sibling index disambiguator (default 0)
64
+ */
65
+ export declare function structuralId(parentId: string, type: string, apiName: string, index?: number): string;
66
+ //# sourceMappingURL=selectionGraph.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"selectionGraph.d.ts","sourceRoot":"","sources":["../../../../../src/sdk/hooks/vibe-edit/selection/selectionGraph.ts"],"names":[],"mappings":"AAAA;;;;;IAKI;AAEJ;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,4CAA4C,CAAC;AAEhG,YAAY,EAAE,cAAc,EAAE,aAAa,EAAE,CAAC;AAE9C;;;;;;;;GAQG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,aAAa,GAAG,MAAM,GAAG,SAAS,CAwBjE;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAQhD;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,SAAI,GAAG,MAAM,CAE/F"}
@@ -0,0 +1,73 @@
1
+ /**
2
+ * Copyright (c) 2026, Salesforce, Inc.
3
+ * All rights reserved.
4
+ * Licensed under the BSD 3-Clause license.
5
+ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
6
+ **/
7
+ /**
8
+ * Compute the SFDX metadata file path for a node from its convention primitives.
9
+ * Encapsulates the Salesforce source-format layout (`objects/<Api>/<Api>.object-meta.xml`,
10
+ * decomposed fields at `objects/<Obj>/fields/<Field>.field-meta.xml`, inline
11
+ * fields inheriting the object file) so no plugin hand-writes these strings.
12
+ *
13
+ * Returns undefined only when there isn't enough information to place the node;
14
+ * callers may leave `filePath` unset (the agent can still locate by name).
15
+ */
16
+ export function sfdxPath(input) {
17
+ const objectsRoot = input.objectsRoot ?? 'objects';
18
+ switch (input.type) {
19
+ case 'object': {
20
+ if (!input.apiName) {
21
+ return undefined;
22
+ }
23
+ return `${objectsRoot}/${input.apiName}/${input.apiName}.object-meta.xml`;
24
+ }
25
+ case 'field': {
26
+ const obj = input.parentApiName;
27
+ if (!obj) {
28
+ return undefined;
29
+ }
30
+ // Decomposed field: its own file. Inline field: the object's file.
31
+ return input.decomposed && input.apiName
32
+ ? `${objectsRoot}/${obj}/fields/${input.apiName}.field-meta.xml`
33
+ : `${objectsRoot}/${obj}/${obj}.object-meta.xml`;
34
+ }
35
+ default:
36
+ // Non-SFDX-object node kinds (flexipage regions/components, etc.) don't map
37
+ // through this resolver — the plugin sets node.filePath directly.
38
+ return undefined;
39
+ }
40
+ }
41
+ /**
42
+ * Deterministic 32-bit FNV-1a hash → zero-padded 8-char hex. Pure and
43
+ * environment-independent (no Web/Node crypto), so the parser (host) and any
44
+ * render-time consumer (iframe) compute identical ids.
45
+ */
46
+ export function hashString(input) {
47
+ let hash = 0x811c9dc5; // FNV offset basis
48
+ for (let i = 0; i < input.length; i++) {
49
+ hash ^= input.charCodeAt(i);
50
+ // FNV prime (16777619) via shifts; >>> 0 keeps it unsigned 32-bit.
51
+ hash = (hash + ((hash << 1) + (hash << 4) + (hash << 7) + (hash << 8) + (hash << 24))) >>> 0;
52
+ }
53
+ return hash.toString(16).padStart(8, '0');
54
+ }
55
+ /**
56
+ * Deterministic id from a node's position in the DATA tree — NOT the DOM. The
57
+ * host is DOM-less, so the id must be derivable from parsed-data structure alone
58
+ * (this is the C4 correction: the old DOM-based `inspectPath` could not be
59
+ * reproduced host-side). Same inputs → same id at parse time and render time.
60
+ *
61
+ * The path is `<parentId>/<type>:<apiName>#<index>` where `index` disambiguates
62
+ * same-(type,apiName) siblings under one parent. Callers pass a per-parent
63
+ * running index (0 when apiName is already unique among siblings).
64
+ *
65
+ * @param parentId parent node's id ('' for a root)
66
+ * @param type node kind
67
+ * @param apiName node api name
68
+ * @param index sibling index disambiguator (default 0)
69
+ */
70
+ export function structuralId(parentId, type, apiName, index = 0) {
71
+ return `${type}_${hashString(`${parentId}/${type}:${apiName}#${index}`)}`;
72
+ }
73
+ //# sourceMappingURL=selectionGraph.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"selectionGraph.js","sourceRoot":"","sources":["../../../../../src/sdk/hooks/vibe-edit/selection/selectionGraph.ts"],"names":[],"mappings":"AAAA;;;;;IAKI;AAgCJ;;;;;;;;GAQG;AACH,MAAM,UAAU,QAAQ,CAAC,KAAoB;IAC3C,MAAM,WAAW,GAAG,KAAK,CAAC,WAAW,IAAI,SAAS,CAAC;IACnD,QAAQ,KAAK,CAAC,IAAI,EAAE,CAAC;QACnB,KAAK,QAAQ,CAAC,CAAC,CAAC;YACd,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;gBACnB,OAAO,SAAS,CAAC;YACnB,CAAC;YACD,OAAO,GAAG,WAAW,IAAI,KAAK,CAAC,OAAO,I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