@foisit/vue-wrapper 2.4.5 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +49 -1
- package/index.d.ts +1 -0
- package/index.mjs +248 -149
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -33,7 +33,7 @@ Transform your Vue app into an intelligent, voice-ready platform. Foisit provide
|
|
|
33
33
|
- **Programmatic UI Triggers** - Direct command execution via `runCommand()`
|
|
34
34
|
- **Rich Markdown Rendering** - Enhanced response formatting with headings, code, and links
|
|
35
35
|
- **Advanced File Validations** - Comprehensive client-side file validation with size, type, and dimension checks
|
|
36
|
-
- **Premium UI** -
|
|
36
|
+
- **Premium UI** - Glass or solid theme with dark/light mode support
|
|
37
37
|
- **Zero Backend Required** - Secure proxy architecture keeps API keys server-side
|
|
38
38
|
- **Vue Native** - Uses Composition API, `provide/inject`, and Vue 3 patterns
|
|
39
39
|
- **Type-Safe** - Full TypeScript support with comprehensive types
|
|
@@ -454,9 +454,57 @@ interface AssistantConfig {
|
|
|
454
454
|
customHtml?: string;
|
|
455
455
|
position?: { bottom: string; right: string };
|
|
456
456
|
};
|
|
457
|
+
|
|
458
|
+
// Theme mode: 'glass' (default) or 'solid'
|
|
459
|
+
theme?: 'glass' | 'solid';
|
|
460
|
+
|
|
461
|
+
// Custom colors for solid theme (ignored in glass mode)
|
|
462
|
+
themeColors?: ThemeColors;
|
|
463
|
+
}
|
|
464
|
+
```
|
|
465
|
+
|
|
466
|
+
### `ThemeColors`
|
|
467
|
+
|
|
468
|
+
Custom colors for solid theme mode:
|
|
469
|
+
|
|
470
|
+
```typescript
|
|
471
|
+
interface ThemeColors {
|
|
472
|
+
background?: string; // Background color (e.g., '#1e1e2e')
|
|
473
|
+
text?: string; // Primary text color (e.g., '#ffffff')
|
|
474
|
+
accent?: string; // Accent color for highlights (e.g., '#89b4fa' or a gradient)
|
|
475
|
+
userBubbleBg?: string; // User message bubble background
|
|
476
|
+
systemBubbleBg?: string; // System message bubble background
|
|
477
|
+
border?: string; // Border color
|
|
457
478
|
}
|
|
458
479
|
```
|
|
459
480
|
|
|
481
|
+
### Theme Customization Example
|
|
482
|
+
|
|
483
|
+
```vue
|
|
484
|
+
<script setup>
|
|
485
|
+
const config = {
|
|
486
|
+
commands: [...],
|
|
487
|
+
// Use solid theme with custom colors
|
|
488
|
+
theme: 'solid',
|
|
489
|
+
themeColors: {
|
|
490
|
+
background: '#1e1e2e',
|
|
491
|
+
text: '#cdd6f4',
|
|
492
|
+
accent: '#89b4fa',
|
|
493
|
+
userBubbleBg: 'rgba(137, 180, 250, 0.2)',
|
|
494
|
+
systemBubbleBg: 'rgba(255, 255, 255, 0.05)',
|
|
495
|
+
},
|
|
496
|
+
};
|
|
497
|
+
</script>
|
|
498
|
+
|
|
499
|
+
<template>
|
|
500
|
+
<AssistantProvider :config="config">
|
|
501
|
+
<App />
|
|
502
|
+
</AssistantProvider>
|
|
503
|
+
</template>
|
|
504
|
+
```
|
|
505
|
+
|
|
506
|
+
> **Note**: Glass theme (default) uses glassmorphism with blur effects and adapts to light/dark mode via `prefers-color-scheme`. Solid theme ignores system preferences and uses configured colors.
|
|
507
|
+
|
|
460
508
|
---
|
|
461
509
|
|
|
462
510
|
## Advanced Usage
|
package/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export { default as AssistantProvider } from './lib/components/AssistantProvider.vue';
|
|
2
2
|
export { useAssistant } from './lib/composables/useAssistant';
|
|
3
3
|
export { AssistantService } from './lib/services/AssistantService';
|
|
4
|
+
export type { ThemeColors } from '../../core/src/index.ts';
|
package/index.mjs
CHANGED
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
**/
|
|
6
6
|
const se = process.env.NODE_ENV !== "production" ? Object.freeze({}) : {}, ze = process.env.NODE_ENV !== "production" ? Object.freeze([]) : [], we = () => {
|
|
7
7
|
}, Be = (i) => i.charCodeAt(0) === 111 && i.charCodeAt(1) === 110 && // uppercase letter
|
|
8
|
-
(i.charCodeAt(2) > 122 || i.charCodeAt(2) < 97), z = Object.assign,
|
|
8
|
+
(i.charCodeAt(2) > 122 || i.charCodeAt(2) < 97), z = Object.assign, E = Array.isArray, M = (i) => typeof i == "function", R = (i) => typeof i == "string", xe = (i) => typeof i == "symbol", T = (i) => i !== null && typeof i == "object";
|
|
9
9
|
let he;
|
|
10
10
|
const Q = () => he || (he = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : typeof global < "u" ? global : {});
|
|
11
11
|
function le(i) {
|
|
12
|
-
if (
|
|
12
|
+
if (E(i)) {
|
|
13
13
|
const e = {};
|
|
14
14
|
for (let t = 0; t < i.length; t++) {
|
|
15
15
|
const s = i[t], n = R(s) ? Ye(s) : le(s);
|
|
@@ -35,7 +35,7 @@ function ce(i) {
|
|
|
35
35
|
let e = "";
|
|
36
36
|
if (R(i))
|
|
37
37
|
e = i;
|
|
38
|
-
else if (
|
|
38
|
+
else if (E(i))
|
|
39
39
|
for (let t = 0; t < i.length; t++) {
|
|
40
40
|
const s = ce(i[t]);
|
|
41
41
|
s && (e += s + " ");
|
|
@@ -156,9 +156,9 @@ function Ze(i) {
|
|
|
156
156
|
}), t.length > 3 && e.push(" ..."), e;
|
|
157
157
|
}
|
|
158
158
|
function Se(i, e, t) {
|
|
159
|
-
return R(e) ? (e = JSON.stringify(e), t ? e : [`${i}=${e}`]) : typeof e == "number" || typeof e == "boolean" || e == null ? t ? e : [`${i}=${e}`] : de(e) ? (e = Se(i, O(e.value), !0), t ? e : [`${i}=Ref<`, e, ">"]) :
|
|
159
|
+
return R(e) ? (e = JSON.stringify(e), t ? e : [`${i}=${e}`]) : typeof e == "number" || typeof e == "boolean" || e == null ? t ? e : [`${i}=${e}`] : de(e) ? (e = Se(i, O(e.value), !0), t ? e : [`${i}=Ref<`, e, ">"]) : M(e) ? [`${i}=fn${e.name ? `<${e.name}>` : ""}`] : (e = O(e), t ? e : [`${i}=`, e]);
|
|
160
160
|
}
|
|
161
|
-
const
|
|
161
|
+
const ke = {
|
|
162
162
|
sp: "serverPrefetch hook",
|
|
163
163
|
bc: "beforeCreate hook",
|
|
164
164
|
c: "created hook",
|
|
@@ -195,14 +195,14 @@ function ue(i, e, t, s) {
|
|
|
195
195
|
try {
|
|
196
196
|
return s ? i(...s) : i();
|
|
197
197
|
} catch (n) {
|
|
198
|
-
|
|
198
|
+
Ee(n, e, t);
|
|
199
199
|
}
|
|
200
200
|
}
|
|
201
|
-
function
|
|
201
|
+
function Ee(i, e, t, s = !0) {
|
|
202
202
|
const n = e ? e.vnode : null, { errorHandler: o, throwUnhandledErrorInProduction: a } = e && e.appContext.config || se;
|
|
203
203
|
if (e) {
|
|
204
204
|
let r = e.parent;
|
|
205
|
-
const c = e.proxy, h = process.env.NODE_ENV !== "production" ?
|
|
205
|
+
const c = e.proxy, h = process.env.NODE_ENV !== "production" ? ke[t] : `https://vuejs.org/error-reference/#runtime-${t}`;
|
|
206
206
|
for (; r; ) {
|
|
207
207
|
const d = r.ec;
|
|
208
208
|
if (d) {
|
|
@@ -225,7 +225,7 @@ function ke(i, e, t, s = !0) {
|
|
|
225
225
|
}
|
|
226
226
|
function et(i, e, t, s = !0, n = !1) {
|
|
227
227
|
if (process.env.NODE_ENV !== "production") {
|
|
228
|
-
const o =
|
|
228
|
+
const o = ke[e];
|
|
229
229
|
if (t && Ge(t), _(`Unhandled error${o ? ` during execution of ${o}` : ""}`), t && Ke(), s)
|
|
230
230
|
throw i;
|
|
231
231
|
console.error(i);
|
|
@@ -261,7 +261,7 @@ function _e() {
|
|
|
261
261
|
re || (re = tt.then(Ae));
|
|
262
262
|
}
|
|
263
263
|
function ot(i) {
|
|
264
|
-
|
|
264
|
+
E(i) ? P.push(...i) : N && i.id === -1 ? N.splice(F + 1, 0, i) : i.flags & 1 || (P.push(i), i.flags |= 1), _e();
|
|
265
265
|
}
|
|
266
266
|
function rt(i) {
|
|
267
267
|
if (P.length) {
|
|
@@ -308,7 +308,7 @@ function Le(i, e) {
|
|
|
308
308
|
const t = i.get(e) || 0;
|
|
309
309
|
if (t > it) {
|
|
310
310
|
const s = e.i, n = s && Pe(s.type);
|
|
311
|
-
return
|
|
311
|
+
return Ee(
|
|
312
312
|
`Maximum recursive updates exceeded${n ? ` in component <${n}>` : ""}. This means you have a reactive effect that is mutating its own dependencies and thus recursively triggering itself. Possible sources include component template, render function, updated hook or watcher source function.`,
|
|
313
313
|
null,
|
|
314
314
|
10
|
|
@@ -373,18 +373,18 @@ function ie(i) {
|
|
|
373
373
|
};
|
|
374
374
|
}
|
|
375
375
|
let H, j = [];
|
|
376
|
-
function
|
|
376
|
+
function Ie(i, e) {
|
|
377
377
|
var t, s;
|
|
378
378
|
H = i, H ? (H.enabled = !0, j.forEach(({ event: n, args: o }) => H.emit(n, ...o)), j = []) : /* handle late devtools injection - only do this if we are in an actual */ /* browser environment to avoid the timer handle stalling test runner exit */ /* (#4815) */ typeof window < "u" && // some envs mock window but not fully
|
|
379
379
|
window.HTMLElement && // also exclude jsdom
|
|
380
380
|
// eslint-disable-next-line no-restricted-syntax
|
|
381
381
|
!((s = (t = window.navigator) == null ? void 0 : t.userAgent) != null && s.includes("jsdom")) ? ((e.__VUE_DEVTOOLS_HOOK_REPLAY__ = e.__VUE_DEVTOOLS_HOOK_REPLAY__ || []).push((o) => {
|
|
382
|
-
|
|
382
|
+
Ie(o, e);
|
|
383
383
|
}), setTimeout(() => {
|
|
384
384
|
H || (e.__VUE_DEVTOOLS_HOOK_REPLAY__ = null, j = []);
|
|
385
385
|
}, 3e3)) : j = [];
|
|
386
386
|
}
|
|
387
|
-
let
|
|
387
|
+
let I = null, dt = null;
|
|
388
388
|
function ut(i, e) {
|
|
389
389
|
if (process.env.NODE_ENV !== "production" && (!L || L.isMounted) && _("provide() can only be used inside setup()."), L) {
|
|
390
390
|
let t = L.provides;
|
|
@@ -393,23 +393,23 @@ function ut(i, e) {
|
|
|
393
393
|
}
|
|
394
394
|
}
|
|
395
395
|
function ft(i, e, t = !1) {
|
|
396
|
-
const s =
|
|
396
|
+
const s = Mt();
|
|
397
397
|
if (s || vt) {
|
|
398
398
|
let n = s ? s.parent == null || s.ce ? s.vnode.appContext && s.vnode.appContext.provides : s.parent.provides : void 0;
|
|
399
399
|
if (n && i in n)
|
|
400
400
|
return n[i];
|
|
401
401
|
if (arguments.length > 1)
|
|
402
|
-
return t &&
|
|
402
|
+
return t && M(e) ? e.call(s && s.proxy) : e;
|
|
403
403
|
process.env.NODE_ENV !== "production" && _(`injection "${String(i)}" not found.`);
|
|
404
404
|
} else process.env.NODE_ENV !== "production" && _("inject() can only be used inside setup() or functional components.");
|
|
405
405
|
}
|
|
406
406
|
const mt = (i) => i.__isTeleport;
|
|
407
|
-
function
|
|
408
|
-
i.shapeFlag & 6 && i.component ? (i.transition = e,
|
|
407
|
+
function Me(i, e) {
|
|
408
|
+
i.shapeFlag & 6 && i.component ? (i.transition = e, Me(i.component.subTree, e)) : i.shapeFlag & 128 ? (i.ssContent.transition = e.clone(i.ssContent), i.ssFallback.transition = e.clone(i.ssFallback)) : i.transition = e;
|
|
409
409
|
}
|
|
410
410
|
// @__NO_SIDE_EFFECTS__
|
|
411
411
|
function ht(i, e) {
|
|
412
|
-
return
|
|
412
|
+
return M(i) ? (
|
|
413
413
|
// #8236: extend call and options.name access are considered side-effects
|
|
414
414
|
// by Rollup, so we have to wrap it in a pure-annotated IIFE.
|
|
415
415
|
z({ name: i.name }, e, { setup: i })
|
|
@@ -418,10 +418,10 @@ function ht(i, e) {
|
|
|
418
418
|
Q().requestIdleCallback;
|
|
419
419
|
Q().cancelIdleCallback;
|
|
420
420
|
const pt = (i) => !!i.type.__asyncLoader, gt = /* @__PURE__ */ Symbol.for("v-ndc");
|
|
421
|
-
function
|
|
422
|
-
if (
|
|
421
|
+
function bt(i, e, t = {}, s, n) {
|
|
422
|
+
if (I.ce || I.parent && pt(I.parent) && I.parent.ce) {
|
|
423
423
|
const h = Object.keys(t).length > 0;
|
|
424
|
-
return ge(),
|
|
424
|
+
return ge(), be(
|
|
425
425
|
q,
|
|
426
426
|
null,
|
|
427
427
|
[fe("slot", t, s)],
|
|
@@ -434,7 +434,7 @@ function yt(i, e, t = {}, s, n) {
|
|
|
434
434
|
), o = () => []), o && o._c && (o._d = !1), ge();
|
|
435
435
|
const a = o && Ne(o(t)), r = t.key || // slot content array of a dynamic conditional slot may have a branch
|
|
436
436
|
// key attached in the `createSlots` helper, respect that
|
|
437
|
-
a && a.key, c =
|
|
437
|
+
a && a.key, c = be(
|
|
438
438
|
q,
|
|
439
439
|
{
|
|
440
440
|
key: (r && !xe(r) ? r : `_${e}`) + // #7256 force differentiate fallback content from actual content
|
|
@@ -448,24 +448,24 @@ function yt(i, e, t = {}, s, n) {
|
|
|
448
448
|
function Ne(i) {
|
|
449
449
|
return i.some((e) => Oe(e) ? !(e.type === Te || e.type === q && !Ne(e.children)) : !0) ? i : null;
|
|
450
450
|
}
|
|
451
|
-
const
|
|
452
|
-
process.env.NODE_ENV !== "production" && (
|
|
451
|
+
const yt = {};
|
|
452
|
+
process.env.NODE_ENV !== "production" && (yt.ownKeys = (i) => (_(
|
|
453
453
|
"Avoid app logic that relies on enumerating keys on a component instance. The keys will be empty in production mode to avoid performance overhead."
|
|
454
454
|
), Reflect.ownKeys(i)));
|
|
455
455
|
let vt = null;
|
|
456
456
|
const wt = {}, Re = (i) => Object.getPrototypeOf(i) === wt, xt = (i) => i.__isSuspense, q = /* @__PURE__ */ Symbol.for("v-fgt"), Ct = /* @__PURE__ */ Symbol.for("v-txt"), Te = /* @__PURE__ */ Symbol.for("v-cmt"), Y = [];
|
|
457
|
-
let
|
|
457
|
+
let k = null;
|
|
458
458
|
function ge(i = !1) {
|
|
459
|
-
Y.push(
|
|
459
|
+
Y.push(k = i ? null : []);
|
|
460
460
|
}
|
|
461
461
|
function St() {
|
|
462
|
-
Y.pop(),
|
|
462
|
+
Y.pop(), k = Y[Y.length - 1] || null;
|
|
463
463
|
}
|
|
464
|
-
function
|
|
465
|
-
return i.dynamicChildren =
|
|
464
|
+
function kt(i) {
|
|
465
|
+
return i.dynamicChildren = k || ze, St(), k && k.push(i), i;
|
|
466
466
|
}
|
|
467
|
-
function
|
|
468
|
-
return
|
|
467
|
+
function be(i, e, t, s, n) {
|
|
468
|
+
return kt(
|
|
469
469
|
fe(
|
|
470
470
|
i,
|
|
471
471
|
e,
|
|
@@ -479,13 +479,13 @@ function ye(i, e, t, s, n) {
|
|
|
479
479
|
function Oe(i) {
|
|
480
480
|
return i ? i.__v_isVNode === !0 : !1;
|
|
481
481
|
}
|
|
482
|
-
const
|
|
482
|
+
const Et = (...i) => Fe(
|
|
483
483
|
...i
|
|
484
484
|
), $e = ({ key: i }) => i ?? null, G = ({
|
|
485
485
|
ref: i,
|
|
486
486
|
ref_key: e,
|
|
487
487
|
ref_for: t
|
|
488
|
-
}) => (typeof i == "number" && (i = "" + i), i != null ? R(i) || de(i) ||
|
|
488
|
+
}) => (typeof i == "number" && (i = "" + i), i != null ? R(i) || de(i) || M(i) ? { i: I, r: i, k: e, f: !!t } : i : null);
|
|
489
489
|
function _t(i, e = null, t = null, s = 0, n = null, o = i === q ? 0 : 1, a = !1, r = !1) {
|
|
490
490
|
const c = {
|
|
491
491
|
__v_isVNode: !0,
|
|
@@ -514,19 +514,19 @@ function _t(i, e = null, t = null, s = 0, n = null, o = i === q ? 0 : 1, a = !1,
|
|
|
514
514
|
dynamicProps: n,
|
|
515
515
|
dynamicChildren: null,
|
|
516
516
|
appContext: null,
|
|
517
|
-
ctx:
|
|
517
|
+
ctx: I
|
|
518
518
|
};
|
|
519
519
|
return r ? (me(c, t), o & 128 && i.normalize(c)) : t && (c.shapeFlag |= R(t) ? 8 : 16), process.env.NODE_ENV !== "production" && c.key !== c.key && _("VNode created with invalid key (NaN). VNode type:", c.type), // avoid a block node from tracking itself
|
|
520
520
|
!a && // has current parent block
|
|
521
|
-
|
|
521
|
+
k && // presence of a patch flag indicates this node needs patching on updates.
|
|
522
522
|
// component nodes also should always be patched, because even if the
|
|
523
523
|
// component doesn't need to update, it needs to persist the instance on to
|
|
524
524
|
// the next vnode so that it can be properly unmounted later.
|
|
525
525
|
(c.patchFlag > 0 || o & 6) && // the EVENTS flag is only for hydration and if it is the only flag, the
|
|
526
526
|
// vnode should not be considered dynamic due to handler caching.
|
|
527
|
-
c.patchFlag !== 32 &&
|
|
527
|
+
c.patchFlag !== 32 && k.push(c), c;
|
|
528
528
|
}
|
|
529
|
-
const fe = process.env.NODE_ENV !== "production" ?
|
|
529
|
+
const fe = process.env.NODE_ENV !== "production" ? Et : Fe;
|
|
530
530
|
function Fe(i, e = null, t = null, s = 0, n = null, o = !1) {
|
|
531
531
|
if ((!i || i === gt) && (process.env.NODE_ENV !== "production" && !i && _(`Invalid vnode type when creating vnode: ${i}.`), i = Te), Oe(i)) {
|
|
532
532
|
const r = X(
|
|
@@ -535,14 +535,14 @@ function Fe(i, e = null, t = null, s = 0, n = null, o = !1) {
|
|
|
535
535
|
!0
|
|
536
536
|
/* mergeRef: true */
|
|
537
537
|
);
|
|
538
|
-
return t && me(r, t), !o &&
|
|
538
|
+
return t && me(r, t), !o && k && (r.shapeFlag & 6 ? k[k.indexOf(i)] = r : k.push(r)), r.patchFlag = -2, r;
|
|
539
539
|
}
|
|
540
540
|
if (De(i) && (i = i.__vccOpts), e) {
|
|
541
541
|
e = At(e);
|
|
542
542
|
let { class: r, style: c } = e;
|
|
543
|
-
r && !R(r) && (e.class = ce(r)), T(c) && (oe(c) && !
|
|
543
|
+
r && !R(r) && (e.class = ce(r)), T(c) && (oe(c) && !E(c) && (c = z({}, c)), e.style = le(c));
|
|
544
544
|
}
|
|
545
|
-
const a = R(i) ? 1 : xt(i) ? 128 : mt(i) ? 64 : T(i) ? 4 :
|
|
545
|
+
const a = R(i) ? 1 : xt(i) ? 128 : mt(i) ? 64 : T(i) ? 4 : M(i) ? 2 : 0;
|
|
546
546
|
return process.env.NODE_ENV !== "production" && a & 4 && oe(i) && (i = O(i), _(
|
|
547
547
|
"Vue received a Component that was made a reactive object. This can lead to unnecessary performance overhead and should be avoided by marking the component with `markRaw` or using `shallowRef` instead of `ref`.",
|
|
548
548
|
`
|
|
@@ -563,7 +563,7 @@ function At(i) {
|
|
|
563
563
|
return i ? oe(i) || Re(i) ? z({}, i) : i : null;
|
|
564
564
|
}
|
|
565
565
|
function X(i, e, t = !1, s = !1) {
|
|
566
|
-
const { props: n, ref: o, patchFlag: a, children: r, transition: c } = i, h = e ?
|
|
566
|
+
const { props: n, ref: o, patchFlag: a, children: r, transition: c } = i, h = e ? It(n || {}, e) : n, d = {
|
|
567
567
|
__v_isVNode: !0,
|
|
568
568
|
__v_skip: !0,
|
|
569
569
|
type: i.type,
|
|
@@ -573,11 +573,11 @@ function X(i, e, t = !1, s = !1) {
|
|
|
573
573
|
// #2078 in the case of <component :is="vnode" ref="extra"/>
|
|
574
574
|
// if the vnode itself already has a ref, cloneVNode will need to merge
|
|
575
575
|
// the refs so the single vnode can be set on multiple refs
|
|
576
|
-
t && o ?
|
|
576
|
+
t && o ? E(o) ? o.concat(G(e)) : [o, G(e)] : G(e)
|
|
577
577
|
) : o,
|
|
578
578
|
scopeId: i.scopeId,
|
|
579
579
|
slotScopeIds: i.slotScopeIds,
|
|
580
|
-
children: process.env.NODE_ENV !== "production" && a === -1 &&
|
|
580
|
+
children: process.env.NODE_ENV !== "production" && a === -1 && E(r) ? r.map(He) : r,
|
|
581
581
|
target: i.target,
|
|
582
582
|
targetStart: i.targetStart,
|
|
583
583
|
targetAnchor: i.targetAnchor,
|
|
@@ -607,14 +607,14 @@ function X(i, e, t = !1, s = !1) {
|
|
|
607
607
|
ctx: i.ctx,
|
|
608
608
|
ce: i.ce
|
|
609
609
|
};
|
|
610
|
-
return c && s &&
|
|
610
|
+
return c && s && Me(
|
|
611
611
|
d,
|
|
612
612
|
c.clone(d)
|
|
613
613
|
), d;
|
|
614
614
|
}
|
|
615
615
|
function He(i) {
|
|
616
616
|
const e = X(i);
|
|
617
|
-
return
|
|
617
|
+
return E(i.children) && (e.children = i.children.map(He)), e;
|
|
618
618
|
}
|
|
619
619
|
function Lt(i = " ", e = 0) {
|
|
620
620
|
return fe(Ct, null, i, e);
|
|
@@ -624,7 +624,7 @@ function me(i, e) {
|
|
|
624
624
|
const { shapeFlag: s } = i;
|
|
625
625
|
if (e == null)
|
|
626
626
|
e = null;
|
|
627
|
-
else if (
|
|
627
|
+
else if (E(e))
|
|
628
628
|
t = 16;
|
|
629
629
|
else if (typeof e == "object")
|
|
630
630
|
if (s & 65) {
|
|
@@ -632,11 +632,11 @@ function me(i, e) {
|
|
|
632
632
|
n && (n._c && (n._d = !1), me(i, n()), n._c && (n._d = !0));
|
|
633
633
|
return;
|
|
634
634
|
} else
|
|
635
|
-
t = 32, !e._ && !Re(e) && (e._ctx =
|
|
636
|
-
else
|
|
635
|
+
t = 32, !e._ && !Re(e) && (e._ctx = I);
|
|
636
|
+
else M(e) ? (e = { default: e, _ctx: I }, t = 32) : (e = String(e), s & 64 ? (t = 16, e = [Lt(e)]) : t = 8);
|
|
637
637
|
i.children = e, i.shapeFlag |= t;
|
|
638
638
|
}
|
|
639
|
-
function
|
|
639
|
+
function It(...i) {
|
|
640
640
|
const e = {};
|
|
641
641
|
for (let t = 0; t < i.length; t++) {
|
|
642
642
|
const s = i[t];
|
|
@@ -647,13 +647,13 @@ function Mt(...i) {
|
|
|
647
647
|
e.style = le([e.style, s.style]);
|
|
648
648
|
else if (Be(n)) {
|
|
649
649
|
const o = e[n], a = s[n];
|
|
650
|
-
a && o !== a && !(
|
|
650
|
+
a && o !== a && !(E(o) && o.includes(a)) && (e[n] = o ? [].concat(o, a) : a);
|
|
651
651
|
} else n !== "" && (e[n] = s[n]);
|
|
652
652
|
}
|
|
653
653
|
return e;
|
|
654
654
|
}
|
|
655
655
|
let L = null;
|
|
656
|
-
const
|
|
656
|
+
const Mt = () => L || I;
|
|
657
657
|
{
|
|
658
658
|
const i = Q(), e = (t, s) => {
|
|
659
659
|
let n;
|
|
@@ -672,7 +672,7 @@ const It = () => L || M;
|
|
|
672
672
|
process.env.NODE_ENV;
|
|
673
673
|
const Nt = /(?:^|[-_])\w/g, Rt = (i) => i.replace(Nt, (e) => e.toUpperCase()).replace(/[-_]/g, "");
|
|
674
674
|
function Pe(i, e = !0) {
|
|
675
|
-
return
|
|
675
|
+
return M(i) ? i.displayName || i.name : i.name || e && i.__name;
|
|
676
676
|
}
|
|
677
677
|
function Ve(i, e, t = !1) {
|
|
678
678
|
let s = Pe(e);
|
|
@@ -693,7 +693,7 @@ function Ve(i, e, t = !1) {
|
|
|
693
693
|
return s ? Rt(s) : t ? "App" : "Anonymous";
|
|
694
694
|
}
|
|
695
695
|
function De(i) {
|
|
696
|
-
return
|
|
696
|
+
return M(i) && "__vccOpts" in i;
|
|
697
697
|
}
|
|
698
698
|
function Tt() {
|
|
699
699
|
if (process.env.NODE_ENV === "production" || typeof window > "u")
|
|
@@ -754,8 +754,8 @@ function Tt() {
|
|
|
754
754
|
l.type.props && l.props && f.push(a("props", O(l.props))), l.setupState !== se && f.push(a("setup", l.setupState)), l.data !== se && f.push(a("data", O(l.data)));
|
|
755
755
|
const m = c(l, "computed");
|
|
756
756
|
m && f.push(a("computed", m));
|
|
757
|
-
const
|
|
758
|
-
return
|
|
757
|
+
const b = c(l, "inject");
|
|
758
|
+
return b && f.push(a("injected", b)), f.push([
|
|
759
759
|
"div",
|
|
760
760
|
{},
|
|
761
761
|
[
|
|
@@ -798,16 +798,16 @@ function Tt() {
|
|
|
798
798
|
}
|
|
799
799
|
function c(l, f) {
|
|
800
800
|
const m = l.type;
|
|
801
|
-
if (
|
|
801
|
+
if (M(m))
|
|
802
802
|
return;
|
|
803
|
-
const
|
|
803
|
+
const b = {};
|
|
804
804
|
for (const u in l.ctx)
|
|
805
|
-
h(m, u, f) && (
|
|
806
|
-
return
|
|
805
|
+
h(m, u, f) && (b[u] = l.ctx[u]);
|
|
806
|
+
return b;
|
|
807
807
|
}
|
|
808
808
|
function h(l, f, m) {
|
|
809
|
-
const
|
|
810
|
-
if (
|
|
809
|
+
const b = l[m];
|
|
810
|
+
if (E(b) && b.includes(f) || T(b) && f in b || l.extends && h(l.extends, f, m) || l.mixins && l.mixins.some((u) => h(u, f, m)))
|
|
811
811
|
return !0;
|
|
812
812
|
}
|
|
813
813
|
function d(l) {
|
|
@@ -827,7 +827,7 @@ function Ot() {
|
|
|
827
827
|
Tt();
|
|
828
828
|
}
|
|
829
829
|
process.env.NODE_ENV !== "production" && Ot();
|
|
830
|
-
class
|
|
830
|
+
class ye {
|
|
831
831
|
constructor(e) {
|
|
832
832
|
this.endpoint = e || "https://foisit-ninja.netlify.app/.netlify/functions/intent";
|
|
833
833
|
}
|
|
@@ -861,10 +861,10 @@ class be {
|
|
|
861
861
|
class $t {
|
|
862
862
|
constructor(e = !0) {
|
|
863
863
|
if (this.commands = /* @__PURE__ */ new Map(), this.openAIService = null, this.context = null, this.pendingConfirmation = null, this.enableSmartIntent = !0, this.selectOptionsCache = /* @__PURE__ */ new Map(), typeof e == "boolean") {
|
|
864
|
-
this.enableSmartIntent = e, this.enableSmartIntent && (this.openAIService = new
|
|
864
|
+
this.enableSmartIntent = e, this.enableSmartIntent && (this.openAIService = new ye());
|
|
865
865
|
return;
|
|
866
866
|
}
|
|
867
|
-
this.enableSmartIntent = e.enableSmartIntent ?? !0, this.enableSmartIntent && (this.openAIService = new
|
|
867
|
+
this.enableSmartIntent = e.enableSmartIntent ?? !0, this.enableSmartIntent && (this.openAIService = new ye(e.intentEndpoint));
|
|
868
868
|
}
|
|
869
869
|
/** Add a new command (string or object) */
|
|
870
870
|
addCommand(e, t) {
|
|
@@ -891,7 +891,7 @@ class $t {
|
|
|
891
891
|
if (this.isStructured(e)) {
|
|
892
892
|
const c = String(e.commandId), h = e.params ?? {}, d = this.getCommandById(c);
|
|
893
893
|
if (!d) return { message: "That command is not available.", type: "error" };
|
|
894
|
-
const l = this.sanitizeParamsForCommand(d, h), m = (d.parameters ?? []).filter((
|
|
894
|
+
const l = this.sanitizeParamsForCommand(d, h), m = (d.parameters ?? []).filter((b) => b.required).filter((b) => l[b.name] == null || l[b.name] === "");
|
|
895
895
|
return m.length > 0 ? (this.context = { commandId: this.getCommandIdentifier(d), params: l }, {
|
|
896
896
|
message: `Please provide the required details for "${d.command}".`,
|
|
897
897
|
type: "form",
|
|
@@ -1504,8 +1504,14 @@ class Bt {
|
|
|
1504
1504
|
* - `showInvocation`: if true, show the invocation as a user message
|
|
1505
1505
|
*/
|
|
1506
1506
|
async runCommand(e) {
|
|
1507
|
-
if (!e || !e.commandId)
|
|
1508
|
-
|
|
1507
|
+
if (!e || !e.commandId)
|
|
1508
|
+
throw new Error("runCommand requires a commandId");
|
|
1509
|
+
const {
|
|
1510
|
+
commandId: t,
|
|
1511
|
+
params: s,
|
|
1512
|
+
openOverlay: n = !0,
|
|
1513
|
+
showInvocation: o = !0
|
|
1514
|
+
} = e;
|
|
1509
1515
|
n && !this.isOpen && this.toggle();
|
|
1510
1516
|
const a = this.commandHandlers.get(t);
|
|
1511
1517
|
if (a && o && this.messagesContainer && this.addMessage(`Command: ${t}`, "user"), a)
|
|
@@ -1523,7 +1529,10 @@ class Bt {
|
|
|
1523
1529
|
else r == null || this.addMessage(String(r), "system");
|
|
1524
1530
|
return r;
|
|
1525
1531
|
} catch (r) {
|
|
1526
|
-
throw this.hideLoading(), this.addMessage(
|
|
1532
|
+
throw this.hideLoading(), this.addMessage(
|
|
1533
|
+
`Command "${t}" failed: ${String(r)}`,
|
|
1534
|
+
"system"
|
|
1535
|
+
), r;
|
|
1527
1536
|
}
|
|
1528
1537
|
if (this.externalCommandExecutor)
|
|
1529
1538
|
try {
|
|
@@ -1531,9 +1540,15 @@ class Bt {
|
|
|
1531
1540
|
const r = await this.externalCommandExecutor({ commandId: t, params: s });
|
|
1532
1541
|
return this.hideLoading(), r;
|
|
1533
1542
|
} catch (r) {
|
|
1534
|
-
throw this.hideLoading(), this.addMessage(
|
|
1535
|
-
|
|
1536
|
-
|
|
1543
|
+
throw this.hideLoading(), this.addMessage(
|
|
1544
|
+
`Command "${t}" failed: ${String(r)}`,
|
|
1545
|
+
"system"
|
|
1546
|
+
), r;
|
|
1547
|
+
}
|
|
1548
|
+
this.addMessage(
|
|
1549
|
+
`No handler registered for command "${t}".`,
|
|
1550
|
+
"system"
|
|
1551
|
+
);
|
|
1537
1552
|
}
|
|
1538
1553
|
init() {
|
|
1539
1554
|
var t, s;
|
|
@@ -1541,7 +1556,13 @@ class Bt {
|
|
|
1541
1556
|
this.injectOverlayStyles();
|
|
1542
1557
|
const e = document.getElementById("foisit-overlay-container");
|
|
1543
1558
|
if (e && e instanceof HTMLElement) {
|
|
1544
|
-
this.container = e, this.chatWindow = e.querySelector(
|
|
1559
|
+
this.container = e, this.chatWindow = e.querySelector(
|
|
1560
|
+
".foisit-chat"
|
|
1561
|
+
), this.messagesContainer = e.querySelector(
|
|
1562
|
+
".foisit-messages"
|
|
1563
|
+
), this.input = e.querySelector(
|
|
1564
|
+
"input.foisit-input"
|
|
1565
|
+
), ((t = this.config.floatingButton) == null ? void 0 : t.visible) !== !1 && !e.querySelector(".foisit-floating-btn") && this.renderFloatingButton(), this.chatWindow || this.renderChatWindow(), this.config.enableGestureActivation && (this.gestureHandler = new ae(), this.gestureHandler.setupTripleTapListener(() => this.toggle()));
|
|
1545
1566
|
return;
|
|
1546
1567
|
}
|
|
1547
1568
|
this.container = document.createElement("div"), this.container.id = "foisit-overlay-container", this.container.className = "foisit-overlay-container", document.body.appendChild(this.container), ((s = this.config.floatingButton) == null ? void 0 : s.visible) !== !1 && this.renderFloatingButton(), this.renderChatWindow(), this.config.enableGestureActivation && (this.gestureHandler = new ae(), this.gestureHandler.setupTripleTapListener(() => this.toggle()));
|
|
@@ -1642,47 +1663,53 @@ class Bt {
|
|
|
1642
1663
|
v.value = "", v.textContent = "Select...", u.appendChild(v);
|
|
1643
1664
|
const x = (p) => {
|
|
1644
1665
|
(p ?? []).forEach((C) => {
|
|
1645
|
-
const
|
|
1646
|
-
|
|
1666
|
+
const y = document.createElement("option");
|
|
1667
|
+
y.value = String(C.value ?? C.label ?? ""), y.textContent = String(C.label ?? C.value ?? ""), u.appendChild(y);
|
|
1647
1668
|
});
|
|
1648
1669
|
};
|
|
1649
1670
|
if (Array.isArray(d.options) && d.options.length)
|
|
1650
1671
|
x(d.options);
|
|
1651
1672
|
else if (typeof d.getOptions == "function") {
|
|
1652
1673
|
const p = d.getOptions, C = document.createElement("option");
|
|
1653
|
-
C.value = "", C.textContent = "Loading...", u.appendChild(C), Promise.resolve().then(() => p()).then((
|
|
1674
|
+
C.value = "", C.textContent = "Loading...", u.appendChild(C), Promise.resolve().then(() => p()).then((y) => {
|
|
1654
1675
|
for (; u.options.length > 1; ) u.remove(1);
|
|
1655
|
-
x(
|
|
1676
|
+
x(y);
|
|
1656
1677
|
}).catch(() => {
|
|
1657
1678
|
for (; u.options.length > 1; ) u.remove(1);
|
|
1658
|
-
const
|
|
1659
|
-
|
|
1679
|
+
const y = document.createElement("option");
|
|
1680
|
+
y.value = "", y.textContent = "Error loading options", u.appendChild(y);
|
|
1660
1681
|
});
|
|
1661
1682
|
}
|
|
1662
1683
|
d.defaultValue != null && (u.value = String(d.defaultValue)), m = u;
|
|
1663
1684
|
} else if (d.type === "file") {
|
|
1664
1685
|
const u = d, v = document.createElement("input");
|
|
1665
1686
|
v.className = "foisit-form-input", v.type = "file", u.accept && Array.isArray(u.accept) && (v.accept = u.accept.join(",")), u.multiple && (v.multiple = !0), u.capture && (u.capture === !0 ? v.setAttribute("capture", "") : v.setAttribute("capture", String(u.capture))), v.addEventListener("change", async () => {
|
|
1666
|
-
const x = Array.from(v.files || []), p =
|
|
1687
|
+
const x = Array.from(v.files || []), p = b;
|
|
1667
1688
|
if (p.style.display = "none", p.textContent = "", x.length === 0) return;
|
|
1668
1689
|
const C = u.maxFiles ?? (u.multiple ? 10 : 1);
|
|
1669
1690
|
if (x.length > C) {
|
|
1670
1691
|
p.textContent = `Please select at most ${C} file(s).`, p.style.display = "block";
|
|
1671
1692
|
return;
|
|
1672
1693
|
}
|
|
1673
|
-
const
|
|
1674
|
-
if (x.some((w) => w.size >
|
|
1675
|
-
p.textContent = `One or more files exceed the maximum size of ${Math.round(
|
|
1694
|
+
const y = u.maxSizeBytes ?? 1 / 0, g = x.reduce((w, B) => w + B.size, 0);
|
|
1695
|
+
if (x.some((w) => w.size > y)) {
|
|
1696
|
+
p.textContent = `One or more files exceed the maximum size of ${Math.round(
|
|
1697
|
+
y / 1024
|
|
1698
|
+
)} KB.`, p.style.display = "block";
|
|
1676
1699
|
return;
|
|
1677
1700
|
}
|
|
1678
1701
|
const V = u.maxTotalBytes ?? 1 / 0;
|
|
1679
1702
|
if (g > V) {
|
|
1680
|
-
p.textContent = `Total selected files exceed the maximum of ${Math.round(
|
|
1703
|
+
p.textContent = `Total selected files exceed the maximum of ${Math.round(
|
|
1704
|
+
V / 1024
|
|
1705
|
+
)} KB.`, p.style.display = "block";
|
|
1681
1706
|
return;
|
|
1682
1707
|
}
|
|
1683
1708
|
if (u.accept && Array.isArray(u.accept)) {
|
|
1684
1709
|
const w = u.accept;
|
|
1685
|
-
if (!x.every((U) => U.type ? w.some(
|
|
1710
|
+
if (!x.every((U) => U.type ? w.some(
|
|
1711
|
+
(W) => W.startsWith(".") ? U.name.toLowerCase().endsWith(W.toLowerCase()) : U.type === W || U.type.startsWith(W.split("/")[0] + "/")
|
|
1712
|
+
) : !0)) {
|
|
1686
1713
|
p.textContent = "One or more files have an unsupported type.", p.style.display = "block";
|
|
1687
1714
|
return;
|
|
1688
1715
|
}
|
|
@@ -1692,8 +1719,8 @@ class Bt {
|
|
|
1692
1719
|
const u = document.createElement("input");
|
|
1693
1720
|
u.className = "foisit-form-input", d.type === "string" && (u.placeholder = d.placeholder || "Type here..."), d.type === "number" ? (u.type = "number", typeof d.min == "number" && (u.min = String(d.min)), typeof d.max == "number" && (u.max = String(d.max)), typeof d.step == "number" && (u.step = String(d.step)), d.defaultValue != null && (u.value = String(d.defaultValue))) : d.type === "date" ? (u.type = "date", typeof d.min == "string" && (u.min = d.min), typeof d.max == "string" && (u.max = d.max), d.defaultValue != null && (u.value = String(d.defaultValue))) : (u.type = "text", d.defaultValue != null && (u.value = String(d.defaultValue))), m = u;
|
|
1694
1721
|
}
|
|
1695
|
-
const
|
|
1696
|
-
l.appendChild(m), l.appendChild(
|
|
1722
|
+
const b = r();
|
|
1723
|
+
l.appendChild(m), l.appendChild(b), o.push({
|
|
1697
1724
|
name: d.name,
|
|
1698
1725
|
type: d.type,
|
|
1699
1726
|
el: m,
|
|
@@ -1714,16 +1741,18 @@ class Bt {
|
|
|
1714
1741
|
});
|
|
1715
1742
|
for (const m of o) {
|
|
1716
1743
|
if (m.type === "file") {
|
|
1717
|
-
const x = m.el.parentElement, p = x == null ? void 0 : x.querySelector(
|
|
1718
|
-
|
|
1744
|
+
const x = m.el.parentElement, p = x == null ? void 0 : x.querySelector(
|
|
1745
|
+
".foisit-form-error"
|
|
1746
|
+
), C = m.el, y = Array.from(C.files || []);
|
|
1747
|
+
if (m.required && y.length === 0) {
|
|
1719
1748
|
f = !0, C.classList.add("foisit-error-border"), p && (p.textContent = "This file is required", p.style.display = "block");
|
|
1720
1749
|
continue;
|
|
1721
1750
|
}
|
|
1722
|
-
if (
|
|
1751
|
+
if (y.length === 0) continue;
|
|
1723
1752
|
const g = (t ?? []).find((w) => w.name === m.name), V = (g == null ? void 0 : g.delivery) ?? "file";
|
|
1724
1753
|
if (g != null && g.maxWidth || g != null && g.maxHeight)
|
|
1725
1754
|
try {
|
|
1726
|
-
const w = await this.getImageDimensions(
|
|
1755
|
+
const w = await this.getImageDimensions(y[0]);
|
|
1727
1756
|
if (g.maxWidth && w.width > g.maxWidth) {
|
|
1728
1757
|
f = !0, p && (p.textContent = `Image width must be ≤ ${g.maxWidth}px`, p.style.display = "block");
|
|
1729
1758
|
continue;
|
|
@@ -1736,7 +1765,7 @@ class Bt {
|
|
|
1736
1765
|
}
|
|
1737
1766
|
if (g != null && g.maxDurationSec)
|
|
1738
1767
|
try {
|
|
1739
|
-
const w = await this.getMediaDuration(
|
|
1768
|
+
const w = await this.getMediaDuration(y[0]);
|
|
1740
1769
|
if (w && w > g.maxDurationSec) {
|
|
1741
1770
|
f = !0, p && (p.textContent = `Media duration must be ≤ ${g.maxDurationSec}s`, p.style.display = "block");
|
|
1742
1771
|
continue;
|
|
@@ -1744,10 +1773,12 @@ class Bt {
|
|
|
1744
1773
|
} catch {
|
|
1745
1774
|
}
|
|
1746
1775
|
if (V === "file")
|
|
1747
|
-
l[m.name] = g != null && g.multiple ?
|
|
1776
|
+
l[m.name] = g != null && g.multiple ? y : y[0];
|
|
1748
1777
|
else if (V === "base64")
|
|
1749
1778
|
try {
|
|
1750
|
-
const w = await Promise.all(
|
|
1779
|
+
const w = await Promise.all(
|
|
1780
|
+
y.map((B) => this.readFileAsDataURL(B))
|
|
1781
|
+
);
|
|
1751
1782
|
l[m.name] = g != null && g.multiple ? w : w[0];
|
|
1752
1783
|
} catch {
|
|
1753
1784
|
f = !0, p && (p.textContent = "Failed to encode file(s) to base64.", p.style.display = "block");
|
|
@@ -1755,17 +1786,19 @@ class Bt {
|
|
|
1755
1786
|
}
|
|
1756
1787
|
continue;
|
|
1757
1788
|
}
|
|
1758
|
-
const
|
|
1759
|
-
|
|
1789
|
+
const b = (m.el.value ?? "").toString().trim(), u = m.el.parentElement, v = u == null ? void 0 : u.querySelector(
|
|
1790
|
+
".foisit-form-error"
|
|
1791
|
+
);
|
|
1792
|
+
if (m.required && (b == null || b === "")) {
|
|
1760
1793
|
f = !0, m.el.classList.add("foisit-error-border"), v && (v.textContent = "This field is required", v.style.display = "block");
|
|
1761
1794
|
continue;
|
|
1762
1795
|
}
|
|
1763
|
-
if (
|
|
1796
|
+
if (b !== "")
|
|
1764
1797
|
if (m.type === "number") {
|
|
1765
|
-
const x = Number(
|
|
1798
|
+
const x = Number(b);
|
|
1766
1799
|
Number.isNaN(x) || (l[m.name] = x);
|
|
1767
1800
|
} else
|
|
1768
|
-
l[m.name] =
|
|
1801
|
+
l[m.name] = b;
|
|
1769
1802
|
}
|
|
1770
1803
|
if (f) {
|
|
1771
1804
|
n.classList.add("foisit-shake"), setTimeout(() => n.classList.remove("foisit-shake"), 400);
|
|
@@ -1796,7 +1829,10 @@ class Bt {
|
|
|
1796
1829
|
/** Subtle entrance animation for new messages */
|
|
1797
1830
|
animateMessageEntrance(e, t) {
|
|
1798
1831
|
if (!e) return;
|
|
1799
|
-
e.style.transition = `opacity ${t}ms cubic-bezier(0.22, 0.9, 0.32, 1), transform ${Math.max(
|
|
1832
|
+
e.style.transition = `opacity ${t}ms cubic-bezier(0.22, 0.9, 0.32, 1), transform ${Math.max(
|
|
1833
|
+
120,
|
|
1834
|
+
t
|
|
1835
|
+
)}ms cubic-bezier(0.22, 0.9, 0.32, 1)`, requestAnimationFrame(() => {
|
|
1800
1836
|
e.style.opacity = "1", e.style.transform = "translateY(0)";
|
|
1801
1837
|
});
|
|
1802
1838
|
const s = () => {
|
|
@@ -1840,7 +1876,22 @@ class Bt {
|
|
|
1840
1876
|
/** Simple markdown renderer for AI responses */
|
|
1841
1877
|
renderMarkdown(e) {
|
|
1842
1878
|
let t = this.escapeHtml(e);
|
|
1843
|
-
return t = t.replace(/```(\w*)\n([\s\S]*?)```/g, (s, n, o) => `<pre class="foisit-code-block"><code${n ? ` class="language-${n}"` : ""}>${o.trim()}</code></pre>`), t = t.replace(
|
|
1879
|
+
return t = t.replace(/```(\w*)\n([\s\S]*?)```/g, (s, n, o) => `<pre class="foisit-code-block"><code${n ? ` class="language-${n}"` : ""}>${o.trim()}</code></pre>`), t = t.replace(
|
|
1880
|
+
/`([^`]+)`/g,
|
|
1881
|
+
'<code class="foisit-inline-code">$1</code>'
|
|
1882
|
+
), t = t.replace(/^###### (.+)$/gm, '<h6 class="foisit-md-h6">$1</h6>'), t = t.replace(/^##### (.+)$/gm, '<h5 class="foisit-md-h5">$1</h5>'), t = t.replace(/^#### (.+)$/gm, '<h4 class="foisit-md-h4">$1</h4>'), t = t.replace(/^### (.+)$/gm, '<h3 class="foisit-md-h3">$1</h3>'), t = t.replace(/^## (.+)$/gm, '<h2 class="foisit-md-h2">$1</h2>'), t = t.replace(/^# (.+)$/gm, '<h1 class="foisit-md-h1">$1</h1>'), t = t.replace(/\*\*([^*]+)\*\*/g, "<strong>$1</strong>"), t = t.replace(/__([^_]+)__/g, "<strong>$1</strong>"), t = t.replace(/\*([^*]+)\*/g, "<em>$1</em>"), t = t.replace(new RegExp("(?<!_)_([^_]+)_(?!_)", "g"), "<em>$1</em>"), t = t.replace(/~~([^~]+)~~/g, "<del>$1</del>"), t = t.replace(
|
|
1883
|
+
/\[([^\]]+)\]\(([^)]+)\)/g,
|
|
1884
|
+
'<a href="$2" target="_blank" rel="noopener noreferrer" class="foisit-md-link">$1</a>'
|
|
1885
|
+
), t = t.replace(/^[\-\*] (.+)$/gm, '<li class="foisit-md-li">$1</li>'), t = t.replace(
|
|
1886
|
+
/(<li class="foisit-md-li">.*<\/li>\n?)+/g,
|
|
1887
|
+
(s) => `<ul class="foisit-md-ul">${s}</ul>`
|
|
1888
|
+
), t = t.replace(/^\d+\. (.+)$/gm, '<li class="foisit-md-li">$1</li>'), t = t.replace(
|
|
1889
|
+
new RegExp('(?<!<\\/ul>)(<li class="foisit-md-li">.*<\\/li>\\n?)+', "g"),
|
|
1890
|
+
(s) => s.includes("<ul") ? s : `<ol class="foisit-md-ol">${s}</ol>`
|
|
1891
|
+
), t = t.replace(
|
|
1892
|
+
/^> (.+)$/gm,
|
|
1893
|
+
'<blockquote class="foisit-md-blockquote">$1</blockquote>'
|
|
1894
|
+
), t = t.replace(/^(---|___|\*\*\*)$/gm, '<hr class="foisit-md-hr">'), t = t.replace(/\n\n+/g, '</p><p class="foisit-md-p">'), t = t.replace(/\n/g, "<br>"), t.match(/^<(h[1-6]|ul|ol|pre|blockquote|hr|p)/) || (t = `<p class="foisit-md-p">${t}</p>`), t;
|
|
1844
1895
|
}
|
|
1845
1896
|
readFileAsDataURL(e) {
|
|
1846
1897
|
return new Promise((t, s) => {
|
|
@@ -1853,7 +1904,10 @@ class Bt {
|
|
|
1853
1904
|
try {
|
|
1854
1905
|
const s = URL.createObjectURL(e), n = new Image();
|
|
1855
1906
|
n.onload = () => {
|
|
1856
|
-
const o = {
|
|
1907
|
+
const o = {
|
|
1908
|
+
width: n.naturalWidth || n.width,
|
|
1909
|
+
height: n.naturalHeight || n.height
|
|
1910
|
+
};
|
|
1857
1911
|
URL.revokeObjectURL(s), t(o);
|
|
1858
1912
|
}, n.onerror = () => {
|
|
1859
1913
|
URL.revokeObjectURL(s), t({ width: 0, height: 0 });
|
|
@@ -1887,57 +1941,93 @@ class Bt {
|
|
|
1887
1941
|
injectOverlayStyles() {
|
|
1888
1942
|
if (document.getElementById("foisit-overlay-styles")) return;
|
|
1889
1943
|
const e = document.createElement("style");
|
|
1890
|
-
e.id = "foisit-overlay-styles"
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1944
|
+
e.id = "foisit-overlay-styles";
|
|
1945
|
+
const t = this.config.theme || "glass", s = this.config.themeColors || {};
|
|
1946
|
+
if (t === "solid") {
|
|
1947
|
+
const n = s.background || "#1a1a2e", o = s.text || "#ffffff", a = s.accent || "linear-gradient(135deg, #667eea 0%, #764ba2 100%)", r = s.userBubbleBg || "rgba(102, 126, 234, 0.2)", c = s.systemBubbleBg || "rgba(255, 255, 255, 0.08)", h = s.border || "rgba(255, 255, 255, 0.1)";
|
|
1948
|
+
e.textContent = `
|
|
1949
|
+
:root {
|
|
1950
|
+
/* SOLID THEME - Custom Colors */
|
|
1951
|
+
--foisit-bg: ${n};
|
|
1952
|
+
--foisit-border: 1px solid ${h};
|
|
1953
|
+
--foisit-shadow: 0 16px 48px rgba(0, 0, 0, 0.4);
|
|
1954
|
+
--foisit-text: ${o};
|
|
1955
|
+
--foisit-accent: ${a};
|
|
1956
|
+
--foisit-backdrop: none;
|
|
1902
1957
|
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1958
|
+
/* Input */
|
|
1959
|
+
--foisit-input-color: ${o};
|
|
1960
|
+
--foisit-input-placeholder: ${o}99;
|
|
1906
1961
|
|
|
1907
|
-
|
|
1908
|
-
|
|
1962
|
+
/* Bubbles */
|
|
1963
|
+
--foisit-bubble-user-bg: ${r};
|
|
1964
|
+
--foisit-bubble-user-text: ${o};
|
|
1909
1965
|
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
--foisit-error-text: #dc2626;
|
|
1913
|
-
--foisit-error-border: #fca5a5;
|
|
1914
|
-
}
|
|
1966
|
+
--foisit-bubble-sys-bg: ${c};
|
|
1967
|
+
--foisit-bubble-sys-text: ${o}ee;
|
|
1915
1968
|
|
|
1916
|
-
|
|
1969
|
+
/* Form Colors */
|
|
1970
|
+
--foisit-req-star: #f87171;
|
|
1971
|
+
--foisit-error-text: #fca5a5;
|
|
1972
|
+
--foisit-error-border: #f87171;
|
|
1973
|
+
}
|
|
1974
|
+
`;
|
|
1975
|
+
} else
|
|
1976
|
+
e.textContent = `
|
|
1917
1977
|
:root {
|
|
1918
|
-
/*
|
|
1919
|
-
|
|
1920
|
-
--foisit-
|
|
1921
|
-
--foisit-
|
|
1922
|
-
--foisit-
|
|
1978
|
+
/* LIGHT MODE (Default) - Smoother gradient */
|
|
1979
|
+
/* Changed: Softer, right-focused radial highlight to avoid a heavy white bottom */
|
|
1980
|
+
--foisit-bg: radial-gradient(ellipse at 75% 30%, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.03));
|
|
1981
|
+
--foisit-border: 1px solid rgba(255, 255, 255, 0.25);
|
|
1982
|
+
--foisit-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
|
|
1983
|
+
--foisit-text: #333;
|
|
1984
|
+
--foisit-backdrop: blur(20px);
|
|
1923
1985
|
|
|
1924
1986
|
/* Input */
|
|
1925
|
-
--foisit-input-color:
|
|
1926
|
-
--foisit-input-placeholder: rgba(
|
|
1987
|
+
--foisit-input-color: #333;
|
|
1988
|
+
--foisit-input-placeholder: rgba(60, 60, 67, 0.6);
|
|
1927
1989
|
|
|
1928
1990
|
/* Bubbles */
|
|
1929
|
-
--foisit-bubble-user-bg: rgba(
|
|
1930
|
-
--foisit-bubble-user-text:
|
|
1991
|
+
--foisit-bubble-user-bg: rgba(0, 0, 0, 0.04);
|
|
1992
|
+
--foisit-bubble-user-text: #333;
|
|
1931
1993
|
|
|
1932
|
-
--foisit-bubble-sys-bg: rgba(255, 255, 255, 0.
|
|
1933
|
-
--foisit-bubble-sys-text:
|
|
1994
|
+
--foisit-bubble-sys-bg: rgba(255, 255, 255, 0.45);
|
|
1995
|
+
--foisit-bubble-sys-text: #333;
|
|
1934
1996
|
|
|
1935
1997
|
/* Form Colors */
|
|
1936
|
-
--foisit-req-star: #
|
|
1937
|
-
--foisit-error-text: #
|
|
1938
|
-
--foisit-error-border: #
|
|
1998
|
+
--foisit-req-star: #ef4444; /* Red asterisk */
|
|
1999
|
+
--foisit-error-text: #dc2626;
|
|
2000
|
+
--foisit-error-border: #fca5a5;
|
|
1939
2001
|
}
|
|
1940
|
-
|
|
2002
|
+
|
|
2003
|
+
@media (prefers-color-scheme: dark) {
|
|
2004
|
+
:root {
|
|
2005
|
+
/* DARK MODE */
|
|
2006
|
+
--foisit-bg: linear-gradient(135deg, rgba(40, 40, 40, 0.65), rgba(40, 40, 40, 0.25));
|
|
2007
|
+
--foisit-border: 1px solid rgba(255, 255, 255, 0.1);
|
|
2008
|
+
--foisit-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
|
|
2009
|
+
--foisit-text: #fff;
|
|
2010
|
+
--foisit-backdrop: blur(20px);
|
|
2011
|
+
|
|
2012
|
+
/* Input */
|
|
2013
|
+
--foisit-input-color: white;
|
|
2014
|
+
--foisit-input-placeholder: rgba(235, 235, 245, 0.5);
|
|
2015
|
+
|
|
2016
|
+
/* Bubbles */
|
|
2017
|
+
--foisit-bubble-user-bg: rgba(255, 255, 255, 0.1);
|
|
2018
|
+
--foisit-bubble-user-text: white;
|
|
2019
|
+
|
|
2020
|
+
--foisit-bubble-sys-bg: rgba(255, 255, 255, 0.05);
|
|
2021
|
+
--foisit-bubble-sys-text: rgba(255, 255, 255, 0.9);
|
|
2022
|
+
|
|
2023
|
+
/* Form Colors */
|
|
2024
|
+
--foisit-req-star: #f87171;
|
|
2025
|
+
--foisit-error-text: #fca5a5;
|
|
2026
|
+
--foisit-error-border: #f87171;
|
|
2027
|
+
}
|
|
2028
|
+
}
|
|
2029
|
+
`;
|
|
2030
|
+
e.textContent += `
|
|
1941
2031
|
|
|
1942
2032
|
@keyframes foisitPulse {
|
|
1943
2033
|
0%, 100% { transform: scale(0.8); opacity: 0.5; }
|
|
@@ -1985,8 +2075,8 @@ class Bt {
|
|
|
1985
2075
|
border: var(--foisit-border);
|
|
1986
2076
|
box-shadow: var(--foisit-shadow);
|
|
1987
2077
|
|
|
1988
|
-
backdrop-filter:
|
|
1989
|
-
-webkit-backdrop-filter:
|
|
2078
|
+
backdrop-filter: var(--foisit-backdrop);
|
|
2079
|
+
-webkit-backdrop-filter: var(--foisit-backdrop);
|
|
1990
2080
|
|
|
1991
2081
|
border-radius: 18px;
|
|
1992
2082
|
display: none;
|
|
@@ -2195,8 +2285,8 @@ class Bt {
|
|
|
2195
2285
|
border: 1px solid rgba(255,255,255,0.2);
|
|
2196
2286
|
background: var(--foisit-bg);
|
|
2197
2287
|
color: var(--foisit-text);
|
|
2198
|
-
backdrop-filter:
|
|
2199
|
-
-webkit-backdrop-filter:
|
|
2288
|
+
backdrop-filter: var(--foisit-backdrop);
|
|
2289
|
+
-webkit-backdrop-filter: var(--foisit-backdrop);
|
|
2200
2290
|
box-shadow: 0 4px 12px rgba(0,0,0,0.15);
|
|
2201
2291
|
cursor: pointer;
|
|
2202
2292
|
pointer-events: auto;
|
|
@@ -2304,7 +2394,9 @@ class Ut {
|
|
|
2304
2394
|
}), this.fallbackHandler = new Ft(), this.voiceProcessor = new Ht(), this.textToSpeech = new qe(), this.stateManager = new zt(), this.gestureHandler = new ae(), this.overlayManager = new Bt({
|
|
2305
2395
|
floatingButton: this.config.floatingButton,
|
|
2306
2396
|
inputPlaceholder: this.config.inputPlaceholder,
|
|
2307
|
-
enableGestureActivation: this.config.enableGestureActivation
|
|
2397
|
+
enableGestureActivation: this.config.enableGestureActivation,
|
|
2398
|
+
theme: this.config.theme,
|
|
2399
|
+
themeColors: this.config.themeColors
|
|
2308
2400
|
}), this.overlayManager.setExternalCommandExecutor(async (t) => this.commandHandler.executeCommand(t)), this.config.commands.forEach((t) => this.commandHandler.addCommand(t)), this.config.fallbackResponse && this.fallbackHandler.setFallbackMessage(this.config.fallbackResponse), this.overlayManager.registerCallbacks(
|
|
2309
2401
|
async (t) => {
|
|
2310
2402
|
if (typeof t == "string")
|
|
@@ -2320,11 +2412,15 @@ class Ut {
|
|
|
2320
2412
|
}
|
|
2321
2413
|
/** Start listening for activation and commands */
|
|
2322
2414
|
startListening() {
|
|
2323
|
-
console.log(
|
|
2415
|
+
console.log(
|
|
2416
|
+
"AssistantService: Voice is disabled; startListening() is a no-op."
|
|
2417
|
+
);
|
|
2324
2418
|
}
|
|
2325
2419
|
/** Stop listening */
|
|
2326
2420
|
stopListening() {
|
|
2327
|
-
console.log(
|
|
2421
|
+
console.log(
|
|
2422
|
+
"AssistantService: Voice is disabled; stopListening() is a no-op."
|
|
2423
|
+
), this.isActivated = !1;
|
|
2328
2424
|
}
|
|
2329
2425
|
/** Reset activation state so the next activation flow can occur. */
|
|
2330
2426
|
reactivate() {
|
|
@@ -2370,7 +2466,10 @@ class Ut {
|
|
|
2370
2466
|
}
|
|
2371
2467
|
if (t.type === "error") {
|
|
2372
2468
|
const s = typeof e == "string" ? e : "";
|
|
2373
|
-
s ? (this.fallbackHandler.handleFallback(s), this.overlayManager.addMessage(
|
|
2469
|
+
s ? (this.fallbackHandler.handleFallback(s), this.overlayManager.addMessage(
|
|
2470
|
+
this.fallbackHandler.getFallbackMessage(),
|
|
2471
|
+
"system"
|
|
2472
|
+
)) : t.message && this.overlayManager.addMessage(t.message, "system");
|
|
2374
2473
|
return;
|
|
2375
2474
|
}
|
|
2376
2475
|
if ((t.type === "ambiguous" || t.type === "confirm") && t.options) {
|
|
@@ -2481,7 +2580,7 @@ const Wt = /* @__PURE__ */ ht({
|
|
|
2481
2580
|
return t;
|
|
2482
2581
|
};
|
|
2483
2582
|
function Yt(i, e, t, s, n, o) {
|
|
2484
|
-
return
|
|
2583
|
+
return bt(i.$slots, "default");
|
|
2485
2584
|
}
|
|
2486
2585
|
const Gt = /* @__PURE__ */ jt(Wt, [["render", Yt]]), Kt = () => {
|
|
2487
2586
|
const i = ft("assistantService");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@foisit/vue-wrapper",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"main": "./index.mjs",
|
|
5
5
|
"types": "./index.d.ts",
|
|
6
6
|
"exports": {
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"accessibility",
|
|
27
27
|
"website-integration"
|
|
28
28
|
],
|
|
29
|
-
"homepage": "https://foisit-vue
|
|
29
|
+
"homepage": "https://foisit-vue.netlify.app/",
|
|
30
30
|
"funding": {
|
|
31
31
|
"type": "github",
|
|
32
32
|
"url": "https://github.com/sponsors/boluwatifee4"
|