@cognitap/radiant 0.0.90 → 0.0.92

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 (169) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/library/a2ui/A2uiPlaceholder.d.ts +14 -0
  3. package/dist/library/a2ui/A2uiPlaceholder.d.ts.map +1 -0
  4. package/dist/library/a2ui/A2uiPlaceholder.js +44 -0
  5. package/dist/library/a2ui/A2uiPlaceholder.js.map +1 -0
  6. package/dist/library/a2ui/A2uiSurface.d.ts +33 -0
  7. package/dist/library/a2ui/A2uiSurface.d.ts.map +1 -0
  8. package/dist/library/a2ui/A2uiSurface.js +542 -0
  9. package/dist/library/a2ui/A2uiSurface.js.map +1 -0
  10. package/dist/library/a2ui/accessibility.d.ts +31 -0
  11. package/dist/library/a2ui/accessibility.d.ts.map +1 -0
  12. package/dist/library/a2ui/accessibility.js +108 -0
  13. package/dist/library/a2ui/accessibility.js.map +1 -0
  14. package/dist/library/a2ui/accessibilityRules.d.ts +28 -0
  15. package/dist/library/a2ui/accessibilityRules.d.ts.map +1 -0
  16. package/dist/library/a2ui/accessibilityRules.js +73 -0
  17. package/dist/library/a2ui/accessibilityRules.js.map +1 -0
  18. package/dist/library/a2ui/catalogGenerator.d.ts +29 -0
  19. package/dist/library/a2ui/catalogGenerator.d.ts.map +1 -0
  20. package/dist/library/a2ui/catalogGenerator.js +578 -0
  21. package/dist/library/a2ui/catalogGenerator.js.map +1 -0
  22. package/dist/library/a2ui/coerce.d.ts +16 -0
  23. package/dist/library/a2ui/coerce.d.ts.map +1 -0
  24. package/dist/library/a2ui/coerce.js +254 -0
  25. package/dist/library/a2ui/coerce.js.map +1 -0
  26. package/dist/library/a2ui/entries.d.ts +6 -0
  27. package/dist/library/a2ui/entries.d.ts.map +1 -0
  28. package/dist/library/a2ui/entries.js +277 -0
  29. package/dist/library/a2ui/entries.js.map +1 -0
  30. package/dist/library/a2ui/fixtures.d.ts +38 -0
  31. package/dist/library/a2ui/fixtures.d.ts.map +1 -0
  32. package/dist/library/a2ui/fixtures.js +389 -0
  33. package/dist/library/a2ui/fixtures.js.map +1 -0
  34. package/dist/library/a2ui/index.d.ts +17 -0
  35. package/dist/library/a2ui/index.d.ts.map +1 -0
  36. package/dist/library/a2ui/index.js +9 -0
  37. package/dist/library/a2ui/index.js.map +1 -0
  38. package/dist/library/a2ui/protocolErrors.d.ts +13 -0
  39. package/dist/library/a2ui/protocolErrors.d.ts.map +1 -0
  40. package/dist/library/a2ui/protocolErrors.js +48 -0
  41. package/dist/library/a2ui/protocolErrors.js.map +1 -0
  42. package/dist/library/a2ui/registry.d.ts +58 -0
  43. package/dist/library/a2ui/registry.d.ts.map +1 -0
  44. package/dist/library/a2ui/registry.js +128 -0
  45. package/dist/library/a2ui/registry.js.map +1 -0
  46. package/dist/library/a2ui/sanitize.d.ts +7 -0
  47. package/dist/library/a2ui/sanitize.d.ts.map +1 -0
  48. package/dist/library/a2ui/sanitize.js +54 -0
  49. package/dist/library/a2ui/sanitize.js.map +1 -0
  50. package/dist/library/a2ui/surfaceRuntime.d.ts +34 -0
  51. package/dist/library/a2ui/surfaceRuntime.d.ts.map +1 -0
  52. package/dist/library/a2ui/surfaceRuntime.js +284 -0
  53. package/dist/library/a2ui/surfaceRuntime.js.map +1 -0
  54. package/dist/library/catalog/actions.d.ts +40 -0
  55. package/dist/library/catalog/actions.d.ts.map +1 -0
  56. package/dist/library/catalog/actions.js +70 -0
  57. package/dist/library/catalog/actions.js.map +1 -0
  58. package/dist/library/catalog/coerce.d.ts +70 -0
  59. package/dist/library/catalog/coerce.d.ts.map +1 -0
  60. package/dist/library/catalog/coerce.js +332 -0
  61. package/dist/library/catalog/coerce.js.map +1 -0
  62. package/dist/library/catalog/index.d.ts +9 -0
  63. package/dist/library/catalog/index.d.ts.map +1 -0
  64. package/dist/library/catalog/index.js +6 -0
  65. package/dist/library/catalog/index.js.map +1 -0
  66. package/dist/library/catalog/radiantCatalog.d.ts +9 -0
  67. package/dist/library/catalog/radiantCatalog.d.ts.map +1 -0
  68. package/dist/library/catalog/radiantCatalog.js +902 -0
  69. package/dist/library/catalog/radiantCatalog.js.map +1 -0
  70. package/dist/library/catalog/types.d.ts +113 -0
  71. package/dist/library/catalog/types.d.ts.map +1 -0
  72. package/dist/library/catalog/types.js +27 -0
  73. package/dist/library/catalog/types.js.map +1 -0
  74. package/dist/library/catalog/validate.d.ts +31 -0
  75. package/dist/library/catalog/validate.d.ts.map +1 -0
  76. package/dist/library/catalog/validate.js +420 -0
  77. package/dist/library/catalog/validate.js.map +1 -0
  78. package/dist/library/components/Card/Card.d.ts +6 -2
  79. package/dist/library/components/Card/Card.d.ts.map +1 -1
  80. package/dist/library/components/Card/Card.js +12 -4
  81. package/dist/library/components/Card/Card.js.map +1 -1
  82. package/dist/library/components/Checkbox/Checkbox.d.ts.map +1 -1
  83. package/dist/library/components/Checkbox/Checkbox.js +2 -2
  84. package/dist/library/components/Checkbox/Checkbox.js.map +1 -1
  85. package/dist/library/components/Collapsible/Collapsible.js +1 -1
  86. package/dist/library/components/Collapsible/Collapsible.js.map +1 -1
  87. package/dist/library/components/InputGroup/InputGroup.js +1 -1
  88. package/dist/library/components/InputGroup/InputGroup.js.map +1 -1
  89. package/dist/library/components/NavLink/NavLink.d.ts.map +1 -1
  90. package/dist/library/components/NavLink/NavLink.js +1 -1
  91. package/dist/library/components/NavLink/NavLink.js.map +1 -1
  92. package/dist/library/components/RadioGroup/RadioGroup.d.ts.map +1 -1
  93. package/dist/library/components/RadioGroup/RadioGroup.js +3 -3
  94. package/dist/library/components/RadioGroup/RadioGroup.js.map +1 -1
  95. package/dist/library/components/ScrollArea/ScrollArea.d.ts.map +1 -1
  96. package/dist/library/components/ScrollArea/ScrollArea.js +4 -1
  97. package/dist/library/components/ScrollArea/ScrollArea.js.map +1 -1
  98. package/dist/library/components/Switch/Switch.d.ts.map +1 -1
  99. package/dist/library/components/Switch/Switch.js +2 -2
  100. package/dist/library/components/Switch/Switch.js.map +1 -1
  101. package/dist/library/components/Table/Table.d.ts +6 -2
  102. package/dist/library/components/Table/Table.d.ts.map +1 -1
  103. package/dist/library/components/Table/Table.js +10 -4
  104. package/dist/library/components/Table/Table.js.map +1 -1
  105. package/dist/library/components/TagsInput/TagsInput.d.ts.map +1 -1
  106. package/dist/library/components/TagsInput/TagsInput.js +1 -1
  107. package/dist/library/components/TagsInput/TagsInput.js.map +1 -1
  108. package/dist/library/components/TimeInput/TimeInput.d.ts.map +1 -1
  109. package/dist/library/components/TimeInput/TimeInput.js +28 -20
  110. package/dist/library/components/TimeInput/TimeInput.js.map +1 -1
  111. package/dist/library/components/Toast/Toast.js +1 -1
  112. package/dist/library/components/Toast/Toast.js.map +1 -1
  113. package/dist/library/components/ToggleGroup/ToggleGroup.js +1 -1
  114. package/dist/library/components/ToggleGroup/ToggleGroup.js.map +1 -1
  115. package/dist/library/index.d.ts +1 -1
  116. package/dist/library/index.d.ts.map +1 -1
  117. package/dist/library/presentation.d.ts +3 -0
  118. package/dist/library/presentation.d.ts.map +1 -1
  119. package/dist/library/styles.css +1 -1
  120. package/dist/library/themes/components.d.ts +6 -0
  121. package/dist/library/themes/components.d.ts.map +1 -1
  122. package/dist/library/themes/components.js +6 -0
  123. package/dist/library/themes/components.js.map +1 -1
  124. package/dist/library/themes/tokens.d.ts +4 -0
  125. package/dist/library/themes/tokens.d.ts.map +1 -1
  126. package/dist/library/themes/tokens.js +3 -0
  127. package/dist/library/themes/tokens.js.map +1 -1
  128. package/docs/accessibility.md +6 -0
  129. package/docs/architecture.md +20 -1
  130. package/docs/theming.md +13 -0
  131. package/package.json +17 -5
  132. package/src/a2ui/A2uiPlaceholder.tsx +64 -0
  133. package/src/a2ui/A2uiSurface.tsx +790 -0
  134. package/src/a2ui/accessibility.ts +145 -0
  135. package/src/a2ui/accessibilityRules.ts +106 -0
  136. package/src/a2ui/catalog.json +317 -0
  137. package/src/a2ui/catalogGenerator.ts +717 -0
  138. package/src/a2ui/coerce.ts +379 -0
  139. package/src/a2ui/entries.tsx +519 -0
  140. package/src/a2ui/fixtures.ts +402 -0
  141. package/src/a2ui/index.ts +50 -0
  142. package/src/a2ui/protocolErrors.ts +63 -0
  143. package/src/a2ui/registry.ts +221 -0
  144. package/src/a2ui/sanitize.ts +51 -0
  145. package/src/a2ui/surfaceRuntime.ts +317 -0
  146. package/src/catalog/actions.ts +108 -0
  147. package/src/catalog/coerce.ts +447 -0
  148. package/src/catalog/index.ts +67 -0
  149. package/src/catalog/radiantCatalog.ts +949 -0
  150. package/src/catalog/types.ts +159 -0
  151. package/src/catalog/validate.ts +454 -0
  152. package/src/components/Card/Card.tsx +35 -19
  153. package/src/components/Checkbox/Checkbox.tsx +2 -0
  154. package/src/components/Collapsible/Collapsible.tsx +1 -1
  155. package/src/components/InputGroup/InputGroup.tsx +2 -2
  156. package/src/components/NavLink/NavLink.tsx +1 -6
  157. package/src/components/RadioGroup/RadioGroup.tsx +3 -0
  158. package/src/components/ScrollArea/ScrollArea.tsx +5 -1
  159. package/src/components/Switch/Switch.tsx +2 -0
  160. package/src/components/Table/Table.tsx +16 -3
  161. package/src/components/TagsInput/TagsInput.tsx +1 -0
  162. package/src/components/TimeInput/TimeInput.tsx +100 -75
  163. package/src/components/Toast/Toast.tsx +1 -1
  164. package/src/components/ToggleGroup/ToggleGroup.tsx +1 -1
  165. package/src/index.ts +1 -1
  166. package/src/presentation.ts +3 -0
  167. package/src/themes/baseline.css +3 -0
  168. package/src/themes/components.ts +6 -0
  169. package/src/themes/tokens.ts +7 -0
