@runtypelabs/persona 4.13.0 → 4.15.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 +4 -4
- package/dist/animations/glyph-cycle.d.cts +1 -1
- package/dist/animations/glyph-cycle.d.ts +1 -1
- package/dist/animations/{types-DveIaNx6.d.cts → types-BpWGm7_6.d.cts} +17 -0
- package/dist/animations/{types-DveIaNx6.d.ts → types-BpWGm7_6.d.ts} +17 -0
- package/dist/animations/wipe.d.cts +1 -1
- package/dist/animations/wipe.d.ts +1 -1
- package/dist/chunk-QJ4LV2KW.js +1 -0
- package/dist/codegen.cjs +12 -11
- package/dist/codegen.js +14 -13
- package/dist/{context-mentions-ONG7A7M6.js → context-mentions-BTSTIBFC.js} +1 -1
- package/dist/context-mentions.cjs +11 -8
- package/dist/context-mentions.d.cts +339 -22
- package/dist/context-mentions.d.ts +339 -22
- package/dist/context-mentions.js +11 -8
- package/dist/index.cjs +68 -67
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +483 -48
- package/dist/index.d.ts +483 -48
- package/dist/index.global.js +61 -58
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +70 -69
- package/dist/index.js.map +1 -1
- package/dist/launcher.global.js +5 -2
- package/dist/launcher.global.js.map +1 -1
- package/dist/smart-dom-reader.d.cts +339 -22
- package/dist/smart-dom-reader.d.ts +339 -22
- package/dist/theme-editor-preview.cjs +67 -67
- package/dist/theme-editor-preview.d.cts +355 -23
- package/dist/theme-editor-preview.d.ts +355 -23
- package/dist/theme-editor-preview.js +75 -75
- package/dist/theme-editor.cjs +10 -10
- package/dist/theme-editor.d.cts +376 -24
- package/dist/theme-editor.d.ts +376 -24
- package/dist/theme-editor.js +10 -10
- package/dist/theme-reference.cjs +1 -1
- package/dist/theme-reference.d.cts +38 -0
- package/dist/theme-reference.d.ts +38 -0
- package/dist/theme-reference.js +1 -1
- package/dist/widget.css +1 -1
- package/package.json +1 -1
- package/src/artifacts-session.test.ts +106 -0
- package/src/ask-user-question-tool.ts +10 -7
- package/src/client.test.ts +2 -2
- package/src/client.ts +4 -1
- package/src/components/artifact-card.ts +13 -2
- package/src/components/artifact-inline.ts +11 -2
- package/src/components/artifact-preview.ts +1 -1
- package/src/components/composer-builder.test.ts +2 -0
- package/src/components/composer-builder.ts +1 -1
- package/src/components/composer-parts.test.ts +105 -4
- package/src/components/composer-parts.ts +54 -16
- package/src/components/message-bubble.test.ts +7 -1
- package/src/components/message-bubble.ts +11 -8
- package/src/components/messages.ts +5 -2
- package/src/components/panel.ts +31 -5
- package/src/components/pill-composer-builder.test.ts +18 -0
- package/src/components/suggestions.test.ts +233 -0
- package/src/components/suggestions.ts +463 -81
- package/src/components/widget-view.ts +4 -0
- package/src/defaults.ts +5 -3
- package/src/generated/runtype-openapi-contract.ts +17 -0
- package/src/index-core.ts +52 -2
- package/src/launcher-global.ts +1 -1
- package/src/plugins/types.ts +71 -3
- package/src/presets.ts +3 -3
- package/src/session.ts +55 -12
- package/src/styles/widget-styles.test.ts +162 -0
- package/src/styles/widget.css +440 -1
- package/src/suggest-replies-tool.test.ts +233 -2
- package/src/suggest-replies-tool.ts +115 -39
- package/src/theme-editor/index.ts +5 -0
- package/src/theme-editor/presets.test.ts +43 -0
- package/src/theme-editor/presets.ts +101 -87
- package/src/theme-editor/preview-utils.test.ts +34 -0
- package/src/theme-editor/preview-utils.ts +77 -2
- package/src/theme-editor/sections.test.ts +72 -7
- package/src/theme-editor/sections.ts +113 -13
- package/src/theme-editor/state-preferences.test.ts +15 -0
- package/src/theme-editor/state.ts +46 -0
- package/src/theme-editor/types.ts +15 -1
- package/src/theme-editor/webmcp/tools.test.ts +13 -0
- package/src/theme-editor/webmcp/tools.ts +5 -0
- package/src/theme-reference.ts +9 -2
- package/src/types/theme.ts +32 -0
- package/src/types.ts +291 -25
- package/src/ui.artifact-pane-gating.test.ts +5 -5
- package/src/ui.config-preferences.test.ts +166 -0
- package/src/ui.detached-panel.test.ts +1 -1
- package/src/ui.suggest-replies.test.ts +1066 -1
- package/src/ui.ts +311 -45
- package/src/ui.typing-indicator.test.ts +135 -0
- package/src/utils/artifact-display.test.ts +180 -16
- package/src/utils/artifact-display.ts +155 -14
- package/src/utils/artifact-file.test.ts +1 -1
- package/src/utils/code-generators.test.ts +40 -0
- package/src/utils/code-generators.ts +22 -0
- package/src/utils/config-merge.test.ts +84 -0
- package/src/utils/config-merge.ts +6 -1
- package/src/utils/feature-preferences.test.ts +326 -0
- package/src/utils/feature-preferences.ts +498 -0
- package/src/utils/icons.test.ts +26 -0
- package/src/utils/icons.ts +8 -0
- package/src/utils/theme.test.ts +171 -0
- package/src/utils/tokens.ts +71 -7
- package/dist/chunk-MMUPR2JW.js +0 -1
package/src/utils/theme.test.ts
CHANGED
|
@@ -137,6 +137,98 @@ describe('theme utils', () => {
|
|
|
137
137
|
expect(cssVars['--persona-button-radius']).toBe('6px');
|
|
138
138
|
});
|
|
139
139
|
|
|
140
|
+
it.each([
|
|
141
|
+
{
|
|
142
|
+
role: 'surface',
|
|
143
|
+
sentinel: '#010203',
|
|
144
|
+
consumers: [
|
|
145
|
+
'--persona-components-input-background',
|
|
146
|
+
'--persona-input-background',
|
|
147
|
+
],
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
role: 'container',
|
|
151
|
+
sentinel: '#0a0b0c',
|
|
152
|
+
consumers: [
|
|
153
|
+
'--persona-components-message-assistant-background',
|
|
154
|
+
'--persona-message-assistant-bg',
|
|
155
|
+
],
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
role: 'textMuted',
|
|
159
|
+
sentinel: '#0d0e0f',
|
|
160
|
+
consumers: [
|
|
161
|
+
'--persona-components-input-placeholder',
|
|
162
|
+
'--persona-input-placeholder',
|
|
163
|
+
],
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
role: 'text',
|
|
167
|
+
sentinel: '#121314',
|
|
168
|
+
consumers: [
|
|
169
|
+
'--persona-components-message-assistant-text',
|
|
170
|
+
'--persona-message-assistant-text',
|
|
171
|
+
],
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
role: 'border',
|
|
175
|
+
sentinel: '#232425',
|
|
176
|
+
consumers: [
|
|
177
|
+
'--persona-components-message-assistant-border',
|
|
178
|
+
'--persona-message-assistant-border',
|
|
179
|
+
],
|
|
180
|
+
},
|
|
181
|
+
])(
|
|
182
|
+
'cascades semantic.colors.$role to its default input and assistant consumers',
|
|
183
|
+
({ role, sentinel, consumers }) => {
|
|
184
|
+
const theme = createTheme({
|
|
185
|
+
semantic: {
|
|
186
|
+
colors: {
|
|
187
|
+
[role]: sentinel,
|
|
188
|
+
},
|
|
189
|
+
},
|
|
190
|
+
} as any);
|
|
191
|
+
const cssVars = themeToCssVariables(theme);
|
|
192
|
+
|
|
193
|
+
for (const consumer of consumers) {
|
|
194
|
+
expect(cssVars[consumer]).toBe(sentinel);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
);
|
|
198
|
+
|
|
199
|
+
it('keeps explicit input and assistant component colors above semantic defaults', () => {
|
|
200
|
+
const theme = createTheme({
|
|
201
|
+
semantic: {
|
|
202
|
+
colors: {
|
|
203
|
+
surface: '#010203',
|
|
204
|
+
container: '#0a0b0c',
|
|
205
|
+
text: '#121314',
|
|
206
|
+
border: '#232425',
|
|
207
|
+
},
|
|
208
|
+
},
|
|
209
|
+
components: {
|
|
210
|
+
input: {
|
|
211
|
+
background: '#343536',
|
|
212
|
+
placeholder: '#3a3b3c',
|
|
213
|
+
},
|
|
214
|
+
message: {
|
|
215
|
+
assistant: {
|
|
216
|
+
background: '#454647',
|
|
217
|
+
text: '#565758',
|
|
218
|
+
border: '#676869',
|
|
219
|
+
},
|
|
220
|
+
},
|
|
221
|
+
},
|
|
222
|
+
} as any);
|
|
223
|
+
const cssVars = themeToCssVariables(theme);
|
|
224
|
+
|
|
225
|
+
expect(cssVars['--persona-input-background']).toBe('#343536');
|
|
226
|
+
expect(cssVars['--persona-input-placeholder']).toBe('#3a3b3c');
|
|
227
|
+
expect(cssVars['--persona-message-assistant-bg']).toBe('#454647');
|
|
228
|
+
expect(cssVars['--persona-message-assistant-text']).toBe('#565758');
|
|
229
|
+
expect(cssVars['--persona-message-assistant-border']).toBe('#676869');
|
|
230
|
+
});
|
|
231
|
+
|
|
140
232
|
it('maps markdown link and optional heading tokens to consumer CSS vars', () => {
|
|
141
233
|
const theme = createTheme({
|
|
142
234
|
components: {
|
|
@@ -301,6 +393,40 @@ describe('theme utils', () => {
|
|
|
301
393
|
expect(cssVars['--persona-composer-shadow']).toBe('none');
|
|
302
394
|
});
|
|
303
395
|
|
|
396
|
+
it('falls back composer spacing/type vars to the utility-class defaults', () => {
|
|
397
|
+
const cssVars = themeToCssVariables(createTheme());
|
|
398
|
+
|
|
399
|
+
expect(cssVars['--persona-composer-padding']).toBe('0.75rem 1rem');
|
|
400
|
+
expect(cssVars['--persona-composer-gap']).toBe('0.5rem');
|
|
401
|
+
expect(cssVars['--persona-composer-font-size']).toBe('0.875rem');
|
|
402
|
+
expect(cssVars['--persona-composer-line-height']).toBe('1.25rem');
|
|
403
|
+
});
|
|
404
|
+
|
|
405
|
+
it('maps composer spacing/type tokens to dedicated CSS variables', () => {
|
|
406
|
+
const theme = createTheme({
|
|
407
|
+
components: {
|
|
408
|
+
composer: {
|
|
409
|
+
padding: '1rem 1.25rem',
|
|
410
|
+
gap: '0.75rem',
|
|
411
|
+
fontSize: '1rem',
|
|
412
|
+
lineHeight: '1.5rem',
|
|
413
|
+
},
|
|
414
|
+
},
|
|
415
|
+
} as any);
|
|
416
|
+
|
|
417
|
+
const cssVars = themeToCssVariables(theme);
|
|
418
|
+
|
|
419
|
+
expect(cssVars['--persona-components-composer-padding']).toBe('1rem 1.25rem');
|
|
420
|
+
expect(cssVars['--persona-components-composer-gap']).toBe('0.75rem');
|
|
421
|
+
expect(cssVars['--persona-components-composer-fontSize']).toBe('1rem');
|
|
422
|
+
expect(cssVars['--persona-components-composer-lineHeight']).toBe('1.5rem');
|
|
423
|
+
|
|
424
|
+
expect(cssVars['--persona-composer-padding']).toBe('1rem 1.25rem');
|
|
425
|
+
expect(cssVars['--persona-composer-gap']).toBe('0.75rem');
|
|
426
|
+
expect(cssVars['--persona-composer-font-size']).toBe('1rem');
|
|
427
|
+
expect(cssVars['--persona-composer-line-height']).toBe('1.5rem');
|
|
428
|
+
});
|
|
429
|
+
|
|
304
430
|
it('maps scroll-to-bottom component tokens to dedicated CSS variables', () => {
|
|
305
431
|
const theme = createTheme({
|
|
306
432
|
components: {
|
|
@@ -370,6 +496,51 @@ describe('theme utils', () => {
|
|
|
370
496
|
expect(cssVars['--persona-intro-card-bg']).toBe('transparent');
|
|
371
497
|
});
|
|
372
498
|
|
|
499
|
+
it('resolves semantic suggestion tokens for every variant and state', () => {
|
|
500
|
+
const theme = createTheme({
|
|
501
|
+
components: {
|
|
502
|
+
suggestion: {
|
|
503
|
+
chip: {
|
|
504
|
+
background: 'palette.colors.accent.50',
|
|
505
|
+
hoverBackground: 'palette.colors.accent.100',
|
|
506
|
+
focusRing: 'semantic.colors.interactive.focus',
|
|
507
|
+
},
|
|
508
|
+
card: {
|
|
509
|
+
borderRadius: 'palette.radius.lg',
|
|
510
|
+
shadow: 'palette.shadows.md',
|
|
511
|
+
},
|
|
512
|
+
list: {
|
|
513
|
+
minHeight: '48px',
|
|
514
|
+
disabledOpacity: '0.4',
|
|
515
|
+
},
|
|
516
|
+
},
|
|
517
|
+
},
|
|
518
|
+
});
|
|
519
|
+
const cssVars = themeToCssVariables(theme);
|
|
520
|
+
|
|
521
|
+
expect(cssVars['--persona-components-suggestion-chip-background']).toBe(
|
|
522
|
+
'#ecfeff'
|
|
523
|
+
);
|
|
524
|
+
expect(
|
|
525
|
+
cssVars['--persona-components-suggestion-chip-hoverBackground']
|
|
526
|
+
).toBe('#cffafe');
|
|
527
|
+
expect(cssVars['--persona-components-suggestion-chip-focusRing']).toBe(
|
|
528
|
+
'#0f0f0f'
|
|
529
|
+
);
|
|
530
|
+
expect(
|
|
531
|
+
cssVars['--persona-components-suggestion-card-borderRadius']
|
|
532
|
+
).toBe('0.5rem');
|
|
533
|
+
expect(cssVars['--persona-components-suggestion-card-shadow']).toContain(
|
|
534
|
+
'0 4px 6px'
|
|
535
|
+
);
|
|
536
|
+
expect(cssVars['--persona-components-suggestion-list-minHeight']).toBe(
|
|
537
|
+
'48px'
|
|
538
|
+
);
|
|
539
|
+
expect(
|
|
540
|
+
cssVars['--persona-components-suggestion-list-disabledOpacity']
|
|
541
|
+
).toBe('0.4');
|
|
542
|
+
});
|
|
543
|
+
|
|
373
544
|
it('drives --persona-tool-bubble-shadow from the theme token (config.toolCall.shadow is applied inline on the bubble, not the root var)', () => {
|
|
374
545
|
const el = document.createElement('div');
|
|
375
546
|
applyThemeVariables(el, {
|
package/src/utils/tokens.ts
CHANGED
|
@@ -269,9 +269,9 @@ export const DEFAULT_COMPONENTS: ComponentTokens = {
|
|
|
269
269
|
},
|
|
270
270
|
},
|
|
271
271
|
input: {
|
|
272
|
-
// Input role:
|
|
273
|
-
background: '
|
|
274
|
-
placeholder: '
|
|
272
|
+
// Input role: semantic surface so host light/dark schemes cascade.
|
|
273
|
+
background: 'semantic.colors.surface',
|
|
274
|
+
placeholder: 'semantic.colors.textMuted',
|
|
275
275
|
borderRadius: 'palette.radius.lg',
|
|
276
276
|
padding: 'semantic.spacing.md',
|
|
277
277
|
focus: {
|
|
@@ -319,11 +319,11 @@ export const DEFAULT_COMPONENTS: ComponentTokens = {
|
|
|
319
319
|
shadow: 'palette.shadows.sm',
|
|
320
320
|
},
|
|
321
321
|
assistant: {
|
|
322
|
-
// Assistant Messages role:
|
|
323
|
-
background: '
|
|
324
|
-
text: '
|
|
322
|
+
// Assistant Messages role: semantic neutral container.
|
|
323
|
+
background: 'semantic.colors.container',
|
|
324
|
+
text: 'semantic.colors.text',
|
|
325
325
|
borderRadius: 'palette.radius.lg',
|
|
326
|
-
border: '
|
|
326
|
+
border: 'semantic.colors.border',
|
|
327
327
|
shadow: 'palette.shadows.sm',
|
|
328
328
|
},
|
|
329
329
|
border: 'semantic.colors.border',
|
|
@@ -336,6 +336,60 @@ export const DEFAULT_COMPONENTS: ComponentTokens = {
|
|
|
336
336
|
padding: 'semantic.spacing.lg',
|
|
337
337
|
shadow: 'palette.shadows.none',
|
|
338
338
|
},
|
|
339
|
+
suggestion: {
|
|
340
|
+
chip: {
|
|
341
|
+
background: 'semantic.colors.surface',
|
|
342
|
+
foreground: 'semantic.colors.text',
|
|
343
|
+
border: 'semantic.colors.border',
|
|
344
|
+
borderRadius: 'palette.radius.full',
|
|
345
|
+
padding: '0.5rem 0.875rem',
|
|
346
|
+
gap: '0.5rem',
|
|
347
|
+
minHeight: '36px',
|
|
348
|
+
fontSize: '0.8125rem',
|
|
349
|
+
lineHeight: '1.25',
|
|
350
|
+
iconSize: '16px',
|
|
351
|
+
hoverBackground: 'palette.colors.gray.100',
|
|
352
|
+
hoverBorder: 'palette.colors.gray.300',
|
|
353
|
+
pressedBackground: 'palette.colors.gray.200',
|
|
354
|
+
focusRing: 'semantic.colors.interactive.focus',
|
|
355
|
+
disabledOpacity: '0.5',
|
|
356
|
+
},
|
|
357
|
+
card: {
|
|
358
|
+
background: 'semantic.colors.surface',
|
|
359
|
+
foreground: 'semantic.colors.text',
|
|
360
|
+
border: 'semantic.colors.border',
|
|
361
|
+
borderRadius: 'palette.radius.xl',
|
|
362
|
+
padding: '1rem',
|
|
363
|
+
shadow: 'palette.shadows.sm',
|
|
364
|
+
gap: '0.625rem',
|
|
365
|
+
minHeight: '72px',
|
|
366
|
+
fontSize: '0.875rem',
|
|
367
|
+
lineHeight: '1.35',
|
|
368
|
+
iconSize: '18px',
|
|
369
|
+
hoverBackground: 'palette.colors.gray.100',
|
|
370
|
+
hoverBorder: 'palette.colors.gray.300',
|
|
371
|
+
pressedBackground: 'palette.colors.gray.200',
|
|
372
|
+
focusRing: 'semantic.colors.interactive.focus',
|
|
373
|
+
disabledOpacity: '0.5',
|
|
374
|
+
},
|
|
375
|
+
list: {
|
|
376
|
+
background: 'transparent',
|
|
377
|
+
foreground: 'semantic.colors.text',
|
|
378
|
+
border: 'semantic.colors.border',
|
|
379
|
+
borderRadius: 'palette.radius.md',
|
|
380
|
+
padding: '0.75rem',
|
|
381
|
+
gap: '0.625rem',
|
|
382
|
+
minHeight: '44px',
|
|
383
|
+
fontSize: '0.875rem',
|
|
384
|
+
lineHeight: '1.35',
|
|
385
|
+
iconSize: '17px',
|
|
386
|
+
hoverBackground: 'palette.colors.gray.100',
|
|
387
|
+
hoverBorder: 'palette.colors.gray.300',
|
|
388
|
+
pressedBackground: 'palette.colors.gray.200',
|
|
389
|
+
focusRing: 'semantic.colors.interactive.focus',
|
|
390
|
+
disabledOpacity: '0.5',
|
|
391
|
+
},
|
|
392
|
+
},
|
|
339
393
|
toolBubble: {
|
|
340
394
|
shadow: 'palette.shadows.sm',
|
|
341
395
|
},
|
|
@@ -883,6 +937,16 @@ export function themeToCssVariables(theme: PersonaTheme): Record<string, string>
|
|
|
883
937
|
cssVars['--persona-components-reasoningBubble-shadow'] ?? '0 5px 15px rgba(15, 23, 42, 0.08)';
|
|
884
938
|
cssVars['--persona-composer-shadow'] =
|
|
885
939
|
cssVars['--persona-components-composer-shadow'] ?? 'none';
|
|
940
|
+
// Composer spacing/type. Fallbacks reproduce the utility classes the form
|
|
941
|
+
// used to carry (`px-4 py-3`, `gap-2`, `text-sm`) exactly.
|
|
942
|
+
cssVars['--persona-composer-padding'] =
|
|
943
|
+
cssVars['--persona-components-composer-padding'] ?? '0.75rem 1rem';
|
|
944
|
+
cssVars['--persona-composer-gap'] =
|
|
945
|
+
cssVars['--persona-components-composer-gap'] ?? '0.5rem';
|
|
946
|
+
cssVars['--persona-composer-font-size'] =
|
|
947
|
+
cssVars['--persona-components-composer-fontSize'] ?? '0.875rem';
|
|
948
|
+
cssVars['--persona-composer-line-height'] =
|
|
949
|
+
cssVars['--persona-components-composer-lineHeight'] ?? '1.25rem';
|
|
886
950
|
|
|
887
951
|
cssVars['--persona-md-inline-code-bg'] =
|
|
888
952
|
cssVars['--persona-components-markdown-inlineCode-background'] ?? cssVars['--persona-container'];
|
package/dist/chunk-MMUPR2JW.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var zt=(e,t)=>{let n=document.createElement(e);return t&&(n.className=t),n};var Bt=()=>document.createDocumentFragment(),Ft=(e,t={},...n)=>{let o=document.createElement(e);if(t.className&&(o.className=t.className),t.text!==void 0&&(o.textContent=t.text),t.attrs)for(let[s,a]of Object.entries(t.attrs))o.setAttribute(s,a);if(t.style){let s=o.style,a=t.style;for(let c of Object.keys(a)){let l=a[c];l!=null&&(s[c]=l)}}let r=n.filter(s=>s!=null);return r.length>0&&o.append(...r),o},Kt=(...e)=>e.filter(Boolean).join(" ");import{Activity as A,ArrowDown as k,ArrowUp as P,ArrowUpRight as L,Bot as I,ChevronDown as R,ChevronUp as D,ChevronRight as H,ChevronLeft as O,Check as z,Clipboard as B,ClipboardCopy as F,CodeXml as K,Copy as W,File as U,FileCode as j,FileSpreadsheet as $,FileText as q,ImagePlus as V,Loader as X,LoaderCircle as G,Mic as _,Paperclip as Y,RefreshCw as Z,Search as J,Send as Q,ShieldAlert as ee,ShieldCheck as te,ShieldX as ne,Square as oe,ThumbsDown as re,ThumbsUp as ie,Upload as se,Volume2 as ae,X as le,User as ce,Mail as de,Phone as ue,Calendar as me,Clock as pe,Building as ge,MapPin as he,Lock as fe,Key as we,CreditCard as ye,AtSign as be,Hash as ve,Globe as xe,Link as Ce,CircleCheck as Se,CircleX as Ee,TriangleAlert as Te,Info as Me,Ban as Ne,Shield as Ae,ArrowLeft as ke,ArrowRight as Pe,ExternalLink as Le,Ellipsis as Ie,EllipsisVertical as Re,Menu as De,House as He,Plus as Oe,Minus as ze,Pencil as Be,Trash as Fe,Trash2 as Ke,Save as We,Download as Ue,Share as je,Funnel as $e,Settings as qe,RotateCw as Ve,Maximize as Xe,Minimize as Ge,ShoppingCart as _e,ShoppingBag as Ye,Package as Ze,Truck as Je,Tag as Qe,Gift as et,Receipt as tt,Wallet as nt,Store as ot,DollarSign as rt,Percent as it,Play as st,Pause as at,VolumeX as lt,Camera as ct,Image as dt,Film as ut,Headphones as mt,MessageCircle as pt,MessageSquare as gt,Bell as ht,Heart as ft,Star as wt,Eye as yt,EyeOff as bt,Bookmark as vt,CalendarDays as xt,History as Ct,Timer as St,Folder as Et,FolderOpen as Tt,Files as Mt,Sparkles as Nt,Zap as At,Sun as kt,Moon as Pt,Flag as Lt,Monitor as It,Smartphone as Rt}from"lucide";var Dt={activity:A,"arrow-down":k,"arrow-up":P,"arrow-up-right":L,bot:I,"chevron-down":R,"chevron-up":D,"chevron-right":H,"chevron-left":O,check:z,clipboard:B,"clipboard-copy":F,"code-xml":K,copy:W,file:U,"file-code":j,"file-spreadsheet":$,"file-text":q,"image-plus":V,loader:X,"loader-circle":G,mic:_,paperclip:Y,"refresh-cw":Z,search:J,send:Q,"shield-alert":ee,"shield-check":te,"shield-x":ne,square:oe,"thumbs-down":re,"thumbs-up":ie,upload:se,"volume-2":ae,x:le,user:ce,mail:de,phone:ue,calendar:me,clock:pe,building:ge,"map-pin":he,lock:fe,key:we,"credit-card":ye,"at-sign":be,hash:ve,globe:xe,link:Ce,"circle-check":Se,"circle-x":Ee,"triangle-alert":Te,info:Me,ban:Ne,shield:Ae,"arrow-left":ke,"arrow-right":Pe,"external-link":Le,ellipsis:Ie,"ellipsis-vertical":Re,menu:De,house:He,plus:Oe,minus:ze,pencil:Be,trash:Fe,"trash-2":Ke,save:We,download:Ue,share:je,funnel:$e,settings:qe,"rotate-cw":Ve,maximize:Xe,minimize:Ge,"shopping-cart":_e,"shopping-bag":Ye,package:Ze,truck:Je,tag:Qe,gift:et,receipt:tt,wallet:nt,store:ot,"dollar-sign":rt,percent:it,play:st,pause:at,"volume-x":lt,camera:ct,image:dt,film:ut,headphones:mt,"message-circle":pt,"message-square":gt,bell:ht,heart:ft,star:wt,eye:yt,"eye-off":bt,bookmark:vt,"calendar-days":xt,history:Ct,timer:St,folder:Et,"folder-open":Tt,files:Mt,sparkles:Nt,zap:At,sun:kt,moon:Pt,flag:Lt,monitor:It,smartphone:Rt},jt=(e,t=24,n="currentColor",o=2)=>{let r=Dt[e];return r?Ht(r,t,n,o):(console.warn(`Lucide icon "${e}" is not in the Persona registry. Add it to packages/widget/src/utils/icons.ts (see docs/icon-registry-shortlist.md).`),null)};function Ht(e,t,n,o){if(!Array.isArray(e))return null;let r=document.createElementNS("http://www.w3.org/2000/svg","svg");return r.setAttribute("width",String(t)),r.setAttribute("height",String(t)),r.setAttribute("viewBox","0 0 24 24"),r.setAttribute("fill","none"),r.setAttribute("stroke",n),r.setAttribute("stroke-width",String(o)),r.setAttribute("stroke-linecap","round"),r.setAttribute("stroke-linejoin","round"),r.setAttribute("aria-hidden","true"),e.forEach(s=>{if(!Array.isArray(s)||s.length<2)return;let a=s[0],c=s[1];if(!c)return;let l=document.createElementNS("http://www.w3.org/2000/svg",a);Object.entries(c).forEach(([h,f])=>{h!=="stroke"&&l.setAttribute(h,String(f))}),r.appendChild(l)}),r}function qt(e){let t={trigger:e.trigger??"@",position:e.triggerPosition??"anywhere",allowSpaces:!1,sources:Array.isArray(e.sources)?e.sources:[],searchPlaceholder:e.searchPlaceholder,showButton:e.showButton!==!1,buttonIconName:e.buttonIconName,buttonTooltipText:e.buttonTooltipText},n=(e.triggers??[]).map(o=>({trigger:o.trigger,position:o.triggerPosition??"anywhere",allowSpaces:o.allowSpaces??!1,sources:Array.isArray(o.sources)?o.sources:[],searchPlaceholder:o.searchPlaceholder,showButton:o.showButton===!0,buttonIconName:o.buttonIconName,buttonTooltipText:o.buttonTooltipText}));return[t,...n]}function T(e){let t=e.getRootNode?.();return t instanceof ShadowRoot||t instanceof Document?t:e.ownerDocument??document}function b(e,t,n){let o=e instanceof Document?e.head:e,r=t.replace(/["\\]/g,"\\$&");if(o.querySelector(`style[data-persona-plugin-style="${r}"]`))return;let a=(e instanceof Document?e:e.ownerDocument??document).createElement("style");a.setAttribute("data-persona-plugin-style",t),a.textContent=n,o.appendChild(a)}function Xt(e,t,n){if(e instanceof Document||e instanceof ShadowRoot){b(e,t,n);return}let o=e;if(o.isConnected){b(T(o),t,n);return}let r=o.ownerDocument??document;b(r,t,n),queueMicrotask(()=>{let s=T(o);s!==r&&b(s,t,n)})}function Ot(e){let t=e.getRootNode?.();return t instanceof ShadowRoot?t:(e.ownerDocument??document).body}function Gt(e){let{anchor:t,content:n,placement:o="bottom-start",offset:r=6,matchAnchorWidth:s=!1,horizontalOffset:a,verticalOffset:c,zIndex:l=2147483e3,onOpen:h,onDismiss:f}=e,M=e.container??Ot(t),d=!1,w=null,v=()=>{if(!d)return;let i=t.getBoundingClientRect();n.style.position="fixed",s&&(n.style.minWidth=`${i.width}px`),a&&(n.style.maxWidth=`${i.width}px`);let m=n.getBoundingClientRect(),u=c?.()??null,y=u!=null?i.top+u:i.top,x=o==="top-start"||o==="top-end"?y-r-m.height:i.bottom+r,g=o==="bottom-end"||o==="top-end"?i.right-m.width:i.left,E=a?.()??null;if(E!=null){let N=Math.max(i.left,i.right-m.width);g=Math.min(Math.max(i.left+E,i.left),N)}n.style.top=`${x}px`,n.style.left=`${g}px`},p=()=>{d&&(d=!1,w&&(w(),w=null),n.remove())},S=()=>{if(d)return;d=!0,l!=null&&(n.style.zIndex=String(l)),M.appendChild(n),v();let i=(t.ownerDocument??document).defaultView??window,m=t.ownerDocument??document,u=()=>{if(!t.isConnected){p(),f?.("anchor-removed");return}v()},y=C=>{let g=typeof C.composedPath=="function"?C.composedPath():[];g.includes(n)||g.includes(t)||(p(),f?.("outside"))},x=i.setTimeout(()=>{m.addEventListener("pointerdown",y,!0)},0);i.addEventListener("scroll",u,!0),i.addEventListener("resize",u),w=()=>{i.clearTimeout(x),m.removeEventListener("pointerdown",y,!0),i.removeEventListener("scroll",u,!0),i.removeEventListener("resize",u)},h?.()};return{get isOpen(){return d},open:S,close:p,toggle:()=>d?p():S(),reposition:v,destroy:p}}function _t(e){return(typeof e.composedPath=="function"?e.composedPath():[]).some(n=>n instanceof HTMLElement&&(n.tagName==="INPUT"||n.tagName==="TEXTAREA"||n.isContentEditable))}export{zt as a,Bt as b,Ft as c,Kt as d,jt as e,qt as f,Xt as g,Gt as h,_t as i};
|