@object-ui/plugin-ai 17.2.0 → 17.5.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/CHANGELOG.md CHANGED
@@ -1,5 +1,163 @@
1
1
  # @object-ui/plugin-ai
2
2
 
3
+ ## 17.5.0
4
+
5
+ ### Patch Changes
6
+
7
+ - d0c3b26: Every plain `<button>` now declares its `type`. HTML defaults an untyped button to
8
+ `type="submit"`, so any of these buttons would submit the form it was composed into
9
+ instead of running its own handler — a real risk for renderers (`drawer`, `tree-view`,
10
+ `navigation-overlay`) whose placement inside a form is a JSON metadata decision. 114
11
+ sites were converted to `type="button"`; no site was a genuine submit button, and the
12
+ DOM is otherwise unchanged.
13
+
14
+ The defect class is now closed mechanically by a new `object-ui/button-has-type` ESLint
15
+ rule (error), so the next untyped button fails CI at write time rather than being found
16
+ by a fourth audit round (objectui#4045, closing the objectui#3344 family).
17
+
18
+ - Updated dependencies [ceccdcf]
19
+ - Updated dependencies [d6e5124]
20
+ - Updated dependencies [debad27]
21
+ - Updated dependencies [dc2aa3e]
22
+ - Updated dependencies [ee66e2e]
23
+ - Updated dependencies [ee26e65]
24
+ - Updated dependencies [5900ac5]
25
+ - Updated dependencies [f650253]
26
+ - Updated dependencies [3d9769a]
27
+ - Updated dependencies [8f85f8b]
28
+ - Updated dependencies [d0c3b26]
29
+ - Updated dependencies [3fc2971]
30
+ - Updated dependencies [aca27fa]
31
+ - Updated dependencies [dde7283]
32
+ - Updated dependencies [4dadf0d]
33
+ - Updated dependencies [ae10a01]
34
+ - Updated dependencies [92876f0]
35
+ - Updated dependencies [f279deb]
36
+ - Updated dependencies [4b70d28]
37
+ - Updated dependencies [eb7f586]
38
+ - Updated dependencies [e901131]
39
+ - Updated dependencies [d9d3463]
40
+ - Updated dependencies [2a40f69]
41
+ - Updated dependencies [bec3e14]
42
+ - Updated dependencies [613b167]
43
+ - Updated dependencies [b4d3c22]
44
+ - Updated dependencies [1f9b905]
45
+ - Updated dependencies [cb13400]
46
+ - Updated dependencies [bc64bfe]
47
+ - Updated dependencies [abb0f81]
48
+ - Updated dependencies [38ab505]
49
+ - Updated dependencies [3e19fe7]
50
+ - Updated dependencies [b953a97]
51
+ - Updated dependencies [d7f3e30]
52
+ - Updated dependencies [7e4f0e5]
53
+ - Updated dependencies [a84385b]
54
+ - Updated dependencies [45e1949]
55
+ - Updated dependencies [92250d6]
56
+ - Updated dependencies [c1d939f]
57
+ - Updated dependencies [49ae9f4]
58
+ - Updated dependencies [a3ae404]
59
+ - Updated dependencies [bfdf3d4]
60
+ - Updated dependencies [bb68488]
61
+ - Updated dependencies [b1e42d0]
62
+ - Updated dependencies [2459a3e]
63
+ - Updated dependencies [d6aa172]
64
+ - Updated dependencies [fe52a04]
65
+ - Updated dependencies [3f5f87c]
66
+ - Updated dependencies [f5e1143]
67
+ - Updated dependencies [f148a64]
68
+ - Updated dependencies [bb68488]
69
+ - Updated dependencies [9461dd3]
70
+ - Updated dependencies [47f551b]
71
+ - Updated dependencies [ab04728]
72
+ - Updated dependencies [5bf09fd]
73
+ - @object-ui/react@17.5.0
74
+ - @object-ui/components@17.5.0
75
+ - @object-ui/core@17.5.0
76
+ - @object-ui/types@17.5.0
77
+
78
+ ## 17.4.0
79
+
80
+ ### Patch Changes
81
+
82
+ - Updated dependencies [794c497]
83
+ - Updated dependencies [993336f]
84
+ - Updated dependencies [f0a625a]
85
+ - Updated dependencies [b5980f4]
86
+ - Updated dependencies [8aad9fd]
87
+ - Updated dependencies [6719877]
88
+ - Updated dependencies [56ff091]
89
+ - Updated dependencies [0cbdca8]
90
+ - Updated dependencies [d229dfa]
91
+ - Updated dependencies [ecae400]
92
+ - Updated dependencies [4bc6c23]
93
+ - Updated dependencies [d3e738a]
94
+ - Updated dependencies [c3b01a7]
95
+ - Updated dependencies [7ed3360]
96
+ - Updated dependencies [0fa5e4d]
97
+ - Updated dependencies [5bfaabd]
98
+ - Updated dependencies [e06810e]
99
+ - Updated dependencies [ab3ad4f]
100
+ - Updated dependencies [c2fd122]
101
+ - Updated dependencies [e24d767]
102
+ - Updated dependencies [aca561a]
103
+ - Updated dependencies [48132f7]
104
+ - Updated dependencies [0ef9dfd]
105
+ - Updated dependencies [1d723e3]
106
+ - Updated dependencies [0109f54]
107
+ - Updated dependencies [7e5bb5d]
108
+ - Updated dependencies [fbc23e0]
109
+ - Updated dependencies [e6fdbdc]
110
+ - Updated dependencies [54233b1]
111
+ - Updated dependencies [97b63d7]
112
+ - Updated dependencies [6bb454a]
113
+ - Updated dependencies [523be48]
114
+ - Updated dependencies [7e2b7e9]
115
+ - Updated dependencies [c1e1e6b]
116
+ - @object-ui/components@17.4.0
117
+ - @object-ui/react@17.4.0
118
+ - @object-ui/core@17.4.0
119
+ - @object-ui/types@17.4.0
120
+
121
+ ## 17.3.0
122
+
123
+ ### Patch Changes
124
+
125
+ - Updated dependencies [18cd432]
126
+ - Updated dependencies [532cf8b]
127
+ - Updated dependencies [680080a]
128
+ - Updated dependencies [a7651e6]
129
+ - Updated dependencies [d915c47]
130
+ - Updated dependencies [b71fc92]
131
+ - Updated dependencies [34595eb]
132
+ - Updated dependencies [3889ffb]
133
+ - Updated dependencies [5781fb1]
134
+ - Updated dependencies [9e9e9a9]
135
+ - Updated dependencies [56409c2]
136
+ - Updated dependencies [042e09d]
137
+ - Updated dependencies [9cbcbf4]
138
+ - Updated dependencies [85c4c9c]
139
+ - Updated dependencies [fd54c3e]
140
+ - Updated dependencies [4eeb932]
141
+ - Updated dependencies [23018cc]
142
+ - Updated dependencies [53811d1]
143
+ - Updated dependencies [d915c47]
144
+ - Updated dependencies [f44d872]
145
+ - Updated dependencies [509104a]
146
+ - Updated dependencies [825bbe3]
147
+ - Updated dependencies [5dd0127]
148
+ - Updated dependencies [06632e9]
149
+ - Updated dependencies [a4cff5b]
150
+ - Updated dependencies [175bd79]
151
+ - Updated dependencies [f833d3a]
152
+ - Updated dependencies [2a9513d]
153
+ - Updated dependencies [71be406]
154
+ - Updated dependencies [d22ae31]
155
+ - Updated dependencies [8d8094a]
156
+ - @object-ui/core@17.3.0
157
+ - @object-ui/components@17.3.0
158
+ - @object-ui/types@17.3.0
159
+ - @object-ui/react@17.3.0
160
+
3
161
  ## 17.2.0
4
162
 
5
163
  ### Patch Changes
@@ -912,6 +1070,7 @@
912
1070
  Library builds (vite lib mode) now externalize every non-relative import instead of bundling third-party CJS dependencies into the published dist. This avoids inlined `require("react")` / `require("react-dom")` calls that cause `Calling \`require\` for "react" in an environment that doesn't expose the \`require\` function` runtime errors when consumer apps re-bundle the published dist.
913
1071
 
914
1072
  Specifically fixes:
1073
+
915
1074
  - `@object-ui/plugin-dashboard` no longer inlines `react-grid-layout` (and its transitive `react-draggable` / `react-resizable` CJS bundles). `react-grid-layout` is now declared as a peer dependency so consumers install a single ESM-friendly copy.
916
1075
  - `@object-ui/components`, `@object-ui/plugin-calendar`, `@object-ui/plugin-charts`, `@object-ui/plugin-designer` no longer inline `react-i18next` / `i18next` / `use-sync-external-store` CJS shims.
917
1076
  - All plugin packages now use a unified `external: (id) => !/^[./]/.test(id) && !id.startsWith(__dirname)` rule, ensuring future additions of CJS deps are automatically externalized.
package/README.md CHANGED
@@ -19,7 +19,6 @@ npm install @object-ui/plugin-ai
19
19
  **Peer Dependencies:**
20
20
  - `react` ^18.0.0 || ^19.0.0
21
21
  - `react-dom` ^18.0.0 || ^19.0.0
22
- - `@object-ui/core`
23
22
 
24
23
  ## Quick Start
25
24
 
@@ -120,17 +119,6 @@ Components auto-register with `ComponentRegistry`:
120
119
  }
