@zantopia/zephyr-ui 0.1.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 +267 -0
- package/dist/Zephyr-BupwOffR.js +118 -0
- package/dist/Zephyr-BupwOffR.js.map +1 -0
- package/dist/core/animations.d.ts +18 -0
- package/dist/core/config.d.ts +154 -0
- package/dist/core/config.js +41 -0
- package/dist/core/config.js.map +1 -0
- package/dist/core/logos.d.ts +30 -0
- package/dist/core/personas.d.ts +23 -0
- package/dist/core/styles.d.ts +12 -0
- package/dist/core/themes.d.ts +8 -0
- package/dist/core/themes.js +49 -0
- package/dist/core/themes.js.map +1 -0
- package/dist/core/widget.d.ts +70 -0
- package/dist/core/ws-client.d.ts +46 -0
- package/dist/index.d.ts +29 -0
- package/dist/index.js +47 -0
- package/dist/index.js.map +1 -0
- package/dist/react/Zephyr.d.ts +116 -0
- package/dist/react/index.d.ts +2 -0
- package/dist/react/index.js +7 -0
- package/dist/react/index.js.map +1 -0
- package/dist/vanilla/init.d.ts +12 -0
- package/dist/vue/Zephyr.vue.d.ts +307 -0
- package/dist/vue/index.d.ts +1 -0
- package/dist/vue/index.js +119 -0
- package/dist/vue/index.js.map +1 -0
- package/dist/widget-BjgCJR9K.js +926 -0
- package/dist/widget-BjgCJR9K.js.map +1 -0
- package/package.json +86 -0
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
import { PropType } from 'vue';
|
|
2
|
+
import { ZephyrConfig, ZephyrTheme, ZephyrLogo, ZephyrPersona, ZephyrOpenAnimation, ZephyrTriggerAnimation, ZephyrPosition, ZephyrSize, ZephyrFeature } from '../core/config';
|
|
3
|
+
import { ZephyrMessage } from '../core/widget';
|
|
4
|
+
|
|
5
|
+
declare function __VLS_template(): {
|
|
6
|
+
default?(_: {}): any;
|
|
7
|
+
};
|
|
8
|
+
declare const __VLS_component: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
|
|
9
|
+
/** Full config object (from defineZephyrConfig) */
|
|
10
|
+
config: {
|
|
11
|
+
type: PropType<ZephyrConfig>;
|
|
12
|
+
default: null;
|
|
13
|
+
};
|
|
14
|
+
/** Zephyr server URL */
|
|
15
|
+
server: {
|
|
16
|
+
type: StringConstructor;
|
|
17
|
+
default: string;
|
|
18
|
+
};
|
|
19
|
+
/** API key */
|
|
20
|
+
apiKey: {
|
|
21
|
+
type: StringConstructor;
|
|
22
|
+
default: string;
|
|
23
|
+
};
|
|
24
|
+
/** Logo preset or custom URL */
|
|
25
|
+
logo: {
|
|
26
|
+
type: PropType<ZephyrLogo>;
|
|
27
|
+
default: undefined;
|
|
28
|
+
};
|
|
29
|
+
/** Persona preset or custom */
|
|
30
|
+
persona: {
|
|
31
|
+
type: PropType<ZephyrPersona>;
|
|
32
|
+
default: undefined;
|
|
33
|
+
};
|
|
34
|
+
/** Theme (dark/light/auto or custom object) */
|
|
35
|
+
theme: {
|
|
36
|
+
type: PropType<ZephyrTheme>;
|
|
37
|
+
default: undefined;
|
|
38
|
+
};
|
|
39
|
+
/** Accent color */
|
|
40
|
+
accentColor: {
|
|
41
|
+
type: StringConstructor;
|
|
42
|
+
default: undefined;
|
|
43
|
+
};
|
|
44
|
+
/** Panel open animation */
|
|
45
|
+
openAnimation: {
|
|
46
|
+
type: PropType<ZephyrOpenAnimation>;
|
|
47
|
+
default: undefined;
|
|
48
|
+
};
|
|
49
|
+
/** Trigger button animation */
|
|
50
|
+
triggerAnimation: {
|
|
51
|
+
type: PropType<ZephyrTriggerAnimation>;
|
|
52
|
+
default: undefined;
|
|
53
|
+
};
|
|
54
|
+
/** Position */
|
|
55
|
+
position: {
|
|
56
|
+
type: PropType<ZephyrPosition>;
|
|
57
|
+
default: undefined;
|
|
58
|
+
};
|
|
59
|
+
/** Size */
|
|
60
|
+
size: {
|
|
61
|
+
type: PropType<ZephyrSize>;
|
|
62
|
+
default: undefined;
|
|
63
|
+
};
|
|
64
|
+
/** Language */
|
|
65
|
+
language: {
|
|
66
|
+
type: StringConstructor;
|
|
67
|
+
default: undefined;
|
|
68
|
+
};
|
|
69
|
+
/** Greeting */
|
|
70
|
+
greeting: {
|
|
71
|
+
type: StringConstructor;
|
|
72
|
+
default: undefined;
|
|
73
|
+
};
|
|
74
|
+
/** Input placeholder */
|
|
75
|
+
placeholder: {
|
|
76
|
+
type: StringConstructor;
|
|
77
|
+
default: undefined;
|
|
78
|
+
};
|
|
79
|
+
/** Enabled features */
|
|
80
|
+
features: {
|
|
81
|
+
type: PropType<ZephyrFeature[]>;
|
|
82
|
+
default: undefined;
|
|
83
|
+
};
|
|
84
|
+
/** Start open */
|
|
85
|
+
startOpen: {
|
|
86
|
+
type: BooleanConstructor;
|
|
87
|
+
default: undefined;
|
|
88
|
+
};
|
|
89
|
+
/** Show badge */
|
|
90
|
+
showBadge: {
|
|
91
|
+
type: BooleanConstructor;
|
|
92
|
+
default: undefined;
|
|
93
|
+
};
|
|
94
|
+
/** Custom CSS */
|
|
95
|
+
customCSS: {
|
|
96
|
+
type: StringConstructor;
|
|
97
|
+
default: undefined;
|
|
98
|
+
};
|
|
99
|
+
/** Container selector */
|
|
100
|
+
container: {
|
|
101
|
+
type: PropType<string | null>;
|
|
102
|
+
default: undefined;
|
|
103
|
+
};
|
|
104
|
+
/** Panel width */
|
|
105
|
+
panelWidth: {
|
|
106
|
+
type: NumberConstructor;
|
|
107
|
+
default: undefined;
|
|
108
|
+
};
|
|
109
|
+
/** Panel height */
|
|
110
|
+
panelHeight: {
|
|
111
|
+
type: NumberConstructor;
|
|
112
|
+
default: undefined;
|
|
113
|
+
};
|
|
114
|
+
/** Border radius */
|
|
115
|
+
panelBorderRadius: {
|
|
116
|
+
type: NumberConstructor;
|
|
117
|
+
default: undefined;
|
|
118
|
+
};
|
|
119
|
+
/** Backdrop */
|
|
120
|
+
backdrop: {
|
|
121
|
+
type: BooleanConstructor;
|
|
122
|
+
default: undefined;
|
|
123
|
+
};
|
|
124
|
+
/** z-index */
|
|
125
|
+
zIndex: {
|
|
126
|
+
type: NumberConstructor;
|
|
127
|
+
default: undefined;
|
|
128
|
+
};
|
|
129
|
+
}>, {
|
|
130
|
+
send: (text: string) => void | undefined;
|
|
131
|
+
open: () => void | undefined;
|
|
132
|
+
close: () => void | undefined;
|
|
133
|
+
toggle: () => void | undefined;
|
|
134
|
+
setTheme: (t: ZephyrTheme) => void | undefined;
|
|
135
|
+
setLogo: (l: ZephyrLogo) => void | undefined;
|
|
136
|
+
setPersona: (p: ZephyrPersona) => void | undefined;
|
|
137
|
+
setAccentColor: (c: string) => void | undefined;
|
|
138
|
+
getMessages: () => ZephyrMessage[];
|
|
139
|
+
isOpen: () => boolean;
|
|
140
|
+
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
141
|
+
error: (err: {
|
|
142
|
+
message: string;
|
|
143
|
+
}) => void;
|
|
144
|
+
toggle: (open: boolean) => void;
|
|
145
|
+
ready: () => void;
|
|
146
|
+
message: (msg: ZephyrMessage) => void;
|
|
147
|
+
}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
|
|
148
|
+
/** Full config object (from defineZephyrConfig) */
|
|
149
|
+
config: {
|
|
150
|
+
type: PropType<ZephyrConfig>;
|
|
151
|
+
default: null;
|
|
152
|
+
};
|
|
153
|
+
/** Zephyr server URL */
|
|
154
|
+
server: {
|
|
155
|
+
type: StringConstructor;
|
|
156
|
+
default: string;
|
|
157
|
+
};
|
|
158
|
+
/** API key */
|
|
159
|
+
apiKey: {
|
|
160
|
+
type: StringConstructor;
|
|
161
|
+
default: string;
|
|
162
|
+
};
|
|
163
|
+
/** Logo preset or custom URL */
|
|
164
|
+
logo: {
|
|
165
|
+
type: PropType<ZephyrLogo>;
|
|
166
|
+
default: undefined;
|
|
167
|
+
};
|
|
168
|
+
/** Persona preset or custom */
|
|
169
|
+
persona: {
|
|
170
|
+
type: PropType<ZephyrPersona>;
|
|
171
|
+
default: undefined;
|
|
172
|
+
};
|
|
173
|
+
/** Theme (dark/light/auto or custom object) */
|
|
174
|
+
theme: {
|
|
175
|
+
type: PropType<ZephyrTheme>;
|
|
176
|
+
default: undefined;
|
|
177
|
+
};
|
|
178
|
+
/** Accent color */
|
|
179
|
+
accentColor: {
|
|
180
|
+
type: StringConstructor;
|
|
181
|
+
default: undefined;
|
|
182
|
+
};
|
|
183
|
+
/** Panel open animation */
|
|
184
|
+
openAnimation: {
|
|
185
|
+
type: PropType<ZephyrOpenAnimation>;
|
|
186
|
+
default: undefined;
|
|
187
|
+
};
|
|
188
|
+
/** Trigger button animation */
|
|
189
|
+
triggerAnimation: {
|
|
190
|
+
type: PropType<ZephyrTriggerAnimation>;
|
|
191
|
+
default: undefined;
|
|
192
|
+
};
|
|
193
|
+
/** Position */
|
|
194
|
+
position: {
|
|
195
|
+
type: PropType<ZephyrPosition>;
|
|
196
|
+
default: undefined;
|
|
197
|
+
};
|
|
198
|
+
/** Size */
|
|
199
|
+
size: {
|
|
200
|
+
type: PropType<ZephyrSize>;
|
|
201
|
+
default: undefined;
|
|
202
|
+
};
|
|
203
|
+
/** Language */
|
|
204
|
+
language: {
|
|
205
|
+
type: StringConstructor;
|
|
206
|
+
default: undefined;
|
|
207
|
+
};
|
|
208
|
+
/** Greeting */
|
|
209
|
+
greeting: {
|
|
210
|
+
type: StringConstructor;
|
|
211
|
+
default: undefined;
|
|
212
|
+
};
|
|
213
|
+
/** Input placeholder */
|
|
214
|
+
placeholder: {
|
|
215
|
+
type: StringConstructor;
|
|
216
|
+
default: undefined;
|
|
217
|
+
};
|
|
218
|
+
/** Enabled features */
|
|
219
|
+
features: {
|
|
220
|
+
type: PropType<ZephyrFeature[]>;
|
|
221
|
+
default: undefined;
|
|
222
|
+
};
|
|
223
|
+
/** Start open */
|
|
224
|
+
startOpen: {
|
|
225
|
+
type: BooleanConstructor;
|
|
226
|
+
default: undefined;
|
|
227
|
+
};
|
|
228
|
+
/** Show badge */
|
|
229
|
+
showBadge: {
|
|
230
|
+
type: BooleanConstructor;
|
|
231
|
+
default: undefined;
|
|
232
|
+
};
|
|
233
|
+
/** Custom CSS */
|
|
234
|
+
customCSS: {
|
|
235
|
+
type: StringConstructor;
|
|
236
|
+
default: undefined;
|
|
237
|
+
};
|
|
238
|
+
/** Container selector */
|
|
239
|
+
container: {
|
|
240
|
+
type: PropType<string | null>;
|
|
241
|
+
default: undefined;
|
|
242
|
+
};
|
|
243
|
+
/** Panel width */
|
|
244
|
+
panelWidth: {
|
|
245
|
+
type: NumberConstructor;
|
|
246
|
+
default: undefined;
|
|
247
|
+
};
|
|
248
|
+
/** Panel height */
|
|
249
|
+
panelHeight: {
|
|
250
|
+
type: NumberConstructor;
|
|
251
|
+
default: undefined;
|
|
252
|
+
};
|
|
253
|
+
/** Border radius */
|
|
254
|
+
panelBorderRadius: {
|
|
255
|
+
type: NumberConstructor;
|
|
256
|
+
default: undefined;
|
|
257
|
+
};
|
|
258
|
+
/** Backdrop */
|
|
259
|
+
backdrop: {
|
|
260
|
+
type: BooleanConstructor;
|
|
261
|
+
default: undefined;
|
|
262
|
+
};
|
|
263
|
+
/** z-index */
|
|
264
|
+
zIndex: {
|
|
265
|
+
type: NumberConstructor;
|
|
266
|
+
default: undefined;
|
|
267
|
+
};
|
|
268
|
+
}>> & Readonly<{
|
|
269
|
+
onError?: ((err: {
|
|
270
|
+
message: string;
|
|
271
|
+
}) => any) | undefined;
|
|
272
|
+
onToggle?: ((open: boolean) => any) | undefined;
|
|
273
|
+
onReady?: (() => any) | undefined;
|
|
274
|
+
onMessage?: ((msg: ZephyrMessage) => any) | undefined;
|
|
275
|
+
}>, {
|
|
276
|
+
logo: ZephyrLogo;
|
|
277
|
+
persona: ZephyrPersona;
|
|
278
|
+
theme: ZephyrTheme;
|
|
279
|
+
accentColor: string;
|
|
280
|
+
openAnimation: ZephyrOpenAnimation;
|
|
281
|
+
triggerAnimation: ZephyrTriggerAnimation;
|
|
282
|
+
language: string;
|
|
283
|
+
features: ZephyrFeature[];
|
|
284
|
+
startOpen: boolean;
|
|
285
|
+
showBadge: boolean;
|
|
286
|
+
server: string;
|
|
287
|
+
apiKey: string;
|
|
288
|
+
greeting: string;
|
|
289
|
+
placeholder: string;
|
|
290
|
+
customCSS: string;
|
|
291
|
+
container: string | null;
|
|
292
|
+
position: ZephyrPosition;
|
|
293
|
+
size: ZephyrSize;
|
|
294
|
+
backdrop: boolean;
|
|
295
|
+
zIndex: number;
|
|
296
|
+
config: ZephyrConfig;
|
|
297
|
+
panelWidth: number;
|
|
298
|
+
panelHeight: number;
|
|
299
|
+
panelBorderRadius: number;
|
|
300
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
301
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, ReturnType<typeof __VLS_template>>;
|
|
302
|
+
export default _default;
|
|
303
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
304
|
+
new (): {
|
|
305
|
+
$slots: S;
|
|
306
|
+
};
|
|
307
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Zephyr } from './Zephyr.vue';
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { defineComponent as d, onMounted as f, onUnmounted as u, watch as i, renderSlot as c } from "vue";
|
|
2
|
+
import { Z as g } from "../widget-BjgCJR9K.js";
|
|
3
|
+
const y = /* @__PURE__ */ d({
|
|
4
|
+
__name: "Zephyr",
|
|
5
|
+
props: {
|
|
6
|
+
/** Full config object (from defineZephyrConfig) */
|
|
7
|
+
config: { type: Object, default: null },
|
|
8
|
+
/** Zephyr server URL */
|
|
9
|
+
server: { type: String, default: "" },
|
|
10
|
+
/** API key */
|
|
11
|
+
apiKey: { type: String, default: "" },
|
|
12
|
+
/** Logo preset or custom URL */
|
|
13
|
+
logo: { type: [String, Object], default: void 0 },
|
|
14
|
+
/** Persona preset or custom */
|
|
15
|
+
persona: { type: [String, Object], default: void 0 },
|
|
16
|
+
/** Theme (dark/light/auto or custom object) */
|
|
17
|
+
theme: { type: [String, Object], default: void 0 },
|
|
18
|
+
/** Accent color */
|
|
19
|
+
accentColor: { type: String, default: void 0 },
|
|
20
|
+
/** Panel open animation */
|
|
21
|
+
openAnimation: { type: String, default: void 0 },
|
|
22
|
+
/** Trigger button animation */
|
|
23
|
+
triggerAnimation: { type: String, default: void 0 },
|
|
24
|
+
/** Position */
|
|
25
|
+
position: { type: String, default: void 0 },
|
|
26
|
+
/** Size */
|
|
27
|
+
size: { type: String, default: void 0 },
|
|
28
|
+
/** Language */
|
|
29
|
+
language: { type: String, default: void 0 },
|
|
30
|
+
/** Greeting */
|
|
31
|
+
greeting: { type: String, default: void 0 },
|
|
32
|
+
/** Input placeholder */
|
|
33
|
+
placeholder: { type: String, default: void 0 },
|
|
34
|
+
/** Enabled features */
|
|
35
|
+
features: { type: Array, default: void 0 },
|
|
36
|
+
/** Start open */
|
|
37
|
+
startOpen: { type: Boolean, default: void 0 },
|
|
38
|
+
/** Show badge */
|
|
39
|
+
showBadge: { type: Boolean, default: void 0 },
|
|
40
|
+
/** Custom CSS */
|
|
41
|
+
customCSS: { type: String, default: void 0 },
|
|
42
|
+
/** Container selector */
|
|
43
|
+
container: { type: String, default: void 0 },
|
|
44
|
+
/** Panel width */
|
|
45
|
+
panelWidth: { type: Number, default: void 0 },
|
|
46
|
+
/** Panel height */
|
|
47
|
+
panelHeight: { type: Number, default: void 0 },
|
|
48
|
+
/** Border radius */
|
|
49
|
+
panelBorderRadius: { type: Number, default: void 0 },
|
|
50
|
+
/** Backdrop */
|
|
51
|
+
backdrop: { type: Boolean, default: void 0 },
|
|
52
|
+
/** z-index */
|
|
53
|
+
zIndex: { type: Number, default: void 0 }
|
|
54
|
+
},
|
|
55
|
+
emits: ["ready", "message", "error", "toggle"],
|
|
56
|
+
setup(a, { expose: s, emit: p }) {
|
|
57
|
+
const e = a, r = p;
|
|
58
|
+
let o = null;
|
|
59
|
+
function l() {
|
|
60
|
+
var t;
|
|
61
|
+
const n = {
|
|
62
|
+
...e.config || {},
|
|
63
|
+
server: e.server || ((t = e.config) == null ? void 0 : t.server) || ""
|
|
64
|
+
};
|
|
65
|
+
return e.apiKey && (n.apiKey = e.apiKey), e.logo !== void 0 && (n.logo = e.logo), e.persona !== void 0 && (n.persona = e.persona), e.theme !== void 0 && (n.theme = e.theme), e.accentColor !== void 0 && (n.accentColor = e.accentColor), e.openAnimation !== void 0 && (n.openAnimation = e.openAnimation), e.triggerAnimation !== void 0 && (n.triggerAnimation = e.triggerAnimation), e.language !== void 0 && (n.language = e.language), e.greeting !== void 0 && (n.greeting = e.greeting), e.placeholder !== void 0 && (n.placeholder = e.placeholder), e.features !== void 0 && (n.features = e.features), e.startOpen !== void 0 && (n.startOpen = e.startOpen), e.showBadge !== void 0 && (n.showBadge = e.showBadge), e.customCSS !== void 0 && (n.customCSS = e.customCSS), e.container !== void 0 && (n.container = e.container), (e.position || e.size || e.panelWidth || e.panelHeight || e.panelBorderRadius != null || e.backdrop !== void 0 || e.zIndex) && (n.panel = {
|
|
66
|
+
...n.panel,
|
|
67
|
+
...e.position && { position: e.position },
|
|
68
|
+
...e.size && { size: e.size },
|
|
69
|
+
...e.panelWidth && { width: e.panelWidth },
|
|
70
|
+
...e.panelHeight && { height: e.panelHeight },
|
|
71
|
+
...e.panelBorderRadius != null && { borderRadius: e.panelBorderRadius },
|
|
72
|
+
...e.backdrop !== void 0 && { backdrop: e.backdrop },
|
|
73
|
+
...e.zIndex && { zIndex: e.zIndex }
|
|
74
|
+
}), n;
|
|
75
|
+
}
|
|
76
|
+
return f(() => {
|
|
77
|
+
const n = l();
|
|
78
|
+
if (!n.server) {
|
|
79
|
+
console.warn("[Zephyr] No server URL. Provide server prop or config.");
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
o = new g(n, {
|
|
83
|
+
onReady: () => r("ready"),
|
|
84
|
+
onMessage: (t) => r("message", t),
|
|
85
|
+
onError: (t) => r("error", t),
|
|
86
|
+
onToggle: (t) => r("toggle", t)
|
|
87
|
+
}), o.mount(e.container || null);
|
|
88
|
+
}), u(() => {
|
|
89
|
+
o == null || o.destroy(), o = null;
|
|
90
|
+
}), i(() => e.theme, (n) => {
|
|
91
|
+
n !== void 0 && (o == null || o.setTheme(n));
|
|
92
|
+
}), i(() => e.accentColor, (n) => {
|
|
93
|
+
n && (o == null || o.setAccentColor(n));
|
|
94
|
+
}), i(() => e.persona, (n) => {
|
|
95
|
+
n !== void 0 && (o == null || o.setPersona(n));
|
|
96
|
+
}), i(() => e.logo, (n) => {
|
|
97
|
+
n !== void 0 && (o == null || o.setLogo(n));
|
|
98
|
+
}), i(() => e.openAnimation, (n) => {
|
|
99
|
+
n && (o == null || o.setOpenAnimation(n));
|
|
100
|
+
}), i(() => e.triggerAnimation, (n) => {
|
|
101
|
+
n && (o == null || o.setTriggerAnimation(n));
|
|
102
|
+
}), s({
|
|
103
|
+
send: (n) => o == null ? void 0 : o.send(n),
|
|
104
|
+
open: () => o == null ? void 0 : o.open(),
|
|
105
|
+
close: () => o == null ? void 0 : o.close(),
|
|
106
|
+
toggle: () => o == null ? void 0 : o.toggle(),
|
|
107
|
+
setTheme: (n) => o == null ? void 0 : o.setTheme(n),
|
|
108
|
+
setLogo: (n) => o == null ? void 0 : o.setLogo(n),
|
|
109
|
+
setPersona: (n) => o == null ? void 0 : o.setPersona(n),
|
|
110
|
+
setAccentColor: (n) => o == null ? void 0 : o.setAccentColor(n),
|
|
111
|
+
getMessages: () => (o == null ? void 0 : o.getMessages()) || [],
|
|
112
|
+
isOpen: () => (o == null ? void 0 : o.getIsOpen()) || !1
|
|
113
|
+
}), (n, t) => c(n.$slots, "default");
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
export {
|
|
117
|
+
y as Zephyr
|
|
118
|
+
};
|
|
119
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/vue/Zephyr.vue"],"sourcesContent":["<!--\n 🦊 Zephyr — Vue 3 Component\n\n Usage:\n import { Zephyr } from '@zephyr/ui/vue';\n import config from './zephyr.config';\n\n // Then in template:\n // Zephyr server=\"http://localhost:8000\" persona=\"friendly\" theme=\"dark\"\n // Zephyr :config=\"config\"\n-->\n\n<template>\n <!-- Widget renders itself to the DOM — this is just a lifecycle wrapper -->\n <slot />\n</template>\n\n<script setup lang=\"ts\">\nimport { onMounted, onUnmounted, watch, ref, type PropType } from \"vue\";\nimport type {\n ZephyrConfig,\n ZephyrTheme,\n ZephyrLogo,\n ZephyrPersona,\n ZephyrOpenAnimation,\n ZephyrTriggerAnimation,\n ZephyrPosition,\n ZephyrSize,\n ZephyrFeature,\n} from \"../core/config\";\nimport { ZephyrWidget, type ZephyrMessage } from \"../core/widget\";\n\n// ─── Props ───────────────────────────────────────────────────\n\nconst props = defineProps({\n /** Full config object (from defineZephyrConfig) */\n config: { type: Object as PropType<ZephyrConfig>, default: null },\n\n /** Zephyr server URL */\n server: { type: String, default: \"\" },\n /** API key */\n apiKey: { type: String, default: \"\" },\n /** Logo preset or custom URL */\n logo: { type: [String, Object] as PropType<ZephyrLogo>, default: undefined },\n /** Persona preset or custom */\n persona: { type: [String, Object] as PropType<ZephyrPersona>, default: undefined },\n /** Theme (dark/light/auto or custom object) */\n theme: { type: [String, Object] as PropType<ZephyrTheme>, default: undefined },\n /** Accent color */\n accentColor: { type: String, default: undefined },\n /** Panel open animation */\n openAnimation: { type: String as PropType<ZephyrOpenAnimation>, default: undefined },\n /** Trigger button animation */\n triggerAnimation: { type: String as PropType<ZephyrTriggerAnimation>, default: undefined },\n /** Position */\n position: { type: String as PropType<ZephyrPosition>, default: undefined },\n /** Size */\n size: { type: String as PropType<ZephyrSize>, default: undefined },\n /** Language */\n language: { type: String, default: undefined },\n /** Greeting */\n greeting: { type: String, default: undefined },\n /** Input placeholder */\n placeholder: { type: String, default: undefined },\n /** Enabled features */\n features: { type: Array as PropType<ZephyrFeature[]>, default: undefined },\n /** Start open */\n startOpen: { type: Boolean, default: undefined },\n /** Show badge */\n showBadge: { type: Boolean, default: undefined },\n /** Custom CSS */\n customCSS: { type: String, default: undefined },\n /** Container selector */\n container: { type: String as PropType<string | null>, default: undefined },\n /** Panel width */\n panelWidth: { type: Number, default: undefined },\n /** Panel height */\n panelHeight: { type: Number, default: undefined },\n /** Border radius */\n panelBorderRadius: { type: Number, default: undefined },\n /** Backdrop */\n backdrop: { type: Boolean, default: undefined },\n /** z-index */\n zIndex: { type: Number, default: undefined },\n});\n\n// ─── Emits ───────────────────────────────────────────────────\n\nconst emit = defineEmits<{\n ready: [];\n message: [msg: ZephyrMessage];\n error: [err: { message: string }];\n toggle: [open: boolean];\n}>();\n\n// ─── Widget instance ─────────────────────────────────────────\n\nlet widget: ZephyrWidget | null = null;\n\nfunction buildConfig(): ZephyrConfig {\n const base: ZephyrConfig = {\n ...(props.config || {}),\n server: props.server || props.config?.server || \"\",\n };\n\n if (props.apiKey) base.apiKey = props.apiKey;\n if (props.logo !== undefined) base.logo = props.logo;\n if (props.persona !== undefined) base.persona = props.persona;\n if (props.theme !== undefined) base.theme = props.theme;\n if (props.accentColor !== undefined) base.accentColor = props.accentColor;\n if (props.openAnimation !== undefined) base.openAnimation = props.openAnimation;\n if (props.triggerAnimation !== undefined) base.triggerAnimation = props.triggerAnimation;\n if (props.language !== undefined) base.language = props.language;\n if (props.greeting !== undefined) base.greeting = props.greeting;\n if (props.placeholder !== undefined) base.placeholder = props.placeholder;\n if (props.features !== undefined) base.features = props.features;\n if (props.startOpen !== undefined) base.startOpen = props.startOpen;\n if (props.showBadge !== undefined) base.showBadge = props.showBadge;\n if (props.customCSS !== undefined) base.customCSS = props.customCSS;\n if (props.container !== undefined) base.container = props.container;\n\n if (props.position || props.size || props.panelWidth || props.panelHeight ||\n props.panelBorderRadius != null || props.backdrop !== undefined || props.zIndex) {\n base.panel = {\n ...base.panel,\n ...(props.position && { position: props.position }),\n ...(props.size && { size: props.size }),\n ...(props.panelWidth && { width: props.panelWidth }),\n ...(props.panelHeight && { height: props.panelHeight }),\n ...(props.panelBorderRadius != null && { borderRadius: props.panelBorderRadius }),\n ...(props.backdrop !== undefined && { backdrop: props.backdrop }),\n ...(props.zIndex && { zIndex: props.zIndex }),\n };\n }\n\n return base;\n}\n\nonMounted(() => {\n const config = buildConfig();\n if (!config.server) {\n console.warn(\"[Zephyr] No server URL. Provide server prop or config.\");\n return;\n }\n\n widget = new ZephyrWidget(config, {\n onReady: () => emit(\"ready\"),\n onMessage: (msg) => emit(\"message\", msg),\n onError: (err) => emit(\"error\", err),\n onToggle: (open) => emit(\"toggle\", open),\n });\n widget.mount(props.container || null);\n});\n\nonUnmounted(() => {\n widget?.destroy();\n widget = null;\n});\n\n// ─── Watchers for reactive prop changes ──────────────────────\n\nwatch(() => props.theme, (val) => { if (val !== undefined) widget?.setTheme(val); });\nwatch(() => props.accentColor, (val) => { if (val) widget?.setAccentColor(val); });\nwatch(() => props.persona, (val) => { if (val !== undefined) widget?.setPersona(val); });\nwatch(() => props.logo, (val) => { if (val !== undefined) widget?.setLogo(val); });\nwatch(() => props.openAnimation, (val) => { if (val) widget?.setOpenAnimation(val); });\nwatch(() => props.triggerAnimation, (val) => { if (val) widget?.setTriggerAnimation(val); });\n\n// ─── Expose imperative API ───────────────────────────────────\n\ndefineExpose({\n send: (text: string) => widget?.send(text),\n open: () => widget?.open(),\n close: () => widget?.close(),\n toggle: () => widget?.toggle(),\n setTheme: (t: ZephyrTheme) => widget?.setTheme(t),\n setLogo: (l: ZephyrLogo) => widget?.setLogo(l),\n setPersona: (p: ZephyrPersona) => widget?.setPersona(p),\n setAccentColor: (c: string) => widget?.setAccentColor(c),\n getMessages: () => widget?.getMessages() || [],\n isOpen: () => widget?.getIsOpen() || false,\n});\n</script>\n"],"names":["props","__props","emit","__emit","widget","buildConfig","base","_a","onMounted","config","ZephyrWidget","msg","err","open","onUnmounted","watch","val","__expose","text","t","l","p","c","_renderSlot","_ctx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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