@nice2dev/ui-ai 1.0.2
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 +64 -0
- package/README.md +56 -0
- package/dist/NiceAIHintBubble.d.ts +4 -0
- package/dist/NiceAIHintBubble.d.ts.map +1 -0
- package/dist/NiceAIProvider.d.ts +29 -0
- package/dist/NiceAIProvider.d.ts.map +1 -0
- package/dist/index.cjs +10 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.mjs +1078 -0
- package/dist/integrations.d.ts +287 -0
- package/dist/integrations.d.ts.map +1 -0
- package/dist/rateLimiter.d.ts +23 -0
- package/dist/rateLimiter.d.ts.map +1 -0
- package/dist/streaming.d.ts +25 -0
- package/dist/streaming.d.ts.map +1 -0
- package/dist/style.css +1 -0
- package/dist/types.d.ts +133 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/useNiceAIHint.d.ts +10 -0
- package/dist/useNiceAIHint.d.ts.map +1 -0
- package/dist/wrappers.d.ts +66 -0
- package/dist/wrappers.d.ts.map +1 -0
- package/package.json +56 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# @nice2dev/ui-ai — Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to the AI hints package.
|
|
4
|
+
|
|
5
|
+
## [0.2.0] — 2026-03-25
|
|
6
|
+
|
|
7
|
+
### Added (FAZA 2)
|
|
8
|
+
|
|
9
|
+
- **NiceAIProvider** — React context for LLM configuration (endpoint, key, model, system prompt)
|
|
10
|
+
- **useNiceAIHint** — hook for AI hints with debounce, cache, abort on unmount
|
|
11
|
+
- **NiceAIHintBubble** — ✨ icon with popover showing LLM response
|
|
12
|
+
- **Streaming response** — SSE/fetch stream with token-by-token display
|
|
13
|
+
- **Rate limiting & cost guard** — max requests/min, max tokens/session
|
|
14
|
+
- **Privacy mode** — send only metadata (label + type), not field values
|
|
15
|
+
|
|
16
|
+
### Integrations
|
|
17
|
+
|
|
18
|
+
- TextInput/TextArea — content suggestions, grammar correction, auto-complete
|
|
19
|
+
- NumberInput/Slider — contextual range suggestions
|
|
20
|
+
- Select/Autocomplete — intelligent option sorting
|
|
21
|
+
- DatePicker — smart date suggestions
|
|
22
|
+
- DataGrid — AI column config, auto-filter, anomaly detection
|
|
23
|
+
- NiceChart — chart type suggestion, auto-labeling
|
|
24
|
+
- CodeEditor — `useAICodeHint` with cursor-aware snippets
|
|
25
|
+
- HtmlEditor — `useAIHtmlHint` (SEO/a11y/grammar/cleanup modes)
|
|
26
|
+
- ColorPicker — palette suggestions by industry/context
|
|
27
|
+
- Form-level AI — "fill form from description"
|
|
28
|
+
- Validation AI — intelligent error messages
|
|
29
|
+
- Audio/3D/Graphics/Game Engine/Icons integrations
|
|
30
|
+
|
|
31
|
+
### Tests
|
|
32
|
+
|
|
33
|
+
- 111 unit tests (5.55:1 ratio — excellent coverage)
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## [0.1.0] — 2025-06-01
|
|
38
|
+
|
|
39
|
+
Initial beta release.
|
|
40
|
+
|
|
41
|
+
All notable changes to `@nice2dev/ui-ai` will be documented in this file.
|
|
42
|
+
|
|
43
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
44
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## [0.1.0] — 2026-03-18
|
|
49
|
+
|
|
50
|
+
### 🤖 Initial Release
|
|
51
|
+
|
|
52
|
+
First release of `@nice2dev/ui-ai` — LLM-powered contextual hints for React form fields.
|
|
53
|
+
|
|
54
|
+
### Features
|
|
55
|
+
|
|
56
|
+
- **NiceAIProvider** — context provider with OpenAI, Azure OpenAI, and Ollama backend support
|
|
57
|
+
- **NiceAIHintBubble** — contextual AI hint bubble attached to form fields
|
|
58
|
+
- **useNiceAIHint** — hook for programmatic hint generation
|
|
59
|
+
- **Rate limiting** — configurable requests/tokens per minute
|
|
60
|
+
- **Trigger modes** — hover, focus, click triggers
|
|
61
|
+
- **Position** — top, right, bottom, left positioning with auto-flip
|
|
62
|
+
- **Caching** — response memoization for repeated queries
|
|
63
|
+
- **i18n** — full internationalization support
|
|
64
|
+
- **Theming** — CSS custom properties with light/dark mode
|
package/README.md
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# @nice2dev/ui-ai
|
|
2
|
+
|
|
3
|
+
> AI Hints infrastructure — LLM-powered contextual suggestions for 12+ NiceToDev control types.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **NiceAIProvider** — React context with endpoint/key/model/temperature/max-tokens configuration
|
|
8
|
+
- **useNiceAIHint(context)** — hook with debounce, cache, abort-on-unmount, streaming (SSE)
|
|
9
|
+
- **NiceAIHintBubble** — ✨ icon + tooltip/popover rendering LLM response token-by-token
|
|
10
|
+
- **Rate Limiting & Cost Guard** — max requests/min, max tokens/session, cost warnings
|
|
11
|
+
- **Privacy Mode** — send only metadata (label + type + rules), never field values
|
|
12
|
+
- **Fallback Graceful** — no AI config = zero overhead, zero errors
|
|
13
|
+
|
|
14
|
+
## Control Integrations
|
|
15
|
+
|
|
16
|
+
| Control | AI Feature |
|
|
17
|
+
|---------|-----------|
|
|
18
|
+
| TextInput / TextArea | Content suggestions, grammar correction, sentence completion |
|
|
19
|
+
| NumberInput / Slider | Range suggestions from context ("typical price: 50–200") |
|
|
20
|
+
| Select / Autocomplete | Smart sort, most-frequent-choice suggestion |
|
|
21
|
+
| DatePicker | Date suggestions ("next business day", "in one week") |
|
|
22
|
+
| DataGrid | Column config, filter suggestions, anomaly detection |
|
|
23
|
+
| Chart | Chart type suggestion from data, auto-labeling |
|
|
24
|
+
| CodeEditor | Language/framework-aware code hints |
|
|
25
|
+
| HtmlEditor | SEO, accessibility, grammar, cleanup modes |
|
|
26
|
+
| ColorPicker | Industry/context-based palette suggestion |
|
|
27
|
+
| Form-level | "Fill form from description" — LLM parses text → fills fields |
|
|
28
|
+
| Validation | Intelligent error messages ("enter company name, e.g. NiceToDev sp. z o.o.") |
|
|
29
|
+
|
|
30
|
+
## Specialist Package Integrations
|
|
31
|
+
|
|
32
|
+
- **ui-audio** — `useAIAudioHint` (tag/bpm/mix/transcribe)
|
|
33
|
+
- **ui-3d** — `useAI3DHint` (material/optimize/lighting/animation)
|
|
34
|
+
- **ui-graphics** — `useAIGraphicsHint` (filter/palette/upscale/style-transfer)
|
|
35
|
+
- **game-engine** — `useAINpcHint` (NPC decisions, dialogue, procedural levels, quests)
|
|
36
|
+
- **icons** — `useAIIconSearch` (semantic icon search)
|
|
37
|
+
|
|
38
|
+
## Installation
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
npm install @nice2dev/ui-ai
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Usage
|
|
45
|
+
|
|
46
|
+
```tsx
|
|
47
|
+
import { NiceAIProvider, useNiceAIHint, NiceAIHintBubble } from '@nice2dev/ui-ai';
|
|
48
|
+
|
|
49
|
+
<NiceAIProvider config={{ endpoint: '...', apiKey: '...', model: 'gpt-4o' }}>
|
|
50
|
+
<MyForm />
|
|
51
|
+
</NiceAIProvider>
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## License
|
|
55
|
+
|
|
56
|
+
MIT © NiceToDev
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NiceAIHintBubble.d.ts","sourceRoot":"","sources":["../src/NiceAIHintBubble.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,qBAAqB,EAAkB,MAAM,SAAS,CAAC;AAoFrE,eAAO,MAAM,gBAAgB,mHAgO5B,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { NiceAIConfig, RateLimitConfig, RateLimitStatus } from './types';
|
|
3
|
+
import { RateLimiter } from './rateLimiter';
|
|
4
|
+
|
|
5
|
+
export interface NiceAIProviderProps {
|
|
6
|
+
/** AI endpoint configuration. */
|
|
7
|
+
config: NiceAIConfig;
|
|
8
|
+
/** Rate limiting settings. */
|
|
9
|
+
rateLimits?: RateLimitConfig;
|
|
10
|
+
/** Enable/disable AI hints globally. @default true */
|
|
11
|
+
enabled?: boolean;
|
|
12
|
+
/** Callback when rate limit warning threshold is reached. */
|
|
13
|
+
onRateLimitWarning?: () => void;
|
|
14
|
+
children: ReactNode;
|
|
15
|
+
}
|
|
16
|
+
interface AIContextValue {
|
|
17
|
+
config: NiceAIConfig;
|
|
18
|
+
enabled: boolean;
|
|
19
|
+
rateLimiter: RateLimiter;
|
|
20
|
+
getRateLimitStatus: () => RateLimitStatus;
|
|
21
|
+
}
|
|
22
|
+
export declare function NiceAIProvider({ config, rateLimits, enabled, onRateLimitWarning, children, }: NiceAIProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
23
|
+
/**
|
|
24
|
+
* Access the AI configuration context.
|
|
25
|
+
* Returns null if no NiceAIProvider is present (graceful fallback).
|
|
26
|
+
*/
|
|
27
|
+
export declare function useAIContext(): AIContextValue | null;
|
|
28
|
+
export {};
|
|
29
|
+
//# sourceMappingURL=NiceAIProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NiceAIProvider.d.ts","sourceRoot":"","sources":["../src/NiceAIProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC9E,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAM5C,MAAM,WAAW,mBAAmB;IAClC,iCAAiC;IACjC,MAAM,EAAE,YAAY,CAAC;IACrB,8BAA8B;IAC9B,UAAU,CAAC,EAAE,eAAe,CAAC;IAC7B,sDAAsD;IACtD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,6DAA6D;IAC7D,kBAAkB,CAAC,EAAE,MAAM,IAAI,CAAC;IAChC,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,UAAU,cAAc;IACtB,MAAM,EAAE,YAAY,CAAC;IACrB,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,EAAE,WAAW,CAAC;IACzB,kBAAkB,EAAE,MAAM,eAAe,CAAC;CAC3C;AAID,wBAAgB,cAAc,CAAC,EAC7B,MAAM,EACN,UAAU,EACV,OAAc,EACd,kBAAkB,EAClB,QAAQ,GACT,EAAE,mBAAmB,2CAqBrB;AAED;;;GAGG;AACH,wBAAgB,YAAY,IAAI,cAAc,GAAG,IAAI,CAEpD"}
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),a=require("react");class B{constructor(e={},n){this.timestamps=[],this.tokenCount=0,this.warningEmitted=!1,this.config={maxRequestsPerMinute:e.maxRequestsPerMinute??30,maxTokensPerSession:e.maxTokensPerSession??1e4,warnThresholdPercent:e.warnThresholdPercent??80},this.onWarning=n}canRequest(){return this.pruneOldTimestamps(),!(this.timestamps.length>=this.config.maxRequestsPerMinute||this.tokenCount>=this.config.maxTokensPerSession)}recordRequest(){return this.canRequest()?(this.timestamps.push(Date.now()),!0):!1}recordTokens(e){this.tokenCount+=e,this.checkWarning()}getStatus(){this.pruneOldTimestamps();const e=this.config.maxTokensPerSession>0?this.tokenCount/this.config.maxTokensPerSession*100:0,n=this.config.maxRequestsPerMinute>0?this.timestamps.length/this.config.maxRequestsPerMinute*100:0;return{requestsThisMinute:this.timestamps.length,tokensThisSession:this.tokenCount,isLimited:!this.canRequest(),isWarning:e>=this.config.warnThresholdPercent||n>=this.config.warnThresholdPercent}}reset(){this.timestamps=[],this.tokenCount=0,this.warningEmitted=!1}pruneOldTimestamps(){const e=Date.now()-6e4;this.timestamps=this.timestamps.filter(n=>n>e)}checkWarning(){var n;if(this.warningEmitted)return;this.getStatus().isWarning&&(this.warningEmitted=!0,(n=this.onWarning)==null||n.call(this))}}const F=a.createContext(null);function ue({config:i,rateLimits:e,enabled:n=!0,onRateLimitWarning:r,children:t}){const l=a.useRef(null);l.current||(l.current=new B(e,r));const c=a.useCallback(()=>l.current.getStatus(),[]),w=a.useMemo(()=>({config:i,enabled:n,rateLimiter:l.current,getRateLimitStatus:c}),[i,n,c]);return o.jsx(F.Provider,{value:w,children:t})}function E(){return a.useContext(F)}async function*Y(i,e){var l,c,w,s,g,y,I,f,S;const n=(l=i.body)==null?void 0:l.getReader();if(!n)throw new Error("Response body is not readable");const r=new TextDecoder;let t="";try{for(;!(e!=null&&e.aborted);){const{done:C,value:d}=await n.read();if(C)break;t+=r.decode(d,{stream:!0});const P=t.split(`
|
|
2
|
+
`);t=P.pop()??"";for(const T of P){const u=T.trim();if(!(!u||u===":")){if(u.startsWith("data:")){const h=u.slice(5).trim();if(h==="[DONE]"){yield{token:"",done:!0};return}try{const k=JSON.parse(h),b=((s=(w=(c=k.choices)==null?void 0:c[0])==null?void 0:w.delta)==null?void 0:s.content)??"",x=((y=(g=k.choices)==null?void 0:g[0])==null?void 0:y.finish_reason)==="stop";(b||x)&&(yield{token:b,done:x,usage:k.usage})}catch{h&&(yield{token:h,done:!1})}continue}try{const h=JSON.parse(u),k=h.text??h.content??h.token??"";k&&(yield{token:k,done:!1})}catch{u&&(yield{token:u,done:!1})}}}}if(t.trim()){const C=t.trim();if(C.startsWith("data:")){const d=C.slice(5).trim();if(d&&d!=="[DONE]")try{const T=((S=(f=(I=JSON.parse(d).choices)==null?void 0:I[0])==null?void 0:f.delta)==null?void 0:S.content)??"";T&&(yield{token:T,done:!0})}catch{yield{token:d,done:!0}}}}}finally{n.releaseLock()}}async function K(i){var n,r,t,l;const e=await i.json();if((t=(r=(n=e.choices)==null?void 0:n[0])==null?void 0:r.message)!=null&&t.content)return{text:e.choices[0].message.content,usage:e.usage};if((l=e.message)!=null&&l.content)return{text:e.message.content};if(typeof e.text=="string")return{text:e.text};if(typeof e.content=="string")return{text:e.content};if(typeof e.response=="string")return{text:e.response};throw new Error("Unrecognized AI response format")}const O=new Map;function W(i,e){const n=e?{...i,fieldValue:void 0,formContext:void 0}:i;return JSON.stringify(n)}function ce(i,e){const n=[],r=e.systemPrompt??"You are a helpful assistant providing concise contextual hints for form fields. Keep responses short (1-3 sentences). Be specific and actionable.";n.push({role:"system",content:r});const t=[];if(i.fieldLabel&&t.push(`Field: "${i.fieldLabel}"`),i.fieldType&&t.push(`Type: ${i.fieldType}`),!e.privacyMode&&i.fieldValue!==void 0){const c=typeof i.fieldValue=="string"?i.fieldValue:JSON.stringify(i.fieldValue);t.push(`Current value: ${c}`)}i.validationRules&&Object.keys(i.validationRules).length>0&&t.push(`Validation: ${JSON.stringify(i.validationRules)}`),i.schema&&Object.keys(i.schema).length>0&&t.push(`Schema: ${JSON.stringify(i.schema)}`),!e.privacyMode&&i.formContext&&Object.keys(i.formContext).length>0&&t.push(`Form context: ${JSON.stringify(i.formContext)}`),i.customPrompt&&t.push(i.customPrompt);const l=t.length>0?`Provide a helpful hint for this field:
|
|
3
|
+
${t.join(`
|
|
4
|
+
`)}`:"Provide a helpful suggestion.";return n.push({role:"user",content:l}),n}function m(i={},e={}){i=i??{},e=e??{};const{debounceMs:n=500,disabled:r=!1}=e,t=E(),[l,c]=a.useState(""),[w,s]=a.useState(!1),[g,y]=a.useState(null),[I,f]=a.useState(!1),S=a.useRef(null),C=a.useRef(0),d=a.useCallback(async()=>{var N,q,G;if(!t||!t.enabled||r)return;const{config:u,rateLimiter:h}=t;if(!h.recordRequest()){y("Rate limit exceeded. Please wait before requesting another hint.");return}const k=W(i,u.privacyMode??!1),b=O.get(k);if(b){c(b),s(!1),y(null),f(!1);return}(N=S.current)==null||N.abort();const x=new AbortController;S.current=x,s(!0),y(null),c(""),f(!1);const M=ce(i,u),L=u.stream!==!1;try{const $={"Content-Type":"application/json",...u.headers};u.apiKey&&($.Authorization=`Bearer ${u.apiKey}`);const le=JSON.stringify({model:u.model??"gpt-3.5-turbo",messages:M,temperature:u.temperature??.7,max_tokens:u.maxTokens??256,stream:L}),A=await fetch(u.endpoint,{method:"POST",headers:$,body:le,signal:x.signal});if(!A.ok){const v=await A.text().catch(()=>A.statusText);throw new Error(`AI request failed (${A.status}): ${v}`)}if(L){f(!0);let v="";for await(const R of Y(A,x.signal))if(x.signal.aborted||(v+=R.token,c(v),(q=R.usage)!=null&&q.completion_tokens&&h.recordTokens(R.usage.completion_tokens),R.done))break;if(v.length>0){const R=Math.ceil(v.length/4);h.recordTokens(R)}O.set(k,v)}else{const v=await K(A);c(v.text),O.set(k,v.text),(G=v.usage)!=null&&G.completion_tokens?h.recordTokens(v.usage.completion_tokens):h.recordTokens(Math.ceil(v.text.length/4))}}catch($){if($ instanceof DOMException&&$.name==="AbortError")return;y($ instanceof Error?$.message:"AI hint request failed")}finally{x.signal.aborted||(s(!1),f(!1))}},[t,i,r]);a.useEffect(()=>{if(!t||!t.enabled||r)return;const u=setTimeout(d,n);return()=>clearTimeout(u)},[i==null?void 0:i.fieldLabel,i==null?void 0:i.fieldType,i==null?void 0:i.fieldValue,i==null?void 0:i.customPrompt,n,r,t==null?void 0:t.enabled,C.current]),a.useEffect(()=>()=>{var u;(u=S.current)==null||u.abort()},[]);const P=a.useCallback(()=>{var u;(u=S.current)==null||u.abort(),s(!1),f(!1)},[]),T=a.useCallback(()=>{if(t){const u=W(i,t.config.privacyMode??!1);O.delete(u)}C.current+=1,d()},[t,i,d]);return!t||!t.enabled?{text:"",loading:!1,error:null,streaming:!1,abort:()=>{},refresh:()=>{},hint:null,fetchHint:async()=>{}}:{text:l,loading:w,error:g,streaming:I,abort:P,refresh:T,hint:l?{content:l}:null,fetchHint:async()=>{await d()}}}function de(){return o.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[o.jsx("path",{d:"M12 3l1.5 5.5L19 10l-5.5 1.5L12 17l-1.5-5.5L5 10l5.5-1.5z"}),o.jsx("path",{d:"M19 15l.5 2 2 .5-2 .5-.5 2-.5-2-2-.5 2-.5z"}),o.jsx("path",{d:"M5 19l.5 1.5 1.5.5-1.5.5-.5 1.5-.5-1.5-1.5-.5 1.5-.5z"})]})}function se(i,e){if(i!=="auto"||!e)return i==="auto"?"top":i;const n=e.top,r=window.innerHeight-e.bottom,t=e.left,l=window.innerWidth-e.right,c=Math.max(n,r,t,l);return c===n?"top":c===r?"bottom":c===l?"right":"left"}function oe(i){const e={position:"absolute",zIndex:9999,minWidth:200,maxWidth:320,padding:"8px 12px",borderRadius:8,fontSize:13,lineHeight:1.5,backgroundColor:"var(--ntd-ai-bg, #1e1e2e)",color:"var(--ntd-ai-fg, #cdd6f4)",border:"1px solid var(--ntd-ai-border, #45475a)",boxShadow:"0 4px 16px rgba(0,0,0,0.25)",wordWrap:"break-word"};switch(i){case"top":return{...e,bottom:"100%",left:"50%",transform:"translateX(-50%)",marginBottom:6};case"bottom":return{...e,top:"100%",left:"50%",transform:"translateX(-50%)",marginTop:6};case"left":return{...e,right:"100%",top:"50%",transform:"translateY(-50%)",marginRight:6};case"right":return{...e,left:"100%",top:"50%",transform:"translateY(-50%)",marginLeft:6};default:return{...e,bottom:"100%",left:"50%",transform:"translateX(-50%)",marginBottom:6}}}const J=a.forwardRef(({context:i,position:e="auto",debounceMs:n=500,showOnHover:r=!1,triggerIcon:t,className:l,style:c},w)=>{var k;const s=E(),[g,y]=a.useState(!1),[I,f]=a.useState(!1),S=a.useRef(null),C=a.useRef(null),d=m(i,{debounceMs:n,disabled:!I});a.useEffect(()=>{if(!g)return;const b=x=>{var L,N;const M=x.target;(L=S.current)!=null&&L.contains(M)||(N=C.current)!=null&&N.contains(M)||(y(!1),f(!1))};return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[g]),a.useEffect(()=>{if(!g)return;const b=x=>{x.key==="Escape"&&(y(!1),f(!1),d.abort())};return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[g,d]);const P=a.useCallback(b=>{if(b.stopPropagation(),r)return;const x=!g;y(x),f(x)},[g,r]),T=a.useCallback(()=>{r&&(y(!0),f(!0))},[r]),u=a.useCallback(()=>{r&&(y(!1),f(!1))},[r]);if(!s||!s.enabled)return null;const h=se(e,((k=S.current)==null?void 0:k.getBoundingClientRect())??null);return o.jsxs("span",{ref:w,className:l,style:{position:"relative",display:"inline-flex",...c},onMouseEnter:T,onMouseLeave:u,children:[o.jsx("button",{ref:S,type:"button",onClick:P,"aria-label":"AI hint","aria-expanded":g,className:"ntd-ai-trigger",style:{display:"inline-flex",alignItems:"center",justifyContent:"center",border:"none",background:"transparent",cursor:"pointer",padding:2,borderRadius:4,color:"var(--ntd-ai-trigger-color, #a78bfa)",opacity:.7,transition:"opacity 0.2s, transform 0.2s"},children:t??o.jsx(de,{})}),g&&o.jsxs("div",{ref:C,role:"tooltip",className:"ntd-ai-popover",style:oe(h),children:[d.loading&&!d.text&&o.jsxs("div",{className:"ntd-ai-loading",style:{display:"flex",alignItems:"center",gap:6},children:[o.jsx("span",{style:{display:"inline-block",width:12,height:12,border:"2px solid var(--ntd-ai-border, #45475a)",borderTopColor:"var(--ntd-ai-trigger-color, #a78bfa)",borderRadius:"50%",animation:"ntd-ai-spin 0.8s linear infinite"}}),o.jsx("span",{style:{opacity:.6},children:"Thinking..."})]}),d.text&&o.jsxs("div",{className:"ntd-ai-content",children:[d.text,d.streaming&&o.jsx("span",{className:"ntd-ai-cursor",style:{display:"inline-block",width:2,height:"1em",backgroundColor:"var(--ntd-ai-trigger-color, #a78bfa)",marginLeft:1,animation:"ntd-ai-blink 0.8s step-end infinite",verticalAlign:"text-bottom"}})]}),d.error&&o.jsx("div",{className:"ntd-ai-error",style:{color:"var(--ntd-ai-error, #f38ba8)"},children:d.error}),d.text&&!d.streaming&&o.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:4,marginTop:6,paddingTop:6,borderTop:"1px solid var(--ntd-ai-border, #45475a)"},children:[o.jsx("button",{type:"button",onClick:()=>d.refresh(),className:"ntd-ai-action",style:{fontSize:11,padding:"2px 6px",border:"1px solid var(--ntd-ai-border, #45475a)",borderRadius:4,background:"transparent",color:"inherit",cursor:"pointer"},children:"↻ Refresh"}),o.jsx("button",{type:"button",onClick:()=>{var b;(b=navigator.clipboard)==null||b.writeText(d.text)},className:"ntd-ai-action",style:{fontSize:11,padding:"2px 6px",border:"1px solid var(--ntd-ai-border, #45475a)",borderRadius:4,background:"transparent",color:"inherit",cursor:"pointer"},children:"⎘ Copy"})]})]})]})});J.displayName="NiceAIHintBubble";function D(i,e,n){return{fieldLabel:i,fieldType:"text",fieldValue:e,validationRules:{...(n==null?void 0:n.maxLength)!=null?{maxLength:n.maxLength}:{},...n!=null&&n.pattern?{pattern:n.pattern}:{}},customPrompt:n!=null&&n.placeholder?`Placeholder: "${n.placeholder}". Suggest content or correct grammar.`:"Suggest content, correct grammar, or auto-complete the text."}}function H(i,e,n){return{fieldLabel:i,fieldType:"number",fieldValue:e,validationRules:{...(n==null?void 0:n.min)!=null?{min:n.min}:{},...(n==null?void 0:n.max)!=null?{max:n.max}:{},...(n==null?void 0:n.step)!=null?{step:n.step}:{}},customPrompt:n!=null&&n.unit?`Unit: ${n.unit}. Suggest a reasonable value or range for this field.`:"Suggest a reasonable value or range for this field based on the label and constraints."}}function j(i,e,n){return{fieldLabel:i,fieldType:n!=null&&n.multiple?"multi-select":"select",fieldValue:e,schema:n!=null&&n.options?{availableOptions:n.options.slice(0,20).map(r=>r.label)}:{},customPrompt:"Suggest the most likely selection. Explain why this option is recommended."}}function z(i,e,n){const r=e instanceof Date?e.toISOString().split("T")[0]:e;return{fieldLabel:i,fieldType:"date",fieldValue:r,validationRules:{...n!=null&&n.min?{min:n.min}:{},...n!=null&&n.max?{max:n.max}:{},...n!=null&&n.disableWeekends?{noWeekends:!0}:{}},customPrompt:'Suggest a date. For example: "next business day", "end of month", "in 2 weeks". Explain your suggestion briefly.'}}function V(i,e,n){return{fieldLabel:i,fieldType:"color",fieldValue:e,schema:n!=null&&n.palette?{currentPalette:n.palette}:{},customPrompt:n!=null&&n.industry?`Industry: ${n.industry}. Suggest a color palette (3-5 hex colors) suitable for this context.`:"Suggest a color or palette of colors that works well for this context. Provide hex values."}}function me(i,e){return{fieldLabel:i,fieldType:"data-grid",schema:{...e!=null&&e.columns?{columns:e.columns}:{},...(e==null?void 0:e.rowCount)!=null?{totalRows:e.rowCount}:{}},formContext:{...e!=null&&e.currentFilters?{filters:e.currentFilters}:{},...e!=null&&e.currentSorts?{sorts:e.currentSorts}:{}},customPrompt:"Suggest column configuration, useful filters, or highlight potential data anomalies."}}function ge(i,e){return{fieldLabel:i,fieldType:"chart",schema:{...e!=null&&e.currentType?{chartType:e.currentType}:{},...(e==null?void 0:e.seriesCount)!=null?{series:e.seriesCount}:{},...(e==null?void 0:e.pointCount)!=null?{dataPoints:e.pointCount}:{}},customPrompt:e!=null&&e.dataDescription?`Data: ${e.dataDescription}. Suggest the best chart type and labeling strategy.`:"Suggest the most effective chart type for this data. Explain your recommendation."}}function _(i,e){return{fieldLabel:"Form auto-fill",fieldType:"form",schema:{fields:e},customPrompt:`User description: "${i}"
|
|
5
|
+
Parse this description and return suggested values for each field as JSON: { ${e.map(n=>`"${n.label}": "value"`).join(", ")} }`}}function X(i,e,n,r,t){return{fieldLabel:i,fieldType:e,fieldValue:n,validationRules:t==null?void 0:t.rules,customPrompt:`Current validation error: "${r}". Provide a friendly, specific error message with an example of a valid value. Do NOT say "field is required" — instead explain what the user should enter.`}}function fe(i,e,n){const r=a.useMemo(()=>D(i,e,n),[i,e,n==null?void 0:n.placeholder,n==null?void 0:n.maxLength,n==null?void 0:n.pattern]);return m(r,n)}function he(i,e,n){const r=a.useMemo(()=>H(i,e,n),[i,e,n==null?void 0:n.min,n==null?void 0:n.max,n==null?void 0:n.step,n==null?void 0:n.unit]);return m(r,n)}function be(i,e,n){const r=a.useMemo(()=>j(i,e,n),[i,e,n==null?void 0:n.multiple]);return m(r,n)}function ye(i,e,n){const r=a.useMemo(()=>z(i,e,n),[i,e,n==null?void 0:n.min,n==null?void 0:n.max,n==null?void 0:n.disableWeekends]);return m(r,n)}function xe(i,e,n){const r=a.useMemo(()=>V(i,e,n),[i,e,n==null?void 0:n.industry]);return m(r,n)}function Se(i,e,n,r,t){const l=a.useMemo(()=>r?X(i,e,n,r,t):{fieldLabel:i,fieldType:e},[i,e,n,r]);return m(l,{...t,disabled:!r||(t==null?void 0:t.disabled)})}function Ce(i,e,n){const r=a.useMemo(()=>i?_(i,e):{fieldLabel:"Form"},[i,e]);return m(r,{...n,disabled:!i||(n==null?void 0:n.disabled)})}function U(i,e,n){const t=(e==null?void 0:e.split(`
|
|
6
|
+
`))??[],l=(n==null?void 0:n.cursorLine)!=null?t.slice(Math.max(0,n.cursorLine-8),n.cursorLine+3).join(`
|
|
7
|
+
`):t.slice(0,8*2).join(`
|
|
8
|
+
`);return{fieldLabel:`Code editor (${i})`,fieldType:"code-editor",fieldValue:l||e,schema:{language:i,...n!=null&&n.framework?{framework:n.framework}:{},...(n==null?void 0:n.cursorLine)!=null?{cursorLine:n.cursorLine,cursorCol:n.cursorCol}:{}},customPrompt:`Language: ${i}${n!=null&&n.framework?`, framework: ${n.framework}`:""}.
|
|
9
|
+
Provide a concise inline completion or improvement hint for the code near the cursor. Limit response to ${(n==null?void 0:n.maxSuggestLines)??5} lines of code. If unsure, suggest the most idiomatic approach for this language/framework.`}}function Q(i,e,n){var l;const r=(n==null?void 0:n.mode)??"grammar",t={seo:"Analyze this HTML for SEO: missing meta tags, heading hierarchy (h1→h2→h3), keyword density, image alt attributes. Return a prioritized list of improvements.",accessibility:"Audit this HTML for WCAG 2.1 AA issues: missing aria labels, alt text, heading structure, color contrast hints, keyboard navigation. List specific fixes.",grammar:"Fix grammar, punctuation, and writing style in the visible text content. Return the corrected text only (no HTML tags in response).",cleanup:"Clean up malformed, redundant, or overly nested HTML. Simplify structure while preserving semantics and content."};return{fieldLabel:i,fieldType:"html-editor",fieldValue:e==null?void 0:e.slice(0,2e3),schema:{mode:r,...(l=n==null?void 0:n.targetKeywords)!=null&&l.length?{targetKeywords:n.targetKeywords}:{},...n!=null&&n.locale?{locale:n.locale}:{}},customPrompt:t[r]}}function Z(i,e){const n=(e==null?void 0:e.mode)??"tag",r=`"${i}"`+((e==null?void 0:e.bpm)!=null?`, BPM: ${e.bpm}`:"")+(e!=null&&e.key?`, Key: ${e.key}`:"")+(e!=null&&e.genre?`, Genre: ${e.genre}`:"")+((e==null?void 0:e.duration)!=null?`, Duration: ${e.duration}s`:""),t={tag:`Audio: ${r}. Suggest genre tags, mood descriptors and playlist categories. Return as JSON array of strings.`,bpm:`Audio: ${r}. Suggest likely BPM range and musical key based on metadata. Return as JSON: { bpm: number, key: string }.`,mix:`Track: ${r}. Suggest EQ curve (JSON array of {freq, gain, q}), compression settings, and 2-3 compatible tracks for mixing.`,transcribe:"Return a transcription of the spoken audio content as JSON: { transcript: string, language: string, confidence: number }."};return{fieldLabel:`Audio: ${i}`,fieldType:"audio",schema:{mode:n,...(e==null?void 0:e.bpm)!=null?{bpm:e.bpm}:{},...e!=null&&e.key?{key:e.key}:{},...(e==null?void 0:e.duration)!=null?{duration:e.duration}:{},...e!=null&&e.genre?{genre:e.genre}:{}},customPrompt:t[n]}}function p(i,e){var l;const n=(e==null?void 0:e.mode)??"material",r=(e==null?void 0:e.targetDevice)??"web",t={material:`Scene "${i}", ${(e==null?void 0:e.meshCount)??"?"} meshes. Materials: ${((l=e==null?void 0:e.materials)==null?void 0:l.join(", "))||"none"}. Suggest PBR properties (roughness, metalness, baseColor) and texture maps for each material.`,optimize:`Scene "${i}", triangles: ${(e==null?void 0:e.triangleCount)??"?"}, target: ${r}. Identify budget issues and suggest LOD levels, mesh merging, and texture atlas strategy.`,lighting:`Scene "${i}", target: ${r}. Suggest a complete lighting setup (types, intensity, color, shadow settings) for realistic rendering.`,animation:`Rig in scene "${i}". Suggest animation approach (FK/IK, bone count), keyframe timing and easing curves for natural movement.`};return{fieldLabel:`3D scene: ${i}`,fieldType:"3d-scene",schema:{mode:n,...(e==null?void 0:e.meshCount)!=null?{meshes:e.meshCount}:{},...(e==null?void 0:e.triangleCount)!=null?{triangles:e.triangleCount}:{},...e!=null&&e.targetDevice?{target:e.targetDevice}:{}},customPrompt:t[n]}}function ee(i,e){const n=(e==null?void 0:e.mode)??"palette",r=(e==null?void 0:e.width)!=null?`${e.width}×${e.height??"?"}px`:"unknown dimensions",t={filter:`Image "${i}" (${r}). Suggest CSS/SVG filter parameters (brightness, contrast, saturate, hue-rotate, blur) as JSON: { brightness, contrast, saturate, hueRotate, blur }.`,palette:`Image "${i}". Extract or suggest a harmonious 5-color palette as JSON: { primary, secondary, accent, background, text }.`,upscale:`Image "${i}" at ${r}. Recommend upscaling strategy: model (ESRGAN/RealSR/SRCNN), scale factor, and expected quality gain.`,"style-transfer":`Image "${i}", target style: "${(e==null?void 0:e.targetStyle)??"artistic"}". Suggest style-transfer settings as JSON: { contentWeight, styleWeight, iterations, patchSize }.`};return{fieldLabel:`Graphics: ${i}`,fieldType:"graphics",schema:{mode:n,...(e==null?void 0:e.width)!=null?{width:e.width,height:e.height}:{},...e!=null&&e.targetStyle?{targetStyle:e.targetStyle}:{}},customPrompt:t[n]}}function ne(i,e){var n;return{fieldLabel:"Icon search",fieldType:"icon-picker",fieldValue:i,schema:{...e!=null&&e.style?{iconStyle:e.style}:{},...(e==null?void 0:e.limit)!=null?{maxResults:e.limit}:{},...(n=e==null?void 0:e.availableIcons)!=null&&n.length?{sampleIcons:e.availableIcons.slice(0,30)}:{}},customPrompt:`User query: "${i}"
|
|
10
|
+
Return the ${(e==null?void 0:e.limit)??5} most semantically relevant icon names from the available set as a JSON array of strings, ordered by relevance. Prefer specific over generic names.`}}function ke(i,e,n){const r=a.useMemo(()=>U(i,e,n),[i,e,n==null?void 0:n.cursorLine,n==null?void 0:n.cursorCol,n==null?void 0:n.framework]);return m(r,n)}function ve(i,e,n){const r=a.useMemo(()=>Q(i,e,n),[i,e,n==null?void 0:n.mode,n==null?void 0:n.locale]);return m(r,n)}function we(i,e){const n=a.useMemo(()=>Z(i,e),[i,e==null?void 0:e.bpm,e==null?void 0:e.key,e==null?void 0:e.duration,e==null?void 0:e.mode]);return m(n,e)}function Ie(i,e){const n=a.useMemo(()=>p(i,e),[i,e==null?void 0:e.meshCount,e==null?void 0:e.triangleCount,e==null?void 0:e.targetDevice,e==null?void 0:e.mode]);return m(n,e)}function Te(i,e){const n=a.useMemo(()=>ee(i,e),[i,e==null?void 0:e.width,e==null?void 0:e.height,e==null?void 0:e.mode,e==null?void 0:e.targetStyle]);return m(n,e)}function Pe(i,e){const n=a.useMemo(()=>ne(i,e),[i,e==null?void 0:e.limit,e==null?void 0:e.style]);return m(n,{...e,disabled:!i||(e==null?void 0:e.disabled)})}function ie(i,e){var l;const n=(e==null?void 0:e.mode)??"npc-decision",r=(e==null?void 0:e.genre)??"fantasy",t={"npc-decision":`You are an AI game director. The NPC "${i}" must make a decision. Available BT nodes: ${JSON.stringify((e==null?void 0:e.btStatus)??[])}. Game state: ${JSON.stringify((e==null?void 0:e.gameState)??{})}. Return the name of the BT node to activate next, and one sentence of reasoning.`,dialogue:`You are a ${r} RPG writer. Write a short in-character dialogue line for NPC "${i}". Game state: ${JSON.stringify((e==null?void 0:e.gameState)??{})}. Max 2 sentences, no narrative descriptions.`,"procedural-level":`You are a ${r} game designer. Suggest a procedural level layout for a zone containing "${i}". Describe room count, enemy placement, loot, and one unique mechanic. Keep it under 150 words.`,"quest-description":`You are a ${r} quest designer. Write a compelling quest description involving "${i}". Include: objective, giver NPC, rewards, and a short flavour paragraph. Keep it under 120 words.`,"item-description":`You are a ${r} lore writer. Write a short item description for an item related to "${i}". Include: item name, rarity, flavour text, and one special property. Keep it under 80 words.`};return{fieldLabel:i,fieldType:`game-engine:${n}`,fieldValue:e==null?void 0:e.gameState,customPrompt:t[n],schema:{genre:r,mode:n,btNodes:(l=e==null?void 0:e.btStatus)==null?void 0:l.map(c=>c.node)}}}function $e(i,e){const n=a.useMemo(()=>ie(i,e),[i,e==null?void 0:e.mode,e==null?void 0:e.genre,JSON.stringify(e==null?void 0:e.btStatus),JSON.stringify(e==null?void 0:e.gameState)]);return m(n,e)}function re(i,e,n){const r=(n==null?void 0:n.mode)??"layout",t=(n==null?void 0:n.diagramType)??"flowchart",l={layout:`You are a diagram layout optimizer. Given this ${t} with ${i.length} nodes and ${e.length} edges, suggest optimal positions for each node to minimize edge crossings and improve readability. Return JSON: { suggestions: [{ id: string, x: number, y: number, reason: string }] }. Consider flow direction (top-to-bottom or left-to-right) and grouping related nodes.`,structure:`You are a diagram analyst. Analyze this ${t} structure. Identify: 1) Missing connections, 2) Potential bottlenecks, 3) Orphan nodes, 4) Cycles or loops. Return JSON: { issues: [{ type: string, description: string, nodeIds: string[] }], score: number }`,simplify:`You are a diagram simplifier. Suggest how to simplify this ${t} while preserving meaning. Identify: nodes that could be merged, redundant edges, or overly complex branches. Return JSON: { simplifications: [{ action: 'merge'|'remove'|'group', ids: string[], reason: string }] }`,group:`You are a diagram organizer. Suggest logical groupings for nodes in this ${t}. Consider semantic relationships, data flow patterns, and visual clustering. Return JSON: { groups: [{ name: string, nodeIds: string[], color?: string }] }`},c=i.map(s=>{var g;return{id:s.id,type:s.type,label:(g=s.label)==null?void 0:g.slice(0,30),pos:[Math.round(s.x),Math.round(s.y)]}}),w=e.map(s=>({id:s.id,src:s.source,tgt:s.target}));return{fieldLabel:`Diagram (${t})`,fieldType:`diagram:${r}`,fieldValue:JSON.stringify({nodes:c,edges:w}),schema:{diagramType:t,mode:r,nodeCount:i.length,edgeCount:e.length,containerSize:n==null?void 0:n.containerSize},customPrompt:l[r]}}function Ae(i,e,n){const r=a.useMemo(()=>re(i,e,n),[JSON.stringify(i),JSON.stringify(e),n==null?void 0:n.mode,n==null?void 0:n.diagramType]);return m(r,{...n,disabled:i.length===0||(n==null?void 0:n.disabled)})}function te(i,e){const n=(e==null?void 0:e.mode)??"generate",r=(e==null?void 0:e.presentationType)??"business",t=(e==null?void 0:e.duration)??15,l=Math.ceil(t/2),c={generate:`You are a presentation designer. Create a ${r} presentation outline based on: "${i}". Target audience: ${(e==null?void 0:e.audience)??"general"}. Duration: ${t} minutes (~${l} slides). Return JSON: { title: string, slides: [{ title: string, layout: 'title'|'content'|'two-column'|'chart'|'image', bullets?: string[], chartType?: string, speakerNotes?: string }] }. Include: clear slide titles, 3-5 bullet points per content slide, and brief speaker notes.`,summarize:`You are a presentation optimizer. Summarize this presentation to be more concise: "${i}". Reduce slide count by 30% while preserving key messages. Return JSON: { summary: string, reducedSlides: [{ title: string, keyPoints: string[] }] }`,expand:`You are a presentation expert. Expand this brief outline into a detailed presentation: "${i}". Add supporting details, examples, and transitions. Target: ${l} slides. Return JSON: { slides: [{ title: string, content: string, transitions?: string, animations?: string[] }] }`,improve:`You are a presentation coach. Review and improve this presentation structure: "${i}". Suggest: better flow, stronger opening/closing, clearer data visualization. Return JSON: { improvements: [{ slide: number, issue: string, suggestion: string }], score: number }`};return{fieldLabel:`Presentation (${r})`,fieldType:`presentation:${n}`,fieldValue:i,schema:{presentationType:r,mode:n,duration:t,slideCount:l,audience:e==null?void 0:e.audience,hasData:(e==null?void 0:e.dataContext)!=null},customPrompt:c[n]}}function Re(i,e){const n=a.useMemo(()=>te(i,e),[i,e==null?void 0:e.mode,e==null?void 0:e.presentationType,e==null?void 0:e.duration,e==null?void 0:e.audience]);return m(n,{...e,disabled:!i||(e==null?void 0:e.disabled)})}function ae(i,e){var t;const n=(e==null?void 0:e.mode)??"all",r={alignment:"Analyze element alignment on this slide. Suggest adjustments to create visual harmony. Return JSON: { suggestions: [{ elementIndex: number, issue: string, fixX?: number, fixY?: number }] }",contrast:"Analyze color contrast and readability. Suggest improvements for accessibility (WCAG AA). Return JSON: { suggestions: [{ area: string, currentContrast: number, suggestedFix: string }] }",spacing:"Analyze whitespace and element spacing. Apply the rule of thirds and consistent margins. Return JSON: { suggestions: [{ elementIndex: number, issue: string, suggestedMargin: number }] }",typography:"Analyze typography: hierarchy, font sizes, line heights, readability. Return JSON: { suggestions: [{ area: string, issue: string, suggestedFontSize?: number }] }",all:"Perform a complete design review of this slide. Check alignment, contrast, spacing, and typography. Return JSON: { score: number, suggestions: [{ category: string, issue: string, fix: string }] }. Prioritize issues by impact on visual clarity."};return{fieldLabel:i.title??"Slide Design",fieldType:`slide-design:${n}`,fieldValue:JSON.stringify(i),schema:{mode:n,hasElements:(((t=i.elements)==null?void 0:t.length)??0)>0,layout:i.layout,brandColors:e==null?void 0:e.brandColors},customPrompt:r[n]}}function Le(i,e){const n=a.useMemo(()=>ae(i,e),[JSON.stringify(i),e==null?void 0:e.mode,JSON.stringify(e==null?void 0:e.brandColors)]);return m(n,e)}function Ne(i,e,n){const r=a.forwardRef((t,l)=>{const{aiEnabled:c=!0,aiPosition:w="right",aiPrompt:s,aiDebounceMs:g=500,aiShowOnHover:y=!1,aiTriggerIcon:I,...f}=t,S=a.useMemo(()=>{const C=e(f);return s&&(C.customPrompt=s),C},[f,s]);return o.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4},children:[o.jsx(i,{...f,ref:l}),c&&o.jsx(J,{context:S,position:w,debounceMs:g,showOnHover:y,triggerIcon:I})]})});return r.displayName=n??`withAIHint(${i.displayName??i.name??"Component"})`,r}function Me(i){return D(i.label??"Text",i.value,{placeholder:i.placeholder,maxLength:i.maxLength})}function Oe(i){return H(i.label??"Number",i.value,{min:i.min,max:i.max,step:i.step})}function Ee(i){return j(i.label??"Select",i.value,{options:i.options,multiple:i.multiple})}function Je(i){return z(i.label??"Date",i.value,{min:i.min,max:i.max})}function De(i){return V(i.label??"Color",i.value)}exports.NiceAIHintBubble=J;exports.NiceAIProvider=ue;exports.RateLimiter=B;exports.build3DSceneContext=p;exports.buildAudioContext=Z;exports.buildChartContext=ge;exports.buildCodeEditorContext=U;exports.buildColorPickerContext=V;exports.buildDataGridContext=me;exports.buildDatePickerContext=z;exports.buildDiagramLayoutContext=re;exports.buildFormFillContext=_;exports.buildGameEngineContext=ie;exports.buildGraphicsContext=ee;exports.buildHtmlEditorContext=Q;exports.buildIconSearchContext=ne;exports.buildNumberInputContext=H;exports.buildPresentationGenerateContext=te;exports.buildSelectContext=j;exports.buildSlideDesignContext=ae;exports.buildTextInputContext=D;exports.buildValidationContext=X;exports.colorControlContext=De;exports.dateControlContext=Je;exports.numberControlContext=Oe;exports.parseJSONResponse=K;exports.parseSSEStream=Y;exports.selectControlContext=Ee;exports.textControlContext=Me;exports.useAI3DHint=Ie;exports.useAIAudioHint=we;exports.useAICodeHint=ke;exports.useAIColorHint=xe;exports.useAIContext=E;exports.useAIDateHint=ye;exports.useAIDiagramLayout=Ae;exports.useAIFormFill=Ce;exports.useAIGraphicsHint=Te;exports.useAIHtmlHint=ve;exports.useAIIconSearch=Pe;exports.useAINpcHint=$e;exports.useAINumberHint=he;exports.useAIPresentationGenerate=Re;exports.useAISelectHint=be;exports.useAISlideDesign=Le;exports.useAITextHint=fe;exports.useAIValidation=Se;exports.useNiceAIHint=m;exports.withAIHint=Ne;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
|
|
2
|
+
export type { NiceAIConfig, RateLimitConfig, AIHintContext, AIHintResult, RateLimitStatus, AIHintPosition, NiceAIHintBubbleProps, ChatMessage, StreamChunk, } from './types';
|
|
3
|
+
export { NiceAIProvider, useAIContext } from './NiceAIProvider';
|
|
4
|
+
export type { NiceAIProviderProps } from './NiceAIProvider';
|
|
5
|
+
export { useNiceAIHint } from './useNiceAIHint';
|
|
6
|
+
export type { UseNiceAIHintOptions } from './useNiceAIHint';
|
|
7
|
+
export { NiceAIHintBubble } from './NiceAIHintBubble';
|
|
8
|
+
export { parseSSEStream, parseJSONResponse } from './streaming';
|
|
9
|
+
export { RateLimiter } from './rateLimiter';
|
|
10
|
+
export { buildTextInputContext, buildNumberInputContext, buildSelectContext, buildDatePickerContext, buildColorPickerContext, buildDataGridContext, buildChartContext, buildFormFillContext, buildValidationContext, useAITextHint, useAINumberHint, useAISelectHint, useAIDateHint, useAIColorHint, useAIValidation, useAIFormFill, buildCodeEditorContext, buildHtmlEditorContext, buildAudioContext, build3DSceneContext, buildGraphicsContext, buildIconSearchContext, useAICodeHint, useAIHtmlHint, useAIAudioHint, useAI3DHint, useAIGraphicsHint, useAIIconSearch, buildGameEngineContext, useAINpcHint, type GameEngineAIContext, buildDiagramLayoutContext, useAIDiagramLayout, type DiagramAIContext, buildPresentationGenerateContext, buildSlideDesignContext, useAIPresentationGenerate, useAISlideDesign, type PresentationAIContext, type SlideDesignAIContext, } from './integrations';
|
|
11
|
+
export { withAIHint, textControlContext, numberControlContext, selectControlContext, dateControlContext, colorControlContext, } from './wrappers';
|
|
12
|
+
export type { WithAIHintProps } from './wrappers';
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AAGH,OAAO,cAAc,CAAC;AAGtB,YAAY,EACV,YAAY,EACZ,eAAe,EACf,aAAa,EACb,YAAY,EACZ,eAAe,EACf,cAAc,EACd,qBAAqB,EACrB,WAAW,EACX,WAAW,GACZ,MAAM,SAAS,CAAC;AAGjB,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChE,YAAY,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAG5D,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,YAAY,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAG5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAGtD,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAGhE,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAG5C,OAAO,EACL,qBAAqB,EACrB,uBAAuB,EACvB,kBAAkB,EAClB,sBAAsB,EACtB,uBAAuB,EACvB,oBAAoB,EACpB,iBAAiB,EACjB,oBAAoB,EACpB,sBAAsB,EACtB,aAAa,EACb,eAAe,EACf,eAAe,EACf,aAAa,EACb,cAAc,EACd,eAAe,EACf,aAAa,EAEb,sBAAsB,EACtB,sBAAsB,EACtB,iBAAiB,EACjB,mBAAmB,EACnB,oBAAoB,EACpB,sBAAsB,EACtB,aAAa,EACb,aAAa,EACb,cAAc,EACd,WAAW,EACX,iBAAiB,EACjB,eAAe,EACf,sBAAsB,EACtB,YAAY,EACZ,KAAK,mBAAmB,EAExB,yBAAyB,EACzB,kBAAkB,EAClB,KAAK,gBAAgB,EAErB,gCAAgC,EAChC,uBAAuB,EACvB,yBAAyB,EACzB,gBAAgB,EAChB,KAAK,qBAAqB,EAC1B,KAAK,oBAAoB,GAC1B,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACL,UAAU,EACV,kBAAkB,EAClB,oBAAoB,EACpB,oBAAoB,EACpB,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,YAAY,CAAC;AACpB,YAAY,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC"}
|