@runtypelabs/persona 2.1.0 → 2.2.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/LICENSE +21 -0
- package/dist/index.cjs +39 -39
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +99 -1
- package/dist/index.d.ts +99 -1
- package/dist/index.global.js +84 -84
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +39 -39
- package/dist/index.js.map +1 -1
- package/dist/widget.css +40 -10
- package/package.json +2 -1
- package/src/client.ts +0 -1
- package/src/components/artifact-pane.ts +2 -0
- package/src/components/composer-builder.ts +1 -0
- package/src/components/header-builder.ts +1 -0
- package/src/components/header-layouts.ts +41 -1
- package/src/components/message-bubble.ts +2 -0
- package/src/components/panel.ts +2 -0
- package/src/index.ts +14 -1
- package/src/presets.ts +127 -0
- package/src/styles/widget.css +40 -10
- package/src/types/theme.ts +41 -0
- package/src/types.ts +14 -0
- package/src/ui.ts +14 -1
- package/src/utils/tokens.ts +54 -0
package/dist/index.d.cts
CHANGED
|
@@ -638,6 +638,14 @@ type AgentWidgetArtifactsFeature = {
|
|
|
638
638
|
allowedTypes?: PersonaArtifactKind[];
|
|
639
639
|
/** Split / drawer dimensions and launcher widen behavior */
|
|
640
640
|
layout?: AgentWidgetArtifactsLayoutConfig;
|
|
641
|
+
/**
|
|
642
|
+
* Called when an artifact card action is triggered (open, download).
|
|
643
|
+
* Return `true` to prevent the default behavior.
|
|
644
|
+
*/
|
|
645
|
+
onArtifactAction?: (action: {
|
|
646
|
+
type: 'open' | 'download';
|
|
647
|
+
artifactId: string;
|
|
648
|
+
}) => boolean | void;
|
|
641
649
|
};
|
|
642
650
|
type AgentWidgetFeatureFlags = {
|
|
643
651
|
showReasoning?: boolean;
|
|
@@ -1480,6 +1488,12 @@ type AgentWidgetHeaderLayoutConfig = {
|
|
|
1480
1488
|
trailingActions?: AgentWidgetHeaderTrailingAction[];
|
|
1481
1489
|
/** Called when a `trailingActions` button is clicked. */
|
|
1482
1490
|
onAction?: (actionId: string) => void;
|
|
1491
|
+
/**
|
|
1492
|
+
* Called when the header title row is clicked.
|
|
1493
|
+
* Useful for dropdown menus or navigation triggered from the header.
|
|
1494
|
+
* When set, the title row becomes visually interactive (cursor: pointer).
|
|
1495
|
+
*/
|
|
1496
|
+
onTitleClick?: () => void;
|
|
1483
1497
|
};
|
|
1484
1498
|
/**
|
|
1485
1499
|
* Avatar configuration for message bubbles
|
|
@@ -4411,6 +4425,38 @@ interface ComposerChromeTokens {
|
|
|
4411
4425
|
/** Box-shadow on the composer form (raw CSS, e.g. `none`). */
|
|
4412
4426
|
shadow: string;
|
|
4413
4427
|
}
|
|
4428
|
+
/** Artifact toolbar chrome. */
|
|
4429
|
+
interface ArtifactToolbarTokens {
|
|
4430
|
+
iconHoverColor?: string;
|
|
4431
|
+
iconHoverBackground?: string;
|
|
4432
|
+
iconPadding?: string;
|
|
4433
|
+
iconBorderRadius?: string;
|
|
4434
|
+
iconBorder?: string;
|
|
4435
|
+
toggleGroupGap?: string;
|
|
4436
|
+
toggleBorderRadius?: string;
|
|
4437
|
+
copyBackground?: string;
|
|
4438
|
+
copyBorder?: string;
|
|
4439
|
+
copyColor?: string;
|
|
4440
|
+
copyBorderRadius?: string;
|
|
4441
|
+
copyPadding?: string;
|
|
4442
|
+
copyMenuBackground?: string;
|
|
4443
|
+
copyMenuBorder?: string;
|
|
4444
|
+
copyMenuShadow?: string;
|
|
4445
|
+
copyMenuBorderRadius?: string;
|
|
4446
|
+
copyMenuItemHoverBackground?: string;
|
|
4447
|
+
}
|
|
4448
|
+
/** Artifact tab strip chrome. */
|
|
4449
|
+
interface ArtifactTabTokens {
|
|
4450
|
+
background?: string;
|
|
4451
|
+
activeBackground?: string;
|
|
4452
|
+
activeBorder?: string;
|
|
4453
|
+
borderRadius?: string;
|
|
4454
|
+
textColor?: string;
|
|
4455
|
+
}
|
|
4456
|
+
/** Artifact pane chrome. */
|
|
4457
|
+
interface ArtifactPaneTokens {
|
|
4458
|
+
toolbarBackground?: string;
|
|
4459
|
+
}
|
|
4414
4460
|
interface ComponentTokens {
|
|
4415
4461
|
button: ButtonTokens;
|
|
4416
4462
|
input: InputTokens;
|
|
@@ -4426,6 +4472,12 @@ interface ComponentTokens {
|
|
|
4426
4472
|
toolBubble: ToolBubbleTokens;
|
|
4427
4473
|
reasoningBubble: ReasoningBubbleTokens;
|
|
4428
4474
|
composer: ComposerChromeTokens;
|
|
4475
|
+
/** Artifact toolbar, tab strip, and pane chrome. */
|
|
4476
|
+
artifact?: {
|
|
4477
|
+
toolbar?: ArtifactToolbarTokens;
|
|
4478
|
+
tab?: ArtifactTabTokens;
|
|
4479
|
+
pane?: ArtifactPaneTokens;
|
|
4480
|
+
};
|
|
4429
4481
|
}
|
|
4430
4482
|
interface PaletteExtras {
|
|
4431
4483
|
transitions?: Record<string, string>;
|
|
@@ -4645,6 +4697,22 @@ declare function resolveTokens(theme: PersonaTheme): Record<string, ResolvedToke
|
|
|
4645
4697
|
declare function validateTheme(theme: Partial<PersonaTheme>): ThemeValidationResult;
|
|
4646
4698
|
declare function createTheme(userConfig?: Partial<PersonaTheme>, options?: CreateThemeOptions): PersonaTheme;
|
|
4647
4699
|
declare function themeToCssVariables(theme: PersonaTheme): Record<string, string>;
|
|
4700
|
+
/**
|
|
4701
|
+
* Stable `data-persona-theme-zone` values applied to key widget regions.
|
|
4702
|
+
* Visual editors should use `[data-persona-theme-zone="header"]` selectors
|
|
4703
|
+
* rather than internal class names.
|
|
4704
|
+
*/
|
|
4705
|
+
declare const THEME_ZONES: {
|
|
4706
|
+
readonly header: "Widget header bar";
|
|
4707
|
+
readonly messages: "Message list area";
|
|
4708
|
+
readonly 'user-message': "User message bubble";
|
|
4709
|
+
readonly 'assistant-message': "Assistant message bubble";
|
|
4710
|
+
readonly composer: "Footer / composer area";
|
|
4711
|
+
readonly container: "Main widget container";
|
|
4712
|
+
readonly 'artifact-pane': "Artifact sidebar";
|
|
4713
|
+
readonly 'artifact-toolbar': "Artifact toolbar";
|
|
4714
|
+
};
|
|
4715
|
+
type ThemeZone = keyof typeof THEME_ZONES;
|
|
4648
4716
|
|
|
4649
4717
|
type ColorScheme = 'light' | 'dark' | 'auto';
|
|
4650
4718
|
interface PersonaWidgetConfig {
|
|
@@ -4885,6 +4953,36 @@ declare const DEFAULT_WIDGET_CONFIG: Partial<AgentWidgetConfig>;
|
|
|
4885
4953
|
*/
|
|
4886
4954
|
declare function mergeWithDefaults(config?: Partial<AgentWidgetConfig>): Partial<AgentWidgetConfig>;
|
|
4887
4955
|
|
|
4956
|
+
/**
|
|
4957
|
+
* A named preset containing partial widget configuration.
|
|
4958
|
+
* Apply with: `createAgentExperience(el, { ...PRESET_SHOP.config, apiUrl: '...' })`
|
|
4959
|
+
* or via IIFE: `{ ...AgentWidget.PRESETS.shop.config, apiUrl: '...' }`
|
|
4960
|
+
*/
|
|
4961
|
+
interface WidgetPreset {
|
|
4962
|
+
id: string;
|
|
4963
|
+
label: string;
|
|
4964
|
+
config: Partial<AgentWidgetConfig>;
|
|
4965
|
+
}
|
|
4966
|
+
/**
|
|
4967
|
+
* Shopping / e-commerce preset.
|
|
4968
|
+
* Dark header, rounded launchers, shopping-oriented copy.
|
|
4969
|
+
*/
|
|
4970
|
+
declare const PRESET_SHOP: WidgetPreset;
|
|
4971
|
+
/**
|
|
4972
|
+
* Minimal preset.
|
|
4973
|
+
* Stripped-down header, no launcher button, suitable for inline embeds.
|
|
4974
|
+
*/
|
|
4975
|
+
declare const PRESET_MINIMAL: WidgetPreset;
|
|
4976
|
+
/**
|
|
4977
|
+
* Fullscreen assistant preset.
|
|
4978
|
+
* No launcher, content-max-width constrained, minimal header.
|
|
4979
|
+
*/
|
|
4980
|
+
declare const PRESET_FULLSCREEN: WidgetPreset;
|
|
4981
|
+
/** All named presets keyed by ID. */
|
|
4982
|
+
declare const PRESETS: Record<string, WidgetPreset>;
|
|
4983
|
+
/** Look up a preset by ID. */
|
|
4984
|
+
declare function getPreset(id: string): WidgetPreset | undefined;
|
|
4985
|
+
|
|
4888
4986
|
interface HeaderElements {
|
|
4889
4987
|
header: HTMLElement;
|
|
4890
4988
|
iconHolder: HTMLElement;
|
|
@@ -4975,4 +5073,4 @@ declare function createVoiceProvider(config: VoiceConfig): VoiceProvider;
|
|
|
4975
5073
|
declare function createBestAvailableVoiceProvider(config?: Partial<VoiceConfig>): VoiceProvider;
|
|
4976
5074
|
declare function isVoiceSupported(config?: Partial<VoiceConfig>): boolean;
|
|
4977
5075
|
|
|
4978
|
-
export { type AgentConfig, type AgentExecutionState, type AgentLoopConfig, type AgentMessageMetadata, type AgentRequestOptions, type AgentToolsConfig, type AgentWidgetAgentRequestPayload, type AgentWidgetApproval, type AgentWidgetApprovalConfig, type AgentWidgetArtifactsFeature, type AgentWidgetArtifactsLayoutConfig, type AgentWidgetAttachmentsConfig, type AgentWidgetAvatarConfig, AgentWidgetClient, type AgentWidgetComposerConfig, type AgentWidgetConfig, type AgentWidgetController, type AgentWidgetControllerEventMap, type AgentWidgetCustomFetch, type AgentWidgetDockConfig, type AgentWidgetEvent, type AgentWidgetFeatureFlags, type AgentWidgetHeaderLayoutConfig, type AgentWidgetHeadersFunction, type AgentWidgetInitHandle, type AgentWidgetInitOptions, type AgentWidgetLauncherConfig, type AgentWidgetLayoutConfig, type AgentWidgetLoadingIndicatorConfig, type AgentWidgetMarkdownConfig, type AgentWidgetMarkdownOptions, type AgentWidgetMarkdownRendererOverrides, type AgentWidgetMessage, type AgentWidgetMessageActionsConfig, type AgentWidgetMessageFeedback, type AgentWidgetMessageLayoutConfig, type AgentWidgetPlugin, type AgentWidgetRequestPayload, type AgentWidgetSSEEventParser, type AgentWidgetSSEEventResult, AgentWidgetSession, type AgentWidgetSessionStatus, type AgentWidgetStreamParser, type AgentWidgetStreamParserResult, type AgentWidgetTheme, type AgentWidgetTimestampConfig, type ArtifactConfigPayload, AttachmentManager, type AttachmentManagerConfig, type BorderScale, type CSATFeedbackOptions, type ClientChatRequest, type ClientFeedbackRequest, type ClientFeedbackType, type ClientInitResponse, type ClientSession, type CodeFormat, type CodeGeneratorHooks, type CodeGeneratorOptions, type ColorPalette, type ColorShade, type ComponentContext, type ComponentDirective, type ComponentRenderer, type ComponentTokens, type ComposerBuildContext, type ComposerElements, type ContentPart, type CreateStandardBubbleOptions, type CreateThemeOptions, DEFAULT_COMPONENTS, DEFAULT_DARK_THEME, DEFAULT_LIGHT_THEME, DEFAULT_PALETTE, DEFAULT_SEMANTIC, DEFAULT_WIDGET_CONFIG, type DomContextMode, type DomContextOptions, type EnrichedPageElement, type EventStreamBadgeColor, type EventStreamConfig, type EventStreamPayloadRenderContext, type EventStreamRowRenderContext, type EventStreamToolbarRenderContext, type EventStreamViewRenderContext, type FormatEnrichedContextOptions, type HeaderBuildContext, type HeaderElements, type HeaderLayoutContext, type HeaderLayoutRenderer, type HeaderRenderContext, type IdleIndicatorRenderContext, type ImageContentPart, type InjectAssistantMessageOptions, type InjectMessageOptions, type InjectSystemMessageOptions, type InjectUserMessageOptions, type LoadingIndicatorRenderContext, type LoadingIndicatorRenderer, type MarkdownProcessorOptions, type MessageActionCallbacks, type MessageContent, type MessageRenderContext, type MessageTransform, type NPSFeedbackOptions, type ParseOptionsConfig, type ParseRule, type PendingAttachment, type PersonaArtifactKind, type PersonaArtifactManualUpsert, type PersonaArtifactRecord, type PersonaTheme, type PersonaThemePlugin, type RadiusScale, type RuleScoringContext, type SSEEventCallback, type SSEEventRecord, type SemanticColors, type SemanticSpacing, type SemanticTypography, type ShadowScale, type SlotRenderContext, type SlotRenderer, type SpacingScale, type TextContentPart, type ThemeValidationError, type ThemeValidationResult, type TokenReference, type TypographyScale, VERSION, type VoiceConfig, type VoiceProvider, type VoiceResult, type VoiceStatus, type WidgetHostLayout, type WidgetHostLayoutMode, type WidgetLayoutSlot, accessibilityPlugin, animationsPlugin, applyThemeVariables, attachHeaderToContainer, brandPlugin, buildComposer, buildDefaultHeader, buildHeader, buildHeaderWithLayout, buildMinimalHeader, collectEnrichedPageContext, componentRegistry, createActionManager, createAgentExperience, createBestAvailableVoiceProvider, createBubbleWithLayout, createCSATFeedback, createComponentMiddleware, createComponentStreamParser, createDirectivePostprocessor, createFlexibleJsonStreamParser, createImagePart, createJsonStreamParser, createLocalStorageAdapter, createMarkdownProcessor, createMarkdownProcessorFromConfig, createMessageActions, createNPSFeedback, createPlainTextParser, createPlugin, createRegexJsonParser, createStandardBubble, createTextPart, createTheme, createThemeObserver, createTypingIndicator, createVoiceProvider, createWidgetHostLayout, createXmlParser, initAgentWidget as default, defaultActionHandlers, defaultJsonActionParser, defaultParseRules, detectColorScheme, directivePostprocessor, escapeHtml, extractComponentDirectiveFromMessage, fileToImagePart, formatEnrichedContext, generateAssistantMessageId, generateCodeSnippet, generateMessageId, generateStableSelector, generateUserMessageId, getActiveTheme, getColorScheme, getDisplayText, getHeaderLayout, getImageParts, hasComponentDirective, hasImages, headerLayouts, highContrastPlugin, initAgentWidget, isComponentDirectiveType, isDockedMountMode, isVoiceSupported, markdownPostprocessor, mergeWithDefaults, migrateV1Theme, normalizeContent, pluginRegistry, reducedMotionPlugin, renderComponentDirective, renderLoadingIndicatorWithFallback, resolveDockConfig, resolveTokens, themeToCssVariables, validateImageFile, validateTheme, validateV1Theme };
|
|
5076
|
+
export { type AgentConfig, type AgentExecutionState, type AgentLoopConfig, type AgentMessageMetadata, type AgentRequestOptions, type AgentToolsConfig, type AgentWidgetAgentRequestPayload, type AgentWidgetApproval, type AgentWidgetApprovalConfig, type AgentWidgetArtifactsFeature, type AgentWidgetArtifactsLayoutConfig, type AgentWidgetAttachmentsConfig, type AgentWidgetAvatarConfig, AgentWidgetClient, type AgentWidgetComposerConfig, type AgentWidgetConfig, type AgentWidgetController, type AgentWidgetControllerEventMap, type AgentWidgetCustomFetch, type AgentWidgetDockConfig, type AgentWidgetEvent, type AgentWidgetFeatureFlags, type AgentWidgetHeaderLayoutConfig, type AgentWidgetHeadersFunction, type AgentWidgetInitHandle, type AgentWidgetInitOptions, type AgentWidgetLauncherConfig, type AgentWidgetLayoutConfig, type AgentWidgetLoadingIndicatorConfig, type AgentWidgetMarkdownConfig, type AgentWidgetMarkdownOptions, type AgentWidgetMarkdownRendererOverrides, type AgentWidgetMessage, type AgentWidgetMessageActionsConfig, type AgentWidgetMessageFeedback, type AgentWidgetMessageLayoutConfig, type AgentWidgetPlugin, type AgentWidgetRequestPayload, type AgentWidgetSSEEventParser, type AgentWidgetSSEEventResult, AgentWidgetSession, type AgentWidgetSessionStatus, type AgentWidgetStreamParser, type AgentWidgetStreamParserResult, type AgentWidgetTheme, type AgentWidgetTimestampConfig, type ArtifactConfigPayload, type ArtifactPaneTokens, type ArtifactTabTokens, type ArtifactToolbarTokens, AttachmentManager, type AttachmentManagerConfig, type BorderScale, type CSATFeedbackOptions, type ClientChatRequest, type ClientFeedbackRequest, type ClientFeedbackType, type ClientInitResponse, type ClientSession, type CodeFormat, type CodeGeneratorHooks, type CodeGeneratorOptions, type ColorPalette, type ColorShade, type ComponentContext, type ComponentDirective, type ComponentRenderer, type ComponentTokens, type ComposerBuildContext, type ComposerElements, type ContentPart, type CreateStandardBubbleOptions, type CreateThemeOptions, DEFAULT_COMPONENTS, DEFAULT_DARK_THEME, DEFAULT_LIGHT_THEME, DEFAULT_PALETTE, DEFAULT_SEMANTIC, DEFAULT_WIDGET_CONFIG, type DomContextMode, type DomContextOptions, type EnrichedPageElement, type EventStreamBadgeColor, type EventStreamConfig, type EventStreamPayloadRenderContext, type EventStreamRowRenderContext, type EventStreamToolbarRenderContext, type EventStreamViewRenderContext, type FormatEnrichedContextOptions, type HeaderBuildContext, type HeaderElements, type HeaderLayoutContext, type HeaderLayoutRenderer, type HeaderRenderContext, type IdleIndicatorRenderContext, type ImageContentPart, type InjectAssistantMessageOptions, type InjectMessageOptions, type InjectSystemMessageOptions, type InjectUserMessageOptions, type LoadingIndicatorRenderContext, type LoadingIndicatorRenderer, type MarkdownProcessorOptions, type MessageActionCallbacks, type MessageContent, type MessageRenderContext, type MessageTransform, type NPSFeedbackOptions, PRESETS, PRESET_FULLSCREEN, PRESET_MINIMAL, PRESET_SHOP, type ParseOptionsConfig, type ParseRule, type PendingAttachment, type PersonaArtifactKind, type PersonaArtifactManualUpsert, type PersonaArtifactRecord, type PersonaTheme, type PersonaThemePlugin, type RadiusScale, type RuleScoringContext, type SSEEventCallback, type SSEEventRecord, type SemanticColors, type SemanticSpacing, type SemanticTypography, type ShadowScale, type SlotRenderContext, type SlotRenderer, type SpacingScale, THEME_ZONES, type TextContentPart, type ThemeValidationError, type ThemeValidationResult, type ThemeZone, type TokenReference, type TypographyScale, VERSION, type VoiceConfig, type VoiceProvider, type VoiceResult, type VoiceStatus, type WidgetHostLayout, type WidgetHostLayoutMode, type WidgetLayoutSlot, type WidgetPreset, accessibilityPlugin, animationsPlugin, applyThemeVariables, attachHeaderToContainer, brandPlugin, buildComposer, buildDefaultHeader, buildHeader, buildHeaderWithLayout, buildMinimalHeader, collectEnrichedPageContext, componentRegistry, createActionManager, createAgentExperience, createBestAvailableVoiceProvider, createBubbleWithLayout, createCSATFeedback, createComponentMiddleware, createComponentStreamParser, createDirectivePostprocessor, createFlexibleJsonStreamParser, createImagePart, createJsonStreamParser, createLocalStorageAdapter, createMarkdownProcessor, createMarkdownProcessorFromConfig, createMessageActions, createNPSFeedback, createPlainTextParser, createPlugin, createRegexJsonParser, createStandardBubble, createTextPart, createTheme, createThemeObserver, createTypingIndicator, createVoiceProvider, createWidgetHostLayout, createXmlParser, initAgentWidget as default, defaultActionHandlers, defaultJsonActionParser, defaultParseRules, detectColorScheme, directivePostprocessor, escapeHtml, extractComponentDirectiveFromMessage, fileToImagePart, formatEnrichedContext, generateAssistantMessageId, generateCodeSnippet, generateMessageId, generateStableSelector, generateUserMessageId, getActiveTheme, getColorScheme, getDisplayText, getHeaderLayout, getImageParts, getPreset, hasComponentDirective, hasImages, headerLayouts, highContrastPlugin, initAgentWidget, isComponentDirectiveType, isDockedMountMode, isVoiceSupported, markdownPostprocessor, mergeWithDefaults, migrateV1Theme, normalizeContent, pluginRegistry, reducedMotionPlugin, renderComponentDirective, renderLoadingIndicatorWithFallback, resolveDockConfig, resolveTokens, themeToCssVariables, validateImageFile, validateTheme, validateV1Theme };
|
package/dist/index.d.ts
CHANGED
|
@@ -638,6 +638,14 @@ type AgentWidgetArtifactsFeature = {
|
|
|
638
638
|
allowedTypes?: PersonaArtifactKind[];
|
|
639
639
|
/** Split / drawer dimensions and launcher widen behavior */
|
|
640
640
|
layout?: AgentWidgetArtifactsLayoutConfig;
|
|
641
|
+
/**
|
|
642
|
+
* Called when an artifact card action is triggered (open, download).
|
|
643
|
+
* Return `true` to prevent the default behavior.
|
|
644
|
+
*/
|
|
645
|
+
onArtifactAction?: (action: {
|
|
646
|
+
type: 'open' | 'download';
|
|
647
|
+
artifactId: string;
|
|
648
|
+
}) => boolean | void;
|
|
641
649
|
};
|
|
642
650
|
type AgentWidgetFeatureFlags = {
|
|
643
651
|
showReasoning?: boolean;
|
|
@@ -1480,6 +1488,12 @@ type AgentWidgetHeaderLayoutConfig = {
|
|
|
1480
1488
|
trailingActions?: AgentWidgetHeaderTrailingAction[];
|
|
1481
1489
|
/** Called when a `trailingActions` button is clicked. */
|
|
1482
1490
|
onAction?: (actionId: string) => void;
|
|
1491
|
+
/**
|
|
1492
|
+
* Called when the header title row is clicked.
|
|
1493
|
+
* Useful for dropdown menus or navigation triggered from the header.
|
|
1494
|
+
* When set, the title row becomes visually interactive (cursor: pointer).
|
|
1495
|
+
*/
|
|
1496
|
+
onTitleClick?: () => void;
|
|
1483
1497
|
};
|
|
1484
1498
|
/**
|
|
1485
1499
|
* Avatar configuration for message bubbles
|
|
@@ -4411,6 +4425,38 @@ interface ComposerChromeTokens {
|
|
|
4411
4425
|
/** Box-shadow on the composer form (raw CSS, e.g. `none`). */
|
|
4412
4426
|
shadow: string;
|
|
4413
4427
|
}
|
|
4428
|
+
/** Artifact toolbar chrome. */
|
|
4429
|
+
interface ArtifactToolbarTokens {
|
|
4430
|
+
iconHoverColor?: string;
|
|
4431
|
+
iconHoverBackground?: string;
|
|
4432
|
+
iconPadding?: string;
|
|
4433
|
+
iconBorderRadius?: string;
|
|
4434
|
+
iconBorder?: string;
|
|
4435
|
+
toggleGroupGap?: string;
|
|
4436
|
+
toggleBorderRadius?: string;
|
|
4437
|
+
copyBackground?: string;
|
|
4438
|
+
copyBorder?: string;
|
|
4439
|
+
copyColor?: string;
|
|
4440
|
+
copyBorderRadius?: string;
|
|
4441
|
+
copyPadding?: string;
|
|
4442
|
+
copyMenuBackground?: string;
|
|
4443
|
+
copyMenuBorder?: string;
|
|
4444
|
+
copyMenuShadow?: string;
|
|
4445
|
+
copyMenuBorderRadius?: string;
|
|
4446
|
+
copyMenuItemHoverBackground?: string;
|
|
4447
|
+
}
|
|
4448
|
+
/** Artifact tab strip chrome. */
|
|
4449
|
+
interface ArtifactTabTokens {
|
|
4450
|
+
background?: string;
|
|
4451
|
+
activeBackground?: string;
|
|
4452
|
+
activeBorder?: string;
|
|
4453
|
+
borderRadius?: string;
|
|
4454
|
+
textColor?: string;
|
|
4455
|
+
}
|
|
4456
|
+
/** Artifact pane chrome. */
|
|
4457
|
+
interface ArtifactPaneTokens {
|
|
4458
|
+
toolbarBackground?: string;
|
|
4459
|
+
}
|
|
4414
4460
|
interface ComponentTokens {
|
|
4415
4461
|
button: ButtonTokens;
|
|
4416
4462
|
input: InputTokens;
|
|
@@ -4426,6 +4472,12 @@ interface ComponentTokens {
|
|
|
4426
4472
|
toolBubble: ToolBubbleTokens;
|
|
4427
4473
|
reasoningBubble: ReasoningBubbleTokens;
|
|
4428
4474
|
composer: ComposerChromeTokens;
|
|
4475
|
+
/** Artifact toolbar, tab strip, and pane chrome. */
|
|
4476
|
+
artifact?: {
|
|
4477
|
+
toolbar?: ArtifactToolbarTokens;
|
|
4478
|
+
tab?: ArtifactTabTokens;
|
|
4479
|
+
pane?: ArtifactPaneTokens;
|
|
4480
|
+
};
|
|
4429
4481
|
}
|
|
4430
4482
|
interface PaletteExtras {
|
|
4431
4483
|
transitions?: Record<string, string>;
|
|
@@ -4645,6 +4697,22 @@ declare function resolveTokens(theme: PersonaTheme): Record<string, ResolvedToke
|
|
|
4645
4697
|
declare function validateTheme(theme: Partial<PersonaTheme>): ThemeValidationResult;
|
|
4646
4698
|
declare function createTheme(userConfig?: Partial<PersonaTheme>, options?: CreateThemeOptions): PersonaTheme;
|
|
4647
4699
|
declare function themeToCssVariables(theme: PersonaTheme): Record<string, string>;
|
|
4700
|
+
/**
|
|
4701
|
+
* Stable `data-persona-theme-zone` values applied to key widget regions.
|
|
4702
|
+
* Visual editors should use `[data-persona-theme-zone="header"]` selectors
|
|
4703
|
+
* rather than internal class names.
|
|
4704
|
+
*/
|
|
4705
|
+
declare const THEME_ZONES: {
|
|
4706
|
+
readonly header: "Widget header bar";
|
|
4707
|
+
readonly messages: "Message list area";
|
|
4708
|
+
readonly 'user-message': "User message bubble";
|
|
4709
|
+
readonly 'assistant-message': "Assistant message bubble";
|
|
4710
|
+
readonly composer: "Footer / composer area";
|
|
4711
|
+
readonly container: "Main widget container";
|
|
4712
|
+
readonly 'artifact-pane': "Artifact sidebar";
|
|
4713
|
+
readonly 'artifact-toolbar': "Artifact toolbar";
|
|
4714
|
+
};
|
|
4715
|
+
type ThemeZone = keyof typeof THEME_ZONES;
|
|
4648
4716
|
|
|
4649
4717
|
type ColorScheme = 'light' | 'dark' | 'auto';
|
|
4650
4718
|
interface PersonaWidgetConfig {
|
|
@@ -4885,6 +4953,36 @@ declare const DEFAULT_WIDGET_CONFIG: Partial<AgentWidgetConfig>;
|
|
|
4885
4953
|
*/
|
|
4886
4954
|
declare function mergeWithDefaults(config?: Partial<AgentWidgetConfig>): Partial<AgentWidgetConfig>;
|
|
4887
4955
|
|
|
4956
|
+
/**
|
|
4957
|
+
* A named preset containing partial widget configuration.
|
|
4958
|
+
* Apply with: `createAgentExperience(el, { ...PRESET_SHOP.config, apiUrl: '...' })`
|
|
4959
|
+
* or via IIFE: `{ ...AgentWidget.PRESETS.shop.config, apiUrl: '...' }`
|
|
4960
|
+
*/
|
|
4961
|
+
interface WidgetPreset {
|
|
4962
|
+
id: string;
|
|
4963
|
+
label: string;
|
|
4964
|
+
config: Partial<AgentWidgetConfig>;
|
|
4965
|
+
}
|
|
4966
|
+
/**
|
|
4967
|
+
* Shopping / e-commerce preset.
|
|
4968
|
+
* Dark header, rounded launchers, shopping-oriented copy.
|
|
4969
|
+
*/
|
|
4970
|
+
declare const PRESET_SHOP: WidgetPreset;
|
|
4971
|
+
/**
|
|
4972
|
+
* Minimal preset.
|
|
4973
|
+
* Stripped-down header, no launcher button, suitable for inline embeds.
|
|
4974
|
+
*/
|
|
4975
|
+
declare const PRESET_MINIMAL: WidgetPreset;
|
|
4976
|
+
/**
|
|
4977
|
+
* Fullscreen assistant preset.
|
|
4978
|
+
* No launcher, content-max-width constrained, minimal header.
|
|
4979
|
+
*/
|
|
4980
|
+
declare const PRESET_FULLSCREEN: WidgetPreset;
|
|
4981
|
+
/** All named presets keyed by ID. */
|
|
4982
|
+
declare const PRESETS: Record<string, WidgetPreset>;
|
|
4983
|
+
/** Look up a preset by ID. */
|
|
4984
|
+
declare function getPreset(id: string): WidgetPreset | undefined;
|
|
4985
|
+
|
|
4888
4986
|
interface HeaderElements {
|
|
4889
4987
|
header: HTMLElement;
|
|
4890
4988
|
iconHolder: HTMLElement;
|
|
@@ -4975,4 +5073,4 @@ declare function createVoiceProvider(config: VoiceConfig): VoiceProvider;
|
|
|
4975
5073
|
declare function createBestAvailableVoiceProvider(config?: Partial<VoiceConfig>): VoiceProvider;
|
|
4976
5074
|
declare function isVoiceSupported(config?: Partial<VoiceConfig>): boolean;
|
|
4977
5075
|
|
|
4978
|
-
export { type AgentConfig, type AgentExecutionState, type AgentLoopConfig, type AgentMessageMetadata, type AgentRequestOptions, type AgentToolsConfig, type AgentWidgetAgentRequestPayload, type AgentWidgetApproval, type AgentWidgetApprovalConfig, type AgentWidgetArtifactsFeature, type AgentWidgetArtifactsLayoutConfig, type AgentWidgetAttachmentsConfig, type AgentWidgetAvatarConfig, AgentWidgetClient, type AgentWidgetComposerConfig, type AgentWidgetConfig, type AgentWidgetController, type AgentWidgetControllerEventMap, type AgentWidgetCustomFetch, type AgentWidgetDockConfig, type AgentWidgetEvent, type AgentWidgetFeatureFlags, type AgentWidgetHeaderLayoutConfig, type AgentWidgetHeadersFunction, type AgentWidgetInitHandle, type AgentWidgetInitOptions, type AgentWidgetLauncherConfig, type AgentWidgetLayoutConfig, type AgentWidgetLoadingIndicatorConfig, type AgentWidgetMarkdownConfig, type AgentWidgetMarkdownOptions, type AgentWidgetMarkdownRendererOverrides, type AgentWidgetMessage, type AgentWidgetMessageActionsConfig, type AgentWidgetMessageFeedback, type AgentWidgetMessageLayoutConfig, type AgentWidgetPlugin, type AgentWidgetRequestPayload, type AgentWidgetSSEEventParser, type AgentWidgetSSEEventResult, AgentWidgetSession, type AgentWidgetSessionStatus, type AgentWidgetStreamParser, type AgentWidgetStreamParserResult, type AgentWidgetTheme, type AgentWidgetTimestampConfig, type ArtifactConfigPayload, AttachmentManager, type AttachmentManagerConfig, type BorderScale, type CSATFeedbackOptions, type ClientChatRequest, type ClientFeedbackRequest, type ClientFeedbackType, type ClientInitResponse, type ClientSession, type CodeFormat, type CodeGeneratorHooks, type CodeGeneratorOptions, type ColorPalette, type ColorShade, type ComponentContext, type ComponentDirective, type ComponentRenderer, type ComponentTokens, type ComposerBuildContext, type ComposerElements, type ContentPart, type CreateStandardBubbleOptions, type CreateThemeOptions, DEFAULT_COMPONENTS, DEFAULT_DARK_THEME, DEFAULT_LIGHT_THEME, DEFAULT_PALETTE, DEFAULT_SEMANTIC, DEFAULT_WIDGET_CONFIG, type DomContextMode, type DomContextOptions, type EnrichedPageElement, type EventStreamBadgeColor, type EventStreamConfig, type EventStreamPayloadRenderContext, type EventStreamRowRenderContext, type EventStreamToolbarRenderContext, type EventStreamViewRenderContext, type FormatEnrichedContextOptions, type HeaderBuildContext, type HeaderElements, type HeaderLayoutContext, type HeaderLayoutRenderer, type HeaderRenderContext, type IdleIndicatorRenderContext, type ImageContentPart, type InjectAssistantMessageOptions, type InjectMessageOptions, type InjectSystemMessageOptions, type InjectUserMessageOptions, type LoadingIndicatorRenderContext, type LoadingIndicatorRenderer, type MarkdownProcessorOptions, type MessageActionCallbacks, type MessageContent, type MessageRenderContext, type MessageTransform, type NPSFeedbackOptions, type ParseOptionsConfig, type ParseRule, type PendingAttachment, type PersonaArtifactKind, type PersonaArtifactManualUpsert, type PersonaArtifactRecord, type PersonaTheme, type PersonaThemePlugin, type RadiusScale, type RuleScoringContext, type SSEEventCallback, type SSEEventRecord, type SemanticColors, type SemanticSpacing, type SemanticTypography, type ShadowScale, type SlotRenderContext, type SlotRenderer, type SpacingScale, type TextContentPart, type ThemeValidationError, type ThemeValidationResult, type TokenReference, type TypographyScale, VERSION, type VoiceConfig, type VoiceProvider, type VoiceResult, type VoiceStatus, type WidgetHostLayout, type WidgetHostLayoutMode, type WidgetLayoutSlot, accessibilityPlugin, animationsPlugin, applyThemeVariables, attachHeaderToContainer, brandPlugin, buildComposer, buildDefaultHeader, buildHeader, buildHeaderWithLayout, buildMinimalHeader, collectEnrichedPageContext, componentRegistry, createActionManager, createAgentExperience, createBestAvailableVoiceProvider, createBubbleWithLayout, createCSATFeedback, createComponentMiddleware, createComponentStreamParser, createDirectivePostprocessor, createFlexibleJsonStreamParser, createImagePart, createJsonStreamParser, createLocalStorageAdapter, createMarkdownProcessor, createMarkdownProcessorFromConfig, createMessageActions, createNPSFeedback, createPlainTextParser, createPlugin, createRegexJsonParser, createStandardBubble, createTextPart, createTheme, createThemeObserver, createTypingIndicator, createVoiceProvider, createWidgetHostLayout, createXmlParser, initAgentWidget as default, defaultActionHandlers, defaultJsonActionParser, defaultParseRules, detectColorScheme, directivePostprocessor, escapeHtml, extractComponentDirectiveFromMessage, fileToImagePart, formatEnrichedContext, generateAssistantMessageId, generateCodeSnippet, generateMessageId, generateStableSelector, generateUserMessageId, getActiveTheme, getColorScheme, getDisplayText, getHeaderLayout, getImageParts, hasComponentDirective, hasImages, headerLayouts, highContrastPlugin, initAgentWidget, isComponentDirectiveType, isDockedMountMode, isVoiceSupported, markdownPostprocessor, mergeWithDefaults, migrateV1Theme, normalizeContent, pluginRegistry, reducedMotionPlugin, renderComponentDirective, renderLoadingIndicatorWithFallback, resolveDockConfig, resolveTokens, themeToCssVariables, validateImageFile, validateTheme, validateV1Theme };
|
|
5076
|
+
export { type AgentConfig, type AgentExecutionState, type AgentLoopConfig, type AgentMessageMetadata, type AgentRequestOptions, type AgentToolsConfig, type AgentWidgetAgentRequestPayload, type AgentWidgetApproval, type AgentWidgetApprovalConfig, type AgentWidgetArtifactsFeature, type AgentWidgetArtifactsLayoutConfig, type AgentWidgetAttachmentsConfig, type AgentWidgetAvatarConfig, AgentWidgetClient, type AgentWidgetComposerConfig, type AgentWidgetConfig, type AgentWidgetController, type AgentWidgetControllerEventMap, type AgentWidgetCustomFetch, type AgentWidgetDockConfig, type AgentWidgetEvent, type AgentWidgetFeatureFlags, type AgentWidgetHeaderLayoutConfig, type AgentWidgetHeadersFunction, type AgentWidgetInitHandle, type AgentWidgetInitOptions, type AgentWidgetLauncherConfig, type AgentWidgetLayoutConfig, type AgentWidgetLoadingIndicatorConfig, type AgentWidgetMarkdownConfig, type AgentWidgetMarkdownOptions, type AgentWidgetMarkdownRendererOverrides, type AgentWidgetMessage, type AgentWidgetMessageActionsConfig, type AgentWidgetMessageFeedback, type AgentWidgetMessageLayoutConfig, type AgentWidgetPlugin, type AgentWidgetRequestPayload, type AgentWidgetSSEEventParser, type AgentWidgetSSEEventResult, AgentWidgetSession, type AgentWidgetSessionStatus, type AgentWidgetStreamParser, type AgentWidgetStreamParserResult, type AgentWidgetTheme, type AgentWidgetTimestampConfig, type ArtifactConfigPayload, type ArtifactPaneTokens, type ArtifactTabTokens, type ArtifactToolbarTokens, AttachmentManager, type AttachmentManagerConfig, type BorderScale, type CSATFeedbackOptions, type ClientChatRequest, type ClientFeedbackRequest, type ClientFeedbackType, type ClientInitResponse, type ClientSession, type CodeFormat, type CodeGeneratorHooks, type CodeGeneratorOptions, type ColorPalette, type ColorShade, type ComponentContext, type ComponentDirective, type ComponentRenderer, type ComponentTokens, type ComposerBuildContext, type ComposerElements, type ContentPart, type CreateStandardBubbleOptions, type CreateThemeOptions, DEFAULT_COMPONENTS, DEFAULT_DARK_THEME, DEFAULT_LIGHT_THEME, DEFAULT_PALETTE, DEFAULT_SEMANTIC, DEFAULT_WIDGET_CONFIG, type DomContextMode, type DomContextOptions, type EnrichedPageElement, type EventStreamBadgeColor, type EventStreamConfig, type EventStreamPayloadRenderContext, type EventStreamRowRenderContext, type EventStreamToolbarRenderContext, type EventStreamViewRenderContext, type FormatEnrichedContextOptions, type HeaderBuildContext, type HeaderElements, type HeaderLayoutContext, type HeaderLayoutRenderer, type HeaderRenderContext, type IdleIndicatorRenderContext, type ImageContentPart, type InjectAssistantMessageOptions, type InjectMessageOptions, type InjectSystemMessageOptions, type InjectUserMessageOptions, type LoadingIndicatorRenderContext, type LoadingIndicatorRenderer, type MarkdownProcessorOptions, type MessageActionCallbacks, type MessageContent, type MessageRenderContext, type MessageTransform, type NPSFeedbackOptions, PRESETS, PRESET_FULLSCREEN, PRESET_MINIMAL, PRESET_SHOP, type ParseOptionsConfig, type ParseRule, type PendingAttachment, type PersonaArtifactKind, type PersonaArtifactManualUpsert, type PersonaArtifactRecord, type PersonaTheme, type PersonaThemePlugin, type RadiusScale, type RuleScoringContext, type SSEEventCallback, type SSEEventRecord, type SemanticColors, type SemanticSpacing, type SemanticTypography, type ShadowScale, type SlotRenderContext, type SlotRenderer, type SpacingScale, THEME_ZONES, type TextContentPart, type ThemeValidationError, type ThemeValidationResult, type ThemeZone, type TokenReference, type TypographyScale, VERSION, type VoiceConfig, type VoiceProvider, type VoiceResult, type VoiceStatus, type WidgetHostLayout, type WidgetHostLayoutMode, type WidgetLayoutSlot, type WidgetPreset, accessibilityPlugin, animationsPlugin, applyThemeVariables, attachHeaderToContainer, brandPlugin, buildComposer, buildDefaultHeader, buildHeader, buildHeaderWithLayout, buildMinimalHeader, collectEnrichedPageContext, componentRegistry, createActionManager, createAgentExperience, createBestAvailableVoiceProvider, createBubbleWithLayout, createCSATFeedback, createComponentMiddleware, createComponentStreamParser, createDirectivePostprocessor, createFlexibleJsonStreamParser, createImagePart, createJsonStreamParser, createLocalStorageAdapter, createMarkdownProcessor, createMarkdownProcessorFromConfig, createMessageActions, createNPSFeedback, createPlainTextParser, createPlugin, createRegexJsonParser, createStandardBubble, createTextPart, createTheme, createThemeObserver, createTypingIndicator, createVoiceProvider, createWidgetHostLayout, createXmlParser, initAgentWidget as default, defaultActionHandlers, defaultJsonActionParser, defaultParseRules, detectColorScheme, directivePostprocessor, escapeHtml, extractComponentDirectiveFromMessage, fileToImagePart, formatEnrichedContext, generateAssistantMessageId, generateCodeSnippet, generateMessageId, generateStableSelector, generateUserMessageId, getActiveTheme, getColorScheme, getDisplayText, getHeaderLayout, getImageParts, getPreset, hasComponentDirective, hasImages, headerLayouts, highContrastPlugin, initAgentWidget, isComponentDirectiveType, isDockedMountMode, isVoiceSupported, markdownPostprocessor, mergeWithDefaults, migrateV1Theme, normalizeContent, pluginRegistry, reducedMotionPlugin, renderComponentDirective, renderLoadingIndicatorWithFallback, resolveDockConfig, resolveTokens, themeToCssVariables, validateImageFile, validateTheme, validateV1Theme };
|