@antglobal/copilot-cards-core 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.
- package/README.md +57 -0
- package/dist/index.cjs +349 -128
- package/dist/index.d.ts +33 -7
- package/dist/index.js +349 -129
- package/dist/validation-text.cjs +1298 -0
- package/dist/validation-text.d.ts +215 -0
- package/dist/validation-text.js +1293 -0
- package/package.json +7 -1
package/dist/index.d.ts
CHANGED
|
@@ -40,8 +40,8 @@ interface ActionRunnerContext {
|
|
|
40
40
|
/** Optional adapter-specific resolver for structured parameter bindings. */
|
|
41
41
|
parameterResolver?: (params: Record<string, any>) => Record<string, any>;
|
|
42
42
|
/**
|
|
43
|
-
*
|
|
44
|
-
*
|
|
43
|
+
* Renderer-owned write hook. When present, it owns the synchronous variable
|
|
44
|
+
* write and decides whether that write should publish a render.
|
|
45
45
|
*/
|
|
46
46
|
variableWriter?: (key: string, value: any, options: {
|
|
47
47
|
silent: boolean;
|
|
@@ -151,6 +151,7 @@ interface ExpressionValue {
|
|
|
151
151
|
/**
|
|
152
152
|
* Slot layout mode — the key name in `props.slots` determines the layout:
|
|
153
153
|
* - default: no special layout, children appended directly
|
|
154
|
+
* - flex: one-dimensional Flexbox layout applied to the host container
|
|
154
155
|
* - columns: multi-column layout using groups (each group = one column)
|
|
155
156
|
* - grid: CSS grid with configurable column count and gap
|
|
156
157
|
* - horizontalScroll: horizontal scrollable container with drag and snap
|
|
@@ -158,13 +159,14 @@ interface ExpressionValue {
|
|
|
158
159
|
* - list: vertical list with optional ordered/unordered markers
|
|
159
160
|
* - float: relative container with absolutely positioned overlays
|
|
160
161
|
*/
|
|
161
|
-
type SlotLayout = 'default' | 'columns' | 'grid' | 'horizontalScroll' | 'carousel' | 'list' | 'float' | 'keyValue' | 'table' | 'chart';
|
|
162
|
+
type SlotLayout = 'default' | 'flex' | 'columns' | 'grid' | 'horizontalScroll' | 'carousel' | 'list' | 'float' | 'keyValue' | 'table' | 'chart';
|
|
162
163
|
/** Binds a slot to a template that is instantiated once per source item. */
|
|
163
164
|
interface RepeatBinding {
|
|
164
165
|
source: string;
|
|
165
166
|
template: string;
|
|
166
|
-
item
|
|
167
|
+
item?: string;
|
|
167
168
|
index?: string;
|
|
169
|
+
emptyTemplate?: string;
|
|
168
170
|
}
|
|
169
171
|
/**
|
|
170
172
|
* Content of a named slot.
|
|
@@ -180,6 +182,11 @@ interface RepeatBinding {
|
|
|
180
182
|
* height and children can be pinned to a cell via their own
|
|
181
183
|
* `style.gridColumn` / `style.gridRow`. Omit for auto-flow.
|
|
182
184
|
* - `rowHeight` — min height per row when `rows` is set (default '48px')
|
|
185
|
+
*
|
|
186
|
+
* Horizontal scroll `config` fields include:
|
|
187
|
+
* - `scrollbar` — `auto` leaves presentation to the host/browser, `hidden` hides
|
|
188
|
+
* the native scrollbar, and `visible` explicitly restores it.
|
|
189
|
+
* Omitted/invalid values preserve the legacy hidden output.
|
|
183
190
|
*/
|
|
184
191
|
interface SlotContent {
|
|
185
192
|
children?: string[];
|
|
@@ -267,9 +274,27 @@ interface RenderTreeNode {
|
|
|
267
274
|
* lists element IDs that become nested RenderTreeNodes.
|
|
268
275
|
*/
|
|
269
276
|
declare function parseSchema(input: CardSchemaInput): RenderTreeNode;
|
|
277
|
+
type SchemaValidationIssueCode = 'SCHEMA_TYPE_MISMATCH' | 'SCHEMA_REQUIRED_FIELD' | 'LEGACY_CONVERSION_FAILED' | 'ROOT_TYPE_MISMATCH' | 'ROOT_REFERENCE_NOT_FOUND' | 'ELEMENTS_UNINSPECTABLE' | 'ELEMENT_ACCESSOR_NOT_ALLOWED' | 'ELEMENT_TYPE_MISMATCH' | 'ELEMENT_TYPE_MISSING' | 'ELEMENT_PROPS_TYPE_MISMATCH' | 'SLOTS_TYPE_MISMATCH' | 'SLOT_ACCESSOR_NOT_ALLOWED' | 'SLOTS_UNINSPECTABLE' | 'SLOT_TYPE_MISMATCH' | 'SLOT_CHILDREN_TYPE_MISMATCH' | 'SLOT_CHILD_ID_INVALID' | 'SLOT_GROUPS_TYPE_MISMATCH' | 'SLOT_GROUP_TYPE_MISMATCH' | 'SLOT_GROUP_CHILD_ID_INVALID' | 'ELEMENT_REFERENCE_NOT_FOUND' | 'DYNAMIC_SLOT_MULTIPLE' | 'DYNAMIC_TEMPLATE_INVALID' | 'DYNAMIC_TEMPLATE_NOT_FOUND' | 'REPEAT_TYPE_MISMATCH' | 'REPEAT_SLOT_UNSUPPORTED' | 'REPEAT_CONTENT_CONFLICT' | 'REPEAT_SOURCE_TYPE_MISMATCH' | 'REPEAT_SOURCE_INVALID' | 'REPEAT_TEMPLATE_TYPE_MISMATCH' | 'REPEAT_TEMPLATE_INVALID' | 'REPEAT_TEMPLATE_NOT_FOUND' | 'REPEAT_ALIAS_TYPE_MISMATCH' | 'REPEAT_ALIAS_INVALID' | 'REPEAT_ALIAS_RESERVED' | 'REPEAT_ALIAS_COLLISION' | 'REPEAT_EMPTY_TEMPLATE_TYPE_MISMATCH' | 'REPEAT_EMPTY_TEMPLATE_INVALID' | 'REPEAT_EMPTY_TEMPLATE_NOT_FOUND' | 'REPEAT_TEMPLATE_CYCLE' | 'DYNAMIC_TEMPLATE_CYCLE' | 'DYNAMIC_LIFECYCLE_UNSUPPORTED' | 'DYNAMIC_VARIABLE_KEY_UNSUPPORTED';
|
|
278
|
+
/** A machine-readable schema validation diagnostic. */
|
|
279
|
+
interface SchemaValidationIssue {
|
|
280
|
+
code: SchemaValidationIssueCode;
|
|
281
|
+
/** RFC 6901 JSON Pointer to the invalid or missing value. */
|
|
282
|
+
path: string;
|
|
283
|
+
/** Existing parent used when `path` names a missing source value. */
|
|
284
|
+
anchorPath?: string;
|
|
285
|
+
/** Backwards-compatible, human-readable error text. */
|
|
286
|
+
message: string;
|
|
287
|
+
/** Dynamic values for localization or custom presentation. */
|
|
288
|
+
params?: Record<string, unknown>;
|
|
289
|
+
}
|
|
270
290
|
/**
|
|
271
|
-
* Validate
|
|
291
|
+
* Validate an unknown schema input and return structured diagnostics.
|
|
292
|
+
*
|
|
293
|
+
* Component names and component-specific props are deliberately not checked;
|
|
294
|
+
* this validator only owns the shared card graph and binding protocol.
|
|
272
295
|
*/
|
|
296
|
+
declare function validateSchemaDetailed(input: unknown): SchemaValidationIssue[];
|
|
297
|
+
/** Validate a CardSchema and return backwards-compatible error messages. */
|
|
273
298
|
declare function validateSchema(input: CardSchemaInput): string[];
|
|
274
299
|
|
|
275
300
|
/**
|
|
@@ -468,6 +493,7 @@ interface RepeatOwner {
|
|
|
468
493
|
sourceOwnerId: string;
|
|
469
494
|
slot: SlotLayout;
|
|
470
495
|
templateId: string;
|
|
496
|
+
emptyTemplateId?: string;
|
|
471
497
|
sourcePath?: string;
|
|
472
498
|
dataPath: string;
|
|
473
499
|
instancePath: string;
|
|
@@ -1430,5 +1456,5 @@ interface BuiltinIconDefinition {
|
|
|
1430
1456
|
declare const BUILTIN_ICON_NAMES: readonly (keyof typeof BUILTIN_ICONS)[];
|
|
1431
1457
|
declare function getBuiltinIcon(name: string | undefined): BuiltinIconDefinition | undefined;
|
|
1432
1458
|
|
|
1433
|
-
export { ActionRegistry, BUILTIN_ICONS, BUILTIN_ICON_NAMES, JsonPointerPathError, LifecycleManager, StreamingEngine, StreamingParser, a2uiComponentToElement, a2uiToCommand, bindingTopologyFingerprint, cloneJsonData, convertLegacySchema, createA2UIParameterResolver, createExpressionContext, createLifecycleManager, decodeJsonPointerSegment, extractPartialSchema, findAffectedRepeatOwners, findTemplateRepeatOwners, getBuiltinIcon, getByJsonPointer, getByPath, hasDynamicChildren, hasExpression, interpolate, isA2UIChildList, isA2UIDynamicChildList, isA2UIEnvelope, isA2UIPathBinding, isBoundRenderTreeNode, isLegacySchema, materializeCard, normalizeSchema, parseJsonPointer, parseSchema, registerActionHandler, registry, replaceRootContents, requiresBindingMaterialization, resetIdCounter, resolveA2UIDeep, resolveA2UIPath, resolveActionRef, resolveDeep, resolveExpression, resolveExpressionValue, runActionStep, runActionSteps, setByJsonPointer, setByPath, validateSchema };
|
|
1434
|
-
export type { A2UIChildList, A2UIComponent, A2UIDynamicChildList, A2UIEnvelope, A2UIPathBinding, ActionChainConfig, ActionConfigProvider, ActionRunnerContext, ActionStep, ActionStepHandler, AppendContentCommand, BindingScope, BoundInstance, BoundRenderTreeNode, BuiltinIconDefinition, BuiltinIconName, CardSchema, CardSchemaInput, CleanupFn, ComponentChange, CreateSurfaceCommand, DeleteSurfaceCommand, ElementLifecycle, ElementNode, ExpressionContext, ExpressionValue, JsonPointerPathErrorCode, LegacyCardContentItem, LegacyCardSchema, LegacyTracking, LegacyTrackingType, MaterializeDiagnostic, MaterializeOptions, MaterializedCard, PartialSchemaResult, RenderTreeNode, RepeatBinding, RepeatOwner, SimpleActionHandler, SlotContent, SlotLayout, StreamingCommand, StreamingEngineEvents, StreamingParserOptions, UpdateComponentsCommand, UpdateDataModelCommand };
|
|
1459
|
+
export { ActionRegistry, BUILTIN_ICONS, BUILTIN_ICON_NAMES, JsonPointerPathError, LifecycleManager, StreamingEngine, StreamingParser, a2uiComponentToElement, a2uiToCommand, bindingTopologyFingerprint, cloneJsonData, convertLegacySchema, createA2UIParameterResolver, createExpressionContext, createLifecycleManager, decodeJsonPointerSegment, extractPartialSchema, findAffectedRepeatOwners, findTemplateRepeatOwners, getBuiltinIcon, getByJsonPointer, getByPath, hasDynamicChildren, hasExpression, interpolate, isA2UIChildList, isA2UIDynamicChildList, isA2UIEnvelope, isA2UIPathBinding, isBoundRenderTreeNode, isLegacySchema, materializeCard, normalizeSchema, parseJsonPointer, parseSchema, registerActionHandler, registry, replaceRootContents, requiresBindingMaterialization, resetIdCounter, resolveA2UIDeep, resolveA2UIPath, resolveActionRef, resolveDeep, resolveExpression, resolveExpressionValue, runActionStep, runActionSteps, setByJsonPointer, setByPath, validateSchema, validateSchemaDetailed };
|
|
1460
|
+
export type { A2UIChildList, A2UIComponent, A2UIDynamicChildList, A2UIEnvelope, A2UIPathBinding, ActionChainConfig, ActionConfigProvider, ActionRunnerContext, ActionStep, ActionStepHandler, AppendContentCommand, BindingScope, BoundInstance, BoundRenderTreeNode, BuiltinIconDefinition, BuiltinIconName, CardSchema, CardSchemaInput, CleanupFn, ComponentChange, CreateSurfaceCommand, DeleteSurfaceCommand, ElementLifecycle, ElementNode, ExpressionContext, ExpressionValue, JsonPointerPathErrorCode, LegacyCardContentItem, LegacyCardSchema, LegacyTracking, LegacyTrackingType, MaterializeDiagnostic, MaterializeOptions, MaterializedCard, PartialSchemaResult, RenderTreeNode, RepeatBinding, RepeatOwner, SchemaValidationIssue, SchemaValidationIssueCode, SimpleActionHandler, SlotContent, SlotLayout, StreamingCommand, StreamingEngineEvents, StreamingParserOptions, UpdateComponentsCommand, UpdateDataModelCommand };
|