@antglobal/copilot-cards-web 1.0.6 → 1.0.7
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/dist/index.d.ts +58 -6
- package/dist/index.js +3075 -479
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -29,6 +29,33 @@ interface WebActionContextOptions {
|
|
|
29
29
|
*/
|
|
30
30
|
declare function createWebActionContext(options?: WebActionContextOptions): ActionRunnerContext;
|
|
31
31
|
|
|
32
|
+
interface CardNodeHandle {
|
|
33
|
+
/** Stable schema/runtime node id represented by this logical handle. */
|
|
34
|
+
readonly id: string;
|
|
35
|
+
/** Current rendered node type, or null while the node is unavailable. */
|
|
36
|
+
readonly type: string | null;
|
|
37
|
+
/**
|
|
38
|
+
* Current custom-element host. This is a transient snapshot and may change
|
|
39
|
+
* after any render; consumers should keep the handle instead of this value.
|
|
40
|
+
*/
|
|
41
|
+
readonly current: HTMLElement | null;
|
|
42
|
+
/** Measure the current custom-element host. */
|
|
43
|
+
getRect(): DOMRectReadOnly | null;
|
|
44
|
+
/** Focus the component's logical control. */
|
|
45
|
+
focus(options?: FocusOptions): boolean;
|
|
46
|
+
/** Blur the component's logical control. */
|
|
47
|
+
blur(): boolean;
|
|
48
|
+
/** Scroll the current custom-element host into view. */
|
|
49
|
+
scrollIntoView(options?: ScrollIntoViewOptions): boolean;
|
|
50
|
+
}
|
|
51
|
+
interface CardFocusChangeEvent {
|
|
52
|
+
/** Currently focused logical card node, or null after focus leaves the card. */
|
|
53
|
+
node: CardNodeHandle | null;
|
|
54
|
+
/** Previously focused logical card node, if any. */
|
|
55
|
+
previousNode: CardNodeHandle | null;
|
|
56
|
+
}
|
|
57
|
+
type CardFocusChangeListener = (event: CardFocusChangeEvent) => void;
|
|
58
|
+
|
|
32
59
|
interface ResponsiveMobileOptions {
|
|
33
60
|
readonly unit: 'rem';
|
|
34
61
|
readonly rootValue: number;
|
|
@@ -77,6 +104,10 @@ interface CardInstance {
|
|
|
77
104
|
dispose: () => void;
|
|
78
105
|
/** Update variables and re-render. */
|
|
79
106
|
updateVariables: (variables: Record<string, any>) => void;
|
|
107
|
+
/** Get a stable logical handle that resolves the current host lazily. */
|
|
108
|
+
getNode: (id: string) => CardNodeHandle;
|
|
109
|
+
/** Observe logical focus changes within this card. */
|
|
110
|
+
onFocusChange: (listener: CardFocusChangeListener) => () => void;
|
|
80
111
|
}
|
|
81
112
|
/**
|
|
82
113
|
* Render a card schema into a container element.
|
|
@@ -470,6 +501,18 @@ declare abstract class BaseElement extends HTMLElement {
|
|
|
470
501
|
protected toCSS(value: string | number): string;
|
|
471
502
|
/** Assign component markup and convert only its CSS declarations. */
|
|
472
503
|
protected setShadowHTML(html: string): void;
|
|
504
|
+
/**
|
|
505
|
+
* Patch freshly rendered markup around an existing interactive element.
|
|
506
|
+
*
|
|
507
|
+
* Replacing a focused native control through `shadowRoot.innerHTML` resets
|
|
508
|
+
* its selection and, on mobile WebViews, can also recreate the soft
|
|
509
|
+
* keyboard with a different layout. This helper keeps the selected element
|
|
510
|
+
* connected while reconciling its surrounding markup.
|
|
511
|
+
*/
|
|
512
|
+
protected patchShadowHTMLPreservingElement(html: string, preserved: Element, selector: string): boolean;
|
|
513
|
+
private reconcilePreservedTree;
|
|
514
|
+
private patchPreservedElement;
|
|
515
|
+
private reconcileKey;
|
|
473
516
|
/**
|
|
474
517
|
* Escape a value before interpolating it into a double-quoted HTML
|
|
475
518
|
* attribute. Browsers decode the entities before parsing inline CSS, so
|
|
@@ -620,9 +663,14 @@ declare class CardButton extends BaseElement {
|
|
|
620
663
|
|
|
621
664
|
declare class CardInput extends BaseElement {
|
|
622
665
|
static readonly is = "ai-card-input";
|
|
666
|
+
private readonly wiredInputs;
|
|
667
|
+
private readonly wiredNumberInputs;
|
|
623
668
|
protected render(): void;
|
|
624
|
-
|
|
625
|
-
|
|
669
|
+
/**
|
|
670
|
+
* Consume an interaction-driven focus request from the card renderer.
|
|
671
|
+
* Mounts and ordinary updates never call this method.
|
|
672
|
+
*/
|
|
673
|
+
requestAutoFocus(): boolean;
|
|
626
674
|
/** Escape HTML entities for safe insertion. */
|
|
627
675
|
private escapeHtml;
|
|
628
676
|
/** Escape attribute values for safe insertion. */
|
|
@@ -660,6 +708,8 @@ declare class CardImage extends BaseElement {
|
|
|
660
708
|
static readonly is = "ai-card-image";
|
|
661
709
|
private _lightbox;
|
|
662
710
|
protected render(): void;
|
|
711
|
+
private applyHostDimension;
|
|
712
|
+
private resolveDeclaredDimension;
|
|
663
713
|
private bindEvents;
|
|
664
714
|
private openLightbox;
|
|
665
715
|
private closeLightbox;
|
|
@@ -1020,10 +1070,12 @@ type InputAffix = string | InputAffixConfig;
|
|
|
1020
1070
|
interface InputProps {
|
|
1021
1071
|
/** Placeholder text */
|
|
1022
1072
|
placeholder?: string;
|
|
1023
|
-
/** Focus
|
|
1073
|
+
/** Focus an empty input when a card interaction reveals it (default false) */
|
|
1024
1074
|
autoFocus?: boolean;
|
|
1025
1075
|
/** HTML input type: text / textarea / password / number etc. */
|
|
1026
1076
|
inputType?: 'text' | 'textarea' | 'password' | (string & {});
|
|
1077
|
+
/** Mobile soft-keyboard hint; does not change validation or step controls. */
|
|
1078
|
+
inputMode?: 'none' | 'text' | 'tel' | 'url' | 'email' | 'numeric' | 'decimal' | 'search';
|
|
1027
1079
|
/** Label text displayed above the input */
|
|
1028
1080
|
label?: string;
|
|
1029
1081
|
/** Initial value */
|
|
@@ -1061,9 +1113,9 @@ interface ImageProps {
|
|
|
1061
1113
|
/** Alt text for accessibility */
|
|
1062
1114
|
alt?: string;
|
|
1063
1115
|
/** Image width (CSS value) */
|
|
1064
|
-
width?: string;
|
|
1116
|
+
width?: string | number;
|
|
1065
1117
|
/** Image height (CSS value) */
|
|
1066
|
-
height?: string;
|
|
1118
|
+
height?: string | number;
|
|
1067
1119
|
/** CSS object-fit mode (default 'cover') */
|
|
1068
1120
|
objectFit?: 'cover' | 'contain' | 'fill' | 'none' | 'scale-down';
|
|
1069
1121
|
/** Whether lightbox preview is enabled (default true) */
|
|
@@ -1785,4 +1837,4 @@ declare const componentRenderers: Record<string, ComponentRenderer>;
|
|
|
1785
1837
|
declare function registerComponent(type: string, renderer: ComponentRenderer): void;
|
|
1786
1838
|
|
|
1787
1839
|
export { BaseElement, BotSDK, CardButton, CardChoiceItem, CardChoiceList, CardCollapse, CardCounter, CardDivider, CardForm, CardHtml, CardIcon, CardImage, CardInput, CardLoading, CardPasscodeInput, CardProgress, CardRate, CardSelect, CardSteps, CardSwitch, CardTag, CardText, DEFAULT_MOBILE_RESPONSIVE, LocalActionConfigProvider, RemoteActionConfigProvider, buildStyleString, componentRenderers, connectSSE, connectStreaming, convertPixelTokens, createResponsiveContext, createWebActionContext, isMobileViewport, onViewportChange, pxToRem, pxToVw, registerComponent, renderCard, renderStreamingCard, resolveSize, sanitizeHtml, trimIncompleteTag };
|
|
1788
|
-
export type { A2UIActionPayload, BotSDKOptions, ButtonProps, CardInstance, ChoiceIndicatorIcon, ChoiceItemProps, ChoiceListProps, ChoiceListValue, CollapseProps, ComponentRenderer, ConnectorConfig, CounterIcon, CounterProps, DividerProps, FormField, FormProps, FormRule, HtmlProps, IconProps, ImageProps, InputAffix, InputAffixConfig, InputProps, LoadingProps, PartialFinalizeResult, PasscodeInputProps, ProgressProps, ProgressSegment, RateProps, RenderCardOptions, ResponsiveContext, ResponsiveMobileOptions, ResponsiveOptions, SSEConnectOptions, SelectOption, SelectProps, SelectSize, SelectStyles, SelectVariant, StepIcon, StepItem, StepsProps, StreamingCardInstance, StreamingCardOptions, StreamingConnectOptions, StreamingConnection, SwitchProps, TagProps, TextProps, WebActionContextOptions };
|
|
1840
|
+
export type { A2UIActionPayload, BotSDKOptions, ButtonProps, CardFocusChangeEvent, CardFocusChangeListener, CardInstance, CardNodeHandle, ChoiceIndicatorIcon, ChoiceItemProps, ChoiceListProps, ChoiceListValue, CollapseProps, ComponentRenderer, ConnectorConfig, CounterIcon, CounterProps, DividerProps, FormField, FormProps, FormRule, HtmlProps, IconProps, ImageProps, InputAffix, InputAffixConfig, InputProps, LoadingProps, PartialFinalizeResult, PasscodeInputProps, ProgressProps, ProgressSegment, RateProps, RenderCardOptions, ResponsiveContext, ResponsiveMobileOptions, ResponsiveOptions, SSEConnectOptions, SelectOption, SelectProps, SelectSize, SelectStyles, SelectVariant, StepIcon, StepItem, StepsProps, StreamingCardInstance, StreamingCardOptions, StreamingConnectOptions, StreamingConnection, SwitchProps, TagProps, TextProps, WebActionContextOptions };
|