@progress/kendo-react-webmcp 15.0.1-develop.3 → 15.0.1-develop.5

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 (78) hide show
  1. package/WebMcpProvider.js +1 -1
  2. package/WebMcpProvider.mjs +84 -80
  3. package/adapters/button.d.ts +1 -1
  4. package/adapters/button.js +1 -1
  5. package/adapters/button.mjs +12 -17
  6. package/adapters/{dashboard.d.ts → checkbox.d.ts} +5 -6
  7. package/adapters/checkbox.js +8 -0
  8. package/adapters/checkbox.mjs +60 -0
  9. package/adapters/dropdowntree.js +1 -1
  10. package/adapters/dropdowntree.mjs +78 -51
  11. package/adapters/editor.d.ts +0 -1
  12. package/adapters/editor.js +1 -1
  13. package/adapters/editor.mjs +38 -46
  14. package/adapters/form.d.ts +1 -0
  15. package/adapters/form.js +3 -3
  16. package/adapters/form.mjs +75 -49
  17. package/adapters/gantt.d.ts +2 -0
  18. package/adapters/gantt.js +1 -1
  19. package/adapters/gantt.mjs +188 -140
  20. package/adapters/grid.d.ts +0 -1
  21. package/adapters/grid.js +1 -1
  22. package/adapters/grid.mjs +52 -60
  23. package/adapters/multicolumncombobox.d.ts +20 -0
  24. package/adapters/multicolumncombobox.js +8 -0
  25. package/adapters/multicolumncombobox.mjs +75 -0
  26. package/adapters/multiselect.d.ts +2 -0
  27. package/adapters/multiselect.js +1 -1
  28. package/adapters/multiselect.mjs +46 -30
  29. package/adapters/notification.js +1 -1
  30. package/adapters/notification.mjs +14 -14
  31. package/adapters/pivotgrid.js +1 -1
  32. package/adapters/pivotgrid.mjs +39 -47
  33. package/adapters/scheduler.js +1 -1
  34. package/adapters/scheduler.mjs +137 -92
  35. package/adapters/spreadsheet.js +1 -1
  36. package/adapters/spreadsheet.mjs +3 -3
  37. package/adapters/switch.js +1 -1
  38. package/adapters/switch.mjs +29 -19
  39. package/adapters/treeview.js +2 -2
  40. package/adapters/treeview.mjs +79 -113
  41. package/adapters/window.d.ts +0 -2
  42. package/adapters/window.js +1 -1
  43. package/adapters/window.mjs +29 -63
  44. package/commands/form.d.ts +4 -1
  45. package/commands/form.js +1 -1
  46. package/commands/form.mjs +11 -7
  47. package/commands/gantt.js +1 -1
  48. package/commands/gantt.mjs +14 -10
  49. package/commands/grid.d.ts +0 -4
  50. package/commands/grid.js +1 -1
  51. package/commands/grid.mjs +18 -24
  52. package/commands/index.d.ts +0 -1
  53. package/commands/pivotgrid.d.ts +0 -4
  54. package/commands/pivotgrid.js +1 -1
  55. package/commands/pivotgrid.mjs +6 -12
  56. package/commands/scheduler.d.ts +10 -0
  57. package/commands/scheduler.js +1 -1
  58. package/commands/scheduler.mjs +16 -4
  59. package/commands/window.d.ts +0 -8
  60. package/commands/window.js +1 -1
  61. package/commands/window.mjs +8 -18
  62. package/dist/cdn/js/kendo-react-webmcp.js +1 -1
  63. package/index.d.mts +2 -1
  64. package/index.d.ts +2 -1
  65. package/index.js +1 -1
  66. package/index.mjs +248 -249
  67. package/package.json +3 -3
  68. package/schemas/gantt.d.ts +4 -0
  69. package/schemas/gantt.js +1 -1
  70. package/schemas/gantt.mjs +93 -8
  71. package/schemas/scheduler.d.ts +2 -0
  72. package/schemas/scheduler.js +1 -1
  73. package/schemas/scheduler.mjs +21 -5
  74. package/adapters/dashboard.js +0 -8
  75. package/adapters/dashboard.mjs +0 -41
  76. package/commands/dashboard.d.ts +0 -19
  77. package/commands/dashboard.js +0 -8
  78. package/commands/dashboard.mjs +0 -21
@@ -147,13 +147,13 @@ const A = {
147
147
  name: "get_cell",
148
148
  description: `Get the value of a cell in the ${e.dataName} spreadsheet.`,
149
149
  commandType: n.GetCell,
150
- enabled: !0
150
+ enabled: !1
151
151
  },
152
152
  {
153
153
  name: "get_data",
154
154
  description: `Get the full workbook data from the ${e.dataName} spreadsheet as JSON.`,
155
155
  commandType: n.GetData,
156
- enabled: !0
156
+ enabled: !1
157
157
  },
