@salesforce/metadata-plugins 1.13.0 → 1.15.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/README.md +16 -7
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/plugins/agent/ui/assets/{VibeEditComposer-D5GykTkw.js → VibeEditComposer-sSbOXosJ.js} +1 -1
- package/dist/plugins/agent/ui/assets/index-BIxtmvIY.js +72 -0
- package/dist/plugins/agent/ui/assets/index-DK6mLwjU.css +1 -0
- package/dist/plugins/agent/ui/index.html +2 -2
- package/dist/plugins/{flow/ui/assets/VibeEditComposer-C36-RsSl.js → flexipage/ui/assets/VibeEditComposer-2omfTQa8.js} +1 -1
- package/dist/plugins/flexipage/ui/assets/index-Ch0zZsHI.css +1 -0
- package/dist/plugins/flexipage/ui/assets/index-uJdxEdOM.js +49 -0
- package/dist/plugins/flexipage/ui/index.html +2 -2
- package/dist/plugins/{permissionset/ui/assets/VibeEditComposer-HYu9RPHQ.js → flow/ui/assets/VibeEditComposer-6VCphcxQ.js} +1 -1
- package/dist/plugins/flow/ui/assets/index-CQ3TDL7z.css +1 -0
- package/dist/plugins/flow/ui/assets/index-CpyTpkLI.js +49 -0
- package/dist/plugins/flow/ui/index.html +2 -2
- package/dist/plugins/flowintent/ui/assets/{index-CzlE9StJ.js → index-y2EUB92Z.js} +8 -8
- package/dist/plugins/flowintent/ui/index.html +1 -1
- package/dist/plugins/keyvaluetable/KeyValueTableParser.d.ts +36 -0
- package/dist/plugins/keyvaluetable/KeyValueTableParser.d.ts.map +1 -0
- package/dist/plugins/keyvaluetable/KeyValueTableParser.js +429 -0
- package/dist/plugins/keyvaluetable/KeyValueTableVisualizer.d.ts +29 -0
- package/dist/plugins/keyvaluetable/KeyValueTableVisualizer.d.ts.map +1 -0
- package/dist/plugins/keyvaluetable/KeyValueTableVisualizer.js +63 -0
- package/dist/plugins/keyvaluetable/humanize.d.ts +9 -0
- package/dist/plugins/keyvaluetable/humanize.d.ts.map +1 -0
- package/dist/plugins/keyvaluetable/humanize.js +15 -0
- package/dist/plugins/keyvaluetable/types/KeyValueTableData.d.ts +78 -0
- package/dist/plugins/keyvaluetable/types/KeyValueTableData.d.ts.map +1 -0
- package/dist/plugins/keyvaluetable/types/KeyValueTableData.js +7 -0
- package/dist/plugins/keyvaluetable/ui/assets/index-BFCI4_BV.js +50 -0
- package/dist/plugins/keyvaluetable/ui/assets/index-CxfJGu2l.css +1 -0
- package/dist/plugins/keyvaluetable/ui/index.html +14 -0
- package/dist/plugins/{flexipage/ui/assets/VibeEditComposer-CwNZdtC5.js → permissionset/ui/assets/VibeEditComposer-CIuLlA6k.js} +1 -1
- package/dist/plugins/permissionset/ui/assets/index-C30GA5Fg.js +49 -0
- package/dist/plugins/permissionset/ui/assets/index-DrM8dMi5.css +1 -0
- package/dist/plugins/permissionset/ui/index.html +2 -2
- package/dist/plugins/schema/ui/assets/VibeEditComposer-4dxANHzI.js +1 -0
- package/dist/plugins/schema/ui/assets/index-ByiBxce_.js +71 -0
- package/dist/plugins/schema/ui/assets/index-CkSyHqut.css +1 -0
- package/dist/plugins/schema/ui/index.html +2 -2
- package/package.json +3 -3
- package/dist/plugins/agent/ui/assets/index-CFqH429G.css +0 -1
- package/dist/plugins/agent/ui/assets/index-nYWtX5pm.js +0 -72
- package/dist/plugins/flexipage/ui/assets/index-C2upgZns.css +0 -1
- package/dist/plugins/flexipage/ui/assets/index-hFZPLB6p.js +0 -49
- package/dist/plugins/flow/ui/assets/index-CdpIq7gH.js +0 -49
- package/dist/plugins/flow/ui/assets/index-Ckw5Ej7p.css +0 -1
- package/dist/plugins/permissionset/ui/assets/index-DWBjNYzW.css +0 -1
- package/dist/plugins/permissionset/ui/assets/index-DilBd-cG.js +0 -49
- package/dist/plugins/schema/ui/assets/VibeEditComposer-Ce9dBbb3.js +0 -1
- package/dist/plugins/schema/ui/assets/index-DSSQ6K8b.js +0 -71
- package/dist/plugins/schema/ui/assets/index-Dsaw92BM.css +0 -1
package/README.md
CHANGED
|
@@ -11,13 +11,14 @@ This package provides metadata visualization plugins that parse Salesforce XML m
|
|
|
11
11
|
|
|
12
12
|
## Supported Metadata Types
|
|
13
13
|
|
|
14
|
-
| Metadata Type
|
|
15
|
-
|
|
|
16
|
-
| FlexiPages
|
|
17
|
-
| Data Model
|
|
18
|
-
| Agent Script
|
|
19
|
-
| Flow
|
|
20
|
-
| Permission Set
|
|
14
|
+
| Metadata Type | File Pattern | Plugin ID | Description |
|
|
15
|
+
| --------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------- | ----------------------------------------------------------------------------------------------------------------------------------- |
|
|
16
|
+
| FlexiPages | `.flexipage-meta.xml` | `flexipage` | Lightning Page layout visualization |
|
|
17
|
+
| Data Model | `.object-meta.xml`, `.field-meta.xml` | `schema` | Interactive ERD visualization of objects, fields, and relationships |
|
|
18
|
+
| Agent Script | `.agent` | `agent` | Agent script visualization |
|
|
19
|
+
| Flow | `.flow-meta.xml` | `flow` | Interactive Flow diagram with decisions, loops, and fault paths |
|
|
20
|
+
| Permission Set | `.permissionset-meta.xml`, `.permissionset` | `permissionset` | Permission set overview — object, field, tab, record-type, and named-access grants |
|
|
21
|
+
| Key-Value Table | `.md`, `.labels`, `.listView`, `.globalValueSetTranslation`, `.tab`, `.fieldSet`, `.profile`, `.workflowAlert`, `.customPermission`, `.globalValueSet`, `.standardValueSetTranslation`, `.reportFolder`, `.standardValueSet`, `.documentFolder`, `.emailFolder`, `.businessProcess`, `.fieldSrcTrgtRelationship`, `.webLink`, `.workflowFieldUpdate`, `.remoteSite`, `.compactLayout`, `.featureParameterInteger`, `.role`, `.group`, `.featureParameterBoolean`, `.sharingReason` (each followed by `-meta.xml`) | `keyvaluetable` | Overview, setting/value table and list tables for flat metadata such as custom metadata, labels, list views, value sets and folders |
|
|
21
22
|
|
|
22
23
|
## Installation
|
|
23
24
|
|
|
@@ -63,6 +64,7 @@ import {
|
|
|
63
64
|
AgentVisualizer,
|
|
64
65
|
FlowVisualizer,
|
|
65
66
|
PermissionSetVisualizer,
|
|
67
|
+
KeyValueTableVisualizer,
|
|
66
68
|
} from '@salesforce/metadata-plugins';
|
|
67
69
|
|
|
68
70
|
const flexipageViz = new FlexipageVisualizer();
|
|
@@ -70,6 +72,7 @@ const schemaViz = new SchemaVisualizer();
|
|
|
70
72
|
const agentViz = new AgentVisualizer();
|
|
71
73
|
const flowViz = new FlowVisualizer();
|
|
72
74
|
const permissionSetViz = new PermissionSetVisualizer();
|
|
75
|
+
const keyValueTableViz = new KeyValueTableVisualizer();
|
|
73
76
|
|
|
74
77
|
// Check plugin metadata
|
|
75
78
|
const info = schemaViz.getMetadataPluginInfo();
|
|
@@ -90,6 +93,7 @@ console.log(info.filePatterns); // ['.object-meta.xml', '.field-meta.xml']
|
|
|
90
93
|
- **`AgentVisualizer`** — Implements `IVisualizationPlugin<AgentScriptData>` for Agent script metadata
|
|
91
94
|
- **`FlowVisualizer`** — Implements `IVisualizationPlugin<FlowModel>` for Flow metadata
|
|
92
95
|
- **`PermissionSetVisualizer`** — Implements `IVisualizationPlugin<PermissionSetData>` for Permission Set metadata
|
|
96
|
+
- **`KeyValueTableVisualizer`** — Implements `IVisualizationPlugin<KeyValueTableData>` for 26 flat metadata types (custom metadata, labels, list views, value sets, folders, ...)
|
|
93
97
|
|
|
94
98
|
### Parsers
|
|
95
99
|
|
|
@@ -98,6 +102,7 @@ console.log(info.filePatterns); // ['.object-meta.xml', '.field-meta.xml']
|
|
|
98
102
|
- **`AgentParser`** — Implements `IMetadataParser<AgentScriptData>`
|
|
99
103
|
- **`FlowParser`** — Implements `IMetadataParser<FlowModel>`
|
|
100
104
|
- **`PermissionSetParser`** — Implements `IMetadataParser<PermissionSetData>`
|
|
105
|
+
- **`KeyValueTableParser`** — Implements `IMetadataParser<KeyValueTableData>`
|
|
101
106
|
|
|
102
107
|
### Types
|
|
103
108
|
|
|
@@ -106,6 +111,7 @@ console.log(info.filePatterns); // ['.object-meta.xml', '.field-meta.xml']
|
|
|
106
111
|
- **`AgentScriptData`** — Parsed Agent script structure
|
|
107
112
|
- **`FlowModel`** — Parsed Flow structure with nodes, connectors, and metadata
|
|
108
113
|
- **`PermissionSetData`** — Parsed Permission Set structure with object, field, tab, record-type, and named-access grants
|
|
114
|
+
- **`KeyValueTableData`** — Parsed flat metadata: scalar `entries`, repeated-child `lists`, and nested `trees`
|
|
109
115
|
|
|
110
116
|
## Package Exports
|
|
111
117
|
|
|
@@ -117,6 +123,7 @@ import {
|
|
|
117
123
|
AgentVisualizer,
|
|
118
124
|
FlowVisualizer,
|
|
119
125
|
PermissionSetVisualizer,
|
|
126
|
+
KeyValueTableVisualizer,
|
|
120
127
|
getAllVisualizers,
|
|
121
128
|
} from '@salesforce/metadata-plugins';
|
|
122
129
|
|
|
@@ -127,6 +134,7 @@ import {
|
|
|
127
134
|
AgentParser,
|
|
128
135
|
FlowParser,
|
|
129
136
|
PermissionSetParser,
|
|
137
|
+
KeyValueTableParser,
|
|
130
138
|
} from '@salesforce/metadata-plugins';
|
|
131
139
|
|
|
132
140
|
// Types
|
|
@@ -136,6 +144,7 @@ import type {
|
|
|
136
144
|
AgentScriptData,
|
|
137
145
|
FlowModel,
|
|
138
146
|
PermissionSetData,
|
|
147
|
+
KeyValueTableData,
|
|
139
148
|
} from '@salesforce/metadata-plugins';
|
|
140
149
|
```
|
|
141
150
|
|
package/dist/index.d.ts
CHANGED
|
@@ -10,18 +10,21 @@ export { AgentVisualizer } from './plugins/agent/AgentVisualizer.js';
|
|
|
10
10
|
export { FlowVisualizer } from './plugins/flow/FlowVisualizer.js';
|
|
11
11
|
export { PermissionSetVisualizer } from './plugins/permissionset/PermissionSetVisualizer.js';
|
|
12
12
|
export { FlowIntentVisualizer } from './plugins/flowintent/FlowIntentVisualizer.js';
|
|
13
|
+
export { KeyValueTableVisualizer } from './plugins/keyvaluetable/KeyValueTableVisualizer.js';
|
|
13
14
|
export { FlexipageParser } from './plugins/flexipage/FlexipageParser.js';
|
|
14
15
|
export { SchemaParser } from './plugins/schema/SchemaParser.js';
|
|
15
16
|
export { AgentParser } from './plugins/agent/AgentParser.js';
|
|
16
17
|
export { FlowParser } from './plugins/flow/FlowParser.js';
|
|
17
18
|
export { PermissionSetParser } from './plugins/permissionset/PermissionSetParser.js';
|
|
18
19
|
export { FlowIntentParser } from './plugins/flowintent/FlowIntentParser.js';
|
|
20
|
+
export { KeyValueTableParser } from './plugins/keyvaluetable/KeyValueTableParser.js';
|
|
19
21
|
export type { FlexipageMetadata } from './plugins/flexipage/types/FlexipageMetadata.js';
|
|
20
22
|
export type { SchemaERDData } from './plugins/schema/types/SchemaERDData.js';
|
|
21
23
|
export type { AgentScriptData } from './plugins/agent/types/AgentScriptData.js';
|
|
22
24
|
export type { FlowModel } from './plugins/flow/types/FlowData.js';
|
|
23
25
|
export type { PermissionSetData } from './plugins/permissionset/types/PermissionSetData.js';
|
|
24
26
|
export type { IntentFlow } from './plugins/flowintent/types/index.js';
|
|
27
|
+
export type { KeyValueTableData } from './plugins/keyvaluetable/types/KeyValueTableData.js';
|
|
25
28
|
import { IVisualizationPlugin, PluginConfig } from '@salesforce/metadata-core-sdk';
|
|
26
29
|
/**
|
|
27
30
|
* Get all visualization plugins
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;IAKI;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;IAKI;AAuBJ,OAAO,EAAE,mBAAmB,EAAE,MAAM,4CAA4C,CAAC;AACjF,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AACxE,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,EAAE,uBAAuB,EAAE,MAAM,oDAAoD,CAAC;AAC7F,OAAO,EAAE,oBAAoB,EAAE,MAAM,8CAA8C,CAAC;AACpF,OAAO,EAAE,uBAAuB,EAAE,MAAM,oDAAoD,CAAC;AAG7F,OAAO,EAAE,eAAe,EAAE,MAAM,wCAAwC,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,gDAAgD,CAAC;AACrF,OAAO,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AAC5E,OAAO,EAAE,mBAAmB,EAAE,MAAM,gDAAgD,CAAC;AAGrF,YAAY,EAAE,iBAAiB,EAAE,MAAM,gDAAgD,CAAC;AACxF,YAAY,EAAE,aAAa,EAAE,MAAM,yCAAyC,CAAC;AAC7E,YAAY,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAC;AAChF,YAAY,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAClE,YAAY,EAAE,iBAAiB,EAAE,MAAM,oDAAoD,CAAC;AAC5F,YAAY,EAAE,UAAU,EAAE,MAAM,qCAAqC,CAAC;AACtE,YAAY,EAAE,iBAAiB,EAAE,MAAM,oDAAoD,CAAC;AAG5F,OAAO,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAEnF;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,CAAC,EAAE,YAAY,GAAG,oBAAoB,EAAE,CAoB/E"}
|
package/dist/index.js
CHANGED
|
@@ -21,6 +21,7 @@ import { AgentVisualizer } from './plugins/agent/AgentVisualizer.js';
|
|
|
21
21
|
import { FlowVisualizer } from './plugins/flow/FlowVisualizer.js';
|
|
22
22
|
import { PermissionSetVisualizer } from './plugins/permissionset/PermissionSetVisualizer.js';
|
|
23
23
|
import { FlowIntentVisualizer } from './plugins/flowintent/FlowIntentVisualizer.js';
|
|
24
|
+
import { KeyValueTableVisualizer } from './plugins/keyvaluetable/KeyValueTableVisualizer.js';
|
|
24
25
|
// Export visualization plugins
|
|
25
26
|
export { FlexipageVisualizer } from './plugins/flexipage/FlexipageVisualizer.js';
|
|
26
27
|
export { SchemaVisualizer } from './plugins/schema/SchemaVisualizer.js';
|
|
@@ -28,6 +29,7 @@ export { AgentVisualizer } from './plugins/agent/AgentVisualizer.js';
|
|
|
28
29
|
export { FlowVisualizer } from './plugins/flow/FlowVisualizer.js';
|
|
29
30
|
export { PermissionSetVisualizer } from './plugins/permissionset/PermissionSetVisualizer.js';
|
|
30
31
|
export { FlowIntentVisualizer } from './plugins/flowintent/FlowIntentVisualizer.js';
|
|
32
|
+
export { KeyValueTableVisualizer } from './plugins/keyvaluetable/KeyValueTableVisualizer.js';
|
|
31
33
|
// Export parsers
|
|
32
34
|
export { FlexipageParser } from './plugins/flexipage/FlexipageParser.js';
|
|
33
35
|
export { SchemaParser } from './plugins/schema/SchemaParser.js';
|
|
@@ -35,6 +37,7 @@ export { AgentParser } from './plugins/agent/AgentParser.js';
|
|
|
35
37
|
export { FlowParser } from './plugins/flow/FlowParser.js';
|
|
36
38
|
export { PermissionSetParser } from './plugins/permissionset/PermissionSetParser.js';
|
|
37
39
|
export { FlowIntentParser } from './plugins/flowintent/FlowIntentParser.js';
|
|
40
|
+
export { KeyValueTableParser } from './plugins/keyvaluetable/KeyValueTableParser.js';
|
|
38
41
|
/**
|
|
39
42
|
* Get all visualization plugins
|
|
40
43
|
*
|
|
@@ -53,6 +56,7 @@ export function getAllVisualizers(config) {
|
|
|
53
56
|
new FlowVisualizer(),
|
|
54
57
|
new PermissionSetVisualizer(),
|
|
55
58
|
new FlowIntentVisualizer(),
|
|
59
|
+
new KeyValueTableVisualizer(),
|
|
56
60
|
];
|
|
57
61
|
if (!config?.pluginSettings) {
|
|
58
62
|
return all;
|
package/dist/plugins/agent/ui/assets/{VibeEditComposer-D5GykTkw.js → VibeEditComposer-sSbOXosJ.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r,R as t,S as he,A as be}from"./index-nYWtX5pm.js";const k=12,re=12;function ce(o,u,c){const b=Math.max(c.left+k,c.left+c.width-u.width-k),a=Math.max(c.top+k,c.top+c.height-u.height-k);return{left:Math.min(Math.max(o.left,c.left+k),b),top:Math.min(Math.max(o.top,c.top+k),a)}}function ve(o,u,c){const b=o.left+o.width+re,a=o.left-u.width-re,m=b+u.width<=c.left+c.width-k;return ce({left:m?b:a,top:o.top},u,c)}function Ee(){return t.createElement("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true"},he.map(o=>t.createElement("path",{key:o,d:o,fill:"currentColor"})))}function ge(){return t.createElement("svg",{width:"40",height:"48",viewBox:"0 0 40 48.3291",preserveAspectRatio:"xMidYMid meet",overflow:"visible",fill:"none","aria-hidden":"true"},be.map(o=>t.createElement("path",{key:o,d:o,fill:"currentColor"})))}function O({size:o,className:u,children:c}){return t.createElement("svg",{className:u,width:o,height:o,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},c)}const oe=t.createElement(t.Fragment,null,t.createElement("path",{d:"M18 6 6 18"}),t.createElement("path",{d:"m6 6 12 12"})),_e=t.createElement(t.Fragment,null,t.createElement("circle",{cx:"8",cy:"6",r:"1",fill:"currentColor",stroke:"none"}),t.createElement("circle",{cx:"16",cy:"6",r:"1",fill:"currentColor",stroke:"none"}),t.createElement("circle",{cx:"8",cy:"12",r:"1",fill:"currentColor",stroke:"none"}),t.createElement("circle",{cx:"16",cy:"12",r:"1",fill:"currentColor",stroke:"none"}),t.createElement("circle",{cx:"8",cy:"18",r:"1",fill:"currentColor",stroke:"none"}),t.createElement("circle",{cx:"16",cy:"18",r:"1",fill:"currentColor",stroke:"none"}));function X(o){return{left:o.left,top:o.top,width:o.width,height:o.height}}function ie(){return{left:0,top:0,width:window.innerWidth,height:window.innerHeight}}function we({ids:o,nodeFor:u}){const[c,b]=r.useState([]);return r.useEffect(()=>{let a=0;const m=()=>{const f=[];for(const p of o){const h=u(p);if(!h)continue;const s=h.getBoundingClientRect();f.push({id:p,x:s.x,y:s.y,width:s.width,height:s.height})}b(p=>p.length===f.length&&p.every((h,s)=>h.id===f[s].id&&h.x===f[s].x&&h.y===f[s].y&&h.width===f[s].width&&h.height===f[s].height)?p:f),a=requestAnimationFrame(m)};return a=requestAnimationFrame(m),()=>cancelAnimationFrame(a)},[o,u]),c.length===0?null:t.createElement("div",{className:"vibe-edit-composer__pulse-layer","aria-hidden":"true"},c.map(a=>t.createElement("div",{key:a.id,className:"vibe-edit-composer__pulse",style:{left:a.x,top:a.y,width:a.width,height:a.height}})))}function ke({elements:o,nodeFor:u,onEdit:c,onDeselect:b,onSent:a,onClose:m,onDraftChange:f}){const[p,h]=r.useState(""),[s,I]=r.useState("idle"),[ae,z]=r.useState(""),[A,Y]=r.useState([]),[F,G]=r.useState(""),C=r.useRef(null),T=r.useRef(null),[L,P]=r.useState(null),v=r.useRef(null),[H,K]=r.useState(!1),W=r.useId(),g=r.useRef(!1),V=r.useRef(null),_=r.useRef(null),U=r.useRef(!1),M=r.useRef(null),$=r.useRef(!1),S=r.useRef(!0);r.useEffect(()=>(S.current=!0,()=>{S.current=!1}),[]);const x=o.length,y=x>0,R=s==="applying",q=y&&p.trim().length>0&&!R,j=y&&p.trim().length>0;r.useEffect(()=>{f==null||f(j)},[j,f]);const w=r.useCallback(e=>{const n=T.current;if(!n)return;const l=ce(e,X(n.getBoundingClientRect()),ie());v.current=l,P(i=>i&&i.left===l.left&&i.top===l.top?i:l)},[]);r.useLayoutEffect(()=>{if(!y){g.current=!1,v.current=null,P(null),K(!1);return}const e=T.current;if(!e)return;const n=o[0].id;V.current!==n&&(V.current=n,g.current=!1);const l=()=>{if(g.current){v.current&&w(v.current);return}const ne=u(o[0].id);if(!ne)return;const D=ve(X(ne.getBoundingClientRect()),X(e.getBoundingClientRect()),ie());v.current=D,P(B=>B&&B.left===D.left&&B.top===D.top?B:D)};l();let i=0;const d=()=>{i===0&&(i=requestAnimationFrame(()=>{i=0,l()}))};window.addEventListener("resize",d),window.addEventListener("scroll",d,!0),window.addEventListener("pointermove",d,!0),window.addEventListener("wheel",d,!0);const E=typeof ResizeObserver>"u"?null:new ResizeObserver(l);return E==null||E.observe(e),E==null||E.observe(u(o[0].id)??e),()=>{cancelAnimationFrame(i),window.removeEventListener("resize",d),window.removeEventListener("scroll",d,!0),window.removeEventListener("pointermove",d,!0),window.removeEventListener("wheel",d,!0),E==null||E.disconnect()}},[o,y,u,w]);const N=r.useCallback((e,n)=>{g.current=!0;const l=v.current??{left:12,top:12};w({left:l.left+e,top:l.top+n})},[w]),se=r.useCallback(e=>{if(e.button!==0)return;const n=T.current;if(!n)return;const l=X(n.getBoundingClientRect()),i=g.current,d=v.current??{left:l.left,top:l.top};w(d),_.current={pointerId:e.pointerId,startX:e.clientX,startY:e.clientY,position:d,wasManuallyPositioned:i,moved:!1},e.currentTarget.setPointerCapture(e.pointerId),e.currentTarget.focus(),e.preventDefault(),e.stopPropagation()},[w]),le=r.useCallback(e=>{const n=_.current;!n||n.pointerId!==e.pointerId||(!n.moved&&Math.hypot(e.clientX-n.startX,e.clientY-n.startY)>3&&(g.current=!0,n.moved=!0),w({left:n.position.left+e.clientX-n.startX,top:n.position.top+e.clientY-n.startY}),e.preventDefault(),e.stopPropagation())},[w]),ue=r.useCallback(e=>{const n=_.current;!n||n.pointerId!==e.pointerId||(_.current=null,U.current=n.moved,e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId))},[]),J=r.useCallback(e=>{const n=_.current;!n||n.pointerId!==e.pointerId||(_.current=null,g.current=n.wasManuallyPositioned,v.current=n.position,P(n.position),e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId))},[]),de=r.useCallback(e=>{const n=e.shiftKey?32:16,i={ArrowLeft:{left:-n,top:0},ArrowRight:{left:n,top:0},ArrowUp:{left:0,top:-n},ArrowDown:{left:0,top:n}}[e.key];if(i)e.preventDefault(),N(i.left,i.top);else if(e.key==="Escape"){e.preventDefault(),e.stopPropagation();const d=_.current;d&&(g.current=d.wasManuallyPositioned,v.current=d.position,P(d.position),_.current=null),K(!1)}},[N]);r.useEffect(()=>{var e;y&&((e=C.current)==null||e.focus())},[y]);const Q=r.useCallback(()=>{h(""),C.current&&(C.current.textContent="")},[]),Z=r.useCallback(async()=>{if(!q||$.current)return;$.current=!0;const e=p.trim(),n=o.map(i=>i.id),l=M.current?{kind:"existing",id:M.current.id,label:M.current.label}:{kind:"new"};I("applying"),Y(n);try{const i=await c(n,e,l);i&&i.chatId&&(M.current={id:i.chatId,label:i.chatLabel??"Edits"}),S.current&&(Q(),I("idle"),z(""),G("Sent to Agentforce Vibes"),a==null||a())}catch(i){S.current&&(Y([]),z(i instanceof Error&&i.message.length>0?i.message:"That edit couldn’t be sent. Try again."),I("error"))}finally{$.current=!1}},[q,Q,p,o,c,a]);r.useEffect(()=>{var e;s==="error"&&((e=C.current)==null||e.focus())},[s]),r.useEffect(()=>{if(!F)return;const e=setTimeout(()=>G(""),4e3);return()=>clearTimeout(e)},[F]),r.useEffect(()=>{if(s!=="idle"||A.length===0)return;const e=setTimeout(()=>Y([]),1200);return()=>clearTimeout(e)},[s,A]);const ee=()=>{o.forEach(e=>b(e.id)),m==null||m()},te=e=>{b(e.id),G(`Removed ${e.label}, ${x-1} selected`),x===1&&(m==null||m())},fe=e=>{h(e.currentTarget.textContent??""),s==="error"&&(z(""),I("idle"))},pe=e=>{e.key==="Enter"&&!e.shiftKey&&!e.nativeEvent.isComposing?(e.preventDefault(),Z()):e.key==="Escape"?(e.preventDefault(),ee()):e.key==="Backspace"&&p.length===0&&x>0&&(e.preventDefault(),te(o[x-1]))},me=e=>{var n;e.target===e.currentTarget&&((n=C.current)==null||n.focus())};return t.createElement(t.Fragment,null,t.createElement("span",{className:"vibe-edit-composer__sr-only",role:"status","aria-live":"polite"},F),A.length>0&&t.createElement(we,{ids:A,nodeFor:u}),y&&t.createElement("div",{className:`vibe-edit-composer${L?" vibe-edit-composer--positioned":""}`,role:"dialog","aria-label":"Edit selected metadata with the agent",onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),style:L?{left:L.left,top:L.top}:void 0},t.createElement("div",{ref:T,className:"vibe-edit-composer__card"},t.createElement("div",{className:"vibe-edit-composer__header"},t.createElement("span",{className:"vibe-edit-composer__title"},t.createElement("span",{className:"vibe-edit-composer__title-icon"},t.createElement(Ee,null)),t.createElement("span",{className:"vibe-edit-composer__title-text"},x," selected")),t.createElement("span",{className:"vibe-edit-composer__header-actions"},t.createElement("button",{type:"button",className:"vibe-edit-composer__icon-button vibe-edit-composer__icon-button--sm vibe-edit-composer__move-handle","aria-label":"Move composer","aria-expanded":H,"aria-controls":H?W:void 0,title:"Drag to move composer. Arrow keys move it when focused.",onClick:()=>{if(U.current){U.current=!1;return}K(e=>!e)},onPointerDown:se,onPointerMove:le,onPointerUp:ue,onPointerCancel:J,onLostPointerCapture:J,onKeyDown:de,disabled:R},t.createElement(O,{size:16},_e)),t.createElement("button",{type:"button",className:"vibe-edit-composer__icon-button vibe-edit-composer__icon-button--sm","aria-label":"Exit select to edit",title:"Exit",onClick:ee,disabled:R},t.createElement(O,{size:16},oe)))),H&&t.createElement("div",{id:W,className:"vibe-edit-composer__move-controls",role:"group","aria-label":"Move composer controls"},t.createElement("button",{type:"button",onClick:()=>N(0,-16),"aria-label":"Move composer up"},"Up"),t.createElement("button",{type:"button",onClick:()=>N(-16,0),"aria-label":"Move composer left"},"Left"),t.createElement("button",{type:"button",onClick:()=>N(16,0),"aria-label":"Move composer right"},"Right"),t.createElement("button",{type:"button",onClick:()=>N(0,16),"aria-label":"Move composer down"},"Down")),s==="error"&&t.createElement("div",{className:"vibe-edit-composer__error",role:"alert"},ae),t.createElement("div",{className:"vibe-edit-composer__panel"},t.createElement("div",{className:"vibe-edit-composer__input-container"},t.createElement("div",{className:"vibe-edit-composer__editable",onClick:me},o.map(e=>t.createElement("span",{key:e.id,className:"vibe-edit-composer__chip",role:"group","aria-label":e.label,title:e.label},t.createElement("button",{type:"button",className:"vibe-edit-composer__chip-icon-wrap","aria-label":`Remove ${e.label} from selection`,onClick:()=>te(e),disabled:R},t.createElement(O,{size:12,className:"vibe-edit-composer__chip-icon"},t.createElement("path",{d:"M16 18l6-6-6-6"}),t.createElement("path",{d:"M8 6l-6 6 6 6"})),t.createElement(O,{size:12,className:"vibe-edit-composer__chip-x"},oe)),t.createElement("span",{className:"vibe-edit-composer__chip-label"},e.label))),t.createElement("span",{ref:C,className:"vibe-edit-composer__text",contentEditable:R?!1:"plaintext-only",suppressContentEditableWarning:!0,role:"textbox","aria-multiline":"true","aria-label":"Describe your edits…","aria-busy":R||void 0,onInput:fe,onKeyDown:pe}),p.length===0&&t.createElement("span",{className:"vibe-edit-composer__placeholder","aria-hidden":"true"},"Describe your edits…")),t.createElement("div",{className:"vibe-edit-composer__footer"},t.createElement("div",{className:"vibe-edit-composer__controls"},t.createElement("button",{type:"button",className:"vibe-edit-composer__send",disabled:!q,onClick:()=>void Z(),"aria-label":"Send to Agent",title:M.current?"Adds to the edits chat":"Opens in a new chat"},t.createElement("span",{className:"vibe-edit-composer__send-icon"},t.createElement(ge,null)),"Send to Agent"))))))))}export{ke as default};
|
|
1
|
+
import{r,R as t,S as he,A as be}from"./index-BIxtmvIY.js";const k=12,re=12;function ce(o,u,c){const b=Math.max(c.left+k,c.left+c.width-u.width-k),a=Math.max(c.top+k,c.top+c.height-u.height-k);return{left:Math.min(Math.max(o.left,c.left+k),b),top:Math.min(Math.max(o.top,c.top+k),a)}}function ve(o,u,c){const b=o.left+o.width+re,a=o.left-u.width-re,m=b+u.width<=c.left+c.width-k;return ce({left:m?b:a,top:o.top},u,c)}function Ee(){return t.createElement("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true"},he.map(o=>t.createElement("path",{key:o,d:o,fill:"currentColor"})))}function ge(){return t.createElement("svg",{width:"40",height:"48",viewBox:"0 0 40 48.3291",preserveAspectRatio:"xMidYMid meet",overflow:"visible",fill:"none","aria-hidden":"true"},be.map(o=>t.createElement("path",{key:o,d:o,fill:"currentColor"})))}function O({size:o,className:u,children:c}){return t.createElement("svg",{className:u,width:o,height:o,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true"},c)}const oe=t.createElement(t.Fragment,null,t.createElement("path",{d:"M18 6 6 18"}),t.createElement("path",{d:"m6 6 12 12"})),_e=t.createElement(t.Fragment,null,t.createElement("circle",{cx:"8",cy:"6",r:"1",fill:"currentColor",stroke:"none"}),t.createElement("circle",{cx:"16",cy:"6",r:"1",fill:"currentColor",stroke:"none"}),t.createElement("circle",{cx:"8",cy:"12",r:"1",fill:"currentColor",stroke:"none"}),t.createElement("circle",{cx:"16",cy:"12",r:"1",fill:"currentColor",stroke:"none"}),t.createElement("circle",{cx:"8",cy:"18",r:"1",fill:"currentColor",stroke:"none"}),t.createElement("circle",{cx:"16",cy:"18",r:"1",fill:"currentColor",stroke:"none"}));function X(o){return{left:o.left,top:o.top,width:o.width,height:o.height}}function ie(){return{left:0,top:0,width:window.innerWidth,height:window.innerHeight}}function we({ids:o,nodeFor:u}){const[c,b]=r.useState([]);return r.useEffect(()=>{let a=0;const m=()=>{const f=[];for(const p of o){const h=u(p);if(!h)continue;const s=h.getBoundingClientRect();f.push({id:p,x:s.x,y:s.y,width:s.width,height:s.height})}b(p=>p.length===f.length&&p.every((h,s)=>h.id===f[s].id&&h.x===f[s].x&&h.y===f[s].y&&h.width===f[s].width&&h.height===f[s].height)?p:f),a=requestAnimationFrame(m)};return a=requestAnimationFrame(m),()=>cancelAnimationFrame(a)},[o,u]),c.length===0?null:t.createElement("div",{className:"vibe-edit-composer__pulse-layer","aria-hidden":"true"},c.map(a=>t.createElement("div",{key:a.id,className:"vibe-edit-composer__pulse",style:{left:a.x,top:a.y,width:a.width,height:a.height}})))}function ke({elements:o,nodeFor:u,onEdit:c,onDeselect:b,onSent:a,onClose:m,onDraftChange:f}){const[p,h]=r.useState(""),[s,I]=r.useState("idle"),[ae,z]=r.useState(""),[A,Y]=r.useState([]),[F,G]=r.useState(""),C=r.useRef(null),T=r.useRef(null),[L,P]=r.useState(null),v=r.useRef(null),[H,K]=r.useState(!1),W=r.useId(),g=r.useRef(!1),V=r.useRef(null),_=r.useRef(null),U=r.useRef(!1),M=r.useRef(null),$=r.useRef(!1),S=r.useRef(!0);r.useEffect(()=>(S.current=!0,()=>{S.current=!1}),[]);const x=o.length,y=x>0,R=s==="applying",q=y&&p.trim().length>0&&!R,j=y&&p.trim().length>0;r.useEffect(()=>{f==null||f(j)},[j,f]);const w=r.useCallback(e=>{const n=T.current;if(!n)return;const l=ce(e,X(n.getBoundingClientRect()),ie());v.current=l,P(i=>i&&i.left===l.left&&i.top===l.top?i:l)},[]);r.useLayoutEffect(()=>{if(!y){g.current=!1,v.current=null,P(null),K(!1);return}const e=T.current;if(!e)return;const n=o[0].id;V.current!==n&&(V.current=n,g.current=!1);const l=()=>{if(g.current){v.current&&w(v.current);return}const ne=u(o[0].id);if(!ne)return;const D=ve(X(ne.getBoundingClientRect()),X(e.getBoundingClientRect()),ie());v.current=D,P(B=>B&&B.left===D.left&&B.top===D.top?B:D)};l();let i=0;const d=()=>{i===0&&(i=requestAnimationFrame(()=>{i=0,l()}))};window.addEventListener("resize",d),window.addEventListener("scroll",d,!0),window.addEventListener("pointermove",d,!0),window.addEventListener("wheel",d,!0);const E=typeof ResizeObserver>"u"?null:new ResizeObserver(l);return E==null||E.observe(e),E==null||E.observe(u(o[0].id)??e),()=>{cancelAnimationFrame(i),window.removeEventListener("resize",d),window.removeEventListener("scroll",d,!0),window.removeEventListener("pointermove",d,!0),window.removeEventListener("wheel",d,!0),E==null||E.disconnect()}},[o,y,u,w]);const N=r.useCallback((e,n)=>{g.current=!0;const l=v.current??{left:12,top:12};w({left:l.left+e,top:l.top+n})},[w]),se=r.useCallback(e=>{if(e.button!==0)return;const n=T.current;if(!n)return;const l=X(n.getBoundingClientRect()),i=g.current,d=v.current??{left:l.left,top:l.top};w(d),_.current={pointerId:e.pointerId,startX:e.clientX,startY:e.clientY,position:d,wasManuallyPositioned:i,moved:!1},e.currentTarget.setPointerCapture(e.pointerId),e.currentTarget.focus(),e.preventDefault(),e.stopPropagation()},[w]),le=r.useCallback(e=>{const n=_.current;!n||n.pointerId!==e.pointerId||(!n.moved&&Math.hypot(e.clientX-n.startX,e.clientY-n.startY)>3&&(g.current=!0,n.moved=!0),w({left:n.position.left+e.clientX-n.startX,top:n.position.top+e.clientY-n.startY}),e.preventDefault(),e.stopPropagation())},[w]),ue=r.useCallback(e=>{const n=_.current;!n||n.pointerId!==e.pointerId||(_.current=null,U.current=n.moved,e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId))},[]),J=r.useCallback(e=>{const n=_.current;!n||n.pointerId!==e.pointerId||(_.current=null,g.current=n.wasManuallyPositioned,v.current=n.position,P(n.position),e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId))},[]),de=r.useCallback(e=>{const n=e.shiftKey?32:16,i={ArrowLeft:{left:-n,top:0},ArrowRight:{left:n,top:0},ArrowUp:{left:0,top:-n},ArrowDown:{left:0,top:n}}[e.key];if(i)e.preventDefault(),N(i.left,i.top);else if(e.key==="Escape"){e.preventDefault(),e.stopPropagation();const d=_.current;d&&(g.current=d.wasManuallyPositioned,v.current=d.position,P(d.position),_.current=null),K(!1)}},[N]);r.useEffect(()=>{var e;y&&((e=C.current)==null||e.focus())},[y]);const Q=r.useCallback(()=>{h(""),C.current&&(C.current.textContent="")},[]),Z=r.useCallback(async()=>{if(!q||$.current)return;$.current=!0;const e=p.trim(),n=o.map(i=>i.id),l=M.current?{kind:"existing",id:M.current.id,label:M.current.label}:{kind:"new"};I("applying"),Y(n);try{const i=await c(n,e,l);i&&i.chatId&&(M.current={id:i.chatId,label:i.chatLabel??"Edits"}),S.current&&(Q(),I("idle"),z(""),G("Sent to Agentforce Vibes"),a==null||a())}catch(i){S.current&&(Y([]),z(i instanceof Error&&i.message.length>0?i.message:"That edit couldn’t be sent. Try again."),I("error"))}finally{$.current=!1}},[q,Q,p,o,c,a]);r.useEffect(()=>{var e;s==="error"&&((e=C.current)==null||e.focus())},[s]),r.useEffect(()=>{if(!F)return;const e=setTimeout(()=>G(""),4e3);return()=>clearTimeout(e)},[F]),r.useEffect(()=>{if(s!=="idle"||A.length===0)return;const e=setTimeout(()=>Y([]),1200);return()=>clearTimeout(e)},[s,A]);const ee=()=>{o.forEach(e=>b(e.id)),m==null||m()},te=e=>{b(e.id),G(`Removed ${e.label}, ${x-1} selected`),x===1&&(m==null||m())},fe=e=>{h(e.currentTarget.textContent??""),s==="error"&&(z(""),I("idle"))},pe=e=>{e.key==="Enter"&&!e.shiftKey&&!e.nativeEvent.isComposing?(e.preventDefault(),Z()):e.key==="Escape"?(e.preventDefault(),ee()):e.key==="Backspace"&&p.length===0&&x>0&&(e.preventDefault(),te(o[x-1]))},me=e=>{var n;e.target===e.currentTarget&&((n=C.current)==null||n.focus())};return t.createElement(t.Fragment,null,t.createElement("span",{className:"vibe-edit-composer__sr-only",role:"status","aria-live":"polite"},F),A.length>0&&t.createElement(we,{ids:A,nodeFor:u}),y&&t.createElement("div",{className:`vibe-edit-composer${L?" vibe-edit-composer--positioned":""}`,role:"dialog","aria-label":"Edit selected metadata with the agent",onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),style:L?{left:L.left,top:L.top}:void 0},t.createElement("div",{ref:T,className:"vibe-edit-composer__card"},t.createElement("div",{className:"vibe-edit-composer__header"},t.createElement("span",{className:"vibe-edit-composer__title"},t.createElement("span",{className:"vibe-edit-composer__title-icon"},t.createElement(Ee,null)),t.createElement("span",{className:"vibe-edit-composer__title-text"},x," selected")),t.createElement("span",{className:"vibe-edit-composer__header-actions"},t.createElement("button",{type:"button",className:"vibe-edit-composer__icon-button vibe-edit-composer__icon-button--sm vibe-edit-composer__move-handle","aria-label":"Move composer","aria-expanded":H,"aria-controls":H?W:void 0,title:"Drag to move composer. Arrow keys move it when focused.",onClick:()=>{if(U.current){U.current=!1;return}K(e=>!e)},onPointerDown:se,onPointerMove:le,onPointerUp:ue,onPointerCancel:J,onLostPointerCapture:J,onKeyDown:de,disabled:R},t.createElement(O,{size:16},_e)),t.createElement("button",{type:"button",className:"vibe-edit-composer__icon-button vibe-edit-composer__icon-button--sm","aria-label":"Exit select to edit",title:"Exit",onClick:ee,disabled:R},t.createElement(O,{size:16},oe)))),H&&t.createElement("div",{id:W,className:"vibe-edit-composer__move-controls",role:"group","aria-label":"Move composer controls"},t.createElement("button",{type:"button",onClick:()=>N(0,-16),"aria-label":"Move composer up"},"Up"),t.createElement("button",{type:"button",onClick:()=>N(-16,0),"aria-label":"Move composer left"},"Left"),t.createElement("button",{type:"button",onClick:()=>N(16,0),"aria-label":"Move composer right"},"Right"),t.createElement("button",{type:"button",onClick:()=>N(0,16),"aria-label":"Move composer down"},"Down")),s==="error"&&t.createElement("div",{className:"vibe-edit-composer__error",role:"alert"},ae),t.createElement("div",{className:"vibe-edit-composer__panel"},t.createElement("div",{className:"vibe-edit-composer__input-container"},t.createElement("div",{className:"vibe-edit-composer__editable",onClick:me},o.map(e=>t.createElement("span",{key:e.id,className:"vibe-edit-composer__chip",role:"group","aria-label":e.label,title:e.label},t.createElement("button",{type:"button",className:"vibe-edit-composer__chip-icon-wrap","aria-label":`Remove ${e.label} from selection`,onClick:()=>te(e),disabled:R},t.createElement(O,{size:12,className:"vibe-edit-composer__chip-icon"},t.createElement("path",{d:"M16 18l6-6-6-6"}),t.createElement("path",{d:"M8 6l-6 6 6 6"})),t.createElement(O,{size:12,className:"vibe-edit-composer__chip-x"},oe)),t.createElement("span",{className:"vibe-edit-composer__chip-label"},e.label))),t.createElement("span",{ref:C,className:"vibe-edit-composer__text",contentEditable:R?!1:"plaintext-only",suppressContentEditableWarning:!0,role:"textbox","aria-multiline":"true","aria-label":"Describe your edits…","aria-busy":R||void 0,onInput:fe,onKeyDown:pe}),p.length===0&&t.createElement("span",{className:"vibe-edit-composer__placeholder","aria-hidden":"true"},"Describe your edits…")),t.createElement("div",{className:"vibe-edit-composer__footer"},t.createElement("div",{className:"vibe-edit-composer__controls"},t.createElement("button",{type:"button",className:"vibe-edit-composer__send",disabled:!q,onClick:()=>void Z(),"aria-label":"Send to Agent",title:M.current?"Adds to the edits chat":"Opens in a new chat"},t.createElement("span",{className:"vibe-edit-composer__send-icon"},t.createElement(ge,null)),"Send to Agent"))))))))}export{ke as default};
|