Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 | /**
* @fds-uif/schema - Foundation Type Definitions
*
* Foundations define design-system agnostic component structure,
* states, accessibility, and behavior.
*/
import type {
Accessibility,
BaseChild,
BoundAttribute,
ComponentProps,
ConditionalAttribute,
Extensions,
Slot,
} from './shared.js';
/**
* Interactive state definition.
*/
export interface State {
/** Unique identifier for the state (becomes a prop) */
name: string;
/** Data type: 'boolean' or 'enum' */
type: 'boolean' | 'enum';
/** ARIA attribute this state maps to */
aria?: string;
/** Description of the state's effect */
description?: string;
/** For enum type, the allowed values */
options?: string[];
/** Namespaced metadata for third-party tooling */
extensions?: Extensions;
}
/**
* Parent-child composition constraints.
*/
export interface Composition {
/** Component must be a direct child of this parent */
requiredComponentParent?: string;
/** Namespaced metadata for third-party tooling */
extensions?: Extensions;
}
/**
* Attributes for foundation elements.
* Note: `class` is not allowed in `static` for foundations.
*/
export interface FoundationAttributes {
/** Hardcoded attribute values (class not allowed) */
static?: Record<string, string>;
/** Attributes bound to component props */
bound?: Record<string, BoundAttribute>;
/** Conditionally rendered attributes */
conditional?: Record<string, ConditionalAttribute | ConditionalAttribute[]>;
}
/**
* Child element in foundation structure.
*/
export interface FoundationChild extends BaseChild {
/** HTML attributes */
attributes?: FoundationAttributes;
/** Nested children */
children?: FoundationChild[];
/**
* Reference to another UIF component (instead of HTML element).
* Declares a structural composition (e.g. Icon composes PrimitiveIcon).
*/
component?: string;
/**
* Configuration for how the composed component's props are wired.
* Only valid when `component` is set.
*/
componentProps?: ComponentProps;
/** Namespaced metadata for third-party tooling */
extensions?: Extensions;
}
/**
* Root structural node for foundations.
*/
export interface FoundationStructure {
/** Unique identifier for this structural node */
name: string;
/** Allowed HTML elements (first is used for generation) */
restrict: string[];
/** Description of this structural element */
description?: string;
/** HTML attributes */
attributes?: FoundationAttributes;
/** Child elements and slots */
children?: FoundationChild[];
/** Slot definition */
slot?: Slot;
/** Namespaced metadata for third-party tooling */
extensions?: Extensions;
}
/**
* UIF Foundation definition.
*
* Foundations are design-system agnostic and define:
* - Component structure and DOM hierarchy
* - Interactive states with ARIA mappings
* - Accessibility requirements
* - Behavior module references
* - Composition constraints
*/
export interface UifFoundation {
/** UIF schema version (e.g., '1.0.0') */
apiVersion: string;
/** Component name in PascalCase */
name: string;
/** Brief description of the component */
description: string;
/** Root structural node defining DOM hierarchy */
structure: FoundationStructure;
/** Interactive states with ARIA mappings */
states?: State[];
/** Accessibility requirements */
accessibility?: Accessibility;
/** Path to behavior module (TypeScript/JavaScript) */
behavior?: string;
/** Parent-child constraints */
composition?: Composition;
/** Namespaced metadata for third-party tooling */
extensions?: Extensions;
}
|