121
120
  ```
122
121
 
123
- <!-- release-metadata:v3.3.0 -->
124
-
125
- ## Compatibility
126
-
127
- - **React:** 18.x or 19.x
128
- - **Node.js:** ≥ 18
129
- - **TypeScript:** ≥ 5.0 (strict mode)
130
- - **`@objectstack/spec`:** ^3.3.0
131
- - **`@objectstack/client`:** ^3.3.0
132
- - **Tailwind CSS:** ≥ 3.4 (for packages with UI)
133
-
134
122
  ## Links
135
123
 
136
124
  - 📚 [Documentation](https://www.objectui.org/docs/plugins/plugin-ai)
package/dist/index.js CHANGED
@@ -309,6 +309,7 @@ var E = ({ schema: e, onApply: c, onRefresh: l }) => {
309
309
  }), h.length > 0 && !D && /* @__PURE__ */ w("div", {
310
310
  className: "mt-3 flex flex-wrap gap-2",
311
311
  children: h.map((e, t) => /* @__PURE__ */ w("button", {
312
+ type: "button",
312
313
  onClick: () => N(e),
313
314
  className: "text-xs px-2.5 py-1 rounded-full border bg-muted/30 hover:bg-muted text-muted-foreground hover:text-foreground transition-colors",
314
315
  disabled: j,
@@ -367,6 +368,7 @@ var E = ({ schema: e, onApply: c, onRefresh: l }) => {
367
368
  }), /* @__PURE__ */ w(a, {
368
369
  className: "space-y-1",
369
370
  children: b.slice(0, 5).map((e, t) => /* @__PURE__ */ T("button", {
371
+ type: "button",
370
372
  onClick: () => N(e.query),
371
373
  className: "w-full flex items-center gap-2 p-2 rounded-md text-sm text-left hover:bg-muted/50 transition-colors",
372
374
  children: [
@@ -1 +1 @@
1
- (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require("@object-ui/core"),require("react"),require("@object-ui/components"),require("lucide-react"),require("react/jsx-runtime")):typeof define==`function`&&define.amd?define([`exports`,`@object-ui/core`,`react`,`@object-ui/components`,`lucide-react`,`react/jsx-runtime`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.ObjectUIPluginAI={},e.ObjectUICore,e.React,e.ObjectUIComponents,e.lucide_react,e.react_jsx_runtime))})(this,function(e,t,n,r,i,a){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var o=Object.create,s=Object.defineProperty,c=Object.getOwnPropertyDescriptor,l=Object.getOwnPropertyNames,u=Object.getPrototypeOf,d=Object.prototype.hasOwnProperty,f=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=l(t),a=0,o=i.length,u;a<o;a++)u=i[a],!d.call(e,u)&&u!==n&&s(e,u,{get:(e=>t[e]).bind(null,u),enumerable:!(r=c(t,u))||r.enumerable});return e};n=((e,t,n)=>(n=e==null?{}:o(u(e)),f(t||!e||!e.__esModule?s(n,`default`,{value:e,enumerable:!0}):n,e)))(n,1);var p=({schema:e,onApply:t,onRefresh:o})=>{let{suggestions:s=[],showConfidence:c=!0,showReasoning:l=!1,autoFill:u=!1}=e,[d,f]=(0,n.useState)(s),[p,m]=(0,n.useState)(new Set),[h,g]=(0,n.useState)(!1),[_,v]=(0,n.useState)(!1),y=e=>{t?.(e),m(t=>new Set(t).add(e.fieldName))},b=()=>{d.forEach(e=>t?.(e)),m(new Set(d.map(e=>e.fieldName)))},x=e=>{f(t=>t.filter(t=>t.fieldName!==e))},S=()=>{v(!0),o&&o(),setTimeout(()=>v(!1),1e3)};if(h||d.length===0)return null;let C=d.filter(e=>!p.has(e.fieldName)),w=e=>e>=.8?`text-green-600`:e>=.5?`text-yellow-600`:`text-red-600`;return(0,a.jsxs)(r.Card,{className:`border-blue-200 bg-blue-50/30`,children:[(0,a.jsx)(r.CardHeader,{className:`pb-2`,children:(0,a.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,a.jsxs)(r.CardTitle,{className:`text-sm flex items-center gap-2`,children:[(0,a.jsx)(i.Sparkles,{className:`h-4 w-4 text-blue-500`}),`AI Suggestions`,(0,a.jsxs)(r.Badge,{variant:`secondary`,className:`text-xs`,children:[C.length,` suggestion`,C.length===1?``:`s`]})]}),(0,a.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,a.jsx)(r.Button,{variant:`ghost`,size:`sm`,onClick:S,disabled:_,className:`h-7`,children:(0,a.jsx)(i.RefreshCw,{className:`h-3 w-3 ${_?`animate-spin`:``}`})}),C.length>1&&(0,a.jsx)(r.Button,{variant:`outline`,size:`sm`,onClick:b,className:`h-7 text-xs`,children:`Apply All`}),(0,a.jsx)(r.Button,{variant:`ghost`,size:`sm`,onClick:()=>g(!0),className:`h-7`,children:(0,a.jsx)(i.X,{className:`h-3 w-3`})})]})]})}),(0,a.jsxs)(r.CardContent,{className:`space-y-2 pt-0`,children:[C.map(e=>(0,a.jsxs)(`div`,{className:`flex items-center gap-3 p-2 rounded-md bg-white border text-sm`,children:[(0,a.jsx)(i.Lightbulb,{className:`h-4 w-4 text-yellow-500 shrink-0`}),(0,a.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,a.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,a.jsx)(`span`,{className:`font-medium`,children:e.fieldName}),(0,a.jsx)(`span`,{className:`text-muted-foreground`,children:`→`}),(0,a.jsx)(`span`,{className:`font-mono text-blue-600 truncate`,children:typeof e.value==`object`?JSON.stringify(e.value):String(e.value)})]}),c&&(0,a.jsxs)(`div`,{className:`text-xs ${w(e.confidence)}`,children:[Math.round(e.confidence*100),`% confidence`]}),l&&e.reasoning&&(0,a.jsx)(`div`,{className:`text-xs text-muted-foreground mt-1`,children:e.reasoning})]}),(0,a.jsxs)(`div`,{className:`flex items-center gap-1 shrink-0`,children:[(0,a.jsx)(r.Button,{variant:`ghost`,size:`sm`,className:`h-7 w-7 p-0 text-green-600 hover:text-green-700 hover:bg-green-50`,onClick:()=>y(e),children:(0,a.jsx)(i.Check,{className:`h-3.5 w-3.5`})}),(0,a.jsx)(r.Button,{variant:`ghost`,size:`sm`,className:`h-7 w-7 p-0 text-red-500 hover:text-red-700 hover:bg-red-50`,onClick:()=>x(e.fieldName),children:(0,a.jsx)(i.X,{className:`h-3.5 w-3.5`})})]})]},e.fieldName)),p.size>0&&(0,a.jsxs)(`div`,{className:`text-xs text-green-600 flex items-center gap-1 pt-1`,children:[(0,a.jsx)(i.Check,{className:`h-3 w-3`}),p.size,` suggestion`,p.size===1?``:`s`,` applied`]})]})]})},m=({schema:e,onSelect:t,onDismiss:n})=>{let{recommendations:o=[],showScores:s=!1,layout:c=`list`,loading:l=!1,emptyMessage:u=`No recommendations available`}=e,d=e=>{t?.(e)},f=e=>{n?.(e)};if(l)return(0,a.jsx)(r.Card,{children:(0,a.jsxs)(r.CardContent,{className:`p-8 text-center`,children:[(0,a.jsx)(i.Sparkles,{className:`h-8 w-8 text-blue-500 mx-auto mb-3 animate-pulse`}),(0,a.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Generating recommendations...`})]})});if(o.length===0)return(0,a.jsx)(r.Card,{children:(0,a.jsx)(r.CardContent,{className:`p-8 text-center text-muted-foreground`,children:u})});let p=e=>{if(!s)return null;let t=Math.round(e*100);return(0,a.jsxs)(r.Badge,{variant:e>=.7?`default`:e>=.4?`secondary`:`outline`,className:`text-xs`,children:[t,`%`]})};return(0,a.jsxs)(r.Card,{children:[(0,a.jsx)(r.CardHeader,{children:(0,a.jsxs)(r.CardTitle,{className:`flex items-center gap-2 text-sm`,children:[(0,a.jsx)(i.Sparkles,{className:`h-4 w-4 text-blue-500`}),`Recommendations`,(0,a.jsx)(r.Badge,{variant:`secondary`,className:`text-xs`,children:o.length})]})}),(0,a.jsx)(r.CardContent,{children:c===`grid`?(0,a.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3`,children:o.map(e=>(0,a.jsx)(r.Card,{className:`cursor-pointer hover:shadow-md transition-shadow`,onClick:()=>d(e),children:(0,a.jsxs)(r.CardContent,{className:`p-4`,children:[(0,a.jsxs)(`div`,{className:`flex items-start justify-between mb-2`,children:[(0,a.jsx)(i.Star,{className:`h-4 w-4 text-yellow-500`}),p(e.score)]}),(0,a.jsx)(`h4`,{className:`font-medium text-sm mb-1`,children:e.title}),e.description&&(0,a.jsx)(`p`,{className:`text-xs text-muted-foreground line-clamp-3`,children:e.description}),e.category&&(0,a.jsx)(r.Badge,{variant:`outline`,className:`text-xs mt-2`,children:e.category}),(0,a.jsxs)(`div`,{className:`flex items-center gap-1 mt-3`,children:[(0,a.jsx)(r.Button,{variant:`ghost`,size:`sm`,className:`h-6 w-6 p-0 text-green-600`,children:(0,a.jsx)(i.ThumbsUp,{className:`h-3 w-3`})}),(0,a.jsx)(r.Button,{variant:`ghost`,size:`sm`,className:`h-6 w-6 p-0 text-red-500`,children:(0,a.jsx)(i.ThumbsDown,{className:`h-3 w-3`})})]})]})},e.id))}):(0,a.jsx)(`div`,{className:`space-y-2`,children:o.map(e=>(0,a.jsxs)(`div`,{className:`flex items-start gap-3 p-3 rounded-lg border hover:bg-muted/30 transition-colors cursor-pointer`,onClick:()=>d(e),children:[(0,a.jsx)(`div`,{className:`mt-1 shrink-0`,children:(0,a.jsx)(i.Star,{className:`h-4 w-4 text-yellow-500`})}),(0,a.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,a.jsxs)(`div`,{className:`flex items-center gap-2 mb-1`,children:[(0,a.jsx)(`span`,{className:`font-medium text-sm`,children:e.title}),e.category&&(0,a.jsx)(r.Badge,{variant:`outline`,className:`text-xs`,children:e.category}),p(e.score)]}),e.description&&(0,a.jsx)(`p`,{className:`text-xs text-muted-foreground line-clamp-2`,children:e.description})]}),(0,a.jsxs)(`div`,{className:`flex items-center gap-1 shrink-0`,children:[e.action&&(0,a.jsx)(r.Button,{variant:`ghost`,size:`sm`,className:`h-7 w-7 p-0`,children:(0,a.jsx)(i.ExternalLink,{className:`h-3.5 w-3.5`})}),(0,a.jsx)(r.Button,{variant:`ghost`,size:`sm`,className:`h-7 w-7 p-0 text-muted-foreground`,onClick:t=>{t.stopPropagation(),f(e)},children:(0,a.jsx)(i.X,{className:`h-3.5 w-3.5`})})]})]},e.id))})})]})},h=({schema:e,onSubmit:t})=>{let{placeholder:o=`Ask a question about your data...`,result:s,suggestions:c=[],showHistory:l=!1,history:u=[],loading:d=!1}=e,[f,p]=(0,n.useState)(``),[m,h]=(0,n.useState)(s),[g,_]=(0,n.useState)(!1),v=g||d,y=e=>{let n=e||f;n.trim()&&(_(!0),t?.(n),t?_(!1):setTimeout(()=>{h({query:n,summary:`Results for: "${n}"`,confidence:.85,data:[],columns:[]}),_(!1)},1e3))},b=e=>{p(e),y(e)};return(0,a.jsxs)(`div`,{className:`space-y-4`,children:[(0,a.jsx)(r.Card,{children:(0,a.jsxs)(r.CardContent,{className:`p-4`,children:[(0,a.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,a.jsxs)(`div`,{className:`relative flex-1`,children:[(0,a.jsx)(i.Search,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground`}),(0,a.jsx)(r.Input,{value:f,onChange:e=>p(e.target.value),onKeyDown:e=>e.key===`Enter`&&y(),placeholder:o,className:`pl-10 pr-20`,disabled:v}),(0,a.jsx)(`div`,{className:`absolute right-2 top-1/2 -translate-y-1/2`,children:(0,a.jsx)(r.Button,{size:`sm`,onClick:()=>y(),disabled:v||!f.trim(),className:`h-7`,children:v?(0,a.jsx)(i.Loader2,{className:`h-3.5 w-3.5 animate-spin`}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(i.Sparkles,{className:`h-3.5 w-3.5 mr-1`}),`Ask`]})})})]})}),c.length>0&&!m&&(0,a.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:c.map((e,t)=>(0,a.jsx)(`button`,{onClick:()=>b(e),className:`text-xs px-2.5 py-1 rounded-full border bg-muted/30 hover:bg-muted text-muted-foreground hover:text-foreground transition-colors`,disabled:v,children:e},t))})]})}),m&&(0,a.jsxs)(r.Card,{children:[(0,a.jsx)(r.CardHeader,{className:`pb-2`,children:(0,a.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,a.jsxs)(r.CardTitle,{className:`text-sm flex items-center gap-2`,children:[(0,a.jsx)(i.Table,{className:`h-4 w-4`}),`Results`]}),m.confidence!==void 0&&(0,a.jsxs)(r.Badge,{variant:m.confidence>=.7?`default`:`secondary`,className:`text-xs`,children:[Math.round(m.confidence*100),`% match`]})]})}),(0,a.jsxs)(r.CardContent,{children:[m.summary&&(0,a.jsx)(`p`,{className:`text-sm text-muted-foreground mb-3`,children:m.summary}),m.data&&m.data.length>0&&m.columns&&(0,a.jsx)(`div`,{className:`border rounded-lg overflow-hidden`,children:(0,a.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,a.jsx)(`thead`,{className:`bg-muted`,children:(0,a.jsx)(`tr`,{children:m.columns.map((e,t)=>(0,a.jsx)(`th`,{className:`px-4 py-2 text-left font-medium`,children:e.label||e.name},t))})}),(0,a.jsx)(`tbody`,{children:m.data.map((e,t)=>(0,a.jsx)(`tr`,{className:`border-t`,children:m.columns.map((t,n)=>(0,a.jsx)(`td`,{className:`px-4 py-2`,children:String(e[t.name]??``)},n))},t))})]})}),(!m.data||m.data.length===0)&&(0,a.jsx)(`div`,{className:`text-center py-6 text-muted-foreground text-sm`,children:`No matching records found`})]})]}),l&&u.length>0&&(0,a.jsxs)(r.Card,{children:[(0,a.jsx)(r.CardHeader,{className:`pb-2`,children:(0,a.jsxs)(r.CardTitle,{className:`text-xs text-muted-foreground flex items-center gap-1`,children:[(0,a.jsx)(i.Clock,{className:`h-3 w-3`}),`Recent Queries`]})}),(0,a.jsx)(r.CardContent,{className:`space-y-1`,children:u.slice(0,5).map((e,t)=>(0,a.jsxs)(`button`,{onClick:()=>b(e.query),className:`w-full flex items-center gap-2 p-2 rounded-md text-sm text-left hover:bg-muted/50 transition-colors`,children:[(0,a.jsx)(i.ArrowRight,{className:`h-3 w-3 text-muted-foreground shrink-0`}),(0,a.jsx)(`span`,{className:`truncate`,children:e.query}),(0,a.jsx)(`span`,{className:`text-xs text-muted-foreground shrink-0 ml-auto`,children:new Date(e.timestamp).toLocaleDateString()})]},t))})]})]})};t.ComponentRegistry.register(`ai-form-assist`,p,{label:`AI Form Assist`,category:`AI`,inputs:[{name:`formId`,type:`string`,label:`Form ID`},{name:`objectName`,type:`string`,label:`Object Name`},{name:`fields`,type:`array`,label:`Fields to suggest`},{name:`suggestions`,type:`code`,label:`Suggestions Data`},{name:`autoFill`,type:`boolean`,label:`Auto Fill`,defaultValue:!1},{name:`showConfidence`,type:`boolean`,label:`Show Confidence`,defaultValue:!0},{name:`showReasoning`,type:`boolean`,label:`Show Reasoning`,defaultValue:!1}]}),t.ComponentRegistry.register(`ai-recommendations`,m,{label:`AI Recommendations`,category:`AI`,inputs:[{name:`objectName`,type:`string`,label:`Object Name`},{name:`recommendations`,type:`code`,label:`Recommendations Data`},{name:`maxResults`,type:`number`,label:`Max Results`,defaultValue:10},{name:`showScores`,type:`boolean`,label:`Show Scores`,defaultValue:!1},{name:`layout`,type:`enum`,label:`Layout`,enum:[{label:`List`,value:`list`},{label:`Grid`,value:`grid`},{label:`Carousel`,value:`carousel`}],defaultValue:`list`},{name:`emptyMessage`,type:`string`,label:`Empty Message`}]}),t.ComponentRegistry.register(`nl-query`,h,{label:`Natural Language Query`,category:`AI`,inputs:[{name:`objectName`,type:`string`,label:`Object Name`},{name:`placeholder`,type:`string`,label:`Placeholder Text`},{name:`suggestions`,type:`array`,label:`Example Queries`},{name:`showHistory`,type:`boolean`,label:`Show History`,defaultValue:!1}]}),e.AIFormAssist=p,e.AIRecommendations=m,e.NLQueryInput=h});
1
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require("@object-ui/core"),require("react"),require("@object-ui/components"),require("lucide-react"),require("react/jsx-runtime")):typeof define==`function`&&define.amd?define([`exports`,`@object-ui/core`,`react`,`@object-ui/components`,`lucide-react`,`react/jsx-runtime`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.ObjectUIPluginAI={},e.ObjectUICore,e.React,e.ObjectUIComponents,e.lucide_react,e.react_jsx_runtime))})(this,function(e,t,n,r,i,a){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var o=Object.create,s=Object.defineProperty,c=Object.getOwnPropertyDescriptor,l=Object.getOwnPropertyNames,u=Object.getPrototypeOf,d=Object.prototype.hasOwnProperty,f=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=l(t),a=0,o=i.length,u;a<o;a++)u=i[a],!d.call(e,u)&&u!==n&&s(e,u,{get:(e=>t[e]).bind(null,u),enumerable:!(r=c(t,u))||r.enumerable});return e};n=((e,t,n)=>(n=e==null?{}:o(u(e)),f(t||!e||!e.__esModule||!d.call(e,`default`)?s(n,`default`,{value:e,enumerable:!0}):n,e)))(n,1);var p=({schema:e,onApply:t,onRefresh:o})=>{let{suggestions:s=[],showConfidence:c=!0,showReasoning:l=!1,autoFill:u=!1}=e,[d,f]=(0,n.useState)(s),[p,m]=(0,n.useState)(new Set),[h,g]=(0,n.useState)(!1),[_,v]=(0,n.useState)(!1),y=e=>{t?.(e),m(t=>new Set(t).add(e.fieldName))},b=()=>{d.forEach(e=>t?.(e)),m(new Set(d.map(e=>e.fieldName)))},x=e=>{f(t=>t.filter(t=>t.fieldName!==e))},S=()=>{v(!0),o&&o(),setTimeout(()=>v(!1),1e3)};if(h||d.length===0)return null;let C=d.filter(e=>!p.has(e.fieldName)),w=e=>e>=.8?`text-green-600`:e>=.5?`text-yellow-600`:`text-red-600`;return(0,a.jsxs)(r.Card,{className:`border-blue-200 bg-blue-50/30`,children:[(0,a.jsx)(r.CardHeader,{className:`pb-2`,children:(0,a.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,a.jsxs)(r.CardTitle,{className:`text-sm flex items-center gap-2`,children:[(0,a.jsx)(i.Sparkles,{className:`h-4 w-4 text-blue-500`}),`AI Suggestions`,(0,a.jsxs)(r.Badge,{variant:`secondary`,className:`text-xs`,children:[C.length,` suggestion`,C.length===1?``:`s`]})]}),(0,a.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,a.jsx)(r.Button,{variant:`ghost`,size:`sm`,onClick:S,disabled:_,className:`h-7`,children:(0,a.jsx)(i.RefreshCw,{className:`h-3 w-3 ${_?`animate-spin`:``}`})}),C.length>1&&(0,a.jsx)(r.Button,{variant:`outline`,size:`sm`,onClick:b,className:`h-7 text-xs`,children:`Apply All`}),(0,a.jsx)(r.Button,{variant:`ghost`,size:`sm`,onClick:()=>g(!0),className:`h-7`,children:(0,a.jsx)(i.X,{className:`h-3 w-3`})})]})]})}),(0,a.jsxs)(r.CardContent,{className:`space-y-2 pt-0`,children:[C.map(e=>(0,a.jsxs)(`div`,{className:`flex items-center gap-3 p-2 rounded-md bg-white border text-sm`,children:[(0,a.jsx)(i.Lightbulb,{className:`h-4 w-4 text-yellow-500 shrink-0`}),(0,a.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,a.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,a.jsx)(`span`,{className:`font-medium`,children:e.fieldName}),(0,a.jsx)(`span`,{className:`text-muted-foreground`,children:`→`}),(0,a.jsx)(`span`,{className:`font-mono text-blue-600 truncate`,children:typeof e.value==`object`?JSON.stringify(e.value):String(e.value)})]}),c&&(0,a.jsxs)(`div`,{className:`text-xs ${w(e.confidence)}`,children:[Math.round(e.confidence*100),`% confidence`]}),l&&e.reasoning&&(0,a.jsx)(`div`,{className:`text-xs text-muted-foreground mt-1`,children:e.reasoning})]}),(0,a.jsxs)(`div`,{className:`flex items-center gap-1 shrink-0`,children:[(0,a.jsx)(r.Button,{variant:`ghost`,size:`sm`,className:`h-7 w-7 p-0 text-green-600 hover:text-green-700 hover:bg-green-50`,onClick:()=>y(e),children:(0,a.jsx)(i.Check,{className:`h-3.5 w-3.5`})}),(0,a.jsx)(r.Button,{variant:`ghost`,size:`sm`,className:`h-7 w-7 p-0 text-red-500 hover:text-red-700 hover:bg-red-50`,onClick:()=>x(e.fieldName),children:(0,a.jsx)(i.X,{className:`h-3.5 w-3.5`})})]})]},e.fieldName)),p.size>0&&(0,a.jsxs)(`div`,{className:`text-xs text-green-600 flex items-center gap-1 pt-1`,children:[(0,a.jsx)(i.Check,{className:`h-3 w-3`}),p.size,` suggestion`,p.size===1?``:`s`,` applied`]})]})]})},m=({schema:e,onSelect:t,onDismiss:n})=>{let{recommendations:o=[],showScores:s=!1,layout:c=`list`,loading:l=!1,emptyMessage:u=`No recommendations available`}=e,d=e=>{t?.(e)},f=e=>{n?.(e)};if(l)return(0,a.jsx)(r.Card,{children:(0,a.jsxs)(r.CardContent,{className:`p-8 text-center`,children:[(0,a.jsx)(i.Sparkles,{className:`h-8 w-8 text-blue-500 mx-auto mb-3 animate-pulse`}),(0,a.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Generating recommendations...`})]})});if(o.length===0)return(0,a.jsx)(r.Card,{children:(0,a.jsx)(r.CardContent,{className:`p-8 text-center text-muted-foreground`,children:u})});let p=e=>{if(!s)return null;let t=Math.round(e*100);return(0,a.jsxs)(r.Badge,{variant:e>=.7?`default`:e>=.4?`secondary`:`outline`,className:`text-xs`,children:[t,`%`]})};return(0,a.jsxs)(r.Card,{children:[(0,a.jsx)(r.CardHeader,{children:(0,a.jsxs)(r.CardTitle,{className:`flex items-center gap-2 text-sm`,children:[(0,a.jsx)(i.Sparkles,{className:`h-4 w-4 text-blue-500`}),`Recommendations`,(0,a.jsx)(r.Badge,{variant:`secondary`,className:`text-xs`,children:o.length})]})}),(0,a.jsx)(r.CardContent,{children:c===`grid`?(0,a.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3`,children:o.map(e=>(0,a.jsx)(r.Card,{className:`cursor-pointer hover:shadow-md transition-shadow`,onClick:()=>d(e),children:(0,a.jsxs)(r.CardContent,{className:`p-4`,children:[(0,a.jsxs)(`div`,{className:`flex items-start justify-between mb-2`,children:[(0,a.jsx)(i.Star,{className:`h-4 w-4 text-yellow-500`}),p(e.score)]}),(0,a.jsx)(`h4`,{className:`font-medium text-sm mb-1`,children:e.title}),e.description&&(0,a.jsx)(`p`,{className:`text-xs text-muted-foreground line-clamp-3`,children:e.description}),e.category&&(0,a.jsx)(r.Badge,{variant:`outline`,className:`text-xs mt-2`,children:e.category}),(0,a.jsxs)(`div`,{className:`flex items-center gap-1 mt-3`,children:[(0,a.jsx)(r.Button,{variant:`ghost`,size:`sm`,className:`h-6 w-6 p-0 text-green-600`,children:(0,a.jsx)(i.ThumbsUp,{className:`h-3 w-3`})}),(0,a.jsx)(r.Button,{variant:`ghost`,size:`sm`,className:`h-6 w-6 p-0 text-red-500`,children:(0,a.jsx)(i.ThumbsDown,{className:`h-3 w-3`})})]})]})},e.id))}):(0,a.jsx)(`div`,{className:`space-y-2`,children:o.map(e=>(0,a.jsxs)(`div`,{className:`flex items-start gap-3 p-3 rounded-lg border hover:bg-muted/30 transition-colors cursor-pointer`,onClick:()=>d(e),children:[(0,a.jsx)(`div`,{className:`mt-1 shrink-0`,children:(0,a.jsx)(i.Star,{className:`h-4 w-4 text-yellow-500`})}),(0,a.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,a.jsxs)(`div`,{className:`flex items-center gap-2 mb-1`,children:[(0,a.jsx)(`span`,{className:`font-medium text-sm`,children:e.title}),e.category&&(0,a.jsx)(r.Badge,{variant:`outline`,className:`text-xs`,children:e.category}),p(e.score)]}),e.description&&(0,a.jsx)(`p`,{className:`text-xs text-muted-foreground line-clamp-2`,children:e.description})]}),(0,a.jsxs)(`div`,{className:`flex items-center gap-1 shrink-0`,children:[e.action&&(0,a.jsx)(r.Button,{variant:`ghost`,size:`sm`,className:`h-7 w-7 p-0`,children:(0,a.jsx)(i.ExternalLink,{className:`h-3.5 w-3.5`})}),(0,a.jsx)(r.Button,{variant:`ghost`,size:`sm`,className:`h-7 w-7 p-0 text-muted-foreground`,onClick:t=>{t.stopPropagation(),f(e)},children:(0,a.jsx)(i.X,{className:`h-3.5 w-3.5`})})]})]},e.id))})})]})},h=({schema:e,onSubmit:t})=>{let{placeholder:o=`Ask a question about your data...`,result:s,suggestions:c=[],showHistory:l=!1,history:u=[],loading:d=!1}=e,[f,p]=(0,n.useState)(``),[m,h]=(0,n.useState)(s),[g,_]=(0,n.useState)(!1),v=g||d,y=e=>{let n=e||f;n.trim()&&(_(!0),t?.(n),t?_(!1):setTimeout(()=>{h({query:n,summary:`Results for: "${n}"`,confidence:.85,data:[],columns:[]}),_(!1)},1e3))},b=e=>{p(e),y(e)};return(0,a.jsxs)(`div`,{className:`space-y-4`,children:[(0,a.jsx)(r.Card,{children:(0,a.jsxs)(r.CardContent,{className:`p-4`,children:[(0,a.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,a.jsxs)(`div`,{className:`relative flex-1`,children:[(0,a.jsx)(i.Search,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground`}),(0,a.jsx)(r.Input,{value:f,onChange:e=>p(e.target.value),onKeyDown:e=>e.key===`Enter`&&y(),placeholder:o,className:`pl-10 pr-20`,disabled:v}),(0,a.jsx)(`div`,{className:`absolute right-2 top-1/2 -translate-y-1/2`,children:(0,a.jsx)(r.Button,{size:`sm`,onClick:()=>y(),disabled:v||!f.trim(),className:`h-7`,children:v?(0,a.jsx)(i.Loader2,{className:`h-3.5 w-3.5 animate-spin`}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(i.Sparkles,{className:`h-3.5 w-3.5 mr-1`}),`Ask`]})})})]})}),c.length>0&&!m&&(0,a.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:c.map((e,t)=>(0,a.jsx)(`button`,{type:`button`,onClick:()=>b(e),className:`text-xs px-2.5 py-1 rounded-full border bg-muted/30 hover:bg-muted text-muted-foreground hover:text-foreground transition-colors`,disabled:v,children:e},t))})]})}),m&&(0,a.jsxs)(r.Card,{children:[(0,a.jsx)(r.CardHeader,{className:`pb-2`,children:(0,a.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,a.jsxs)(r.CardTitle,{className:`text-sm flex items-center gap-2`,children:[(0,a.jsx)(i.Table,{className:`h-4 w-4`}),`Results`]}),m.confidence!==void 0&&(0,a.jsxs)(r.Badge,{variant:m.confidence>=.7?`default`:`secondary`,className:`text-xs`,children:[Math.round(m.confidence*100),`% match`]})]})}),(0,a.jsxs)(r.CardContent,{children:[m.summary&&(0,a.jsx)(`p`,{className:`text-sm text-muted-foreground mb-3`,children:m.summary}),m.data&&m.data.length>0&&m.columns&&(0,a.jsx)(`div`,{className:`border rounded-lg overflow-hidden`,children:(0,a.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,a.jsx)(`thead`,{className:`bg-muted`,children:(0,a.jsx)(`tr`,{children:m.columns.map((e,t)=>(0,a.jsx)(`th`,{className:`px-4 py-2 text-left font-medium`,children:e.label||e.name},t))})}),(0,a.jsx)(`tbody`,{children:m.data.map((e,t)=>(0,a.jsx)(`tr`,{className:`border-t`,children:m.columns.map((t,n)=>(0,a.jsx)(`td`,{className:`px-4 py-2`,children:String(e[t.name]??``)},n))},t))})]})}),(!m.data||m.data.length===0)&&(0,a.jsx)(`div`,{className:`text-center py-6 text-muted-foreground text-sm`,children:`No matching records found`})]})]}),l&&u.length>0&&(0,a.jsxs)(r.Card,{children:[(0,a.jsx)(r.CardHeader,{className:`pb-2`,children:(0,a.jsxs)(r.CardTitle,{className:`text-xs text-muted-foreground flex items-center gap-1`,children:[(0,a.jsx)(i.Clock,{className:`h-3 w-3`}),`Recent Queries`]})}),(0,a.jsx)(r.CardContent,{className:`space-y-1`,children:u.slice(0,5).map((e,t)=>(0,a.jsxs)(`button`,{type:`button`,onClick:()=>b(e.query),className:`w-full flex items-center gap-2 p-2 rounded-md text-sm text-left hover:bg-muted/50 transition-colors`,children:[(0,a.jsx)(i.ArrowRight,{className:`h-3 w-3 text-muted-foreground shrink-0`}),(0,a.jsx)(`span`,{className:`truncate`,children:e.query}),(0,a.jsx)(`span`,{className:`text-xs text-muted-foreground shrink-0 ml-auto`,children:new Date(e.timestamp).toLocaleDateString()})]},t))})]})]})};t.ComponentRegistry.register(`ai-form-assist`,p,{label:`AI Form Assist`,category:`AI`,inputs:[{name:`formId`,type:`string`,label:`Form ID`},{name:`objectName`,type:`string`,label:`Object Name`},{name:`fields`,type:`array`,label:`Fields to suggest`},{name:`suggestions`,type:`code`,label:`Suggestions Data`},{name:`autoFill`,type:`boolean`,label:`Auto Fill`,defaultValue:!1},{name:`showConfidence`,type:`boolean`,label:`Show Confidence`,defaultValue:!0},{name:`showReasoning`,type:`boolean`,label:`Show Reasoning`,defaultValue:!1}]}),t.ComponentRegistry.register(`ai-recommendations`,m,{label:`AI Recommendations`,category:`AI`,inputs:[{name:`objectName`,type:`string`,label:`Object Name`},{name:`recommendations`,type:`code`,label:`Recommendations Data`},{name:`maxResults`,type:`number`,label:`Max Results`,defaultValue:10},{name:`showScores`,type:`boolean`,label:`Show Scores`,defaultValue:!1},{name:`layout`,type:`enum`,label:`Layout`,enum:[{label:`List`,value:`list`},{label:`Grid`,value:`grid`},{label:`Carousel`,value:`carousel`}],defaultValue:`list`},{name:`emptyMessage`,type:`string`,label:`Empty Message`}]}),t.ComponentRegistry.register(`nl-query`,h,{label:`Natural Language Query`,category:`AI`,inputs:[{name:`objectName`,type:`string`,label:`Object Name`},{name:`placeholder`,type:`string`,label:`Placeholder Text`},{name:`suggestions`,type:`array`,label:`Example Queries`},{name:`showHistory`,type:`boolean`,label:`Show History`,defaultValue:!1}]}),e.AIFormAssist=p,e.AIRecommendations=m,e.NLQueryInput=h});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@object-ui/plugin-ai",
3
- "version": "17.2.0",
3
+ "version": "17.5.0",
4
4
  "type": "module",
5
5
  "main": "dist/index.umd.cjs",
6
6
  "module": "dist/index.js",
@@ -24,19 +24,19 @@
24
24
  },
25
25
  "dependencies": {
26
26
  "clsx": "^2.1.1",
27
- "lucide-react": "^1.25.0",
27
+ "lucide-react": "^1.29.0",
28
28
  "tailwind-merge": "^3.6.0",
29
- "@object-ui/components": "17.2.0",
30
- "@object-ui/core": "17.2.0",
31
- "@object-ui/react": "17.2.0",
32
- "@object-ui/types": "17.2.0"
29
+ "@object-ui/components": "17.5.0",
30
+ "@object-ui/core": "17.5.0",
31
+ "@object-ui/react": "17.5.0",
32
+ "@object-ui/types": "17.5.0"
33
33
  },
34
34
  "devDependencies": {
35
- "@types/node": "^26.1.1",
36
- "@types/react": "19.2.17",
37
- "@types/react-dom": "19.2.3",
38
- "@vitejs/plugin-react": "^6.0.4",
39
- "vite": "^8.1.5",
35
+ "@types/node": "^26.1.2",
36
+ "@types/react": "19.2.18",
37
+ "@types/react-dom": "19.2.4",
38
+ "@vitejs/plugin-react": "^6.0.5",
39
+ "vite": "^8.2.1",
40
40
  "vite-plugin-dts": "^5.0.3",
41
41
  "vitest": "^4.1.10"
42
42
  },