@adia-ai/web-components 0.0.2 → 0.0.4
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 +29 -22
- package/a2ui/index.js +23 -17
- package/components/accordion/accordion.js +1 -1
- package/components/action-list/action-list.js +1 -1
- package/components/agent-artifact/agent-artifact.js +1 -1
- package/components/agent-feedback-bar/agent-feedback-bar.js +1 -1
- package/components/agent-questions/agent-questions.js +1 -1
- package/components/agent-reasoning/agent-reasoning.js +1 -1
- package/components/agent-suggestions/agent-suggestions.js +1 -1
- package/components/agent-trace/agent-trace.js +1 -1
- package/components/alert/alert.js +1 -1
- package/components/avatar/avatar.js +1 -1
- package/components/badge/badge.js +1 -1
- package/components/block/block.js +1 -1
- package/components/breadcrumb/breadcrumb.js +1 -1
- package/components/button/button.js +2 -2
- package/components/calendar-picker/calendar-picker.js +2 -2
- package/components/canvas/canvas.js +2 -2
- package/components/card/card.js +2 -2
- package/components/chart/chart.js +1 -1
- package/components/chat/chat-input.js +1 -1
- package/components/chat/chat.css +1 -2
- package/components/chat/chat.js +2 -2
- package/components/check/check.js +2 -2
- package/components/code/code.css +2 -0
- package/components/code/code.js +1 -1
- package/components/col/col.js +1 -1
- package/components/color-picker/color-picker.js +1 -1
- package/components/command/command.js +1 -1
- package/components/description-list/description-list.js +1 -1
- package/components/divider/divider.js +1 -1
- package/components/drawer/drawer.js +1 -1
- package/components/embed/embed.js +1 -1
- package/components/empty-state/empty-state.js +1 -1
- package/components/grid/grid.js +1 -1
- package/components/heatmap/heatmap.js +1 -1
- package/components/icon/icon.js +2 -2
- package/components/image/image.js +1 -1
- package/components/input/input.js +2 -2
- package/components/inspector/inspector.js +2 -2
- package/components/kbd/kbd.js +1 -1
- package/components/list/list.js +1 -1
- package/components/menu/menu.js +2 -2
- package/components/modal/modal.js +1 -1
- package/components/noodles/noodles.js +1 -1
- package/components/otp-input/otp-input.js +1 -1
- package/components/pagination/pagination.js +1 -1
- package/components/pane/pane.css +2 -2
- package/components/pane/pane.js +1 -1
- package/components/pipeline-status/pipeline-status.js +1 -1
- package/components/popover/popover.js +2 -2
- package/components/progress/progress.js +1 -1
- package/components/progress-row/progress-row.js +1 -1
- package/components/radio/radio.js +2 -2
- package/components/range/range.js +1 -1
- package/components/rating/rating.js +1 -1
- package/components/richtext/richtext.js +2 -2
- package/components/row/row.js +2 -2
- package/components/search/search.js +1 -1
- package/components/segment/segment.js +1 -1
- package/components/segmented/segmented.js +1 -1
- package/components/select/select.js +2 -2
- package/components/skeleton/skeleton.js +1 -1
- package/components/slider/slider.js +1 -1
- package/components/stack/stack.js +1 -1
- package/components/stat/stat.js +1 -1
- package/components/stepper/stepper.js +1 -1
- package/components/stream/stream.js +1 -1
- package/components/swiper/swiper.js +1 -1
- package/components/switch/switch.js +2 -2
- package/components/table/table.js +1 -1
- package/components/tabs/tab.js +1 -1
- package/components/tabs/tabs.js +1 -1
- package/components/tag/tag.js +1 -1
- package/components/text/text.js +1 -1
- package/components/textarea/textarea.js +1 -1
- package/components/timeline/timeline.js +1 -1
- package/components/toast/toast.js +1 -1
- package/components/toggle-group/toggle-group.js +1 -1
- package/components/toolbar/toolbar.js +2 -2
- package/components/tooltip/tooltip.js +2 -2
- package/components/tree/tree.js +1 -1
- package/components/upload/upload.js +1 -1
- package/core/markdown.js +1 -1
- package/core/provider.js +2 -2
- package/package.json +7 -3
- package/patterns/a2ui-root/a2ui-root.a2ui.json +118 -0
- package/{a2ui/root.js → patterns/a2ui-root/a2ui-root.js} +9 -4
- package/patterns/a2ui-root/a2ui-root.yaml +76 -0
- package/patterns/adia-chat/adia-chat.js +3 -3
- package/patterns/adia-chat/css/adia-chat.tokens.css +1 -1
- package/patterns/adia-editor/adia-editor.a2ui.json +12 -0
- package/patterns/adia-editor/adia-editor.js +1 -1
- package/patterns/adia-editor/adia-editor.yaml +17 -0
- package/patterns/adia-editor/css/adia-editor.layout.css +70 -3
- package/patterns/adia-editor/css/adia-editor.tokens.css +1 -1
- package/patterns/app-nav/app-nav.js +1 -1
- package/patterns/app-nav-group/app-nav-group.js +2 -2
- package/patterns/app-nav-item/app-nav-item.js +1 -1
- package/patterns/app-shell/app-shell.js +1 -1
- package/patterns/app-shell/css/app-shell.tokens.css +1 -1
- package/patterns/gen-ui/gen-ui.js +1 -1
- package/patterns/index.js +1 -0
- package/patterns/section-nav/section-nav.js +1 -1
- package/patterns/section-nav-group/section-nav-group.js +1 -1
- package/patterns/section-nav-item/section-nav-item.js +1 -1
- package/styles/tokens.css +12 -0
- package/traits/define.js +1 -1
- package/a2ui/dockables/action.js +0 -152
- package/a2ui/dockables/base.js +0 -30
- package/a2ui/dockables/controller.js +0 -97
- package/a2ui/dockables/data-source.js +0 -103
- package/a2ui/dockables/index.js +0 -6
- package/a2ui/dockables/lifecycle.js +0 -84
- package/a2ui/dockables/provider.js +0 -59
- package/a2ui/manifest-runtime.js +0 -226
- package/a2ui/registry.js +0 -200
- package/a2ui/renderer.js +0 -361
- package/a2ui/stream.js +0 -243
- package/a2ui/surface-manifest.js +0 -294
- package/a2ui/surface.js +0 -222
- package/a2ui/wire-factory.js +0 -134
- package/a2ui/wiring-engine.js +0 -209
- package/a2ui/wiring-registry.js +0 -342
- package/patterns/adia-chat/index.html +0 -93
- package/patterns/adia-editor/index.html +0 -179
- package/patterns/app-shell/index.html +0 -112
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* LifecycleDock — Runs actions on mount, unmount, and model changes.
|
|
3
|
-
*
|
|
4
|
-
* One per surface. Fires onMount actions immediately on dock,
|
|
5
|
-
* watches model paths for changes, and runs onUnmount on undock.
|
|
6
|
-
*/
|
|
7
|
-
import { Dockable } from './base.js';
|
|
8
|
-
|
|
9
|
-
export class LifecycleDock extends Dockable {
|
|
10
|
-
kind = 'lifecycle';
|
|
11
|
-
id = 'lifecycle';
|
|
12
|
-
|
|
13
|
-
/** @type {Array} actions to run on mount */
|
|
14
|
-
onMount;
|
|
15
|
-
|
|
16
|
-
/** @type {Array} actions to run on unmount */
|
|
17
|
-
onUnmount;
|
|
18
|
-
|
|
19
|
-
/** @type {Array} model path watchers */
|
|
20
|
-
onModelChange;
|
|
21
|
-
|
|
22
|
-
/** @type {Function} (handlerName) => handlerFn */
|
|
23
|
-
#resolveHandler;
|
|
24
|
-
|
|
25
|
-
/** @type {import('../surface.js').SurfaceContext|null} */
|
|
26
|
-
#ctx = null;
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* @param {object} decl — { onMount?, onUnmount?, onModelChange? }
|
|
30
|
-
* @param {Function} resolveHandler — (name) => async (config, ctx) => result
|
|
31
|
-
*/
|
|
32
|
-
constructor(decl, resolveHandler) {
|
|
33
|
-
super();
|
|
34
|
-
this.onMount = decl.onMount || [];
|
|
35
|
-
this.onUnmount = decl.onUnmount || [];
|
|
36
|
-
this.onModelChange = decl.onModelChange || [];
|
|
37
|
-
this.#resolveHandler = resolveHandler;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
dock(ctx) {
|
|
41
|
-
this.#ctx = ctx;
|
|
42
|
-
|
|
43
|
-
// Run onMount actions
|
|
44
|
-
for (const action of this.onMount) {
|
|
45
|
-
this.#run(action, ctx);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
// Set up model watchers
|
|
49
|
-
const unwatchers = this.onModelChange.map((watcher) => {
|
|
50
|
-
let handler = () => this.#run(watcher, ctx);
|
|
51
|
-
|
|
52
|
-
// Debounce if specified
|
|
53
|
-
if (watcher.debounce > 0) {
|
|
54
|
-
const origHandler = handler;
|
|
55
|
-
let timer;
|
|
56
|
-
handler = () => {
|
|
57
|
-
clearTimeout(timer);
|
|
58
|
-
timer = setTimeout(origHandler, watcher.debounce);
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
return ctx.watchModel(watcher.path, handler);
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
return () => unwatchers.forEach(u => u());
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
undock() {
|
|
69
|
-
if (this.#ctx) {
|
|
70
|
-
for (const action of this.onUnmount) {
|
|
71
|
-
this.#run(action, this.#ctx);
|
|
72
|
-
}
|
|
73
|
-
this.#ctx = null;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
async #run(action, ctx) {
|
|
78
|
-
const fn = this.#resolveHandler(action.handler);
|
|
79
|
-
if (fn) {
|
|
80
|
-
try { await fn(action.config || {}, ctx); }
|
|
81
|
-
catch (err) { console.warn(`LifecycleDock: ${action.handler} failed`, err); }
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* ProviderDock — Injects shared context into a component subtree.
|
|
3
|
-
*
|
|
4
|
-
* Creates an <a2ui-provider> wrapper around the host element.
|
|
5
|
-
* Children can consume the context by name.
|
|
6
|
-
*/
|
|
7
|
-
import { Dockable } from './base.js';
|
|
8
|
-
|
|
9
|
-
export class ProviderDock extends Dockable {
|
|
10
|
-
kind = 'provider';
|
|
11
|
-
|
|
12
|
-
/** @type {string} context name, e.g., "auth" */
|
|
13
|
-
id;
|
|
14
|
-
|
|
15
|
-
/** @type {string|null} component id to wrap (null = root) */
|
|
16
|
-
hostId;
|
|
17
|
-
|
|
18
|
-
/** @type {*} initial context value */
|
|
19
|
-
value;
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* @param {object} decl — { name, host?, value? }
|
|
23
|
-
*/
|
|
24
|
-
constructor(decl) {
|
|
25
|
-
super();
|
|
26
|
-
this.id = `provider:${decl.name}`;
|
|
27
|
-
this.hostId = decl.host || null;
|
|
28
|
-
this.value = decl.value ?? null;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
dock(ctx) {
|
|
32
|
-
const host = this.hostId
|
|
33
|
-
? ctx.getElement(this.hostId)
|
|
34
|
-
: ctx.getRootElement();
|
|
35
|
-
|
|
36
|
-
if (!host) {
|
|
37
|
-
console.warn(`ProviderDock: host "${this.hostId}" not found`);
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
const provider = document.createElement('a2ui-provider');
|
|
42
|
-
provider.setAttribute('name', this.id.replace('provider:', ''));
|
|
43
|
-
provider.value = this.value;
|
|
44
|
-
|
|
45
|
-
// Wrap: insert provider before host, move host inside
|
|
46
|
-
host.parentNode?.insertBefore(provider, host);
|
|
47
|
-
provider.appendChild(host);
|
|
48
|
-
|
|
49
|
-
return () => {
|
|
50
|
-
// Unwrap: move host back out, remove provider
|
|
51
|
-
if (provider.parentNode) {
|
|
52
|
-
provider.parentNode.insertBefore(host, provider);
|
|
53
|
-
provider.remove();
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
undock() {}
|
|
59
|
-
}
|
package/a2ui/manifest-runtime.js
DELETED
|
@@ -1,226 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Manifest Runtime — Loads a surface manifest and manages cross-surface
|
|
3
|
-
* navigation, data flow, context sharing, and lifecycle dependencies.
|
|
4
|
-
*
|
|
5
|
-
* Bridges A008 (design-time manifest) to A007 (per-surface wiring engine).
|
|
6
|
-
* Consumes a SurfaceManifest and orchestrates the live application.
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
import { sharedContextStore } from './context-store.js';
|
|
10
|
-
import { resolveData } from './wiring-registry.js';
|
|
11
|
-
|
|
12
|
-
export class ManifestRuntime {
|
|
13
|
-
/** @type {import('./surface-manifest.js').SurfaceManifest} */
|
|
14
|
-
#manifest;
|
|
15
|
-
|
|
16
|
-
/** @type {Map<string, { mounted: boolean, completed: boolean }>} */
|
|
17
|
-
#surfaceState = new Map();
|
|
18
|
-
|
|
19
|
-
/** @type {Map<string, Function[]>} */
|
|
20
|
-
#triggerListeners = new Map();
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* @param {import('./surface-manifest.js').SurfaceManifest} manifest
|
|
24
|
-
*/
|
|
25
|
-
constructor(manifest) {
|
|
26
|
-
this.#manifest = manifest;
|
|
27
|
-
this.#initSharedContexts();
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Initialize shared contexts from the manifest.
|
|
32
|
-
*/
|
|
33
|
-
#initSharedContexts() {
|
|
34
|
-
const json = this.#manifest.toJSON();
|
|
35
|
-
if (json.sharedContexts) {
|
|
36
|
-
for (const [name, config] of Object.entries(json.sharedContexts)) {
|
|
37
|
-
sharedContextStore.define(name, config);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Signal that a surface has mounted (rendered and wired).
|
|
44
|
-
* Joins shared contexts and checks lifecycle dependencies.
|
|
45
|
-
*
|
|
46
|
-
* @param {string} surfaceId
|
|
47
|
-
* @param {Record<string, string>} [params] — Resolved route params
|
|
48
|
-
*/
|
|
49
|
-
async onSurfaceMount(surfaceId, params = {}) {
|
|
50
|
-
this.#surfaceState.set(surfaceId, { mounted: true, completed: false });
|
|
51
|
-
|
|
52
|
-
// Join shared contexts
|
|
53
|
-
const descriptor = this.#manifest.getSurface(surfaceId);
|
|
54
|
-
if (descriptor?.consumes) {
|
|
55
|
-
for (const contextName of Object.keys(descriptor.consumes)) {
|
|
56
|
-
await sharedContextStore.join(contextName, surfaceId, resolveData, params);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
// Check depends-on: if this surface depends on another, verify it's ready
|
|
61
|
-
const deps = this.#manifest.getAssociationsTo(surfaceId, 'depends-on');
|
|
62
|
-
for (const dep of deps) {
|
|
63
|
-
const depState = this.#surfaceState.get(dep.from);
|
|
64
|
-
const condition = dep.condition || 'mounted';
|
|
65
|
-
|
|
66
|
-
let satisfied = false;
|
|
67
|
-
if (condition === 'mounted') satisfied = depState?.mounted === true;
|
|
68
|
-
if (condition === 'completed') satisfied = depState?.completed === true;
|
|
69
|
-
if (condition === 'has-data') satisfied = this.#hasContextData(surfaceId);
|
|
70
|
-
|
|
71
|
-
if (!satisfied && dep.fallback) {
|
|
72
|
-
this.#executeFallback(dep.fallback, params);
|
|
73
|
-
return false; // Surface should not proceed
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
return true;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* Signal that a surface has unmounted.
|
|
82
|
-
*
|
|
83
|
-
* @param {string} surfaceId
|
|
84
|
-
*/
|
|
85
|
-
onSurfaceUnmount(surfaceId) {
|
|
86
|
-
this.#surfaceState.set(surfaceId, { mounted: false, completed: false });
|
|
87
|
-
|
|
88
|
-
// Leave shared contexts
|
|
89
|
-
const descriptor = this.#manifest.getSurface(surfaceId);
|
|
90
|
-
if (descriptor?.consumes) {
|
|
91
|
-
for (const contextName of Object.keys(descriptor.consumes)) {
|
|
92
|
-
sharedContextStore.leave(contextName, surfaceId);
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* Signal that a surface's primary action completed (e.g., form submitted).
|
|
99
|
-
* Fires cross-surface triggers.
|
|
100
|
-
*
|
|
101
|
-
* @param {string} surfaceId
|
|
102
|
-
* @param {string} actionName — The action that completed (e.g., "submit-checkin")
|
|
103
|
-
* @param {unknown} [result] — The action's return value
|
|
104
|
-
*/
|
|
105
|
-
async onActionComplete(surfaceId, actionName, result) {
|
|
106
|
-
const state = this.#surfaceState.get(surfaceId);
|
|
107
|
-
if (state) state.completed = true;
|
|
108
|
-
|
|
109
|
-
const trigger = `action:${actionName}`;
|
|
110
|
-
|
|
111
|
-
// Process routes-to associations
|
|
112
|
-
const routes = this.#manifest.getAssociationsFrom(surfaceId, 'routes-to')
|
|
113
|
-
.filter(a => a.trigger === trigger);
|
|
114
|
-
for (const route of routes) {
|
|
115
|
-
const target = this.#manifest.getSurface(route.to);
|
|
116
|
-
if (target?.route) {
|
|
117
|
-
let path = target.route;
|
|
118
|
-
const params = this.#resolveAssocParams(route.params, result);
|
|
119
|
-
for (const [key, value] of Object.entries(params)) {
|
|
120
|
-
path = path.replace(`:${key}`, encodeURIComponent(value));
|
|
121
|
-
}
|
|
122
|
-
location.hash = path;
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
// Process feeds associations
|
|
127
|
-
const feeds = this.#manifest.getAssociationsFrom(surfaceId, 'feeds')
|
|
128
|
-
.filter(a => a.trigger === trigger);
|
|
129
|
-
for (const feed of feeds) {
|
|
130
|
-
if (feed.mapping) {
|
|
131
|
-
for (const [targetPath, source] of Object.entries(feed.mapping)) {
|
|
132
|
-
let value;
|
|
133
|
-
if (source.from === 'action-result') value = result;
|
|
134
|
-
else if (source.from === 'context') value = sharedContextStore.read(source.context, source.key);
|
|
135
|
-
else if (source.from === 'literal') value = source.value;
|
|
136
|
-
|
|
137
|
-
// Store for the target surface to consume when it mounts
|
|
138
|
-
sharedContextStore.update(`__feed_${feed.to}`, { [targetPath]: value });
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
// Process triggers associations
|
|
144
|
-
const triggers = this.#manifest.getAssociationsFrom(surfaceId, 'triggers')
|
|
145
|
-
.filter(a => a.trigger === trigger);
|
|
146
|
-
for (const trig of triggers) {
|
|
147
|
-
this.#executeTriggerEffect(trig.to, trig.effect, result);
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
/**
|
|
152
|
-
* Get navigation targets from a surface.
|
|
153
|
-
* @param {string} surfaceId
|
|
154
|
-
* @returns {{ surfaceId: string, route: string, trigger: string }[]}
|
|
155
|
-
*/
|
|
156
|
-
getNavigationTargets(surfaceId) {
|
|
157
|
-
return this.#manifest.getAssociationsFrom(surfaceId, 'routes-to')
|
|
158
|
-
.map(a => ({
|
|
159
|
-
surfaceId: a.to,
|
|
160
|
-
route: this.#manifest.getSurface(a.to)?.route || '',
|
|
161
|
-
trigger: a.trigger || '',
|
|
162
|
-
}));
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
/**
|
|
166
|
-
* Get the manifest.
|
|
167
|
-
*/
|
|
168
|
-
get manifest() { return this.#manifest; }
|
|
169
|
-
|
|
170
|
-
// ── Internal ──
|
|
171
|
-
|
|
172
|
-
#hasContextData(surfaceId) {
|
|
173
|
-
const descriptor = this.#manifest.getSurface(surfaceId);
|
|
174
|
-
if (!descriptor?.consumes) return true;
|
|
175
|
-
for (const contextName of Object.keys(descriptor.consumes)) {
|
|
176
|
-
if (!sharedContextStore.isPopulated(contextName)) return false;
|
|
177
|
-
}
|
|
178
|
-
return true;
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
#executeFallback(fallback, params) {
|
|
182
|
-
if (fallback.startsWith('redirect:')) {
|
|
183
|
-
const targetId = fallback.slice('redirect:'.length);
|
|
184
|
-
const target = this.#manifest.getSurface(targetId);
|
|
185
|
-
if (target?.route) {
|
|
186
|
-
let path = target.route;
|
|
187
|
-
for (const [key, value] of Object.entries(params)) {
|
|
188
|
-
path = path.replace(`:${key}`, encodeURIComponent(value));
|
|
189
|
-
}
|
|
190
|
-
location.hash = path;
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
// Other fallbacks: show-error, wait (future)
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
#resolveAssocParams(paramSpec, actionResult) {
|
|
197
|
-
const params = {};
|
|
198
|
-
if (!paramSpec) return params;
|
|
199
|
-
for (const [name, spec] of Object.entries(paramSpec)) {
|
|
200
|
-
if (spec.from === 'event-detail' || spec.from === 'action-result') {
|
|
201
|
-
params[name] = spec.key ? actionResult?.[spec.key] : actionResult;
|
|
202
|
-
} else if (spec.from === 'param') {
|
|
203
|
-
// Read from current route
|
|
204
|
-
const hash = location.hash.slice(1);
|
|
205
|
-
const match = hash.match(new RegExp(`${spec.key}/([^/]+)`));
|
|
206
|
-
if (match) params[name] = match[1];
|
|
207
|
-
} else if (spec.from === 'literal') {
|
|
208
|
-
params[name] = spec.value;
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
return params;
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
#executeTriggerEffect(targetSurfaceId, effect, data) {
|
|
215
|
-
if (!effect) return;
|
|
216
|
-
|
|
217
|
-
// Dispatch as a custom event that the target surface can listen for
|
|
218
|
-
document.dispatchEvent(new CustomEvent('a2ui-trigger', {
|
|
219
|
-
detail: {
|
|
220
|
-
targetSurface: targetSurfaceId,
|
|
221
|
-
effect,
|
|
222
|
-
data,
|
|
223
|
-
},
|
|
224
|
-
}));
|
|
225
|
-
}
|
|
226
|
-
}
|
package/a2ui/registry.js
DELETED
|
@@ -1,200 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A2UI Registry — maps A2UI type names to AdiaUI custom element tag names.
|
|
3
|
-
*
|
|
4
|
-
* Usage:
|
|
5
|
-
* import { registry, resolveTag } from './registry.js';
|
|
6
|
-
* resolveTag('Button') // → 'button-ui'
|
|
7
|
-
* resolveTag('ChoicePicker') // → 'select-ui'
|
|
8
|
-
* resolveTag('Toggle') // → 'switch-ui'
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
export const registry = new Map([
|
|
12
|
-
|
|
13
|
-
// ══════════════════════════════════════════════════════
|
|
14
|
-
// A2UI Protocol Types (standard catalog)
|
|
15
|
-
// ══════════════════════════════════════════════════════
|
|
16
|
-
|
|
17
|
-
// Layout
|
|
18
|
-
['Row', 'row-ui'],
|
|
19
|
-
['Column', 'col-ui'],
|
|
20
|
-
['List', 'list-ui'],
|
|
21
|
-
['Grid', 'grid-ui'],
|
|
22
|
-
['Stack', 'stack-ui'],
|
|
23
|
-
['Block', 'block-ui'],
|
|
24
|
-
|
|
25
|
-
// Display
|
|
26
|
-
['Text', 'text-ui'],
|
|
27
|
-
['Image', 'image-ui'],
|
|
28
|
-
['Icon', 'icon-ui'],
|
|
29
|
-
['Divider', 'divider-ui'],
|
|
30
|
-
['Badge', 'badge-ui'],
|
|
31
|
-
['Avatar', 'avatar-ui'],
|
|
32
|
-
['AvatarGroup', 'avatar-group-ui'],
|
|
33
|
-
['Progress', 'progress-ui'],
|
|
34
|
-
['Skeleton', 'skeleton-ui'],
|
|
35
|
-
['Code', 'code-ui'],
|
|
36
|
-
['Stat', 'stat-ui'],
|
|
37
|
-
['EmptyState', 'empty-state-ui'],
|
|
38
|
-
|
|
39
|
-
// Input
|
|
40
|
-
['Input', 'input-ui'],
|
|
41
|
-
['TextField', 'input-ui'],
|
|
42
|
-
['TextArea', 'textarea-ui'],
|
|
43
|
-
['CheckBox', 'check-ui'],
|
|
44
|
-
['Toggle', 'switch-ui'],
|
|
45
|
-
['Switch', 'switch-ui'],
|
|
46
|
-
['Slider', 'slider-ui'],
|
|
47
|
-
['Range', 'range-ui'],
|
|
48
|
-
['ChoicePicker', 'select-ui'],
|
|
49
|
-
['Select', 'select-ui'],
|
|
50
|
-
['Radio', 'radio-ui'],
|
|
51
|
-
['DateTimeInput', 'calendar-picker-ui'],
|
|
52
|
-
['CalendarPicker', 'calendar-picker-ui'],
|
|
53
|
-
['ColorPicker', 'color-picker-ui'],
|
|
54
|
-
// Search deprecated — use Input type="search" prefix="magnifying-glass"
|
|
55
|
-
['Upload', 'upload-ui'],
|
|
56
|
-
['OtpInput', 'otp-input-ui'],
|
|
57
|
-
|
|
58
|
-
// Action
|
|
59
|
-
['Button', 'button-ui'],
|
|
60
|
-
|
|
61
|
-
// System State
|
|
62
|
-
['LoadingIndicator', 'progress-ui'],
|
|
63
|
-
['ErrorContainer', 'card-ui'],
|
|
64
|
-
|
|
65
|
-
// Container
|
|
66
|
-
['Card', 'card-ui'],
|
|
67
|
-
['Tabs', 'tabs-ui'],
|
|
68
|
-
['Tab', 'tab-ui'],
|
|
69
|
-
['Panel', 'pane-ui'],
|
|
70
|
-
['Pane', 'pane-ui'],
|
|
71
|
-
['Modal', 'modal-ui'],
|
|
72
|
-
['Dialog', 'modal-ui'],
|
|
73
|
-
['Drawer', 'drawer-ui'],
|
|
74
|
-
['Toast', 'toast-ui'],
|
|
75
|
-
['Popover', 'popover-ui'],
|
|
76
|
-
['Accordion', 'accordion-ui'],
|
|
77
|
-
['AccordionItem', 'accordion-item-ui'],
|
|
78
|
-
['Alert', 'alert-ui'],
|
|
79
|
-
['Tooltip', 'tooltip-ui'],
|
|
80
|
-
['Menu', 'menu-ui'],
|
|
81
|
-
|
|
82
|
-
// Card children (native HTML elements styled by card.css)
|
|
83
|
-
['Section', 'section'],
|
|
84
|
-
['Header', 'header'],
|
|
85
|
-
['Footer', 'footer'],
|
|
86
|
-
|
|
87
|
-
// Agent / Specialized
|
|
88
|
-
['Stream', 'stream-ui'],
|
|
89
|
-
['Table', 'table-ui'],
|
|
90
|
-
['Chart', 'chart-ui'],
|
|
91
|
-
['Embed', 'embed-ui'],
|
|
92
|
-
['Swiper', 'swiper-ui'],
|
|
93
|
-
['Slideshow', 'swiper-ui'],
|
|
94
|
-
['Carousel', 'swiper-ui'],
|
|
95
|
-
|
|
96
|
-
// Navigation
|
|
97
|
-
['Breadcrumb', 'breadcrumb-ui'],
|
|
98
|
-
['Nav', 'nav-n'],
|
|
99
|
-
['Noodles', 'noodles-ui'],
|
|
100
|
-
['Pagination', 'pagination-ui'],
|
|
101
|
-
['SegmentedControl', 'segmented-ui'],
|
|
102
|
-
['Segment', 'segment-ui'],
|
|
103
|
-
['ToggleGroup', 'toggle-group-ui'],
|
|
104
|
-
|
|
105
|
-
// Utility
|
|
106
|
-
['Command', 'command-ui'],
|
|
107
|
-
['Kbd', 'kbd-ui'],
|
|
108
|
-
['Toolbar', 'toolbar-ui'],
|
|
109
|
-
['Tag', 'tag-ui'],
|
|
110
|
-
['Timeline', 'timeline-ui'],
|
|
111
|
-
['TimelineItem', 'timeline-item-ui'],
|
|
112
|
-
|
|
113
|
-
// ══════════════════════════════════════════════════════
|
|
114
|
-
// AgentUI Aliases (backwards compat with -ui tags)
|
|
115
|
-
// ══════════════════════════════════════════════════════
|
|
116
|
-
['button-ui', 'button-ui'],
|
|
117
|
-
['card-ui', 'card-ui'],
|
|
118
|
-
['text-ui', 'text-ui'],
|
|
119
|
-
['input-ui', 'input-ui'],
|
|
120
|
-
['text-field-ui', 'input-ui'],
|
|
121
|
-
['select-ui', 'select-ui'],
|
|
122
|
-
['toggle-ui', 'switch-ui'],
|
|
123
|
-
['check-ui', 'check-ui'],
|
|
124
|
-
['slider-ui', 'slider-ui'],
|
|
125
|
-
['badge-ui', 'badge-ui'],
|
|
126
|
-
['avatar-ui', 'avatar-ui'],
|
|
127
|
-
['icon-ui', 'icon-ui'],
|
|
128
|
-
['image-ui', 'image-ui'],
|
|
129
|
-
['divider-ui', 'divider-ui'],
|
|
130
|
-
['progress-ui', 'progress-ui'],
|
|
131
|
-
['skeleton-ui', 'skeleton-ui'],
|
|
132
|
-
['tabs-ui', 'tabs-ui'],
|
|
133
|
-
['tab-ui', 'tab-ui'],
|
|
134
|
-
['modal-ui', 'modal-ui'],
|
|
135
|
-
['dialog-ui', 'modal-ui'],
|
|
136
|
-
['drawer-ui', 'drawer-ui'],
|
|
137
|
-
['toast-ui', 'toast-ui'],
|
|
138
|
-
['popover-ui', 'popover-ui'],
|
|
139
|
-
['panel-ui', 'pane-ui'],
|
|
140
|
-
['accordion-ui', 'accordion-ui'],
|
|
141
|
-
['alert-ui', 'alert-ui'],
|
|
142
|
-
['tooltip-ui', 'tooltip-ui'],
|
|
143
|
-
['menu-ui', 'menu-ui'],
|
|
144
|
-
['table-ui', 'table-ui'],
|
|
145
|
-
['chart-ui', 'chart-ui'],
|
|
146
|
-
['code-ui', 'code-ui'],
|
|
147
|
-
['textarea-ui', 'textarea-ui'],
|
|
148
|
-
['radio-ui', 'radio-ui'],
|
|
149
|
-
['tag-ui', 'tag-ui'],
|
|
150
|
-
['search-ui', 'search-ui'],
|
|
151
|
-
['upload-ui', 'upload-ui'],
|
|
152
|
-
['breadcrumb-ui', 'breadcrumb-ui'],
|
|
153
|
-
['nav-ui', 'nav-n'],
|
|
154
|
-
['noodles-ui', 'noodles-ui'],
|
|
155
|
-
['pagination-ui', 'pagination-ui'],
|
|
156
|
-
['segmented-control-ui', 'segmented-ui'],
|
|
157
|
-
['segment-ui', 'segment-ui'],
|
|
158
|
-
['command-ui', 'command-ui'],
|
|
159
|
-
['calendar-picker-ui', 'calendar-picker-ui'],
|
|
160
|
-
['color-picker-ui', 'color-picker-ui'],
|
|
161
|
-
['kbd-ui', 'kbd-ui'],
|
|
162
|
-
['toolbar-ui', 'toolbar-ui'],
|
|
163
|
-
['otp-input-ui', 'otp-input-ui'],
|
|
164
|
-
['embed-ui', 'embed-ui'],
|
|
165
|
-
['stream-ui', 'stream-ui'],
|
|
166
|
-
['row-ui', 'row-ui'],
|
|
167
|
-
['col-ui', 'col-ui'],
|
|
168
|
-
['grid-ui', 'grid-ui'],
|
|
169
|
-
['stack-ui', 'stack-ui'],
|
|
170
|
-
['block-ui', 'block-ui'],
|
|
171
|
-
['list-ui', 'list-ui'],
|
|
172
|
-
['range-ui', 'range-ui'],
|
|
173
|
-
['datetime-ui', 'calendar-picker-ui'],
|
|
174
|
-
['timeline-ui', 'timeline-ui'],
|
|
175
|
-
['timeline-item-ui', 'timeline-item-ui'],
|
|
176
|
-
['avatar-group-ui', 'avatar-group-ui'],
|
|
177
|
-
|
|
178
|
-
// Aliases (alternate names)
|
|
179
|
-
['Keyboard', 'kbd-ui'],
|
|
180
|
-
['DatePicker', 'calendar-picker-ui'],
|
|
181
|
-
['CommandPalette', 'command-ui'],
|
|
182
|
-
['Segmented', 'segmented-ui'],
|
|
183
|
-
['OTP', 'otp-input-ui'],
|
|
184
|
-
]);
|
|
185
|
-
|
|
186
|
-
/**
|
|
187
|
-
* Resolve an A2UI component type to a AdiaUI tag name.
|
|
188
|
-
* @param {string} type — A2UI type name or AgentUI tag
|
|
189
|
-
* @returns {string|null} — AdiaUI tag name or null
|
|
190
|
-
*/
|
|
191
|
-
export function resolveTag(type) {
|
|
192
|
-
return registry.get(type) || null;
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
/**
|
|
196
|
-
* Register a custom component type.
|
|
197
|
-
*/
|
|
198
|
-
export function registerType(type, tagName) {
|
|
199
|
-
registry.set(type, tagName);
|
|
200
|
-
}
|