@@ -0,0 +1,145 @@
1
+ import { isPlainRecord } from '../catalog/coerce.js'
2
+ import type { A2uiComponentRecord } from './accessibilityRules.js'
3
+ import { getRegistryEntry } from './coerce.js'
4
+ import { radiantA2uiRegistry } from './entries.js'
5
+ import type { A2uiRegistry } from './registry.js'
6
+ import type { A2uiMessage } from './sanitize.js'
7
+
8
+ export type A2uiAccessibilityError = {
9
+ readonly surfaceId: string
10
+ readonly nodeId: string
11
+ readonly component: string
12
+ readonly rule: string
13
+ readonly prop: string
14
+ readonly message: string
15
+ /** True when a safe fix exists; `fix: true` applies it to the returned messages. */
16
+ readonly fixable: boolean
17
+ }
18
+
19
+ export type ValidateA2uiAccessibilityOptions = {
20
+ /** Registry whose entry rules apply. Defaults to `radiantA2uiRegistry`. */
21
+ readonly registry?: A2uiRegistry
22
+ /** Apply safe fixes to a copy of the messages. */
23
+ readonly fix?: boolean
24
+ }
25
+
26
+ export type ValidateA2uiAccessibilityResult = {
27
+ readonly errors: readonly A2uiAccessibilityError[]
28
+ /** The input messages, or a fixed copy when `fix` is set. Input is never mutated. */
29
+ readonly messages: readonly A2uiMessage[]
30
+ }
31
+
32
+ type Located = {
33
+ readonly component: A2uiComponentRecord
34
+ readonly message: number
35
+ readonly key: 'createSurface' | 'updateComponents'
36
+ readonly index: number
37
+ }
38
+
39
+ const COMPONENT_KEYS = ['createSurface', 'updateComponents'] as const
40
+
41
+ function collectSurfaces(messages: readonly A2uiMessage[]): Map<string, Map<string, Located>> {
42
+ const surfaces = new Map<string, Map<string, Located>>()
43
+ messages.forEach((message, messageIndex) => {
44
+ if (!isPlainRecord(message)) return
45
+ const deleted = message.deleteSurface
46
+ if (isPlainRecord(deleted) && typeof deleted.surfaceId === 'string') {
47
+ surfaces.delete(deleted.surfaceId)
48
+ }
49
+ for (const key of COMPONENT_KEYS) {
50
+ const body = message[key]
51
+ if (!isPlainRecord(body) || !Array.isArray(body.components)) continue
52
+ const surfaceId = typeof body.surfaceId === 'string' ? body.surfaceId : ''
53
+ if (key === 'createSurface' || !surfaces.has(surfaceId)) surfaces.set(surfaceId, new Map())
54
+ const nodes = surfaces.get(surfaceId)!
55
+ body.components.forEach((component: unknown, index) => {
56
+ if (isPlainRecord(component) && typeof component.id === 'string' && component.id) {
57
+ nodes.set(component.id, { component, message: messageIndex, key, index })
58
+ }
59
+ })
60
+ }
61
+ })
62
+ return surfaces
63
+ }
64
+
65
+ /**
66
+ * Checks A2UI surface messages against the accessibility rules declared on each registry
67
+ * entry. Pure: needs no DOM or React render, so servers can run it before storing a surface.
68
+ */
69
+ export function validateA2uiAccessibility(
70
+ messages: readonly A2uiMessage[],
71
+ options: ValidateA2uiAccessibilityOptions = {}
72
+ ): ValidateA2uiAccessibilityResult {
73
+ const registry = options.registry ?? radiantA2uiRegistry
74
+ const errors: A2uiAccessibilityError[] = []
75
+ const fixes: { readonly at: Located; readonly props: Readonly<Record<string, unknown>> }[] = []
76
+
77
+ for (const [surfaceId, nodes] of collectSurfaces(messages)) {
78
+ const context = { getComponent: (id: string) => nodes.get(id)?.component }
79
+ for (const [nodeId, at] of nodes) {
80
+ const name = typeof at.component.component === 'string' ? at.component.component : ''
81
+ const entry = getRegistryEntry(registry, name)
82
+ if (!entry) continue
83
+ for (const rule of entry.accessibility) {
84
+ const finding = rule.check(at.component, context)
85
+ if (!finding) continue
86
+ errors.push({
87
+ surfaceId,
88
+ nodeId,
89
+ component: name,
90
+ rule: rule.id,
91
+ prop: finding.prop,
92
+ message: finding.message,
93
+ fixable: finding.fix !== undefined
94
+ })
95
+ if (finding.fix) fixes.push({ at, props: finding.fix })
96
+ }
97
+ }
98
+ }
99
+
100
+ if (!options.fix || fixes.length === 0) return { errors, messages }
101
+ const fixed = structuredClone(messages) as A2uiMessage[]
102
+ for (const { at, props } of fixes) {
103
+ const body = fixed[at.message]![at.key] as { components: Record<string, unknown>[] }
104
+ Object.assign(body.components[at.index]!, props)
105
+ }
106
+ return { errors, messages: fixed }
107
+ }
108
+
109
+ // Bundlers replace `process.env.NODE_ENV`; without one, a missing `process` means production.
110
+ declare const process: { readonly env: Readonly<Record<string, string | undefined>> }
111
+
112
+ function isDevelopment(): boolean {
113
+ try {
114
+ return process.env.NODE_ENV !== 'production'
115
+ } catch {
116
+ return false
117
+ }
118
+ }
119
+
120
+ const warnedByRegistry = new WeakMap<A2uiRegistry, Set<string>>()
121
+
122
+ /** Warns once per surface, node, and rule in development; silent in production. */
123
+ export function warnA2uiAccessibility(
124
+ messages: readonly A2uiMessage[],
125
+ registry: A2uiRegistry
126
+ ): void {
127
+ if (!isDevelopment()) return
128
+ let warned = warnedByRegistry.get(registry)
129
+ if (!warned) warnedByRegistry.set(registry, (warned = new Set()))
130
+ let errors: readonly A2uiAccessibilityError[]
131
+ try {
132
+ errors = validateA2uiAccessibility(messages, { registry }).errors
133
+ } catch (error) {
134
+ console.warn('A2UI accessibility check failed.', error)
135
+ return
136
+ }
137
+ const fresh = errors.filter(error => {
138
+ const key = `${error.surfaceId}\u0000${error.nodeId}\u0000${error.rule}`
139
+ if (warned.has(key)) return false
140
+ warned.add(key)
141
+ return true
142
+ })
143
+ if (fresh.length === 0) return
144
+ console.warn(`A2UI accessibility:\n${fresh.map(e => `- ${e.message} (${e.rule})`).join('\n')}`)
145
+ }
@@ -0,0 +1,106 @@
1
+ import { isPlainRecord } from '../catalog/coerce.js'
2
+
3
+ /** One A2UI component definition as it appears in `createSurface` or `updateComponents`. */
4
+ export type A2uiComponentRecord = Readonly<Record<string, unknown>>
5
+
6
+ export type A2uiAccessibilityRuleContext = {
7
+ /** Returns the latest definition of another component on the same surface. */
8
+ readonly getComponent: (id: string) => A2uiComponentRecord | undefined
9
+ }
10
+
11
+ export type A2uiAccessibilityFinding = {
12
+ readonly prop: string
13
+ readonly message: string
14
+ /** Props merged into the component when the caller asks for safe fixes. */
15
+ readonly fix?: Readonly<Record<string, unknown>>
16
+ }
17
+
18
+ /** An accessibility rule declared on a registry entry. `check` must be pure. */
19
+ export type A2uiAccessibilityRule = {
20
+ readonly id: string
21
+ readonly check: (
22
+ component: A2uiComponentRecord,
23
+ context: A2uiAccessibilityRuleContext
24
+ ) => A2uiAccessibilityFinding | undefined
25
+ }
26
+
27
+ const isDynamic = (v: unknown): boolean =>
28
+ isPlainRecord(v) && ('@path' in v || 'path' in v || '@call' in v || 'call' in v)
29
+
30
+ /** True when a value renders as non-empty text or is bound to surface state. */
31
+ function hasText(value: unknown): boolean {
32
+ if (isDynamic(value)) return true
33
+ if (typeof value === 'string') return value.trim().length > 0
34
+ return (typeof value === 'number' && Number.isFinite(value)) || typeof value === 'boolean'
35
+ }
36
+
37
+ function readPath(component: A2uiComponentRecord, path: string): unknown {
38
+ let current: unknown = component
39
+ for (const key of path.split('.')) {
40
+ if (!isPlainRecord(current)) return undefined
41
+ current = current[key]
42
+ }
43
+ return current
44
+ }
45
+
46
+ const describe = (component: A2uiComponentRecord) =>
47
+ `${String(component.component)} "${String(component.id)}"`
48
+
49
+ export type ControlLabelRuleOptions = {
50
+ /** Other props the renderer announces as the name, such as `accessibility.label`. */
51
+ readonly alternatives?: readonly string[]
52
+ /** Author-written props copied into `label` as a safe fix, in priority order. */
53
+ readonly fixFrom?: readonly string[]
54
+ }
55
+
56
+ /** Requires a form control to have a non-empty `label` (or a declared alternative). */
57
+ export function controlLabelRule(options: ControlLabelRuleOptions = {}): A2uiAccessibilityRule {
58
+ const alternatives = options.alternatives ?? []
59
+ const fixFrom = options.fixFrom ?? []
60
+ return {
61
+ id: 'control-label',
62
+ check(component) {
63
+ if (['label', ...alternatives].some(path => hasText(readPath(component, path)))) return
64
+ const source = fixFrom
65
+ .map(path => readPath(component, path))
66
+ .find((v): v is string => typeof v === 'string' && v.trim().length > 0)
67
+ const names = ['label', ...alternatives].join(' or ')
68
+ return {
69
+ prop: 'label',
70
+ message: `${describe(component)} has no ${names}.`,
71
+ ...(source === undefined ? {} : { fix: { label: source.trim() } })
72
+ }
73
+ }
74
+ }
75
+ }
76
+
77
+ function subtreeHasText(
78
+ id: unknown,
79
+ context: A2uiAccessibilityRuleContext,
80
+ visited: Set<string>
81
+ ): boolean {
82
+ if (typeof id !== 'string' || !id || visited.has(id)) return false
83
+ visited.add(id)
84
+ const node = context.getComponent(id)
85
+ // A child that has not arrived yet cannot be judged.
86
+ if (!node) return true
87
+ if (hasText(node.text) || hasText(node.label)) return true
88
+ if (subtreeHasText(node.child, context, visited)) return true
89
+ const children = node.children
90
+ if (isPlainRecord(children)) return true
91
+ return Array.isArray(children) && children.some(c => subtreeHasText(c, context, visited))
92
+ }
93
+
94
+ /** Requires a button's `child` subtree to render text that names it. */
95
+ export function buttonNameRule(): A2uiAccessibilityRule {
96
+ return {
97
+ id: 'button-name',
98
+ check(component, context) {
99
+ if (subtreeHasText(component.child, context, new Set())) return
100
+ return {
101
+ prop: 'child',
102
+ message: `${describe(component)} has no text content to name it.`
103
+ }
104
+ }
105
+ }
106
+ }
@@ -0,0 +1,317 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://a2ui.org/specification/v1_0/catalogs/basic/catalog.json",
4
+ "catalogId": "https://a2ui.org/specification/v1_0/catalogs/basic/catalog.json",
5
+ "protocolVersion": "1.0",
6
+ "title": "Radiant A2UI 1.0 Catalog",
7
+ "description": "A2UI 1.0 catalog generated from Radiant registry entries backed by @cognitap/radiant/catalog.",
8
+ "components": {
9
+ "Column": {
10
+ "description": "Arranges child elements vertically with semantic spacing and alignment.",
11
+ "type": "object",
12
+ "properties": {
13
+ "component": {
14
+ "const": "Column"
15
+ },
16
+ "children": {
17
+ "$ref": "common_types.json#/$defs/ChildList",
18
+ "description": "Ordered vertical children."
19
+ },
20
+ "justify": {
21
+ "type": "string",
22
+ "enum": [
23
+ "start",
24
+ "center",
25
+ "end",
26
+ "spaceBetween",
27
+ "spaceAround",
28
+ "spaceEvenly",
29
+ "stretch"
30
+ ],
31
+ "default": "start",
32
+ "description": "Main-axis distribution of children."
33
+ },
34
+ "align": {
35
+ "type": "string",
36
+ "enum": ["start", "center", "end", "stretch"],
37
+ "default": "stretch",
38
+ "description": "Cross-axis alignment of children."
39
+ },
40
+ "weight": {
41
+ "$ref": "#/$defs/Weight"
42
+ }
43
+ },
44
+ "required": ["component", "children"]
45
+ },
46
+ "Text": {
47
+ "description": "Displays formatted text with semantic typographic hierarchy.",
48
+ "type": "object",
49
+ "properties": {
50
+ "component": {
51
+ "const": "Text"
52
+ },
53
+ "text": {
54
+ "$ref": "common_types.json#/$defs/DynamicString",
55
+ "description": "Optional dynamic text value read from surface state."
56
+ },
57
+ "variant": {
58
+ "type": "string",
59
+ "enum": ["caption", "body"],
60
+ "default": "body",
61
+ "description": "Semantic typographic hierarchy."
62
+ },
63
+ "weight": {
64
+ "$ref": "#/$defs/Weight"
65
+ }
66
+ },
67
+ "required": ["component", "text"]
68
+ },
69
+ "TextField": {
70
+ "type": "object",
71
+ "description": "Collects single-line or multi-line text input with label, description, and validation.",
72
+ "allOf": [
73
+ {
74
+ "$ref": "common_types.json#/$defs/Checkable"
75
+ },
76
+ {
77
+ "type": "object",
78
+ "properties": {
79
+ "component": {
80
+ "const": "TextField"
81
+ },
82
+ "label": {
83
+ "$ref": "common_types.json#/$defs/DynamicString",
84
+ "description": "Visible field label."
85
+ },
86
+ "value": {
87
+ "$ref": "common_types.json#/$defs/DynamicString",
88
+ "description": "Current text value bound to surface state."
89
+ },
90
+ "placeholder": {
91
+ "$ref": "common_types.json#/$defs/DynamicString",
92
+ "description": "Example value shown when empty."
93
+ },
94
+ "variant": {
95
+ "type": "string",
96
+ "enum": ["longText", "number", "shortText", "obscured"],
97
+ "default": "shortText",
98
+ "description": "Input intent controlling native input type or multiline textarea."
99
+ },
100
+ "weight": {
101
+ "$ref": "#/$defs/Weight"
102
+ }
103
+ },
104
+ "required": ["component", "label", "value"]
105
+ }
106
+ ]
107
+ },
108
+ "CheckBox": {
109
+ "type": "object",
110
+ "description": "Collects an explicit boolean consent or selection state.",
111
+ "allOf": [
112
+ {
113
+ "$ref": "common_types.json#/$defs/Checkable"
114
+ },
115
+ {
116
+ "type": "object",
117
+ "properties": {
118
+ "component": {
119
+ "const": "CheckBox"
120
+ },
121
+ "label": {
122
+ "$ref": "common_types.json#/$defs/DynamicString",
123
+ "description": "Visible checkbox label."
124
+ },
125
+ "value": {
126
+ "$ref": "common_types.json#/$defs/DynamicBoolean",
127
+ "description": "Checked state bound to surface state."
128
+ },
129
+ "weight": {
130
+ "$ref": "#/$defs/Weight"
131
+ }
132
+ },
133
+ "required": ["component", "label", "value"]
134
+ }
135
+ ]
136
+ },
137
+ "ChoicePicker": {
138
+ "type": "object",
139
+ "description": "Selects one or multiple values from curated options using an intent-based presentation.",
140
+ "allOf": [
141
+ {
142
+ "$ref": "common_types.json#/$defs/Checkable"
143
+ },
144
+ {
145
+ "type": "object",
146
+ "properties": {
147
+ "component": {
148
+ "const": "ChoicePicker"
149
+ },
150
+ "label": {
151
+ "$ref": "common_types.json#/$defs/DynamicString",
152
+ "description": "Visible field or group label."
153
+ },
154
+ "variant": {
155
+ "type": "string",
156
+ "enum": ["multipleSelection", "mutuallyExclusive"],
157
+ "default": "mutuallyExclusive",
158
+ "description": "Whether one or multiple options can be selected."
159
+ },
160
+ "options": {
161
+ "type": "array",
162
+ "description": "Selectable choices presented to the user.",
163
+ "items": {
164
+ "type": "object",
165
+ "properties": {
166
+ "label": {
167
+ "$ref": "common_types.json#/$defs/DynamicString"
168
+ },
169
+ "value": {
170
+ "type": "string"
171
+ }
172
+ },
173
+ "required": ["label", "value"],
174
+ "additionalProperties": false
175
+ }
176
+ },
177
+ "value": {
178
+ "$ref": "common_types.json#/$defs/DynamicStringList",
179
+ "description": "Selected option value or values bound to surface state."
180
+ },
181
+ "displayStyle": {
182
+ "type": "string",
183
+ "enum": ["checkbox", "chips"],
184
+ "default": "checkbox",
185
+ "description": "Visual presentation intent for the choice control."
186
+ },
187
+ "filterable": {
188
+ "type": "boolean",
189
+ "default": false,
190
+ "description": "Enables filtering options by typing when presented as a dropdown."
191
+ },
192
+ "weight": {
193
+ "$ref": "#/$defs/Weight"
194
+ }
195
+ },
196
+ "required": ["component", "options", "value"]
197
+ }
198
+ ]
199
+ },
200
+ "Slider": {
201
+ "type": "object",
202
+ "description": "Selects a numeric value within a bounded range.",
203
+ "allOf": [
204
+ {
205
+ "$ref": "common_types.json#/$defs/Checkable"
206
+ },
207
+ {
208
+ "type": "object",
209
+ "properties": {
210
+ "component": {
211
+ "const": "Slider"
212
+ },
213
+ "label": {
214
+ "$ref": "common_types.json#/$defs/DynamicString",
215
+ "description": "Visible slider label."
216
+ },
217
+ "min": {
218
+ "type": "number",
219
+ "description": "Minimum allowed value.",
220
+ "default": 0
221
+ },
222
+ "max": {
223
+ "type": "number",
224
+ "description": "Maximum allowed value."
225
+ },
226
+ "value": {
227
+ "$ref": "common_types.json#/$defs/DynamicNumber",
228
+ "description": "Current numeric value bound to surface state."
229
+ },
230
+ "steps": {
231
+ "type": "integer",
232
+ "minimum": 1,
233
+ "description": "Number of discrete divisions; the renderer derives the canonical step size."
234
+ },
235
+ "weight": {
236
+ "$ref": "#/$defs/Weight"
237
+ }
238
+ },
239
+ "required": ["component", "value", "max"]
240
+ }
241
+ ]
242
+ },
243
+ "Button": {
244
+ "type": "object",
245
+ "description": "Triggers a client-local update or emits a named outbound action.",
246
+ "allOf": [
247
+ {
248
+ "$ref": "common_types.json#/$defs/Checkable"
249
+ },
250
+ {
251
+ "type": "object",
252
+ "properties": {
253
+ "component": {
254
+ "const": "Button"
255
+ },
256
+ "child": {
257
+ "$ref": "common_types.json#/$defs/Child",
258
+ "description": "Optional rich content inside the button."
259
+ },
260
+ "variant": {
261
+ "type": "string",
262
+ "enum": ["default", "primary", "borderless"],
263
+ "default": "default",
264
+ "description": "Visual treatment of the button."
265
+ },
266
+ "action": {
267
+ "$ref": "common_types.json#/$defs/Action",
268
+ "description": "Action dispatched when the user activates the button."
269
+ },
270
+ "weight": {
271
+ "$ref": "#/$defs/Weight"
272
+ }
273
+ },
274
+ "required": ["component", "child", "action"]
275
+ }
276
+ ]
277
+ }
278
+ },
279
+ "functions": {},
280
+ "$defs": {
281
+ "anyComponent": {
282
+ "oneOf": [
283
+ {
284
+ "$ref": "#/components/Column"
285
+ },
286
+ {
287
+ "$ref": "#/components/Text"
288
+ },
289
+ {
290
+ "$ref": "#/components/TextField"
291
+ },
292
+ {
293
+ "$ref": "#/components/CheckBox"
294
+ },
295
+ {
296
+ "$ref": "#/components/ChoicePicker"
297
+ },
298
+ {
299
+ "$ref": "#/components/Slider"
300
+ },
301
+ {
302
+ "$ref": "#/components/Button"
303
+ }
304
+ ],
305
+ "discriminator": {
306
+ "propertyName": "component"
307
+ }
308
+ },
309
+ "anyFunction": {
310
+ "not": {}
311
+ },
312
+ "Weight": {
313
+ "type": "number",
314
+ "description": "Relative flex growth of this component inside a Row or Column. Set it only on direct children of a Row or Column."
315
+ }
316
+ }
317
+ }