@datalayer/agent-runtimes 1.0.4 → 1.0.5
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 +34 -0
- package/lib/App.js +1 -1
- package/lib/agents/AgentDetails.d.ts +22 -1
- package/lib/agents/AgentDetails.js +34 -47
- package/lib/api/index.d.ts +0 -1
- package/lib/api/index.js +4 -2
- package/lib/chat/Chat.d.ts +5 -106
- package/lib/chat/Chat.js +4 -4
- package/lib/chat/ChatFloating.d.ts +7 -140
- package/lib/chat/ChatFloating.js +2 -2
- package/lib/chat/ChatPopupStandalone.d.ts +8 -47
- package/lib/chat/ChatPopupStandalone.js +3 -3
- package/lib/chat/ChatSidebar.d.ts +4 -69
- package/lib/chat/ChatSidebar.js +2 -2
- package/lib/chat/ChatStandalone.d.ts +4 -54
- package/lib/chat/ChatStandalone.js +3 -3
- package/lib/chat/base/ChatBase.js +1083 -157
- package/lib/chat/header/ChatHeaderBase.d.ts +11 -6
- package/lib/chat/header/ChatHeaderBase.js +18 -16
- package/lib/chat/indicators/McpStatusIndicator.d.ts +7 -4
- package/lib/chat/indicators/McpStatusIndicator.js +7 -32
- package/lib/chat/indicators/SandboxStatusIndicator.d.ts +4 -1
- package/lib/chat/indicators/SandboxStatusIndicator.js +9 -9
- package/lib/chat/indicators/SkillsStatusIndicator.d.ts +7 -0
- package/lib/chat/indicators/SkillsStatusIndicator.js +88 -0
- package/lib/chat/indicators/index.d.ts +1 -0
- package/lib/chat/indicators/index.js +1 -0
- package/lib/chat/messages/ChatMessageList.d.ts +1 -1
- package/lib/chat/messages/ChatMessageList.js +108 -113
- package/lib/chat/prompt/InputFooter.d.ts +19 -6
- package/lib/chat/prompt/InputFooter.js +71 -18
- package/lib/chat/prompt/InputPrompt.d.ts +3 -1
- package/lib/chat/prompt/InputPrompt.js +4 -4
- package/lib/chat/prompt/InputPromptFooter.js +1 -1
- package/lib/chat/prompt/InputPromptLexical.d.ts +3 -1
- package/lib/chat/prompt/InputPromptLexical.js +12 -5
- package/lib/chat/prompt/InputPromptText.d.ts +3 -1
- package/lib/chat/prompt/InputPromptText.js +2 -2
- package/lib/chat/tools/ToolApprovalBanner.js +1 -1
- package/lib/chat/tools/ToolCallDisplay.d.ts +3 -1
- package/lib/chat/tools/ToolCallDisplay.js +2 -2
- package/lib/chat/usage/TokenUsageBar.js +20 -2
- package/lib/client/AgentRuntimesClientContext.d.ts +53 -0
- package/lib/client/AgentRuntimesClientContext.js +55 -0
- package/lib/client/AgentsMixin.d.ts +0 -18
- package/lib/client/AgentsMixin.js +6 -30
- package/lib/client/IAgentRuntimesClient.d.ts +215 -0
- package/lib/client/IAgentRuntimesClient.js +5 -0
- package/lib/client/SdkAgentRuntimesClient.d.ts +151 -0
- package/lib/client/SdkAgentRuntimesClient.js +134 -0
- package/lib/client/index.d.ts +4 -1
- package/lib/client/index.js +3 -1
- package/lib/components/NotificationEventCard.js +5 -1
- package/lib/config/AgentConfiguration.js +3 -3
- package/lib/context/ContextDistribution.d.ts +3 -1
- package/lib/context/ContextDistribution.js +8 -27
- package/lib/context/ContextInspector.d.ts +3 -1
- package/lib/context/ContextInspector.js +19 -67
- package/lib/context/ContextPanel.d.ts +3 -1
- package/lib/context/ContextPanel.js +104 -64
- package/lib/context/ContextUsage.d.ts +3 -1
- package/lib/context/ContextUsage.js +3 -3
- package/lib/context/CostTracker.d.ts +9 -3
- package/lib/context/CostTracker.js +26 -47
- package/lib/context/CostUsageChart.d.ts +12 -0
- package/lib/context/CostUsageChart.js +378 -0
- package/lib/context/GraphFlowChart.d.ts +16 -0
- package/lib/context/GraphFlowChart.js +182 -0
- package/lib/context/TokenUsageChart.d.ts +8 -1
- package/lib/context/TokenUsageChart.js +349 -211
- package/lib/context/TurnGraphChart.d.ts +39 -0
- package/lib/context/TurnGraphChart.js +538 -0
- package/lib/context/otelWsPool.d.ts +20 -0
- package/lib/context/otelWsPool.js +69 -0
- package/lib/examples/A2UiComponentGalleryExample.d.ts +0 -17
- package/lib/examples/A2UiComponentGalleryExample.js +315 -522
- package/lib/examples/A2UiContactCardExample.d.ts +0 -18
- package/lib/examples/A2UiContactCardExample.js +154 -411
- package/lib/examples/A2UiRestaurantExample.d.ts +0 -30
- package/lib/examples/A2UiRestaurantExample.js +114 -212
- package/lib/examples/A2UiViewerExample.d.ts +0 -18
- package/lib/examples/A2UiViewerExample.js +283 -532
- package/lib/examples/AgUiBackendToolRenderingExample.js +1 -1
- package/lib/examples/AgUiHaikuGenUiExample.d.ts +1 -1
- package/lib/examples/AgUiHaikuGenUiExample.js +1 -1
- package/lib/examples/AgentCheckpointsExample.js +13 -27
- package/lib/examples/AgentCodemodeExample.d.ts +4 -6
- package/lib/examples/AgentCodemodeExample.js +591 -169
- package/lib/examples/AgentEvalsExample.js +12 -16
- package/lib/examples/AgentGuardrailsExample.js +370 -64
- package/lib/examples/AgentHooksExample.d.ts +3 -0
- package/lib/examples/AgentHooksExample.js +104 -0
- package/lib/examples/AgentMCPExample.d.ts +3 -0
- package/lib/examples/AgentMCPExample.js +480 -0
- package/lib/examples/AgentMemoryExample.js +13 -17
- package/lib/examples/AgentMonitoringExample.js +260 -199
- package/lib/examples/AgentNotificationsExample.js +49 -17
- package/lib/examples/AgentOtelExample.js +2 -3
- package/lib/examples/AgentOutputsExample.d.ts +11 -6
- package/lib/examples/AgentOutputsExample.js +382 -81
- package/lib/examples/AgentParametersExample.d.ts +3 -0
- package/lib/examples/AgentParametersExample.js +246 -0
- package/lib/examples/AgentSandboxExample.d.ts +2 -2
- package/lib/examples/AgentSandboxExample.js +68 -40
- package/lib/examples/AgentSkillsExample.js +91 -99
- package/lib/examples/{AgentspecExample.js → AgentSpecsExample.js} +10 -21
- package/lib/examples/AgentSubagentsExample.d.ts +14 -0
- package/lib/examples/AgentSubagentsExample.js +228 -0
- package/lib/examples/AgentToolApprovalsExample.js +29 -557
- package/lib/examples/AgentTriggersExample.js +819 -565
- package/lib/examples/ChatCustomExample.js +11 -24
- package/lib/examples/ChatExample.js +7 -24
- package/lib/examples/CopilotKitLexicalExample.js +2 -1
- package/lib/examples/CopilotKitNotebookExample.js +2 -1
- package/lib/examples/HomeExample.d.ts +15 -0
- package/lib/examples/HomeExample.js +77 -0
- package/lib/examples/Lexical2Example.js +4 -2
- package/lib/examples/{LexicalExample.d.ts → LexicalAgentExample.d.ts} +4 -4
- package/lib/examples/{LexicalExample.js → LexicalAgentExample.js} +65 -16
- package/lib/examples/{LexicalSidebarExample.d.ts → LexicalAgentSidebarExample.d.ts} +5 -5
- package/lib/examples/LexicalAgentSidebarExample.js +261 -0
- package/lib/examples/NotebookAgentExample.d.ts +9 -0
- package/lib/examples/NotebookAgentExample.js +192 -0
- package/lib/examples/{NotebookSidebarExample.d.ts → NotebookAgentSidebarExample.d.ts} +2 -2
- package/lib/examples/NotebookAgentSidebarExample.js +221 -0
- package/lib/examples/{DatalayerNotebookExample.d.ts → NotebookCollaborationExample.d.ts} +4 -4
- package/lib/examples/{DatalayerNotebookExample.js → NotebookCollaborationExample.js} +3 -3
- package/lib/examples/NotebookExample.d.ts +4 -7
- package/lib/examples/NotebookExample.js +14 -146
- package/lib/examples/components/AuthRequiredView.d.ts +6 -0
- package/lib/examples/components/AuthRequiredView.js +33 -0
- package/lib/examples/components/ExampleWrapper.d.ts +7 -0
- package/lib/examples/components/ExampleWrapper.js +25 -6
- package/lib/examples/{ag-ui → components}/haiku/HaikuDisplay.js +1 -1
- package/lib/examples/{ag-ui → components}/haiku/InlineHaikuCard.js +1 -1
- package/lib/examples/{ag-ui → components}/haiku/index.d.ts +1 -1
- package/lib/examples/{ag-ui → components}/haiku/index.js +1 -1
- package/lib/examples/components/index.d.ts +3 -0
- package/lib/examples/components/index.js +4 -0
- package/lib/examples/{ag-ui → components}/weather/index.d.ts +1 -1
- package/lib/examples/{ag-ui → components}/weather/index.js +1 -1
- package/lib/examples/example-selector.d.ts +17 -4
- package/lib/examples/example-selector.js +107 -41
- package/lib/examples/index.d.ts +9 -6
- package/lib/examples/index.js +9 -6
- package/lib/examples/main.js +217 -27
- package/lib/examples/utils/a2ui.d.ts +18 -0
- package/lib/examples/utils/a2ui.js +69 -0
- package/lib/examples/utils/a2uiMarkdownProvider.d.ts +7 -0
- package/lib/examples/utils/a2uiMarkdownProvider.js +9 -0
- package/lib/examples/utils/agentId.d.ts +18 -0
- package/lib/examples/utils/agentId.js +54 -0
- package/lib/examples/utils/agents/earthquake-detector.json +11 -11
- package/lib/examples/utils/agents/sales-forecaster.json +11 -11
- package/lib/examples/utils/agents/social-post-generator.json +11 -11
- package/lib/examples/utils/agents/stock-market.json +11 -11
- package/lib/examples/utils/examplesStore.js +82 -27
- package/lib/hooks/index.d.ts +8 -8
- package/lib/hooks/index.js +7 -7
- package/lib/hooks/useA2A.d.ts +2 -3
- package/lib/hooks/useAIAgentsWebSocket.d.ts +43 -4
- package/lib/hooks/useAIAgentsWebSocket.js +118 -12
- package/lib/hooks/useAcp.d.ts +1 -2
- package/lib/hooks/useAgUi.d.ts +1 -1
- package/lib/hooks/{useAgents.d.ts → useAgentRuntimes.d.ts} +39 -2
- package/lib/hooks/{useAgents.js → useAgentRuntimes.js} +125 -15
- package/lib/hooks/useAgentsCatalog.js +1 -1
- package/lib/hooks/useAgentsService.d.ts +2 -2
- package/lib/hooks/useAgentsService.js +7 -7
- package/lib/hooks/useCheckpoints.js +1 -1
- package/lib/hooks/useConfig.d.ts +4 -1
- package/lib/hooks/useConfig.js +10 -3
- package/lib/hooks/useContextSnapshot.d.ts +9 -4
- package/lib/hooks/useContextSnapshot.js +9 -37
- package/lib/hooks/useMonitoring.js +3 -0
- package/lib/hooks/useSandbox.d.ts +20 -8
- package/lib/hooks/useSandbox.js +105 -40
- package/lib/hooks/useSkills.d.ts +23 -5
- package/lib/hooks/useSkills.js +94 -39
- package/lib/hooks/useToolApprovals.d.ts +60 -36
- package/lib/hooks/useToolApprovals.js +318 -69
- package/lib/hooks/useVercelAI.d.ts +1 -1
- package/lib/index.d.ts +2 -1
- package/lib/index.js +1 -0
- package/lib/inference/index.d.ts +0 -1
- package/lib/middleware/index.d.ts +0 -1
- package/lib/protocols/AGUIAdapter.js +6 -0
- package/lib/protocols/VercelAIAdapter.d.ts +7 -0
- package/lib/protocols/VercelAIAdapter.js +59 -7
- package/lib/specs/agents/agents.d.ts +10 -0
- package/lib/specs/agents/agents.js +2139 -262
- package/lib/specs/agents/index.js +3 -1
- package/lib/specs/envvars.d.ts +1 -0
- package/lib/specs/envvars.js +38 -20
- package/lib/specs/evals.js +6 -6
- package/lib/specs/events.d.ts +3 -10
- package/lib/specs/events.js +127 -84
- package/lib/specs/frontendTools.js +2 -2
- package/lib/specs/guardrails.d.ts +0 -7
- package/lib/specs/guardrails.js +240 -159
- package/lib/specs/index.d.ts +1 -0
- package/lib/specs/index.js +1 -0
- package/lib/specs/mcpServers.js +35 -6
- package/lib/specs/memory.d.ts +0 -2
- package/lib/specs/memory.js +4 -17
- package/lib/specs/models.js +25 -5
- package/lib/specs/notifications.js +102 -18
- package/lib/specs/outputs.js +15 -9
- package/lib/specs/personas.d.ts +41 -0
- package/lib/specs/personas.js +168 -0
- package/lib/specs/skills.d.ts +2 -1
- package/lib/specs/skills.js +41 -23
- package/lib/specs/teams/index.js +3 -1
- package/lib/specs/teams/teams.js +468 -348
- package/lib/specs/tools.js +4 -4
- package/lib/specs/triggers.js +61 -11
- package/lib/stores/agentRuntimeStore.d.ts +204 -0
- package/lib/stores/agentRuntimeStore.js +636 -0
- package/lib/stores/index.d.ts +1 -1
- package/lib/stores/index.js +1 -1
- package/lib/tools/adapters/copilotkit/lexicalHooks.d.ts +1 -2
- package/lib/tools/adapters/copilotkit/lexicalHooks.js +1 -3
- package/lib/tools/adapters/copilotkit/notebookHooks.d.ts +1 -2
- package/lib/tools/adapters/copilotkit/notebookHooks.js +1 -3
- package/lib/tools/index.d.ts +0 -2
- package/lib/tools/index.js +0 -1
- package/lib/types/agentspecs.d.ts +50 -1
- package/lib/types/chat.d.ts +309 -8
- package/lib/types/context.d.ts +27 -0
- package/lib/types/cost.d.ts +2 -2
- package/lib/types/index.d.ts +2 -0
- package/lib/types/index.js +2 -0
- package/lib/types/mcp.d.ts +8 -0
- package/lib/types/models.d.ts +2 -2
- package/lib/types/personas.d.ts +25 -0
- package/lib/types/personas.js +5 -0
- package/lib/types/skills.d.ts +43 -1
- package/lib/types/stream.d.ts +110 -0
- package/lib/types/stream.js +36 -0
- package/lib/utils/utils.d.ts +9 -5
- package/lib/utils/utils.js +9 -5
- package/package.json +13 -9
- package/scripts/codegen/__pycache__/generate_agents.cpython-313.pyc +0 -0
- package/scripts/codegen/__pycache__/generate_events.cpython-313.pyc +0 -0
- package/scripts/codegen/__pycache__/versioning.cpython-313.pyc +0 -0
- package/scripts/codegen/generate_agents.py +102 -6
- package/scripts/codegen/generate_events.py +35 -13
- package/scripts/codegen/generate_personas.py +319 -0
- package/scripts/codegen/generate_skills.py +9 -9
- package/scripts/sync-jupyter.sh +26 -7
- package/lib/api/tool-approvals.d.ts +0 -62
- package/lib/api/tool-approvals.js +0 -145
- package/lib/examples/LexicalSidebarExample.js +0 -163
- package/lib/examples/NotebookSidebarExample.js +0 -119
- package/lib/examples/NotebookSimpleExample.d.ts +0 -6
- package/lib/examples/NotebookSimpleExample.js +0 -22
- package/lib/examples/ag-ui/index.d.ts +0 -10
- package/lib/examples/ag-ui/index.js +0 -16
- package/lib/hooks/useAgentsRegistry.d.ts +0 -10
- package/lib/hooks/useAgentsRegistry.js +0 -20
- package/lib/stores/agentsStore.d.ts +0 -123
- package/lib/stores/agentsStore.js +0 -270
- /package/lib/examples/{AgentspecExample.d.ts → AgentSpecsExample.d.ts} +0 -0
- /package/lib/examples/{ag-ui → components}/haiku/HaikuDisplay.d.ts +0 -0
- /package/lib/examples/{ag-ui → components}/haiku/InlineHaikuCard.d.ts +0 -0
- /package/lib/examples/{ag-ui → components}/weather/InlineWeatherCard.d.ts +0 -0
- /package/lib/examples/{ag-ui → components}/weather/InlineWeatherCard.js +0 -0
|
@@ -3,566 +3,359 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
* Copyright (c) 2025-2026 Datalayer, Inc.
|
|
4
4
|
* Distributed under the terms of the Modified BSD License.
|
|
5
5
|
*/
|
|
6
|
-
|
|
7
|
-
* A2UiComponentGalleryExample
|
|
8
|
-
*
|
|
9
|
-
* Showcases the full catalog of A2UI components rendered via @a2ui/react.
|
|
10
|
-
* Uses static A2UI JSON messages (no backend required) to demonstrate:
|
|
11
|
-
* - Text, Button, CheckBox, Slider, TextField, DateTimeInput
|
|
12
|
-
* - MultipleChoice (default, chips, filterable)
|
|
13
|
-
* - Row, Column, Card, List, Tabs, Divider, Modal
|
|
14
|
-
* - Icon, Image, Video, AudioPlayer
|
|
15
|
-
*
|
|
16
|
-
* All messages follow the A2UI three-step pattern:
|
|
17
|
-
* beginRendering → surfaceUpdate → dataModelUpdate
|
|
18
|
-
*/
|
|
19
|
-
import { useState, useCallback } from 'react';
|
|
6
|
+
import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
20
7
|
import { Box } from '@datalayer/primer-addons';
|
|
8
|
+
import { Button, SegmentedControl, Text } from '@primer/react';
|
|
9
|
+
import { A2uiSurface } from '@a2ui/react/v0_9';
|
|
21
10
|
import { ThemedProvider } from './utils/themedProvider';
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
surfaceUpdate: {
|
|
36
|
-
surfaceId,
|
|
37
|
-
components: [{ id: rootId, component: componentDef }],
|
|
38
|
-
},
|
|
39
|
-
},
|
|
40
|
-
];
|
|
41
|
-
if (data)
|
|
42
|
-
msgs.push(data);
|
|
43
|
-
return msgs;
|
|
44
|
-
}
|
|
45
|
-
/** Helper: multi-component surface */
|
|
46
|
-
function multiComponentSurface(surfaceId, rootId, components, data) {
|
|
47
|
-
const msgs = [
|
|
48
|
-
{
|
|
49
|
-
beginRendering: { surfaceId, root: rootId },
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
surfaceUpdate: { surfaceId, components },
|
|
53
|
-
},
|
|
54
|
-
];
|
|
55
|
-
if (data)
|
|
56
|
-
msgs.push(data);
|
|
57
|
-
return msgs;
|
|
58
|
-
}
|
|
59
|
-
function dataModelMsg(surfaceId, contents) {
|
|
60
|
-
return {
|
|
61
|
-
dataModelUpdate: { surfaceId, path: '/', contents },
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
// --- Gallery sections ---
|
|
65
|
-
function textFieldMessages() {
|
|
66
|
-
return singleComponentSurface('gallery-text', 'gallery-text-root', {
|
|
67
|
-
TextField: {
|
|
68
|
-
label: { literalString: 'Enter some text' },
|
|
69
|
-
text: { path: 'galleryData/textField' },
|
|
70
|
-
},
|
|
71
|
-
}, dataModelMsg('gallery-text', [
|
|
72
|
-
{
|
|
73
|
-
key: 'galleryData',
|
|
74
|
-
valueMap: [{ key: 'textField', valueString: 'Hello World' }],
|
|
75
|
-
},
|
|
76
|
-
]));
|
|
77
|
-
}
|
|
78
|
-
function textMessages() {
|
|
79
|
-
return singleComponentSurface('gallery-text-block', 'gallery-text-block-root', {
|
|
80
|
-
Text: {
|
|
81
|
-
usageHint: 'h3',
|
|
82
|
-
text: { literalString: 'Hello from A2UI Text component' },
|
|
83
|
-
},
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
function imageMessages() {
|
|
87
|
-
return singleComponentSurface('gallery-image', 'gallery-image-root', {
|
|
88
|
-
Image: {
|
|
89
|
-
url: { path: 'galleryData/imageUrl' },
|
|
90
|
-
altText: { literalString: 'A2UI demo landscape' },
|
|
91
|
-
fit: 'cover',
|
|
92
|
-
},
|
|
93
|
-
}, dataModelMsg('gallery-image', [
|
|
94
|
-
{
|
|
95
|
-
key: 'galleryData',
|
|
96
|
-
valueMap: [
|
|
11
|
+
import { A2uiMarkdownProvider } from './utils/a2uiMarkdownProvider';
|
|
12
|
+
import { createSceneMessages, useA2uiProcessor } from './utils/a2ui';
|
|
13
|
+
const SCENES = [
|
|
14
|
+
{
|
|
15
|
+
id: 'typography',
|
|
16
|
+
label: 'Typography',
|
|
17
|
+
description: 'Text, Icon, Row, and Button components bound to data-model values.',
|
|
18
|
+
messages: createSceneMessages({
|
|
19
|
+
surfaceId: 'gallery-typography',
|
|
20
|
+
components: [
|
|
21
|
+
{ id: 'root', component: 'Card', child: 'main' },
|
|
97
22
|
{
|
|
98
|
-
|
|
99
|
-
|
|
23
|
+
id: 'main',
|
|
24
|
+
component: 'Column',
|
|
25
|
+
children: ['title', 'subtitle', 'meta-row', 'cta-label', 'cta'],
|
|
100
26
|
},
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
return singleComponentSurface('gallery-video', 'gallery-video-root', {
|
|
107
|
-
Video: {
|
|
108
|
-
sourceUrl: {
|
|
109
|
-
literalString: 'https://interactive-examples.mdn.mozilla.net/media/cc0-videos/flower.mp4',
|
|
110
|
-
},
|
|
111
|
-
},
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
function audioMessages() {
|
|
115
|
-
return singleComponentSurface('gallery-audio', 'gallery-audio-root', {
|
|
116
|
-
AudioPlayer: {
|
|
117
|
-
sourceUrl: {
|
|
118
|
-
literalString: 'https://interactive-examples.mdn.mozilla.net/media/cc0-audio/t-rex-roar.mp3',
|
|
119
|
-
},
|
|
120
|
-
},
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
|
-
function layoutMessages() {
|
|
124
|
-
return multiComponentSurface('gallery-layout', 'gallery-layout-root', [
|
|
125
|
-
{
|
|
126
|
-
id: 'gallery-layout-root',
|
|
127
|
-
component: {
|
|
128
|
-
Column: {
|
|
129
|
-
children: { explicitList: ['layout-title', 'layout-row'] },
|
|
130
|
-
gap: 'small',
|
|
27
|
+
{
|
|
28
|
+
id: 'title',
|
|
29
|
+
component: 'Text',
|
|
30
|
+
variant: 'h2',
|
|
31
|
+
text: { path: '/title' },
|
|
131
32
|
},
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
usageHint: 'caption',
|
|
139
|
-
text: {
|
|
140
|
-
literalString: 'Row and Column layout composition',
|
|
141
|
-
},
|
|
33
|
+
{ id: 'subtitle', component: 'Text', text: { path: '/subtitle' } },
|
|
34
|
+
{
|
|
35
|
+
id: 'meta-row',
|
|
36
|
+
component: 'Row',
|
|
37
|
+
align: 'center',
|
|
38
|
+
children: ['meta-icon', 'meta-text'],
|
|
142
39
|
},
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
children: { explicitList: ['layout-card-1', 'layout-card-2'] },
|
|
150
|
-
gap: 'small',
|
|
40
|
+
{ id: 'meta-icon', component: 'Icon', name: 'star' },
|
|
41
|
+
{
|
|
42
|
+
id: 'meta-text',
|
|
43
|
+
component: 'Text',
|
|
44
|
+
variant: 'caption',
|
|
45
|
+
text: { path: '/meta' },
|
|
151
46
|
},
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
},
|
|
159
|
-
},
|
|
160
|
-
{
|
|
161
|
-
id: 'layout-card-1-text',
|
|
162
|
-
component: {
|
|
163
|
-
Text: { text: { literalString: 'Column -> Row -> Card #1' } },
|
|
164
|
-
},
|
|
165
|
-
},
|
|
166
|
-
{
|
|
167
|
-
id: 'layout-card-2',
|
|
168
|
-
component: {
|
|
169
|
-
Card: { child: 'layout-card-2-text' },
|
|
170
|
-
},
|
|
171
|
-
},
|
|
172
|
-
{
|
|
173
|
-
id: 'layout-card-2-text',
|
|
174
|
-
component: {
|
|
175
|
-
Text: { text: { literalString: 'Column -> Row -> Card #2' } },
|
|
176
|
-
},
|
|
177
|
-
},
|
|
178
|
-
]);
|
|
179
|
-
}
|
|
180
|
-
function checkboxMessages() {
|
|
181
|
-
return singleComponentSurface('gallery-checkbox', 'gallery-checkbox-root', {
|
|
182
|
-
CheckBox: {
|
|
183
|
-
label: { literalString: 'Toggle me' },
|
|
184
|
-
value: { path: 'galleryData/checkbox' },
|
|
185
|
-
},
|
|
186
|
-
}, dataModelMsg('gallery-checkbox', [
|
|
187
|
-
{
|
|
188
|
-
key: 'galleryData',
|
|
189
|
-
valueMap: [{ key: 'checkbox', valueBoolean: false }],
|
|
190
|
-
},
|
|
191
|
-
]));
|
|
192
|
-
}
|
|
193
|
-
function sliderMessages() {
|
|
194
|
-
return singleComponentSurface('gallery-slider', 'gallery-slider-root', {
|
|
195
|
-
Slider: {
|
|
196
|
-
value: { path: 'galleryData/slider' },
|
|
197
|
-
minValue: 0,
|
|
198
|
-
maxValue: 100,
|
|
199
|
-
},
|
|
200
|
-
}, dataModelMsg('gallery-slider', [
|
|
201
|
-
{ key: 'galleryData', valueMap: [{ key: 'slider', valueNumber: 30 }] },
|
|
202
|
-
]));
|
|
203
|
-
}
|
|
204
|
-
function dateTimeMessages() {
|
|
205
|
-
return singleComponentSurface('gallery-date', 'gallery-date-root', {
|
|
206
|
-
DateTimeInput: {
|
|
207
|
-
value: { path: 'galleryData/date' },
|
|
208
|
-
enableDate: true,
|
|
209
|
-
},
|
|
210
|
-
}, dataModelMsg('gallery-date', [
|
|
211
|
-
{
|
|
212
|
-
key: 'galleryData',
|
|
213
|
-
valueMap: [{ key: 'date', valueString: '2025-10-26' }],
|
|
214
|
-
},
|
|
215
|
-
]));
|
|
216
|
-
}
|
|
217
|
-
function multipleChoiceMessages() {
|
|
218
|
-
return singleComponentSurface('gallery-mc', 'gallery-mc-root', {
|
|
219
|
-
MultipleChoice: {
|
|
220
|
-
selections: { path: 'galleryData/favorites' },
|
|
221
|
-
options: [
|
|
222
|
-
{ label: { literalString: 'Apple' }, value: 'A' },
|
|
223
|
-
{ label: { literalString: 'Banana' }, value: 'B' },
|
|
224
|
-
{ label: { literalString: 'Cherry' }, value: 'C' },
|
|
225
|
-
],
|
|
226
|
-
},
|
|
227
|
-
}, dataModelMsg('gallery-mc', [
|
|
228
|
-
{
|
|
229
|
-
key: 'galleryData',
|
|
230
|
-
valueMap: [
|
|
231
|
-
{ key: 'favorites', valueMap: [{ key: '0', valueString: 'A' }] },
|
|
232
|
-
],
|
|
233
|
-
},
|
|
234
|
-
]));
|
|
235
|
-
}
|
|
236
|
-
function buttonMessages() {
|
|
237
|
-
return multiComponentSurface('gallery-button', 'gallery-button-root', [
|
|
238
|
-
{
|
|
239
|
-
id: 'gallery-button-text',
|
|
240
|
-
component: { Text: { text: { literalString: 'Trigger Action' } } },
|
|
241
|
-
},
|
|
242
|
-
{
|
|
243
|
-
id: 'gallery-button-root',
|
|
244
|
-
component: {
|
|
245
|
-
Button: {
|
|
246
|
-
child: 'gallery-button-text',
|
|
247
|
-
primary: true,
|
|
47
|
+
{ id: 'cta-label', component: 'Text', text: 'Trigger Action' },
|
|
48
|
+
{
|
|
49
|
+
id: 'cta',
|
|
50
|
+
component: 'Button',
|
|
51
|
+
child: 'cta-label',
|
|
52
|
+
variant: 'primary',
|
|
248
53
|
action: {
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
{
|
|
252
|
-
|
|
54
|
+
event: {
|
|
55
|
+
name: 'gallery_typography_cta',
|
|
56
|
+
context: { section: 'typography', title: { path: '/title' } },
|
|
57
|
+
},
|
|
253
58
|
},
|
|
254
59
|
},
|
|
60
|
+
],
|
|
61
|
+
value: {
|
|
62
|
+
title: 'A2UI Gallery',
|
|
63
|
+
subtitle: 'Protocol-native renderer with typed schemas and dynamic bindings.',
|
|
64
|
+
meta: 'createSurface · updateComponents · updateDataModel',
|
|
255
65
|
},
|
|
256
|
-
},
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
66
|
+
}),
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
id: 'contact-card',
|
|
70
|
+
label: 'Contact',
|
|
71
|
+
description: 'Card layout with icons and data-bound profile information.',
|
|
72
|
+
messages: createSceneMessages({
|
|
73
|
+
surfaceId: 'gallery-contact-card',
|
|
74
|
+
components: [
|
|
75
|
+
{ id: 'root', component: 'Card', child: 'main-column' },
|
|
76
|
+
{
|
|
77
|
+
id: 'main-column',
|
|
78
|
+
component: 'Column',
|
|
79
|
+
align: 'center',
|
|
80
|
+
children: [
|
|
81
|
+
'avatar-image',
|
|
82
|
+
'name',
|
|
83
|
+
'title',
|
|
84
|
+
'divider',
|
|
85
|
+
'contact-info',
|
|
86
|
+
],
|
|
268
87
|
},
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
88
|
+
{
|
|
89
|
+
id: 'avatar-image',
|
|
90
|
+
component: 'Image',
|
|
91
|
+
url: { path: '/avatar' },
|
|
92
|
+
fit: 'cover',
|
|
93
|
+
variant: 'avatar',
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
id: 'name',
|
|
97
|
+
component: 'Text',
|
|
98
|
+
variant: 'h2',
|
|
99
|
+
text: { path: '/name' },
|
|
100
|
+
},
|
|
101
|
+
{ id: 'title', component: 'Text', text: { path: '/title' } },
|
|
102
|
+
{ id: 'divider', component: 'Divider' },
|
|
103
|
+
{
|
|
104
|
+
id: 'contact-info',
|
|
105
|
+
component: 'Column',
|
|
106
|
+
children: ['phone-row', 'email-row', 'location-row'],
|
|
278
107
|
},
|
|
108
|
+
{
|
|
109
|
+
id: 'phone-row',
|
|
110
|
+
component: 'Row',
|
|
111
|
+
align: 'center',
|
|
112
|
+
children: ['phone-icon', 'phone-text'],
|
|
113
|
+
},
|
|
114
|
+
{ id: 'phone-icon', component: 'Icon', name: 'phone' },
|
|
115
|
+
{ id: 'phone-text', component: 'Text', text: { path: '/phone' } },
|
|
116
|
+
{
|
|
117
|
+
id: 'email-row',
|
|
118
|
+
component: 'Row',
|
|
119
|
+
align: 'center',
|
|
120
|
+
children: ['email-icon', 'email-text'],
|
|
121
|
+
},
|
|
122
|
+
{ id: 'email-icon', component: 'Icon', name: 'mail' },
|
|
123
|
+
{ id: 'email-text', component: 'Text', text: { path: '/email' } },
|
|
124
|
+
{
|
|
125
|
+
id: 'location-row',
|
|
126
|
+
component: 'Row',
|
|
127
|
+
align: 'center',
|
|
128
|
+
children: ['location-icon', 'location-text'],
|
|
129
|
+
},
|
|
130
|
+
{ id: 'location-icon', component: 'Icon', name: 'locationOn' },
|
|
131
|
+
{ id: 'location-text', component: 'Text', text: { path: '/location' } },
|
|
132
|
+
],
|
|
133
|
+
value: {
|
|
134
|
+
avatar: 'https://images.unsplash.com/photo-1507003211169-0a1dd7228f2d?w=100&h=100&fit=crop',
|
|
135
|
+
name: 'David Park',
|
|
136
|
+
title: 'Engineering Manager',
|
|
137
|
+
phone: '+1 (555) 234-5678',
|
|
138
|
+
email: 'david.park@company.com',
|
|
139
|
+
location: 'San Francisco, CA',
|
|
279
140
|
},
|
|
280
|
-
},
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
141
|
+
}),
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
id: 'controls',
|
|
145
|
+
label: 'Controls',
|
|
146
|
+
description: 'Interactive inputs: TextField, ChoicePicker, CheckBox, Slider, DateTimeInput.',
|
|
147
|
+
messages: createSceneMessages({
|
|
148
|
+
surfaceId: 'gallery-controls',
|
|
149
|
+
components: [
|
|
150
|
+
{ id: 'root', component: 'Card', child: 'controls-column' },
|
|
151
|
+
{
|
|
152
|
+
id: 'controls-column',
|
|
153
|
+
component: 'Column',
|
|
154
|
+
children: [
|
|
155
|
+
'title',
|
|
156
|
+
'name-field',
|
|
157
|
+
'plan-picker',
|
|
158
|
+
'alerts-checkbox',
|
|
159
|
+
'volume-slider',
|
|
160
|
+
'when-field',
|
|
161
|
+
'submit-label',
|
|
162
|
+
'submit',
|
|
288
163
|
],
|
|
289
164
|
},
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
return multiComponentSurface('gallery-icons', 'gallery-icons-root', [
|
|
296
|
-
{
|
|
297
|
-
id: 'gallery-icons-root',
|
|
298
|
-
component: {
|
|
299
|
-
Row: {
|
|
300
|
-
children: { explicitList: ['icon-1', 'icon-2', 'icon-3', 'icon-4'] },
|
|
301
|
-
distribution: 'spaceEvenly',
|
|
302
|
-
alignment: 'center',
|
|
165
|
+
{
|
|
166
|
+
id: 'title',
|
|
167
|
+
component: 'Text',
|
|
168
|
+
variant: 'h3',
|
|
169
|
+
text: 'Interactive Inputs',
|
|
303
170
|
},
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
id: 'icon-3',
|
|
310
|
-
component: { Icon: { name: { literalString: 'settings' } } },
|
|
311
|
-
},
|
|
312
|
-
{
|
|
313
|
-
id: 'icon-4',
|
|
314
|
-
component: { Icon: { name: { literalString: 'search' } } },
|
|
315
|
-
},
|
|
316
|
-
]);
|
|
317
|
-
}
|
|
318
|
-
function cardMessages() {
|
|
319
|
-
return multiComponentSurface('gallery-card', 'gallery-card-root', [
|
|
320
|
-
{ id: 'gallery-card-root', component: { Card: { child: 'card-inner' } } },
|
|
321
|
-
{
|
|
322
|
-
id: 'card-inner',
|
|
323
|
-
component: {
|
|
324
|
-
Column: {
|
|
325
|
-
children: {
|
|
326
|
-
explicitList: ['card-title', 'card-divider', 'card-body'],
|
|
327
|
-
},
|
|
328
|
-
alignment: 'stretch',
|
|
171
|
+
{
|
|
172
|
+
id: 'name-field',
|
|
173
|
+
component: 'TextField',
|
|
174
|
+
label: 'Name',
|
|
175
|
+
value: { path: '/name' },
|
|
329
176
|
},
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
id: 'card-body',
|
|
341
|
-
component: {
|
|
342
|
-
Text: {
|
|
343
|
-
text: {
|
|
344
|
-
literalString: 'This is the card body content. Cards wrap any child component.',
|
|
345
|
-
},
|
|
177
|
+
{
|
|
178
|
+
id: 'plan-picker',
|
|
179
|
+
component: 'ChoicePicker',
|
|
180
|
+
label: 'Plan',
|
|
181
|
+
value: { path: '/plan' },
|
|
182
|
+
options: [
|
|
183
|
+
{ label: 'Starter', value: 'starter' },
|
|
184
|
+
{ label: 'Pro', value: 'pro' },
|
|
185
|
+
{ label: 'Enterprise', value: 'enterprise' },
|
|
186
|
+
],
|
|
346
187
|
},
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
return multiComponentSurface('gallery-list', 'gallery-list-root', [
|
|
353
|
-
{
|
|
354
|
-
id: 'gallery-list-root',
|
|
355
|
-
component: {
|
|
356
|
-
List: {
|
|
357
|
-
children: {
|
|
358
|
-
explicitList: ['list-item-1', 'list-item-2', 'list-item-3'],
|
|
359
|
-
},
|
|
360
|
-
direction: 'vertical',
|
|
361
|
-
alignment: 'stretch',
|
|
188
|
+
{
|
|
189
|
+
id: 'alerts-checkbox',
|
|
190
|
+
component: 'CheckBox',
|
|
191
|
+
label: 'Enable alerts',
|
|
192
|
+
value: { path: '/alerts' },
|
|
362
193
|
},
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
id: 'list-item-2',
|
|
371
|
-
component: { Text: { text: { literalString: '📊 Item 2 — Analytics' } } },
|
|
372
|
-
},
|
|
373
|
-
{
|
|
374
|
-
id: 'list-item-3',
|
|
375
|
-
component: { Text: { text: { literalString: '⚙️ Item 3 — Settings' } } },
|
|
376
|
-
},
|
|
377
|
-
]);
|
|
378
|
-
}
|
|
379
|
-
function modalMessages() {
|
|
380
|
-
return multiComponentSurface('gallery-modal', 'gallery-modal-root', [
|
|
381
|
-
{
|
|
382
|
-
id: 'gallery-modal-root',
|
|
383
|
-
component: {
|
|
384
|
-
Modal: {
|
|
385
|
-
entryPointChild: 'modal-trigger-btn',
|
|
386
|
-
contentChild: 'modal-body',
|
|
194
|
+
{
|
|
195
|
+
id: 'volume-slider',
|
|
196
|
+
component: 'Slider',
|
|
197
|
+
label: 'Volume',
|
|
198
|
+
value: { path: '/volume' },
|
|
199
|
+
min: 0,
|
|
200
|
+
max: 100,
|
|
387
201
|
},
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
Button: {
|
|
394
|
-
child: 'modal-btn-text',
|
|
395
|
-
primary: false,
|
|
396
|
-
action: { name: 'noop' },
|
|
202
|
+
{
|
|
203
|
+
id: 'when-field',
|
|
204
|
+
component: 'DateTimeInput',
|
|
205
|
+
label: 'Reminder time',
|
|
206
|
+
value: { path: '/when' },
|
|
397
207
|
},
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
208
|
+
{ id: 'submit-label', component: 'Text', text: 'Submit' },
|
|
209
|
+
{
|
|
210
|
+
id: 'submit',
|
|
211
|
+
component: 'Button',
|
|
212
|
+
variant: 'primary',
|
|
213
|
+
child: 'submit-label',
|
|
214
|
+
action: {
|
|
215
|
+
event: {
|
|
216
|
+
name: 'submit_controls',
|
|
217
|
+
context: {
|
|
218
|
+
name: { path: '/name' },
|
|
219
|
+
plan: { path: '/plan' },
|
|
220
|
+
alerts: { path: '/alerts' },
|
|
221
|
+
volume: { path: '/volume' },
|
|
222
|
+
when: { path: '/when' },
|
|
223
|
+
},
|
|
224
|
+
},
|
|
410
225
|
},
|
|
411
226
|
},
|
|
227
|
+
],
|
|
228
|
+
value: {
|
|
229
|
+
name: 'Morgan',
|
|
230
|
+
plan: 'pro',
|
|
231
|
+
alerts: true,
|
|
232
|
+
volume: 64,
|
|
233
|
+
when: '2026-05-01T18:30:00Z',
|
|
412
234
|
},
|
|
413
|
-
},
|
|
414
|
-
]);
|
|
415
|
-
}
|
|
416
|
-
/** Collect all gallery messages */
|
|
417
|
-
function getAllGalleryMessages() {
|
|
418
|
-
return [
|
|
419
|
-
...textMessages(),
|
|
420
|
-
...imageMessages(),
|
|
421
|
-
...videoMessages(),
|
|
422
|
-
...audioMessages(),
|
|
423
|
-
...layoutMessages(),
|
|
424
|
-
...textFieldMessages(),
|
|
425
|
-
...checkboxMessages(),
|
|
426
|
-
...sliderMessages(),
|
|
427
|
-
...dateTimeMessages(),
|
|
428
|
-
...multipleChoiceMessages(),
|
|
429
|
-
...buttonMessages(),
|
|
430
|
-
...tabsMessages(),
|
|
431
|
-
...iconRowMessages(),
|
|
432
|
-
...cardMessages(),
|
|
433
|
-
...listMessages(),
|
|
434
|
-
...modalMessages(),
|
|
435
|
-
];
|
|
436
|
-
}
|
|
437
|
-
const SECTIONS = [
|
|
438
|
-
{
|
|
439
|
-
label: 'Text',
|
|
440
|
-
surfaceId: 'gallery-text-block',
|
|
441
|
-
messages: textMessages,
|
|
442
|
-
},
|
|
443
|
-
{ label: 'Image', surfaceId: 'gallery-image', messages: imageMessages },
|
|
444
|
-
{ label: 'Video', surfaceId: 'gallery-video', messages: videoMessages },
|
|
445
|
-
{
|
|
446
|
-
label: 'AudioPlayer',
|
|
447
|
-
surfaceId: 'gallery-audio',
|
|
448
|
-
messages: audioMessages,
|
|
449
|
-
},
|
|
450
|
-
{
|
|
451
|
-
label: 'Row + Column',
|
|
452
|
-
surfaceId: 'gallery-layout',
|
|
453
|
-
messages: layoutMessages,
|
|
454
|
-
},
|
|
455
|
-
{
|
|
456
|
-
label: 'TextField',
|
|
457
|
-
surfaceId: 'gallery-text',
|
|
458
|
-
messages: textFieldMessages,
|
|
459
|
-
},
|
|
460
|
-
{
|
|
461
|
-
label: 'CheckBox',
|
|
462
|
-
surfaceId: 'gallery-checkbox',
|
|
463
|
-
messages: checkboxMessages,
|
|
235
|
+
}),
|
|
464
236
|
},
|
|
465
|
-
{ label: 'Slider', surfaceId: 'gallery-slider', messages: sliderMessages },
|
|
466
237
|
{
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
238
|
+
id: 'tabs-modal',
|
|
239
|
+
label: 'Tabs + Modal',
|
|
240
|
+
description: 'Tabs with nested content and a modal trigger using event actions.',
|
|
241
|
+
messages: createSceneMessages({
|
|
242
|
+
surfaceId: 'gallery-tabs-modal',
|
|
243
|
+
components: [
|
|
244
|
+
{ id: 'root', component: 'Column', children: ['tabs', 'modal'] },
|
|
245
|
+
{
|
|
246
|
+
id: 'tabs',
|
|
247
|
+
component: 'Tabs',
|
|
248
|
+
tabs: [
|
|
249
|
+
{ title: 'Overview', child: 'tab-overview' },
|
|
250
|
+
{ title: 'Details', child: 'tab-details' },
|
|
251
|
+
],
|
|
252
|
+
},
|
|
253
|
+
{
|
|
254
|
+
id: 'tab-overview',
|
|
255
|
+
component: 'Card',
|
|
256
|
+
child: 'tab-overview-text',
|
|
257
|
+
},
|
|
258
|
+
{
|
|
259
|
+
id: 'tab-overview-text',
|
|
260
|
+
component: 'Text',
|
|
261
|
+
text: 'Overview tab uses static component composition.',
|
|
262
|
+
},
|
|
263
|
+
{
|
|
264
|
+
id: 'tab-details',
|
|
265
|
+
component: 'Card',
|
|
266
|
+
child: 'tab-details-text',
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
id: 'tab-details-text',
|
|
270
|
+
component: 'Text',
|
|
271
|
+
text: 'Details tab includes modal interaction below.',
|
|
272
|
+
},
|
|
273
|
+
{ id: 'modal-trigger-label', component: 'Text', text: 'Open Modal' },
|
|
274
|
+
{
|
|
275
|
+
id: 'modal-content-text',
|
|
276
|
+
component: 'Text',
|
|
277
|
+
text: 'This content is rendered inside a modal.',
|
|
278
|
+
},
|
|
279
|
+
{
|
|
280
|
+
id: 'modal-content',
|
|
281
|
+
component: 'Card',
|
|
282
|
+
child: 'modal-content-text',
|
|
283
|
+
},
|
|
284
|
+
{
|
|
285
|
+
id: 'modal-trigger',
|
|
286
|
+
component: 'Button',
|
|
287
|
+
child: 'modal-trigger-label',
|
|
288
|
+
action: { event: { name: 'open_modal' } },
|
|
289
|
+
},
|
|
290
|
+
{
|
|
291
|
+
id: 'modal',
|
|
292
|
+
component: 'Modal',
|
|
293
|
+
trigger: 'modal-trigger',
|
|
294
|
+
content: 'modal-content',
|
|
295
|
+
},
|
|
296
|
+
],
|
|
297
|
+
}),
|
|
483
298
|
},
|
|
484
|
-
{ label: 'List', surfaceId: 'gallery-list', messages: listMessages },
|
|
485
|
-
{ label: 'Modal', surfaceId: 'gallery-modal', messages: modalMessages },
|
|
486
299
|
];
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
const
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
const surfaceEntries = Array.from(surfaces.entries());
|
|
508
|
-
return (_jsxs(Box, { sx: { display: 'flex', minHeight: '100vh' }, children: [_jsxs(Box, { sx: {
|
|
509
|
-
width: '240px',
|
|
510
|
-
borderRight: '1px solid',
|
|
300
|
+
function GalleryContent({ onAction, }) {
|
|
301
|
+
const { surfaces, processMessages, resetSurfaces } = useA2uiProcessor(onAction);
|
|
302
|
+
const [selectedScene, setSelectedScene] = useState(SCENES[0].id);
|
|
303
|
+
const currentScene = useMemo(() => SCENES.find(scene => scene.id === selectedScene) ?? SCENES[0], [selectedScene]);
|
|
304
|
+
const showScene = useCallback((scene) => {
|
|
305
|
+
resetSurfaces();
|
|
306
|
+
processMessages(scene.messages);
|
|
307
|
+
}, [processMessages, resetSurfaces]);
|
|
308
|
+
const showAllScenes = useCallback(() => {
|
|
309
|
+
resetSurfaces();
|
|
310
|
+
SCENES.forEach(scene => {
|
|
311
|
+
processMessages(scene.messages);
|
|
312
|
+
});
|
|
313
|
+
}, [processMessages, resetSurfaces]);
|
|
314
|
+
useEffect(() => {
|
|
315
|
+
showScene(currentScene);
|
|
316
|
+
}, [currentScene, showScene]);
|
|
317
|
+
return (_jsxs(Box, { sx: { display: 'flex', flexDirection: 'column', gap: 3, p: 3 }, children: [_jsxs(Box, { sx: {
|
|
318
|
+
width: '100%',
|
|
319
|
+
border: '1px solid',
|
|
511
320
|
borderColor: 'border.default',
|
|
321
|
+
borderRadius: 2,
|
|
322
|
+
p: 3,
|
|
512
323
|
backgroundColor: 'canvas.subtle',
|
|
513
|
-
padding: 3,
|
|
514
324
|
display: 'flex',
|
|
515
325
|
flexDirection: 'column',
|
|
516
|
-
gap:
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
gap: 3,
|
|
525
|
-
}, children: [_jsx(Text, { sx: { fontSize: '3rem' }, children: "\uD83C\uDFA8" }), _jsx(Text, { as: "h2", sx: { fontSize: '1.5rem', fontWeight: 'bold' }, children: "A2UI Component Gallery" }), _jsx(Text, { sx: { color: 'fg.muted', textAlign: 'center', maxWidth: '400px' }, children: "Browse the full catalog of A2UI components rendered via @a2ui/react. Click \"Show All\" or pick a component from the sidebar." }), _jsx(PrimerButton, { variant: "primary", onClick: loadAll, children: "Show All Components" })] })) : (_jsx(Box, { sx: { display: 'flex', flexDirection: 'column', gap: 4 }, children: surfaceEntries.map(([surfaceId]) => (_jsxs(Box, { children: [_jsx(Text, { as: "h4", sx: {
|
|
526
|
-
fontSize: '0.75rem',
|
|
527
|
-
fontWeight: 'bold',
|
|
528
|
-
color: 'fg.muted',
|
|
529
|
-
textTransform: 'uppercase',
|
|
530
|
-
letterSpacing: '0.05em',
|
|
531
|
-
marginBottom: 2,
|
|
532
|
-
}, children: surfaceId }), _jsx(Box, { sx: {
|
|
533
|
-
border: '1px solid',
|
|
534
|
-
borderColor: 'border.default',
|
|
535
|
-
borderRadius: 2,
|
|
536
|
-
padding: 3,
|
|
537
|
-
backgroundColor: 'canvas.default',
|
|
538
|
-
}, children: _jsx(A2UIRenderer, { surfaceId: surfaceId }) })] }, surfaceId))) })) })] }));
|
|
326
|
+
gap: 3,
|
|
327
|
+
}, children: [_jsx(Text, { sx: { fontSize: 2, fontWeight: 'bold' }, children: "Scenes" }), _jsx(SegmentedControl, { "aria-label": "A2UI gallery scene picker", fullWidth: true, children: SCENES.map(scene => (_jsx(SegmentedControl.Button, { selected: scene.id === selectedScene, onClick: () => setSelectedScene(scene.id), children: scene.label }, scene.id))) }), _jsx(Text, { sx: { color: 'fg.muted', fontSize: 1 }, children: currentScene.description }), _jsxs(Box, { sx: { display: 'flex', gap: 2, flexWrap: 'wrap' }, children: [_jsx(Button, { size: "small", variant: "primary", onClick: () => showScene(currentScene), children: "Reload" }), _jsx(Button, { size: "small", variant: "default", onClick: showAllScenes, children: "Show All" }), _jsx(Button, { size: "small", variant: "invisible", onClick: resetSurfaces, children: "Clear" })] })] }), _jsx(Box, { sx: {
|
|
328
|
+
width: '100%',
|
|
329
|
+
minWidth: 0,
|
|
330
|
+
display: 'flex',
|
|
331
|
+
flexDirection: 'column',
|
|
332
|
+
gap: 4,
|
|
333
|
+
}, children: surfaces.map(surface => (_jsx(Box, { sx: { width: '100%' }, children: _jsx(A2uiSurface, { surface: surface }) }, surface.id))) })] }));
|
|
539
334
|
}
|
|
540
|
-
/**
|
|
541
|
-
* A2UiComponentGalleryExample — Kitchen sink of all A2UI components.
|
|
542
|
-
* No backend required — uses static A2UI JSON messages rendered client-side.
|
|
543
|
-
*/
|
|
544
335
|
const A2UiComponentGalleryExample = () => {
|
|
545
|
-
const
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
336
|
+
const [lastAction, setLastAction] = useState(null);
|
|
337
|
+
const handleAction = useCallback((action) => {
|
|
338
|
+
console.log('A2UI Gallery Action:', action);
|
|
339
|
+
setLastAction(action);
|
|
549
340
|
}, []);
|
|
550
|
-
return (_jsx(ThemedProvider, { children: _jsx(
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
minHeight: '100vh',
|
|
554
|
-
backgroundColor: 'canvas.default',
|
|
555
|
-
}, children: [_jsxs(Box, { sx: {
|
|
556
|
-
padding: 3,
|
|
341
|
+
return (_jsx(ThemedProvider, { children: _jsx(A2uiMarkdownProvider, { children: _jsxs(Box, { sx: { minHeight: '100vh', display: 'flex', flexDirection: 'column' }, children: [_jsxs(Box, { sx: {
|
|
342
|
+
px: 3,
|
|
343
|
+
py: 3,
|
|
557
344
|
borderBottom: '1px solid',
|
|
558
345
|
borderColor: 'border.default',
|
|
559
346
|
backgroundColor: 'canvas.subtle',
|
|
560
|
-
}, children: [_jsx(Text, { as: "h1", sx: {
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
347
|
+
}, children: [_jsx(Text, { as: "h1", sx: { fontSize: 3, fontWeight: 'bold' }, children: "\uD83C\uDFA8 A2UI Component Gallery" }), _jsx(Text, { sx: { color: 'fg.muted' }, children: "Showcases the A2UI basic catalog rendered live via MessageProcessor and A2uiSurface." })] }), _jsx(GalleryContent, { onAction: handleAction }), _jsx(Box, { sx: {
|
|
348
|
+
borderTop: '1px solid',
|
|
349
|
+
borderColor: 'border.default',
|
|
350
|
+
p: 3,
|
|
351
|
+
fontFamily: 'mono',
|
|
352
|
+
fontSize: 0,
|
|
353
|
+
backgroundColor: 'canvas.subtle',
|
|
354
|
+
whiteSpace: 'pre-wrap',
|
|
355
|
+
maxHeight: 220,
|
|
356
|
+
overflow: 'auto',
|
|
357
|
+
}, children: lastAction
|
|
358
|
+
? JSON.stringify(lastAction, null, 2)
|
|
359
|
+
: 'No action triggered yet.' })] }) }) }));
|
|
567
360
|
};
|
|
568
361
|
export default A2UiComponentGalleryExample;
|