@antglobal/copilot-cards-web 1.0.5 → 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.
Files changed (3) hide show
  1. package/dist/index.d.ts +60 -8
  2. package/dist/index.js +3358 -579
  3. package/package.json +1 -1
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
- private getAutoFocusControl;
625
- private isFirstAvailableAutoFocusInput;
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 the native input after the component is mounted (default false) */
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) */
@@ -1295,7 +1347,7 @@ interface ChoiceListProps {
1295
1347
  indicatorStyle?: Record<string, any>;
1296
1348
  /** Style merged into selected indicators */
1297
1349
  selectedIndicatorStyle?: Record<string, any>;
1298
- /** Checked mark used by multiple mode; defaults to built-in `check_bold` */
1350
+ /** Selected mark override; single mode keeps its radio dot when omitted, while multiple mode defaults to `check_bold` */
1299
1351
  checkedIcon?: ChoiceIndicatorIcon;
1300
1352
  }
1301
1353
  interface ChoiceIndicatorIcon {
@@ -1323,7 +1375,7 @@ interface ChoiceItemProps {
1323
1375
  indicatorStyle?: Record<string, any>;
1324
1376
  /** Per-item selected indicator style */
1325
1377
  selectedIndicatorStyle?: Record<string, any>;
1326
- /** Per-item checked mark override */
1378
+ /** Per-item selected mark override; also replaces the single-select radio dot */
1327
1379
  checkedIcon?: ChoiceIndicatorIcon;
1328
1380
  }
1329
1381
  interface PasscodeInputProps {
@@ -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 };