158
158
  {
159
159
  name: "set_data",
@@ -165,7 +165,7 @@ const A = {
165
165
  name: "get_sheets",
166
166
  description: `Get the names of all sheets in the ${e.dataName} spreadsheet.`,
167
167
  commandType: n.GetSheets,
168
- enabled: !0
168
+ enabled: !1
169
169
  },
170
170
  {
171
171
  name: "switch_sheet",
@@ -5,4 +5,4 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("../commands/switch.js"),T={componentSuffix:"switch",createTools(d,r,a,h){const i=[],f=t=>`${a.groupName}_${t}`,l=r.current,u=[{name:"toggle",description:`Toggle the ${a.dataName} switch on or off.`,commandType:s.SwitchCommands.Toggle,enabled:!!l.onChange}],e=l.webMcp,g=typeof e=="object"&&e!==null&&typeof e.tools=="function"?e.tools:void 0,w=g?g(u):u,y=async(t,c)=>{var o,m;if(t===s.SwitchCommands.Toggle){const n=r.current,p=(m=(o=n.checked)!=null?o:n.value)!=null?m:!1;return n.onChange&&n.onChange({value:!p,syntheticEvent:null,target:d}),{content:[{type:"text",text:`Switch toggled to ${p?"off":"on"}.`}]}}return{content:[{type:"text",text:`Unknown command: ${t}`}],isError:!0}};for(const t of w){if(!t.enabled)continue;const c=t.commandType;try{i.push(h.registerTool({name:f(t.name),description:t.description,inputSchema:s.getSwitchToolSchema(c),execute:async o=>y(c,o||{})}))}catch{}}return i}};exports.switchAdapter=T;
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("../commands/switch.js"),y={componentSuffix:"switch",createTools(u,i,r,p){const h=[],f=t=>`${r.groupName}_${t}`,l=i.current,m=[{name:"toggle",description:`Toggle the ${r.dataName} switch on or off.`,commandType:n.SwitchCommands.Toggle,enabled:!!l.onChange},{name:"set_value",description:`Set the ${r.dataName} switch to a specific on or off state.`,commandType:n.SwitchCommands.SetValue,enabled:!!l.onChange}],c=l.webMcp,d=typeof c=="object"&&c!==null&&typeof c.tools=="function"?c.tools:void 0,w=d?d(m):m,S=async(t,a)=>{var s,g;if(t===n.SwitchCommands.Toggle){const e=i.current,o=(g=(s=e.checked)!=null?s:e.value)!=null?g:!1;return e.onChange&&e.onChange({value:!o,syntheticEvent:null,target:u}),{content:[{type:"text",text:`Switch toggled to ${o?"off":"on"}.`}]}}if(t===n.SwitchCommands.SetValue){const e=i.current,o=!!a.value;return e.onChange&&e.onChange({value:o,syntheticEvent:null,target:u}),{content:[{type:"text",text:`Switch set to ${o?"on":"off"}.`}]}}return{content:[{type:"text",text:`Unknown command: ${t}`}],isError:!0}};for(const t of w){if(!t.enabled)continue;const a=t.commandType;try{h.push(p.registerTool({name:f(t.name),description:t.description,inputSchema:n.getSwitchToolSchema(a),execute:async s=>S(a,s||{})}))}catch{}}return h}};exports.switchAdapter=y;
@@ -5,44 +5,54 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- import { SwitchCommands as u, getSwitchToolSchema as T } from "../commands/switch.mjs";
9
- const C = {
8
+ import { SwitchCommands as s, getSwitchToolSchema as x } from "../commands/switch.mjs";
9
+ const S = {
10
10
  componentSuffix: "switch",
11
- createTools(f, s, r, h) {
12
- const a = [], d = (t) => `${r.groupName}_${t}`, i = s.current, l = [
11
+ createTools(u, r, i, g) {
12
+ const h = [], d = (t) => `${i.groupName}_${t}`, l = r.current, m = [
13
13
  {
14
14
  name: "toggle",
15
- description: `Toggle the ${r.dataName} switch on or off.`,
16
- commandType: u.Toggle,
17
- enabled: !!i.onChange
15
+ description: `Toggle the ${i.dataName} switch on or off.`,
16
+ commandType: s.Toggle,
17
+ enabled: !!l.onChange
18
+ },
19
+ {
20
+ name: "set_value",
21
+ description: `Set the ${i.dataName} switch to a specific on or off state.`,
22
+ commandType: s.SetValue,
23
+ enabled: !!l.onChange
24
+ }
25
+ ], n = l.webMcp, p = typeof n == "object" && n !== null && typeof n.tools == "function" ? n.tools : void 0, w = p ? p(m) : m, y = async (t, c) => {
26
+ var a, f;
27
+ if (t === s.Toggle) {
28
+ const e = r.current, o = (f = (a = e.checked) != null ? a : e.value) != null ? f : !1;
29
+ return e.onChange && e.onChange({ value: !o, syntheticEvent: null, target: u }), { content: [{ type: "text", text: `Switch toggled to ${o ? "off" : "on"}.` }] };
18
30
  }
19
- ], o = i.webMcp, m = typeof o == "object" && o !== null && typeof o.tools == "function" ? o.tools : void 0, y = m ? m(l) : l, w = async (t, c) => {
20
- var e, p;
21
- if (t === u.Toggle) {
22
- const n = s.current, g = (p = (e = n.checked) != null ? e : n.value) != null ? p : !1;
23
- return n.onChange && n.onChange({ value: !g, syntheticEvent: null, target: f }), { content: [{ type: "text", text: `Switch toggled to ${g ? "off" : "on"}.` }] };
31
+ if (t === s.SetValue) {
32
+ const e = r.current, o = !!c.value;
33
+ return e.onChange && e.onChange({ value: o, syntheticEvent: null, target: u }), { content: [{ type: "text", text: `Switch set to ${o ? "on" : "off"}.` }] };
24
34
  }
25
35
  return { content: [{ type: "text", text: `Unknown command: ${t}` }], isError: !0 };
26
36
  };
27
- for (const t of y) {
37
+ for (const t of w) {
28
38
  if (!t.enabled)
29
39
  continue;
30
40
  const c = t.commandType;
31
41
  try {
32
- a.push(
33
- h.registerTool({
42
+ h.push(
43
+ g.registerTool({
34
44
  name: d(t.name),
35
45
  description: t.description,
36
- inputSchema: T(c),
37
- execute: async (e) => w(c, e || {})
46
+ inputSchema: x(c),
47
+ execute: async (a) => y(c, a || {})
38
48
  })
39
49
  );
40
50
  } catch {
41
51
  }
42
52
  }
43
- return a;
53
+ return h;
44
54
  }
45
55
  };
46
56
  export {
47
- C as switchAdapter
57
+ S as switchAdapter
48
58
  };
@@ -5,5 +5,5 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const x=require("../commands/treeview.js"),b=require("./utils.js");function S(s,n,e,t,a){return s?s.map((r,i)=>{const o={index:i,text:r[n],expanded:!!r[t],selected:!!r[a]},d=r[e];return d&&Array.isArray(d)&&d.length>0&&(o.children=S(d,n,e,t,a)),o}):[]}function f(s,n,e,t,a=""){for(let r=0;r<s.length;r++){const i=s[r],o=a?`${a}_${r}`:`${r}`;if(b.toText(i[e])===n)return{node:i,path:o};const d=i[t];if(d&&Array.isArray(d)&&d.length>0){const h=f(d,n,e,t,o);if(h)return h}}}function A(s,n){const e=s.nodeText;if(!e)return{content:[{type:"text",text:"Missing required argument: nodeText"}],isError:!0};const t=n.current,a=t.textField||"text",r=t.childrenField||"items",i=t.data;if(!i)return{content:[{type:"text",text:"TreeView has no data."}]};const o=f(i,e,a,r);return o?(t.onExpandChange&&t.onExpandChange({item:o.node,itemHierarchicalIndex:o.path,nativeEvent:null,target:null,syntheticEvent:null}),{content:[{type:"text",text:`Expanded node "${e}".`}]}):{content:[{type:"text",text:`Node "${e}" not found.`}],isError:!0}}function _(s,n){const e=s.nodeText;if(!e)return{content:[{type:"text",text:"Missing required argument: nodeText"}],isError:!0};const t=n.current,a=t.textField||"text",r=t.childrenField||"items",i=t.data;if(!i)return{content:[{type:"text",text:"TreeView has no data."}]};const o=f(i,e,a,r);return o?(t.onExpandChange&&t.onExpandChange({item:o.node,itemHierarchicalIndex:o.path,nativeEvent:null,target:null,syntheticEvent:null}),{content:[{type:"text",text:`Collapsed node "${e}".`}]}):{content:[{type:"text",text:`Node "${e}" not found.`}],isError:!0}}function M(s,n){const e=s.nodeText;if(!e)return{content:[{type:"text",text:"Missing required argument: nodeText"}],isError:!0};const t=n.current,a=t.textField||"text",r=t.childrenField||"items",i=t.data;if(!i)return{content:[{type:"text",text:"TreeView has no data."}]};const o=f(i,e,a,r);return o?(t.onItemClick&&t.onItemClick({item:o.node,itemHierarchicalIndex:o.path,nativeEvent:null,target:null,syntheticEvent:null}),{content:[{type:"text",text:`Selected node "${e}".`}]}):{content:[{type:"text",text:`Node "${e}" not found.`}],isError:!0}}function I(s,n,e){switch(s){case x.TreeViewCommands.Expand:return A(n,e);case x.TreeViewCommands.Collapse:return _(n,e);case x.TreeViewCommands.Select:return M(n,e);default:return{content:[{type:"text",text:`Unknown command: ${s}`}],isError:!0}}}const k={componentSuffix:"treeview",createTools(s,n,e,t){const a=[],r=c=>`${e.groupName}_${c}`,i=n.current,o=[{name:"expand_node",description:`Expand a node in the ${e.dataName} treeview`,commandType:x.TreeViewCommands.Expand,enabled:!!i.onExpandChange},{name:"collapse_node",description:`Collapse a node in the ${e.dataName} treeview`,commandType:x.TreeViewCommands.Collapse,enabled:!!i.onExpandChange},{name:"select_node",description:`Select a node in the ${e.dataName} treeview`,commandType:x.TreeViewCommands.Select,enabled:!!i.onItemClick}],d=n.current.webMcp,h=typeof d=="object"&&d!==null&&typeof d.tools=="function"?d.tools:void 0,V=h?h(o,{tname:r}):o,N=async(c,u)=>I(c,u,n);try{a.push(t.registerTool({name:r("get_structure"),description:`Get the tree structure of the ${e.dataName} treeview as JSON.`,inputSchema:{type:"object",properties:{},required:[]},async execute(){const c=n.current,u=c.textField||"text",l=c.childrenField||"items",y=c.expandField||"expanded",T=c.selectField||"selected",p=c.data;if(!p||p.length===0)return{content:[{type:"text",text:"TreeView has no data."}]};const m=S(p,u,l,y,T);return{content:[{type:"text",text:JSON.stringify(m,null,2)}]}}}))}catch{}if(i.onFilterChange)try{a.push(t.registerTool({name:r("search"),description:`Search for nodes matching a text pattern in the ${e.dataName} treeview.`,inputSchema:{type:"object",properties:{query:{type:"string",description:"Text to search for (case-insensitive)"}},required:["query"]},async execute(c){const u=(c.query||"").toLowerCase();if(!u)return{content:[{type:"text",text:"Missing required argument: query"}],isError:!0};const l=n.current,y=l.textField||"text",T=l.childrenField||"items",p=l.data;if(!p)return{content:[{type:"text",text:"TreeView has no data."}]};const m=[],w=(q,E)=>{q.forEach(($,v)=>{const F=E?`${E}_${v}`:`${v}`,g=$[y]||"";typeof g=="string"&&g.toLowerCase().includes(u)&&m.push({text:g,path:F});const C=$[T];C&&Array.isArray(C)&&w(C,F)})};return w(p,""),m.length===0?{content:[{type:"text",text:`No nodes matching "${u}".`}]}:{content:[{type:"text",text:`${m.length} match(es):
9
- ${JSON.stringify(m,null,2)}`}]}}}))}catch{}for(const c of V){if(!c.enabled)continue;const u=x.getTreeViewToolSchema(c.commandType),l=c.commandType;try{a.push(t.registerTool({name:r(c.name),description:c.description,inputSchema:u,execute:async y=>N(l,y||{})}))}catch{}}return a}};exports.treeViewAdapter=k;
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("../commands/treeview.js"),b=require("./utils.js");function h(c,n,e,t,a=""){for(let i=0;i<c.length;i++){const o=c[i],r=a?`${a}_${i}`:`${i}`;if(b.toText(o[e])===n)return{node:o,path:r};const d=o[t];if(d&&Array.isArray(d)&&d.length>0){const x=h(d,n,e,t,r);if(x)return x}}}function N(c,n){const e=c.nodeText;if(!e)return{content:[{type:"text",text:"Missing required argument: nodeText"}],isError:!0};const t=n.current,a=t.textField||"text",i=t.childrenField||"items",o=t.data;if(!o)return{content:[{type:"text",text:"TreeView has no data."}]};const r=h(o,e,a,i);return r?(t.onExpandChange&&t.onExpandChange({item:r.node,itemHierarchicalIndex:r.path,nativeEvent:null,target:null,syntheticEvent:null}),{content:[{type:"text",text:`Expanded node "${e}".`}]}):{content:[{type:"text",text:`Node "${e}" not found.`}],isError:!0}}function M(c,n){const e=c.nodeText;if(!e)return{content:[{type:"text",text:"Missing required argument: nodeText"}],isError:!0};const t=n.current,a=t.textField||"text",i=t.childrenField||"items",o=t.data;if(!o)return{content:[{type:"text",text:"TreeView has no data."}]};const r=h(o,e,a,i);return r?(t.onExpandChange&&t.onExpandChange({item:r.node,itemHierarchicalIndex:r.path,nativeEvent:null,target:null,syntheticEvent:null}),{content:[{type:"text",text:`Collapsed node "${e}".`}]}):{content:[{type:"text",text:`Node "${e}" not found.`}],isError:!0}}function _(c,n){const e=c.nodeText;if(!e)return{content:[{type:"text",text:"Missing required argument: nodeText"}],isError:!0};const t=n.current,a=t.textField||"text",i=t.childrenField||"items",o=t.data;if(!o)return{content:[{type:"text",text:"TreeView has no data."}]};const r=h(o,e,a,i);return r?(t.onItemClick&&t.onItemClick({item:r.node,itemHierarchicalIndex:r.path,nativeEvent:null,target:null,syntheticEvent:null}),{content:[{type:"text",text:`Selected node "${e}".`}]}):{content:[{type:"text",text:`Node "${e}" not found.`}],isError:!0}}function A(c,n,e){switch(c){case u.TreeViewCommands.Expand:return N(n,e);case u.TreeViewCommands.Collapse:return M(n,e);case u.TreeViewCommands.Select:return _(n,e);default:return{content:[{type:"text",text:`Unknown command: ${c}`}],isError:!0}}}const I={componentSuffix:"treeview",createTools(c,n,e,t){const a=[],i=s=>`${e.groupName}_${s}`,o=n.current,r=[{name:"expand_node",description:`Expand a node in the ${e.dataName} treeview`,commandType:u.TreeViewCommands.Expand,enabled:!!o.onExpandChange},{name:"collapse_node",description:`Collapse a node in the ${e.dataName} treeview`,commandType:u.TreeViewCommands.Collapse,enabled:!!o.onExpandChange},{name:"select_node",description:`Select a node in the ${e.dataName} treeview`,commandType:u.TreeViewCommands.Select,enabled:!!o.onItemClick}],d=n.current.webMcp,x=typeof d=="object"&&d!==null&&typeof d.tools=="function"?d.tools:void 0,F=x?x(r,{tname:i}):r,V=async(s,l)=>A(s,l,n);if(o.onFilterChange)try{a.push(t.registerTool({name:i("search"),description:`Search for nodes matching a text pattern in the ${e.dataName} treeview.`,inputSchema:{type:"object",properties:{query:{type:"string",description:"Text to search for (case-insensitive)"}},required:["query"]},async execute(s){const l=(s.query||"").toLowerCase();if(!l)return{content:[{type:"text",text:"Missing required argument: query"}],isError:!0};const m=n.current,y=m.textField||"text",S=m.childrenField||"items",C=m.data;if(!C)return{content:[{type:"text",text:"TreeView has no data."}]};const p=[],g=(q,w)=>{q.forEach((E,$)=>{const v=w?`${w}_${$}`:`${$}`,f=E[y]||"";typeof f=="string"&&f.toLowerCase().includes(l)&&p.push({text:f,path:v});const T=E[S];T&&Array.isArray(T)&&g(T,v)})};return g(C,""),p.length===0?{content:[{type:"text",text:`No nodes matching "${l}".`}]}:{content:[{type:"text",text:`${p.length} match(es):
9
+ ${JSON.stringify(p,null,2)}`}]}}}))}catch{}for(const s of F){if(!s.enabled)continue;const l=u.getTreeViewToolSchema(s.commandType),m=s.commandType;try{a.push(t.registerTool({name:i(s.name),description:s.description,inputSchema:l,execute:async y=>V(m,y||{})}))}catch{}}return a}};exports.treeViewAdapter=I;
@@ -5,149 +5,115 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- import { TreeViewCommands as h, getTreeViewToolSchema as V } from "../commands/treeview.mjs";
9
- import { toText as _ } from "./utils.mjs";
10
- function S(s, n, e, t, a) {
11
- return s ? s.map((r, c) => {
12
- const o = {
13
- index: c,
14
- text: r[n],
15
- expanded: !!r[t],
16
- selected: !!r[a]
17
- }, d = r[e];
18
- return d && Array.isArray(d) && d.length > 0 && (o.children = S(d, n, e, t, a)), o;
19
- }) : [];
20
- }
21
- function f(s, n, e, t, a = "") {
22
- for (let r = 0; r < s.length; r++) {
23
- const c = s[r], o = a ? `${a}_${r}` : `${r}`;
24
- if (_(c[e]) === n)
25
- return { node: c, path: o };
26
- const d = c[t];
27
- if (d && Array.isArray(d) && d.length > 0) {
28
- const m = f(
29
- d,
8
+ import { TreeViewCommands as u, getTreeViewToolSchema as b } from "../commands/treeview.mjs";
9
+ import { toText as V } from "./utils.mjs";
10
+ function h(c, n, e, t, a = "") {
11
+ for (let i = 0; i < c.length; i++) {
12
+ const o = c[i], r = a ? `${a}_${i}` : `${i}`;
13
+ if (V(o[e]) === n)
14
+ return { node: o, path: r };
15
+ const s = o[t];
16
+ if (s && Array.isArray(s) && s.length > 0) {
17
+ const x = h(
18
+ s,
30
19
  n,
31
20
  e,
32
21
  t,
33
- o
22
+ r
34
23
  );
35
- if (m)
36
- return m;
24
+ if (x)
25
+ return x;
37
26
  }
38
27
  }
39
28
  }
40
- function A(s, n) {
41
- const e = s.nodeText;
29
+ function _(c, n) {
30
+ const e = c.nodeText;
42
31
  if (!e)
43
32
  return { content: [{ type: "text", text: "Missing required argument: nodeText" }], isError: !0 };
44
- const t = n.current, a = t.textField || "text", r = t.childrenField || "items", c = t.data;
45
- if (!c)
33
+ const t = n.current, a = t.textField || "text", i = t.childrenField || "items", o = t.data;
34
+ if (!o)
46
35
  return { content: [{ type: "text", text: "TreeView has no data." }] };
47
- const o = f(c, e, a, r);
48
- return o ? (t.onExpandChange && t.onExpandChange({
49
- item: o.node,
50
- itemHierarchicalIndex: o.path,
36
+ const r = h(o, e, a, i);
37
+ return r ? (t.onExpandChange && t.onExpandChange({
38
+ item: r.node,
39
+ itemHierarchicalIndex: r.path,
51
40
  nativeEvent: null,
52
41
  target: null,
53
42
  syntheticEvent: null
54
43
  }), { content: [{ type: "text", text: `Expanded node "${e}".` }] }) : { content: [{ type: "text", text: `Node "${e}" not found.` }], isError: !0 };
55
44
  }
56
- function I(s, n) {
57
- const e = s.nodeText;
45
+ function I(c, n) {
46
+ const e = c.nodeText;
58
47
  if (!e)
59
48
  return { content: [{ type: "text", text: "Missing required argument: nodeText" }], isError: !0 };
60
- const t = n.current, a = t.textField || "text", r = t.childrenField || "items", c = t.data;
61
- if (!c)
49
+ const t = n.current, a = t.textField || "text", i = t.childrenField || "items", o = t.data;
50
+ if (!o)
62
51
  return { content: [{ type: "text", text: "TreeView has no data." }] };
63
- const o = f(c, e, a, r);
64
- return o ? (t.onExpandChange && t.onExpandChange({
65
- item: o.node,
66
- itemHierarchicalIndex: o.path,
52
+ const r = h(o, e, a, i);
53
+ return r ? (t.onExpandChange && t.onExpandChange({
54
+ item: r.node,
55
+ itemHierarchicalIndex: r.path,
67
56
  nativeEvent: null,
68
57
  target: null,
69
58
  syntheticEvent: null
70
59
  }), { content: [{ type: "text", text: `Collapsed node "${e}".` }] }) : { content: [{ type: "text", text: `Node "${e}" not found.` }], isError: !0 };
71
60
  }
72
- function M(s, n) {
73
- const e = s.nodeText;
61
+ function M(c, n) {
62
+ const e = c.nodeText;
74
63
  if (!e)
75
64
  return { content: [{ type: "text", text: "Missing required argument: nodeText" }], isError: !0 };
76
- const t = n.current, a = t.textField || "text", r = t.childrenField || "items", c = t.data;
77
- if (!c)
65
+ const t = n.current, a = t.textField || "text", i = t.childrenField || "items", o = t.data;
66
+ if (!o)
78
67
  return { content: [{ type: "text", text: "TreeView has no data." }] };
79
- const o = f(c, e, a, r);
80
- return o ? (t.onItemClick && t.onItemClick({
81
- item: o.node,
82
- itemHierarchicalIndex: o.path,
68
+ const r = h(o, e, a, i);
69
+ return r ? (t.onItemClick && t.onItemClick({
70
+ item: r.node,
71
+ itemHierarchicalIndex: r.path,
83
72
  nativeEvent: null,
84
73
  target: null,
85
74
  syntheticEvent: null
86
75
  }), { content: [{ type: "text", text: `Selected node "${e}".` }] }) : { content: [{ type: "text", text: `Node "${e}" not found.` }], isError: !0 };
87
76
  }
88
- function k(s, n, e) {
89
- switch (s) {
90
- case h.Expand:
91
- return A(n, e);
92
- case h.Collapse:
77
+ function k(c, n, e) {
78
+ switch (c) {
79
+ case u.Expand:
80
+ return _(n, e);
81
+ case u.Collapse:
93
82
  return I(n, e);
94
- case h.Select:
83
+ case u.Select:
95
84
  return M(n, e);
96
85
  default:
97
- return { content: [{ type: "text", text: `Unknown command: ${s}` }], isError: !0 };
86
+ return { content: [{ type: "text", text: `Unknown command: ${c}` }], isError: !0 };
98
87
  }
99
88
  }
100
- const J = {
89
+ const L = {
101
90
  componentSuffix: "treeview",
102
- createTools(s, n, e, t) {
103
- const a = [], r = (i) => `${e.groupName}_${i}`, c = n.current, o = [
91
+ createTools(c, n, e, t) {
92
+ const a = [], i = (d) => `${e.groupName}_${d}`, o = n.current, r = [
104
93
  {
105
94
  name: "expand_node",
106
95
  description: `Expand a node in the ${e.dataName} treeview`,
107
- commandType: h.Expand,
108
- enabled: !!c.onExpandChange
96
+ commandType: u.Expand,
97
+ enabled: !!o.onExpandChange
109
98
  },
110
99
  {
111
100
  name: "collapse_node",
112
101
  description: `Collapse a node in the ${e.dataName} treeview`,
113
- commandType: h.Collapse,
114
- enabled: !!c.onExpandChange
102
+ commandType: u.Collapse,
103
+ enabled: !!o.onExpandChange
115
104
  },
116
105
  {
117
106
  name: "select_node",
118
107
  description: `Select a node in the ${e.dataName} treeview`,
119
- commandType: h.Select,
120
- enabled: !!c.onItemClick
108
+ commandType: u.Select,
109
+ enabled: !!o.onItemClick
121
110
  }
122
- ], d = n.current.webMcp, m = typeof d == "object" && d !== null && typeof d.tools == "function" ? d.tools : void 0, N = m ? m(o, { tname: r }) : o, q = async (i, u) => k(i, u, n);
123
- try {
124
- a.push(
125
- t.registerTool({
126
- name: r("get_structure"),
127
- description: `Get the tree structure of the ${e.dataName} treeview as JSON.`,
128
- inputSchema: { type: "object", properties: {}, required: [] },
129
- async execute() {
130
- const i = n.current, u = i.textField || "text", l = i.childrenField || "items", y = i.expandField || "expanded", T = i.selectField || "selected", x = i.data;
131
- if (!x || x.length === 0)
132
- return { content: [{ type: "text", text: "TreeView has no data." }] };
133
- const p = S(
134
- x,
135
- u,
136
- l,
137
- y,
138
- T
139
- );
140
- return { content: [{ type: "text", text: JSON.stringify(p, null, 2) }] };
141
- }
142
- })
143
- );
144
- } catch {
145
- }
146
- if (c.onFilterChange)
111
+ ], s = n.current.webMcp, x = typeof s == "object" && s !== null && typeof s.tools == "function" ? s.tools : void 0, F = x ? x(r, { tname: i }) : r, N = async (d, l) => k(d, l, n);
112
+ if (o.onFilterChange)
147
113
  try {
148
114
  a.push(
149
115
  t.registerTool({
150
- name: r("search"),
116
+ name: i("search"),
151
117
  description: `Search for nodes matching a text pattern in the ${e.dataName} treeview.`,
152
118
  inputSchema: {
153
119
  type: "object",
@@ -156,30 +122,30 @@ const J = {
156
122
  },
157
123
  required: ["query"]
158
124
  },
159
- async execute(i) {
160
- const u = (i.query || "").toLowerCase();
161
- if (!u)
125
+ async execute(d) {
126
+ const l = (d.query || "").toLowerCase();
127
+ if (!l)
162
128
  return {
163
129
  content: [{ type: "text", text: "Missing required argument: query" }],
164
130
  isError: !0
165
131
  };
166
- const l = n.current, y = l.textField || "text", T = l.childrenField || "items", x = l.data;
167
- if (!x)
132
+ const p = n.current, y = p.textField || "text", S = p.childrenField || "items", g = p.data;
133
+ if (!g)
168
134
  return { content: [{ type: "text", text: "TreeView has no data." }] };
169
- const p = [], C = (b, $) => {
170
- b.forEach((w, v) => {
171
- const F = $ ? `${$}_${v}` : `${v}`, g = w[y] || "";
172
- typeof g == "string" && g.toLowerCase().includes(u) && p.push({ text: g, path: F });
173
- const E = w[T];
174
- E && Array.isArray(E) && C(E, F);
135
+ const m = [], E = (q, C) => {
136
+ q.forEach(($, w) => {
137
+ const v = C ? `${C}_${w}` : `${w}`, f = $[y] || "";
138
+ typeof f == "string" && f.toLowerCase().includes(l) && m.push({ text: f, path: v });
139
+ const T = $[S];
140
+ T && Array.isArray(T) && E(T, v);
175
141
  });
176
142
  };
177
- return C(x, ""), p.length === 0 ? { content: [{ type: "text", text: `No nodes matching "${u}".` }] } : {
143
+ return E(g, ""), m.length === 0 ? { content: [{ type: "text", text: `No nodes matching "${l}".` }] } : {
178
144
  content: [
179
145
  {
180
146
  type: "text",
181
- text: `${p.length} match(es):
182
- ${JSON.stringify(p, null, 2)}`
147
+ text: `${m.length} match(es):
148
+ ${JSON.stringify(m, null, 2)}`
183
149
  }
184
150
  ]
185
151
  };
@@ -188,17 +154,17 @@ ${JSON.stringify(p, null, 2)}`
188
154
  );
189
155
  } catch {
190
156
  }
191
- for (const i of N) {
192
- if (!i.enabled)
157
+ for (const d of F) {
158
+ if (!d.enabled)
193
159
  continue;
194
- const u = V(i.commandType), l = i.commandType;
160
+ const l = b(d.commandType), p = d.commandType;
195
161
  try {
196
162
  a.push(
197
163
  t.registerTool({
198
- name: r(i.name),
199
- description: i.description,
200
- inputSchema: u,
201
- execute: async (y) => q(l, y || {})
164
+ name: i(d.name),
165
+ description: d.description,
166
+ inputSchema: l,
167
+ execute: async (y) => N(p, y || {})
202
168
  })
203
169
  );
204
170
  } catch {
@@ -208,5 +174,5 @@ ${JSON.stringify(p, null, 2)}`
208
174
  }
209
175
  };
210
176
  export {
211
- J as treeViewAdapter
177
+ L as treeViewAdapter
212
178
  };
@@ -7,8 +7,6 @@
7
7
  */
8
8
  import { ToolAdapter } from '../types';
9
9
  interface WindowAdapterProps {
10
- onOpen?: (event: unknown) => void;
11
- onClose?: (event: unknown) => void;
12
10
  onStageChange?: (event: unknown) => void;
13
11
  webMcp?: unknown;
14
12
  }
@@ -5,4 +5,4 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("../commands/window.js");function o(r,i){const a=r[i];if(typeof a=="function")return a;const s=r.webMcp;if(typeof s=="object"&&s!==null&&typeof s[i]=="function")return s[i]}const f={componentSuffix:"window",createTools(r,i,a,s){const p=[],C=t=>`${a.groupName}_${t}`,c=i.current,w=[{name:"open",description:`Open the ${a.dataName} window`,commandType:n.WindowCommands.Open,enabled:!!o(c,"onOpen")},{name:"close",description:`Close the ${a.dataName} window`,commandType:n.WindowCommands.Close,enabled:!!o(c,"onClose")},{name:"minimize",description:`Minimize the ${a.dataName} window`,commandType:n.WindowCommands.Minimize,enabled:!!o(c,"onStageChange")},{name:"maximize",description:`Maximize the ${a.dataName} window`,commandType:n.WindowCommands.Maximize,enabled:!!o(c,"onStageChange")},{name:"restore",description:`Restore the ${a.dataName} window to its default size`,commandType:n.WindowCommands.Restore,enabled:!!o(c,"onStageChange")}],m=i.current.webMcp,l=typeof m=="object"&&m!==null&&typeof m.tools=="function"?m.tools:void 0,g=l?l(w):w,y=async(t,u)=>{const d=i.current;switch(t){case n.WindowCommands.Open:{const e=o(d,"onOpen");return e&&e({}),{content:[{type:"text",text:"Window opened."}]}}case n.WindowCommands.Close:{const e=o(d,"onClose");return e&&e({}),{content:[{type:"text",text:"Window closed."}]}}case n.WindowCommands.Minimize:{const e=o(d,"onStageChange");return e&&e({state:"MINIMIZED"}),{content:[{type:"text",text:"Window minimized."}]}}case n.WindowCommands.Maximize:{const e=o(d,"onStageChange");return e&&e({state:"MAXIMIZED"}),{content:[{type:"text",text:"Window maximized."}]}}case n.WindowCommands.Restore:{const e=o(d,"onStageChange");return e&&e({state:"DEFAULT"}),{content:[{type:"text",text:"Window restored."}]}}default:return{content:[{type:"text",text:`Unknown command: ${t}`}],isError:!0}}};for(const t of g){if(!t.enabled)continue;const u=n.getWindowToolSchema(t.commandType),d=t.commandType;try{p.push(s.registerTool({name:C(t.name),description:t.description,inputSchema:u,execute:async e=>y(d,e||{})}))}catch{}}return p}};exports.windowAdapter=f;
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("../commands/window.js"),h={componentSuffix:"window",createTools(C,i,o,w){const d=[],p=e=>`${o.groupName}_${e}`,s=i.current,m=[{name:"minimize",description:`Minimize the ${o.dataName} window`,commandType:n.WindowCommands.Minimize,enabled:!!s.onStageChange},{name:"maximize",description:`Maximize the ${o.dataName} window`,commandType:n.WindowCommands.Maximize,enabled:!!s.onStageChange},{name:"restore",description:`Restore the ${o.dataName} window to its default size`,commandType:n.WindowCommands.Restore,enabled:!!s.onStageChange}],a=i.current.webMcp,c=typeof a=="object"&&a!==null&&typeof a.tools=="function"?a.tools:void 0,l=c?c(m):m,u=async(e,r)=>{const t=i.current;switch(e){case n.WindowCommands.Minimize:return t.onStageChange&&t.onStageChange({state:"MINIMIZED"}),{content:[{type:"text",text:"Window minimized."}]};case n.WindowCommands.Maximize:return t.onStageChange&&t.onStageChange({state:"MAXIMIZED"}),{content:[{type:"text",text:"Window maximized."}]};case n.WindowCommands.Restore:return t.onStageChange&&t.onStageChange({state:"DEFAULT"}),{content:[{type:"text",text:"Window restored."}]};default:return{content:[{type:"text",text:`Unknown command: ${e}`}],isError:!0}}};for(const e of l){if(!e.enabled)continue;const r=n.getWindowToolSchema(e.commandType),t=e.commandType;try{d.push(w.registerTool({name:p(e.name),description:e.description,inputSchema:r,execute:async g=>u(t,g||{})}))}catch{}}return d}};exports.windowAdapter=h;
@@ -5,93 +5,59 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- import { WindowCommands as n, getWindowToolSchema as f } from "../commands/window.mjs";
9
- function o(m, i) {
10
- const a = m[i];
11
- if (typeof a == "function")
12
- return a;
13
- const s = m.webMcp;
14
- if (typeof s == "object" && s !== null && typeof s[i] == "function")
15
- return s[i];
16
- }
8
+ import { WindowCommands as n, getWindowToolSchema as h } from "../commands/window.mjs";
17
9
  const C = {
18
10
  componentSuffix: "window",
19
- createTools(m, i, a, s) {
20
- const p = [], g = (t) => `${a.groupName}_${t}`, r = i.current, l = [
21
- {
22
- name: "open",
23
- description: `Open the ${a.dataName} window`,
24
- commandType: n.Open,
25
- enabled: !!o(r, "onOpen")
26
- },
27
- {
28
- name: "close",
29
- description: `Close the ${a.dataName} window`,
30
- commandType: n.Close,
31
- enabled: !!o(r, "onClose")
32
- },
11
+ createTools(x, i, o, p) {
12
+ const s = [], g = (e) => `${o.groupName}_${e}`, c = i.current, m = [
33
13
  {
34
14
  name: "minimize",
35
- description: `Minimize the ${a.dataName} window`,
15
+ description: `Minimize the ${o.dataName} window`,
36
16
  commandType: n.Minimize,
37
- enabled: !!o(r, "onStageChange")
17
+ enabled: !!c.onStageChange
38
18
  },
39
19
  {
40
20
  name: "maximize",
41
- description: `Maximize the ${a.dataName} window`,
21
+ description: `Maximize the ${o.dataName} window`,
42
22
  commandType: n.Maximize,
43
- enabled: !!o(r, "onStageChange")
23
+ enabled: !!c.onStageChange
44
24
  },
45
25
  {
46
26
  name: "restore",
47
- description: `Restore the ${a.dataName} window to its default size`,
27
+ description: `Restore the ${o.dataName} window to its default size`,
48
28
  commandType: n.Restore,
49
- enabled: !!o(r, "onStageChange")
29
+ enabled: !!c.onStageChange
50
30
  }
51
- ], d = i.current.webMcp, u = typeof d == "object" && d !== null && typeof d.tools == "function" ? d.tools : void 0, x = u ? u(l) : l, y = async (t, w) => {
52
- const c = i.current;
53
- switch (t) {
54
- case n.Open: {
55
- const e = o(c, "onOpen");
56
- return e && e({}), { content: [{ type: "text", text: "Window opened." }] };
57
- }
58
- case n.Close: {
59
- const e = o(c, "onClose");
60
- return e && e({}), { content: [{ type: "text", text: "Window closed." }] };
61
- }
62
- case n.Minimize: {
63
- const e = o(c, "onStageChange");
64
- return e && e({ state: "MINIMIZED" }), { content: [{ type: "text", text: "Window minimized." }] };
65
- }
66
- case n.Maximize: {
67
- const e = o(c, "onStageChange");
68
- return e && e({ state: "MAXIMIZED" }), { content: [{ type: "text", text: "Window maximized." }] };
69
- }
70
- case n.Restore: {
71
- const e = o(c, "onStageChange");
72
- return e && e({ state: "DEFAULT" }), { content: [{ type: "text", text: "Window restored." }] };
73
- }
31
+ ], a = i.current.webMcp, r = typeof a == "object" && a !== null && typeof a.tools == "function" ? a.tools : void 0, l = r ? r(m) : m, u = async (e, d) => {
32
+ const t = i.current;
33
+ switch (e) {
34
+ case n.Minimize:
35
+ return t.onStageChange && t.onStageChange({ state: "MINIMIZED" }), { content: [{ type: "text", text: "Window minimized." }] };
36
+ case n.Maximize:
37
+ return t.onStageChange && t.onStageChange({ state: "MAXIMIZED" }), { content: [{ type: "text", text: "Window maximized." }] };
38
+ case n.Restore:
39
+ return t.onStageChange && t.onStageChange({ state: "DEFAULT" }), { content: [{ type: "text", text: "Window restored." }] };
74
40
  default:
75
- return { content: [{ type: "text", text: `Unknown command: ${t}` }], isError: !0 };
41
+ return { content: [{ type: "text", text: `Unknown command: ${e}` }], isError: !0 };
76
42
  }
77
43
  };
78
- for (const t of x) {
79
- if (!t.enabled)
44
+ for (const e of l) {
45
+ if (!e.enabled)
80
46
  continue;
81
- const w = f(t.commandType), c = t.commandType;
47
+ const d = h(e.commandType), t = e.commandType;
82
48
  try {
83
- p.push(
84
- s.registerTool({
85
- name: g(t.name),
86
- description: t.description,
87
- inputSchema: w,
88
- execute: async (e) => y(c, e || {})
49
+ s.push(
50
+ p.registerTool({
51
+ name: g(e.name),
52
+ description: e.description,
53
+ inputSchema: d,
54
+ execute: async (w) => u(t, w || {})
89
55
  })
90
56
  );
91
57
  } catch {
92
58
  }
93
59
  }
94
- return p;
60
+ return s;
95
61
  }
96
62
  };
97
63
  export {
@@ -14,7 +14,10 @@ export declare const FormCommands: {
14
14
  * Fills one or more form fields with the specified values.
15
15
  *
16
16
  * Parameters:
17
- * - `values` *(object, required)* — Key-value pairs of field names to values.
17
+ * - `values` *(object, recommended)* — Key-value pairs of field names to values.
18
+ *
19
+ * The command also accepts a flat object payload where field names are passed directly
20
+ * as top-level properties (for example `{ firstName: 'John' }`).
18
21
  */
19
22
  readonly Fill: "FormFill";
20
23
  /**
package/commands/form.js CHANGED
@@ -5,4 +5,4 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../schemas/common.js"),e={Fill:"FormFill",Validate:"FormValidate",Submit:"FormSubmit",Reset:"FormReset"};function a(r,t){switch(r){case e.Fill:return{type:"object",properties:{values:{type:"object",description:`Key-value pairs of field names to values.${t&&t.length>0?` Available fields: ${t.join(", ")}.`:""}`}},required:["values"]};case e.Validate:case e.Submit:case e.Reset:return o.getEmptySchema();default:return o.getEmptySchema()}}exports.FormCommands=e;exports.getFormToolSchema=a;
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../schemas/common.js"),e={Fill:"FormFill",Validate:"FormValidate",Submit:"FormSubmit",Reset:"FormReset"};function i(r,t){switch(r){case e.Fill:return{type:"object",properties:{values:{type:"object",description:`Key-value pairs of field names to values.${t&&t.length>0?` Available fields: ${t.join(", ")}.`:""}`}},additionalProperties:!0,description:"Provide either a `values` object, or pass field/value pairs directly as top-level properties."};case e.Validate:case e.Submit:case e.Reset:return o.getEmptySchema();default:return o.getEmptySchema()}}exports.FormCommands=e;exports.getFormToolSchema=i;