@nonoun/native-ai 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/dist/a2ui/a2ui-element.d.ts.map +1 -1
- package/dist/chat/chat-panel-element.d.ts +2 -2
- package/dist/chat/chat-panel-element.d.ts.map +1 -1
- package/dist/native-ai.css +43 -6
- package/dist/native-ai.js +166 -168
- package/dist/register.js +73 -75
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"a2ui-element.d.ts","sourceRoot":"","sources":["../../src/a2ui/a2ui-element.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,aAAa,EAA+C,MAAM,mBAAmB,CAAC;AAa/F,OAAO,8BAA8B,CAAC;AAkFtC,qBAAa,KAAM,SAAQ,aAAa;;IACtC,MAAM,CAAC,kBAAkB,WAAc;IAqDvC,IAAI,MAAM,IAAI,MAAM,CAA+B;IACnD,IAAI,MAAM,CAAC,GAAG,EAAE,MAAM,EAKrB;IAID,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IASpF,OAAO,IAAI,IAAI;IACf,IAAI,IAAI,IAAI;IACZ,QAAQ,IAAI,IAAI;IAChB,KAAK,IAAI,IAAI;IAIb,KAAK,IAAI,IAAI;IAmIb,QAAQ,IAAI,IAAI;
|
|
1
|
+
{"version":3,"file":"a2ui-element.d.ts","sourceRoot":"","sources":["../../src/a2ui/a2ui-element.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,aAAa,EAA+C,MAAM,mBAAmB,CAAC;AAa/F,OAAO,8BAA8B,CAAC;AAkFtC,qBAAa,KAAM,SAAQ,aAAa;;IACtC,MAAM,CAAC,kBAAkB,WAAc;IAqDvC,IAAI,MAAM,IAAI,MAAM,CAA+B;IACnD,IAAI,MAAM,CAAC,GAAG,EAAE,MAAM,EAKrB;IAID,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IASpF,OAAO,IAAI,IAAI;IACf,IAAI,IAAI,IAAI;IACZ,QAAQ,IAAI,IAAI;IAChB,KAAK,IAAI,IAAI;IAIb,KAAK,IAAI,IAAI;IAmIb,QAAQ,IAAI,IAAI;CAkyCjB"}
|
|
@@ -15,8 +15,8 @@ export interface ModelOption {
|
|
|
15
15
|
/**
|
|
16
16
|
* Stamped panel for the chat interface.
|
|
17
17
|
*
|
|
18
|
-
* Creates `<
|
|
19
|
-
* `<n-chat-content>`, and `<
|
|
18
|
+
* Creates `<header>` (icon, title), `<section>` containing
|
|
19
|
+
* `<n-chat-content>`, and `<footer>` with `<n-chat-input>` directly
|
|
20
20
|
* as children. The host element itself is the panel surface.
|
|
21
21
|
*
|
|
22
22
|
* ## Extension Points
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat-panel-element.d.ts","sourceRoot":"","sources":["../../src/chat/chat-panel-element.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAU,MAAM,mBAAmB,CAAC;AAC1D,OAAO,KAAK,EAAkB,aAAa,EAAgC,MAAM,mBAAmB,CAAC;AAWrG,MAAM,MAAM,eAAe,GAAG,cAAc,GAAG,OAAO,GAAG,OAAO,CAAC;AAEjE,MAAM,WAAW,oBAAoB;IACnC,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,oBAAoB;IACnC,MAAM,CAAC,EAAE,OAAO,GAAG,KAAK,GAAG,UAAU,CAAC;CACvC;AAED,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,qBAAa,UAAW,SAAQ,aAAa;;IAC3C,MAAM,CAAC,QAAQ,CAAC,oBAAoB,MAAM;IAC1C,MAAM,CAAC,kBAAkB,WAA6I;IAiCtK,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IA0DpF,IAAI,QAAQ,IAAI,OAAO,CAAiC;IACxD,IAAI,QAAQ,CAAC,GAAG,EAAE,OAAO,EAGxB;IAED,IAAI,WAAW,IAAI,OAAO,CAAoC;IAC9D,IAAI,WAAW,CAAC,GAAG,EAAE,OAAO,EAG3B;IAED,IAAI,eAAe,IAAI,eAAe,CAAwC;IAC9E,IAAI,eAAe,CAAC,GAAG,EAAE,eAAe,EAGvC;IAED,qDAAqD;IACrD,IAAI,MAAM,IAAI,WAAW,EAAE,CAA+B;IAC1D,IAAI,MAAM,CAAC,GAAG,EAAE,WAAW,EAAE,EAa5B;IAED,sCAAsC;IACtC,IAAI,KAAK,IAAI,MAAM,GAAG,IAAI,CAA8B;IACxD,IAAI,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,EAO3B;IAED,qGAAqG;IACrG,IAAI,OAAO,IAAI,MAAM,GAAG,IAAI,CAAgC;IAC5D,IAAI,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,EAI7B;IAED,oCAAoC;IACpC,IAAI,UAAU,IAAI,MAAM,GAAG,IAAI,CAAmC;IAClE,IAAI,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,EAIhC;IAED,2EAA2E;IAC3E,IAAI,aAAa,IAAI,aAAa,GAAG,IAAI,CAAsC;IAC/E,IAAI,aAAa,CAAC,GAAG,EAAE,aAAa,GAAG,IAAI,EAI1C;IAED,sGAAsG;IACtG,IAAI,WAAW,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAAoC;IACpF,IAAI,WAAW,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,EAIjD;IAED,sEAAsE;IACtE,IAAI,SAAS,IAAI,OAAO,CAAkC;IAE1D,qDAAqD;IACrD,IAAI,CAAC,OAAO,CAAC,EAAE,oBAAoB,GAAG,IAAI;IAkB1C,uBAAuB;IACvB,KAAK,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI;IAU5B,gCAAgC;IAChC,aAAa,CAAC,OAAO,CAAC,EAAE,oBAAoB,EAAE,EAAE,GAAE,KAAK,GAAG,MAAM,GAAG,QAAgB,GAAG,IAAI;IAM1F,KAAK,IAAI,IAAI;
|
|
1
|
+
{"version":3,"file":"chat-panel-element.d.ts","sourceRoot":"","sources":["../../src/chat/chat-panel-element.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAU,MAAM,mBAAmB,CAAC;AAC1D,OAAO,KAAK,EAAkB,aAAa,EAAgC,MAAM,mBAAmB,CAAC;AAWrG,MAAM,MAAM,eAAe,GAAG,cAAc,GAAG,OAAO,GAAG,OAAO,CAAC;AAEjE,MAAM,WAAW,oBAAoB;IACnC,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,oBAAoB;IACnC,MAAM,CAAC,EAAE,OAAO,GAAG,KAAK,GAAG,UAAU,CAAC;CACvC;AAED,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,qBAAa,UAAW,SAAQ,aAAa;;IAC3C,MAAM,CAAC,QAAQ,CAAC,oBAAoB,MAAM;IAC1C,MAAM,CAAC,kBAAkB,WAA6I;IAiCtK,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IA0DpF,IAAI,QAAQ,IAAI,OAAO,CAAiC;IACxD,IAAI,QAAQ,CAAC,GAAG,EAAE,OAAO,EAGxB;IAED,IAAI,WAAW,IAAI,OAAO,CAAoC;IAC9D,IAAI,WAAW,CAAC,GAAG,EAAE,OAAO,EAG3B;IAED,IAAI,eAAe,IAAI,eAAe,CAAwC;IAC9E,IAAI,eAAe,CAAC,GAAG,EAAE,eAAe,EAGvC;IAED,qDAAqD;IACrD,IAAI,MAAM,IAAI,WAAW,EAAE,CAA+B;IAC1D,IAAI,MAAM,CAAC,GAAG,EAAE,WAAW,EAAE,EAa5B;IAED,sCAAsC;IACtC,IAAI,KAAK,IAAI,MAAM,GAAG,IAAI,CAA8B;IACxD,IAAI,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,EAO3B;IAED,qGAAqG;IACrG,IAAI,OAAO,IAAI,MAAM,GAAG,IAAI,CAAgC;IAC5D,IAAI,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,EAI7B;IAED,oCAAoC;IACpC,IAAI,UAAU,IAAI,MAAM,GAAG,IAAI,CAAmC;IAClE,IAAI,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,EAIhC;IAED,2EAA2E;IAC3E,IAAI,aAAa,IAAI,aAAa,GAAG,IAAI,CAAsC;IAC/E,IAAI,aAAa,CAAC,GAAG,EAAE,aAAa,GAAG,IAAI,EAI1C;IAED,sGAAsG;IACtG,IAAI,WAAW,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAAoC;IACpF,IAAI,WAAW,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,EAIjD;IAED,sEAAsE;IACtE,IAAI,SAAS,IAAI,OAAO,CAAkC;IAE1D,qDAAqD;IACrD,IAAI,CAAC,OAAO,CAAC,EAAE,oBAAoB,GAAG,IAAI;IAkB1C,uBAAuB;IACvB,KAAK,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI;IAU5B,gCAAgC;IAChC,aAAa,CAAC,OAAO,CAAC,EAAE,oBAAoB,EAAE,EAAE,GAAE,KAAK,GAAG,MAAM,GAAG,QAAgB,GAAG,IAAI;IAM1F,KAAK,IAAI,IAAI;IAgSb,QAAQ,IAAI,IAAI;CA4ZjB"}
|
package/dist/native-ai.css
CHANGED
|
@@ -59,7 +59,10 @@
|
|
|
59
59
|
|
|
60
60
|
/* ── Dark chrome header toolbar (chips + expand) ── */
|
|
61
61
|
|
|
62
|
-
:where(native-a2ui) > :where(n-header)
|
|
62
|
+
:where(native-a2ui) > :where(n-header),
|
|
63
|
+
:where(native-a2ui) > :where(header) {
|
|
64
|
+
display: flex;
|
|
65
|
+
align-items: center;
|
|
63
66
|
flex: none;
|
|
64
67
|
background: var(--n-pg-chrome);
|
|
65
68
|
--n-ink: var(--n-pg-text-muted);
|
|
@@ -70,12 +73,15 @@
|
|
|
70
73
|
|
|
71
74
|
/* Header button hover background */
|
|
72
75
|
:where(native-a2ui) > :where(n-header) :where(n-button):hover,
|
|
73
|
-
:where(native-a2ui) > :where(n-header) :where(n-button)[force-hover]
|
|
76
|
+
:where(native-a2ui) > :where(n-header) :where(n-button)[force-hover],
|
|
77
|
+
:where(native-a2ui) > :where(header) :where(n-button):hover,
|
|
78
|
+
:where(native-a2ui) > :where(header) :where(n-button)[force-hover] {
|
|
74
79
|
background: var(--n-pg-editor-bg);
|
|
75
80
|
}
|
|
76
81
|
|
|
77
82
|
/* Chip active state — "panel is open" indicator */
|
|
78
|
-
:where(native-a2ui) > :where(n-header) :where(n-button)[data-active]
|
|
83
|
+
:where(native-a2ui) > :where(n-header) :where(n-button)[data-active],
|
|
84
|
+
:where(native-a2ui) > :where(header) :where(n-button)[data-active] {
|
|
79
85
|
background: var(--n-pg-editor-bg);
|
|
80
86
|
color: var(--n-pg-text-strong);
|
|
81
87
|
}
|
|
@@ -173,7 +179,12 @@
|
|
|
173
179
|
|
|
174
180
|
/* ── Pane Header (icon + label + close button) ── */
|
|
175
181
|
|
|
176
|
-
:where(native-a2ui) :where(.a2ui-pane) > :where(n-header)
|
|
182
|
+
:where(native-a2ui) :where(.a2ui-pane) > :where(n-header),
|
|
183
|
+
:where(native-a2ui) :where(.a2ui-pane) > :where(header) {
|
|
184
|
+
display: grid;
|
|
185
|
+
grid-template-columns: auto 1fr auto;
|
|
186
|
+
align-items: center;
|
|
187
|
+
gap: 0.375rem;
|
|
177
188
|
flex: none;
|
|
178
189
|
background: var(--n-pg-chrome);
|
|
179
190
|
border-bottom: var(--n-pg-border);
|
|
@@ -189,12 +200,22 @@
|
|
|
189
200
|
letter-spacing: 0.04em;
|
|
190
201
|
}
|
|
191
202
|
|
|
192
|
-
:where(native-a2ui) :where(.a2ui-pane) > :where(
|
|
203
|
+
:where(native-a2ui) :where(.a2ui-pane) > :where(header) > :where(nav),
|
|
204
|
+
:where(native-a2ui) :where(.a2ui-pane) > :where(header) > :where(aside) {
|
|
205
|
+
display: flex;
|
|
206
|
+
align-items: center;
|
|
207
|
+
gap: 0.25rem;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
:where(native-a2ui) :where(.a2ui-pane) > :where(n-header) :where(n-icon),
|
|
211
|
+
:where(native-a2ui) :where(.a2ui-pane) > :where(header) :where(n-icon) {
|
|
193
212
|
font-size: 0.875rem;
|
|
194
213
|
}
|
|
195
214
|
|
|
196
215
|
:where(native-a2ui) :where(.a2ui-pane) > :where(n-header) :where(n-button):hover,
|
|
197
|
-
:where(native-a2ui) :where(.a2ui-pane) > :where(n-header) :where(n-button)[force-hover]
|
|
216
|
+
:where(native-a2ui) :where(.a2ui-pane) > :where(n-header) :where(n-button)[force-hover],
|
|
217
|
+
:where(native-a2ui) :where(.a2ui-pane) > :where(header) :where(n-button):hover,
|
|
218
|
+
:where(native-a2ui) :where(.a2ui-pane) > :where(header) :where(n-button)[force-hover] {
|
|
198
219
|
background: var(--n-pg-editor-bg);
|
|
199
220
|
}
|
|
200
221
|
|
|
@@ -691,6 +712,22 @@
|
|
|
691
712
|
border-top: 1px solid var(--n-chat-panel-footer-border);
|
|
692
713
|
}
|
|
693
714
|
|
|
715
|
+
/* ── Semantic sub-container integration ── */
|
|
716
|
+
|
|
717
|
+
:where(native-chat-panel) > :where(header) {
|
|
718
|
+
background: var(--n-chat-panel-header-background);
|
|
719
|
+
border-bottom: 1px solid var(--n-chat-panel-header-border);
|
|
720
|
+
}
|
|
721
|
+
|
|
722
|
+
:where(native-chat-panel) > :where(section) {
|
|
723
|
+
background: var(--n-chat-panel-body-background);
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
:where(native-chat-panel) > :where(footer) {
|
|
727
|
+
background: var(--n-chat-panel-footer-background);
|
|
728
|
+
border-top: 1px solid var(--n-chat-panel-footer-border);
|
|
729
|
+
}
|
|
730
|
+
|
|
694
731
|
/* ── Model picker ── */
|
|
695
732
|
|
|
696
733
|
:where(native-chat-panel) :where(n-select[data-role="model-picker"]) {
|
package/dist/native-ai.js
CHANGED
|
@@ -4,39 +4,39 @@ import { Decoration as p, EditorView as m, StateEffect as h, StateField as g, ke
|
|
|
4
4
|
import { json as v } from "@codemirror/lang-json";
|
|
5
5
|
import { linter as y } from "@codemirror/lint";
|
|
6
6
|
import "@nonoun/native-code/register";
|
|
7
|
-
import { Kernel as b, resetKernel as
|
|
8
|
-
function
|
|
7
|
+
import { Kernel as b, resetKernel as x } from "@nonoun/native-ui/kernel";
|
|
8
|
+
function S(e) {
|
|
9
9
|
return typeof e == "object" && !!e && "path" in e && typeof e.path == "string" && Object.keys(e).length === 1;
|
|
10
10
|
}
|
|
11
|
-
function
|
|
11
|
+
function C(e) {
|
|
12
12
|
return "createSurface" in e;
|
|
13
13
|
}
|
|
14
|
-
function
|
|
14
|
+
function w(e) {
|
|
15
15
|
return "updateComponents" in e;
|
|
16
16
|
}
|
|
17
|
-
function
|
|
17
|
+
function T(e) {
|
|
18
18
|
return "updateDataModel" in e;
|
|
19
19
|
}
|
|
20
|
-
function
|
|
20
|
+
function E(e) {
|
|
21
21
|
return "deleteSurface" in e;
|
|
22
22
|
}
|
|
23
|
-
function
|
|
23
|
+
function ee(e) {
|
|
24
24
|
return "requestCatalog" in e;
|
|
25
25
|
}
|
|
26
|
-
function
|
|
26
|
+
function te(e) {
|
|
27
27
|
return "action" in e;
|
|
28
28
|
}
|
|
29
|
-
function
|
|
29
|
+
function ne(e) {
|
|
30
30
|
return "error" in e;
|
|
31
31
|
}
|
|
32
|
-
function
|
|
32
|
+
function re(e) {
|
|
33
33
|
return "catalog" in e;
|
|
34
34
|
}
|
|
35
35
|
/**
|
|
36
36
|
* Parse a raw JSON string into a typed A2UI server message.
|
|
37
37
|
* Returns null if the JSON is not a valid A2UI message.
|
|
38
38
|
*/
|
|
39
|
-
function
|
|
39
|
+
function D(e) {
|
|
40
40
|
try {
|
|
41
41
|
let t = JSON.parse(e);
|
|
42
42
|
return "createSurface" in t || "updateComponents" in t || "updateDataModel" in t || "deleteSurface" in t || "requestCatalog" in t ? t : null;
|
|
@@ -44,7 +44,7 @@ function E(e) {
|
|
|
44
44
|
return null;
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
|
-
var
|
|
47
|
+
var ie = [
|
|
48
48
|
{
|
|
49
49
|
a2uiType: "Text",
|
|
50
50
|
nativeTag: "n-text",
|
|
@@ -267,17 +267,17 @@ var ae = [
|
|
|
267
267
|
nativeTag: "n-toast",
|
|
268
268
|
childStrategy: "textContent"
|
|
269
269
|
}
|
|
270
|
-
],
|
|
271
|
-
for (let e of
|
|
270
|
+
], O = /* @__PURE__ */ new Map(), k = /* @__PURE__ */ new Map();
|
|
271
|
+
for (let e of ie) O.set(e.a2uiType, e), e.nativeTag !== "div" && e.nativeTag !== "span" && e.nativeTag !== "n-stack" && !k.has(e.nativeTag) && k.set(e.nativeTag, e);
|
|
272
272
|
/** All component mappings, keyed by A2UI type */
|
|
273
|
-
const
|
|
274
|
-
function
|
|
275
|
-
return
|
|
273
|
+
const A = O;
|
|
274
|
+
function j(e) {
|
|
275
|
+
return O.get(e) ?? null;
|
|
276
276
|
}
|
|
277
|
-
function
|
|
277
|
+
function M(e, t) {
|
|
278
278
|
let n = t?.["data-a2ui"];
|
|
279
|
-
if (n &&
|
|
280
|
-
let r =
|
|
279
|
+
if (n && O.has(n)) return n;
|
|
280
|
+
let r = k.get(e);
|
|
281
281
|
if (r) return r.a2uiType;
|
|
282
282
|
if (e === "span") return "Text";
|
|
283
283
|
if (e === "n-stack") return t?.direction === "row" ? "Row" : "Column";
|
|
@@ -287,7 +287,7 @@ function oe(e, t) {
|
|
|
287
287
|
}
|
|
288
288
|
return e === "img" ? "Image" : e === "video" ? "Video" : e === "audio" ? "AudioPlayer" : e === "hr" ? "Divider" : /^h[1-6]$/.test(e) ? "Text" : null;
|
|
289
289
|
}
|
|
290
|
-
var
|
|
290
|
+
var ae = {
|
|
291
291
|
h1: "h1",
|
|
292
292
|
h2: "h2",
|
|
293
293
|
h3: "h3",
|
|
@@ -301,16 +301,16 @@ var se = {
|
|
|
301
301
|
* For A2UI Text components, resolve the variant to an HTML tag.
|
|
302
302
|
* Returns 'n-text' by default.
|
|
303
303
|
*/
|
|
304
|
-
function
|
|
305
|
-
return e ?
|
|
304
|
+
function oe(e) {
|
|
305
|
+
return e ? ae[e] ?? "n-text" : "n-text";
|
|
306
306
|
}
|
|
307
307
|
/**
|
|
308
308
|
* For A2UI DateTimeInput components, resolve enableDate/enableTime to HTML input type.
|
|
309
309
|
*/
|
|
310
|
-
function
|
|
310
|
+
function se(e, t) {
|
|
311
311
|
return e && t ? "datetime-local" : t && !e ? "time" : "date";
|
|
312
312
|
}
|
|
313
|
-
var
|
|
313
|
+
var ce = {
|
|
314
314
|
number: "number",
|
|
315
315
|
obscured: "password",
|
|
316
316
|
shortText: "text",
|
|
@@ -319,16 +319,16 @@ var ue = {
|
|
|
319
319
|
/**
|
|
320
320
|
* For A2UI TextField components, resolve the variant to an HTML input type attribute.
|
|
321
321
|
*/
|
|
322
|
-
function
|
|
323
|
-
return e ?
|
|
322
|
+
function le(e) {
|
|
323
|
+
return e ? ce[e] ?? "text" : "text";
|
|
324
324
|
}
|
|
325
325
|
/**
|
|
326
326
|
* Get all supported A2UI component types.
|
|
327
327
|
*/
|
|
328
|
-
function
|
|
329
|
-
return Array.from(
|
|
328
|
+
function N() {
|
|
329
|
+
return Array.from(O.keys());
|
|
330
330
|
}
|
|
331
|
-
var
|
|
331
|
+
var ue = {
|
|
332
332
|
Text: "display",
|
|
333
333
|
Icon: "display",
|
|
334
334
|
Image: "display",
|
|
@@ -363,15 +363,15 @@ var fe = {
|
|
|
363
363
|
/**
|
|
364
364
|
* Get the category for an A2UI component type.
|
|
365
365
|
*/
|
|
366
|
-
function
|
|
367
|
-
return
|
|
366
|
+
function P(e) {
|
|
367
|
+
return ue[e] ?? "other";
|
|
368
368
|
}
|
|
369
369
|
/**
|
|
370
370
|
* Get all component types in the same category.
|
|
371
371
|
*/
|
|
372
|
-
function
|
|
373
|
-
let t =
|
|
374
|
-
return Array.from(
|
|
372
|
+
function de(e) {
|
|
373
|
+
let t = P(e);
|
|
374
|
+
return Array.from(O.keys()).filter((e) => P(e) === t);
|
|
375
375
|
}
|
|
376
376
|
/**
|
|
377
377
|
* A2UI Converter
|
|
@@ -379,8 +379,8 @@ function pe(e) {
|
|
|
379
379
|
* Bidirectional conversion between A2UI flat adjacency lists
|
|
380
380
|
* and native-ui nested UINode trees.
|
|
381
381
|
*/
|
|
382
|
-
var
|
|
383
|
-
function
|
|
382
|
+
var fe = new Set(/* @__PURE__ */ "id.component.children.child.text.label.variant.disabled.action.accessibility.value.placeholder.min.max.step.url.src.alt.name.fit.justify.align.weight.direction.enableDate.enableTime.options.filterable.displayStyle.validationRegexp.checks.trigger.content.tabs.poster".split("."));
|
|
383
|
+
function F(e, t) {
|
|
384
384
|
if (e.length === 0) return {
|
|
385
385
|
root: {
|
|
386
386
|
id: "empty-root",
|
|
@@ -412,7 +412,7 @@ function N(e, t) {
|
|
|
412
412
|
warnings: ["No root component found"],
|
|
413
413
|
orphans: []
|
|
414
414
|
};
|
|
415
|
-
let a = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Map(), s = [], c = t?.surfaceId ?? "default", l =
|
|
415
|
+
let a = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Map(), s = [], c = t?.surfaceId ?? "default", l = I(i, n, a, o, s, c), u = e.filter((e) => !a.has(e.id)).map((e) => e.id);
|
|
416
416
|
return u.length > 0 && s.push(`Orphan components not reachable from root: ${u.join(", ")}`), {
|
|
417
417
|
root: l,
|
|
418
418
|
bindings: o,
|
|
@@ -420,7 +420,7 @@ function N(e, t) {
|
|
|
420
420
|
orphans: u
|
|
421
421
|
};
|
|
422
422
|
}
|
|
423
|
-
function
|
|
423
|
+
function I(e, t, n, r, i, a) {
|
|
424
424
|
if (n.has(e)) return i.push(`Cycle detected at component "${e}"`), {
|
|
425
425
|
id: `${e}-cycle`,
|
|
426
426
|
tag: "div",
|
|
@@ -433,14 +433,14 @@ function P(e, t, n, r, i, a) {
|
|
|
433
433
|
tag: "div",
|
|
434
434
|
textContent: `[Missing: ${e}]`
|
|
435
435
|
};
|
|
436
|
-
let s =
|
|
436
|
+
let s = j(o.component);
|
|
437
437
|
if (!s) return i.push(`Unknown A2UI type "${o.component}" for component "${e}"`), {
|
|
438
438
|
id: e,
|
|
439
439
|
tag: "div",
|
|
440
440
|
textContent: o.text ?? `[Unknown: ${o.component}]`
|
|
441
441
|
};
|
|
442
442
|
let c = s.nativeTag;
|
|
443
|
-
o.component === "Text" && o.variant && (c =
|
|
443
|
+
o.component === "Text" && o.variant && (c = oe(o.variant));
|
|
444
444
|
let l = {};
|
|
445
445
|
if (l["data-a2ui"] = o.component, s.defaultAttributes && Object.assign(l, s.defaultAttributes), o.variant && s.variantMap) {
|
|
446
446
|
let e = s.variantMap[o.variant];
|
|
@@ -448,7 +448,7 @@ function P(e, t, n, r, i, a) {
|
|
|
448
448
|
} else o.variant && o.component !== "Text" && (l.variant = o.variant);
|
|
449
449
|
if (s.propertyMap) for (let [t, n] of Object.entries(s.propertyMap)) {
|
|
450
450
|
let i = o[t];
|
|
451
|
-
if (i !== void 0) if (
|
|
451
|
+
if (i !== void 0) if (S(i)) {
|
|
452
452
|
let t = r.get(e);
|
|
453
453
|
t || (t = [], r.set(e, t)), t.push({
|
|
454
454
|
property: n,
|
|
@@ -457,10 +457,10 @@ function P(e, t, n, r, i, a) {
|
|
|
457
457
|
} else l[n] = String(i);
|
|
458
458
|
}
|
|
459
459
|
if (o.disabled && (l.disabled = ""), o.accessibility?.label && (l["aria-label"] = o.accessibility.label), o.component === "TextField") {
|
|
460
|
-
let e =
|
|
460
|
+
let e = le(o.variant);
|
|
461
461
|
e !== "text" && (l.type = e);
|
|
462
462
|
}
|
|
463
|
-
if (o.component === "DateTimeInput" && (l.type =
|
|
463
|
+
if (o.component === "DateTimeInput" && (l.type = se(o.enableDate, o.enableTime)), (o.component === "TextField" || o.component === "DateTimeInput" || o.component === "Slider") && o.label) if (S(o.label)) {
|
|
464
464
|
let t = r.get(e);
|
|
465
465
|
t || (t = [], r.set(e, t)), t.push({
|
|
466
466
|
property: "aria-label",
|
|
@@ -472,14 +472,14 @@ function P(e, t, n, r, i, a) {
|
|
|
472
472
|
l.style = `--n-progress: ${t > 0 ? Math.min(1, Math.max(0, e / t)) : 0}`, l.value && (l["data-value"] = l.value, delete l.value), l.max && (l["data-max"] = l.max, delete l.max);
|
|
473
473
|
}
|
|
474
474
|
let u;
|
|
475
|
-
if (o.text !== void 0) if (
|
|
475
|
+
if (o.text !== void 0) if (S(o.text)) {
|
|
476
476
|
let t = r.get(e);
|
|
477
477
|
t || (t = [], r.set(e, t)), t.push({
|
|
478
478
|
property: "textContent",
|
|
479
479
|
path: o.text.path
|
|
480
480
|
});
|
|
481
481
|
} else u = o.text;
|
|
482
|
-
for (let [e, t] of Object.entries(o))
|
|
482
|
+
for (let [e, t] of Object.entries(o)) fe.has(e) || typeof t == "string" && (l[e] = t);
|
|
483
483
|
let d;
|
|
484
484
|
o.action?.event && s.actionEvent && (d = { [s.actionEvent]: `a2ui:${a}:${e}:${o.action.event.name}` });
|
|
485
485
|
let f, p = o.children ?? (o.child ? [o.child] : void 0);
|
|
@@ -497,7 +497,7 @@ function P(e, t, n, r, i, a) {
|
|
|
497
497
|
attributes: { value: l },
|
|
498
498
|
textContent: u
|
|
499
499
|
});
|
|
500
|
-
let d = c.children ?? (c.child ? [c.child] : void 0), m = d ? d.map((e) =>
|
|
500
|
+
let d = c.children ?? (c.child ? [c.child] : void 0), m = d ? d.map((e) => I(e, t, n, r, i, a)) : void 0, h = typeof c.text == "string" ? c.text : void 0;
|
|
501
501
|
o.push({
|
|
502
502
|
id: `${s}-panel`,
|
|
503
503
|
tag: "n-tab-panel",
|
|
@@ -533,14 +533,14 @@ function P(e, t, n, r, i, a) {
|
|
|
533
533
|
}
|
|
534
534
|
e.length > 0 && (l.options = JSON.stringify(e), o.label && (l.placeholder = String(o.label)));
|
|
535
535
|
}
|
|
536
|
-
} else p && p.length > 0 && (f = p.map((e) =>
|
|
536
|
+
} else p && p.length > 0 && (f = p.map((e) => I(e, t, n, r, i, a)));
|
|
537
537
|
if (s.childStrategy === "slot-label" && u && !f) f = [{
|
|
538
538
|
id: `${e}-label`,
|
|
539
539
|
tag: "span",
|
|
540
540
|
attributes: { slot: "label" },
|
|
541
541
|
textContent: u
|
|
542
542
|
}], u = void 0;
|
|
543
|
-
else if (s.childStrategy === "textContent" && o.label && !u) if (
|
|
543
|
+
else if (s.childStrategy === "textContent" && o.label && !u) if (S(o.label)) {
|
|
544
544
|
let t = r.get(e);
|
|
545
545
|
t || (t = [], r.set(e, t)), t.push({
|
|
546
546
|
property: "textContent",
|
|
@@ -556,7 +556,7 @@ function P(e, t, n, r, i, a) {
|
|
|
556
556
|
"poster"
|
|
557
557
|
]) l[e] && (n[e] = l[e], delete l[e]);
|
|
558
558
|
if (o.component === "Image" && o.url !== void 0) {
|
|
559
|
-
if (
|
|
559
|
+
if (S(o.url)) {
|
|
560
560
|
let t = r.get(`${e}-inner`);
|
|
561
561
|
t || (t = [], r.set(`${e}-inner`, t)), t.push({
|
|
562
562
|
property: "src",
|
|
@@ -581,12 +581,12 @@ function P(e, t, n, r, i, a) {
|
|
|
581
581
|
...d ? { events: d } : {}
|
|
582
582
|
};
|
|
583
583
|
}
|
|
584
|
-
function
|
|
584
|
+
function pe(e, t) {
|
|
585
585
|
let n = [];
|
|
586
|
-
return
|
|
586
|
+
return L(e, n, t?.surfaceId ?? "default"), n;
|
|
587
587
|
}
|
|
588
|
-
function
|
|
589
|
-
let r =
|
|
588
|
+
function L(e, t, n) {
|
|
589
|
+
let r = M(e.tag, e.attributes);
|
|
590
590
|
if (!r) {
|
|
591
591
|
let r = {
|
|
592
592
|
id: e.id,
|
|
@@ -594,10 +594,10 @@ function F(e, t, n) {
|
|
|
594
594
|
...e.children ? { children: e.children.map((e) => e.id) } : {},
|
|
595
595
|
...e.textContent ? { text: e.textContent } : {}
|
|
596
596
|
};
|
|
597
|
-
if (t.push(r), e.children) for (let r of e.children)
|
|
597
|
+
if (t.push(r), e.children) for (let r of e.children) L(r, t, n);
|
|
598
598
|
return;
|
|
599
599
|
}
|
|
600
|
-
let i =
|
|
600
|
+
let i = j(r), a = {
|
|
601
601
|
id: e.id,
|
|
602
602
|
component: r
|
|
603
603
|
};
|
|
@@ -607,11 +607,11 @@ function F(e, t, n) {
|
|
|
607
607
|
} else if (i?.childStrategy === "slot-label" && e.children.length === 1 && e.children[0].attributes?.slot === "label" && e.children[0].textContent) a.text = e.children[0].textContent;
|
|
608
608
|
else {
|
|
609
609
|
a.children = e.children.map((e) => e.id);
|
|
610
|
-
for (let r of e.children)
|
|
610
|
+
for (let r of e.children) L(r, t, n);
|
|
611
611
|
}
|
|
612
612
|
if (e.textContent && (r === "CheckBox" || r === "Switch" || r === "ListItem" ? a.label = e.textContent : a.text = e.textContent), e.attributes) {
|
|
613
|
-
let t = i?.propertyMap ?
|
|
614
|
-
for (let [n, r] of Object.entries(e.attributes)) n === "style" || n === "data-a2ui" || n === "slot" || (t[n] ? a[t[n]] = r : n === "aria-label" ? a.label = r : n === "disabled" && r === "" ? a.disabled = !0 : n === "variant" && (a.variant = (i?.variantMap ?
|
|
613
|
+
let t = i?.propertyMap ? me(i.propertyMap) : {};
|
|
614
|
+
for (let [n, r] of Object.entries(e.attributes)) n === "style" || n === "data-a2ui" || n === "slot" || (t[n] ? a[t[n]] = r : n === "aria-label" ? a.label = r : n === "disabled" && r === "" ? a.disabled = !0 : n === "variant" && (a.variant = (i?.variantMap ? me(i.variantMap) : {})[r] ?? r));
|
|
615
615
|
}
|
|
616
616
|
if (e.events) for (let [t, n] of Object.entries(e.events)) {
|
|
617
617
|
let e = n.split(":");
|
|
@@ -619,7 +619,7 @@ function F(e, t, n) {
|
|
|
619
619
|
}
|
|
620
620
|
t.push(a);
|
|
621
621
|
}
|
|
622
|
-
function
|
|
622
|
+
function me(e) {
|
|
623
623
|
let t = {};
|
|
624
624
|
for (let [n, r] of Object.entries(e)) t[r] = n;
|
|
625
625
|
return t;
|
|
@@ -627,7 +627,7 @@ function ge(e) {
|
|
|
627
627
|
/**
|
|
628
628
|
* Wrap a conversion result as a UIPlan.
|
|
629
629
|
*/
|
|
630
|
-
function
|
|
630
|
+
function R(e, t = "generated") {
|
|
631
631
|
return Object.freeze({
|
|
632
632
|
id: f("a2ui-plan"),
|
|
633
633
|
version: 1,
|
|
@@ -642,18 +642,18 @@ function I(e, t = "generated") {
|
|
|
642
642
|
* Manages A2UI surface lifecycle: create → updateComponents → updateDataModel → delete.
|
|
643
643
|
* Each surface maps to one UIPlan in the kernel.
|
|
644
644
|
*/
|
|
645
|
-
function
|
|
645
|
+
function z(e, t) {
|
|
646
646
|
if (!t || t === "/") return e;
|
|
647
|
-
let n = t.replace(/^\//, "").split("/").map(
|
|
647
|
+
let n = t.replace(/^\//, "").split("/").map(ge), r = e;
|
|
648
648
|
for (let e of n) {
|
|
649
649
|
if (typeof r != "object" || !r) return;
|
|
650
650
|
r = r[e];
|
|
651
651
|
}
|
|
652
652
|
return r;
|
|
653
653
|
}
|
|
654
|
-
function
|
|
654
|
+
function he(e, t, n) {
|
|
655
655
|
if (!t || t === "/") return;
|
|
656
|
-
let r = t.replace(/^\//, "").split("/").map(
|
|
656
|
+
let r = t.replace(/^\//, "").split("/").map(ge), i = e;
|
|
657
657
|
for (let e = 0; e < r.length - 1; e++) {
|
|
658
658
|
let t = r[e];
|
|
659
659
|
(i[t] == null || typeof i[t] != "object") && (i[t] = {}), i = i[t];
|
|
@@ -661,7 +661,7 @@ function R(e, t, n) {
|
|
|
661
661
|
let a = r[r.length - 1];
|
|
662
662
|
n === void 0 ? delete i[a] : i[a] = n;
|
|
663
663
|
}
|
|
664
|
-
function
|
|
664
|
+
function ge(e) {
|
|
665
665
|
return e.replace(/~1/g, "/").replace(/~0/g, "~");
|
|
666
666
|
}
|
|
667
667
|
var B = class {
|
|
@@ -675,7 +675,7 @@ var B = class {
|
|
|
675
675
|
this.#e = e, this.#t = t, this.#n = n ?? null;
|
|
676
676
|
}
|
|
677
677
|
handleMessage(e, t) {
|
|
678
|
-
|
|
678
|
+
C(e) ? this.#a(e, t) : w(e) ? this.#o(e, t) : T(e) ? this.#l(e) : E(e) && this.#u(e);
|
|
679
679
|
}
|
|
680
680
|
#a(e, t) {
|
|
681
681
|
let { surfaceId: n, catalogId: r, theme: i } = e.createSurface, a = this.#r.get(n);
|
|
@@ -713,9 +713,9 @@ var B = class {
|
|
|
713
713
|
}, this.#r.set(n, i), this.#i.value = this.#r.size), i.rendered ? (this.#c(i, r), i.components = [...r]) : (i.components = [...r], this.#s(i)), i.rendered && this.#n?.(i.surfaceId, i.container);
|
|
714
714
|
}
|
|
715
715
|
#s(e) {
|
|
716
|
-
let t =
|
|
716
|
+
let t = F(e.components, { surfaceId: e.surfaceId });
|
|
717
717
|
e.bindings = new Map(t.bindings);
|
|
718
|
-
let n =
|
|
718
|
+
let n = R(t);
|
|
719
719
|
e.planId = n.id;
|
|
720
720
|
try {
|
|
721
721
|
let t = this.#e.executePlan(n, e.container);
|
|
@@ -731,7 +731,7 @@ var B = class {
|
|
|
731
731
|
source: "generated",
|
|
732
732
|
timestamp: Date.now()
|
|
733
733
|
});
|
|
734
|
-
let r =
|
|
734
|
+
let r = F(t, { surfaceId: e.surfaceId });
|
|
735
735
|
e.bindings = new Map(r.bindings);
|
|
736
736
|
for (let t of e.bindingDisposers) t();
|
|
737
737
|
e.bindingDisposers = [];
|
|
@@ -742,7 +742,7 @@ var B = class {
|
|
|
742
742
|
let { surfaceId: t, path: n, value: r } = e.updateDataModel, i = this.#r.get(t);
|
|
743
743
|
if (!i) return;
|
|
744
744
|
let a = { ...i.dataModel.value };
|
|
745
|
-
!n || n === "/" ? i.dataModel.value = r ?? {} : (
|
|
745
|
+
!n || n === "/" ? i.dataModel.value = r ?? {} : (he(a, n, r), i.dataModel.value = a);
|
|
746
746
|
}
|
|
747
747
|
#u(e) {
|
|
748
748
|
let { surfaceId: t } = e.deleteSurface, n = this.#r.get(t);
|
|
@@ -757,7 +757,7 @@ var B = class {
|
|
|
757
757
|
let i = t.get(n);
|
|
758
758
|
if (i) for (let t of r) {
|
|
759
759
|
let n = u(() => {
|
|
760
|
-
let n = e.dataModel.value, r =
|
|
760
|
+
let n = e.dataModel.value, r = z(n, t.path);
|
|
761
761
|
r !== void 0 && (t.property === "textContent" ? i.textContent = String(r) : t.property === "src" || t.property === "alt" || t.property.startsWith("aria-") ? i.setAttribute(t.property, String(r)) : i[t.property] = r);
|
|
762
762
|
});
|
|
763
763
|
e.bindingDisposers.push(n);
|
|
@@ -802,7 +802,7 @@ var B = class {
|
|
|
802
802
|
};
|
|
803
803
|
function _e(e, t) {
|
|
804
804
|
let n = {};
|
|
805
|
-
for (let [r, i] of Object.entries(e)) typeof i == "object" && i && "path" in i ? n[r] =
|
|
805
|
+
for (let [r, i] of Object.entries(e)) typeof i == "object" && i && "path" in i ? n[r] = z(t, i.path) : n[r] = i;
|
|
806
806
|
return n;
|
|
807
807
|
}
|
|
808
808
|
/** A2UI properties that map to HTML attributes on the rendered element. */
|
|
@@ -833,7 +833,7 @@ function be(e, t, n) {
|
|
|
833
833
|
for (let [e, o] of i) if (!r.has(e)) {
|
|
834
834
|
let r = xe(e, t);
|
|
835
835
|
if (r) {
|
|
836
|
-
let t =
|
|
836
|
+
let t = F([o], {
|
|
837
837
|
surfaceId: n,
|
|
838
838
|
rootId: e
|
|
839
839
|
});
|
|
@@ -848,7 +848,7 @@ function be(e, t, n) {
|
|
|
848
848
|
let i = r.get(e);
|
|
849
849
|
if (i) {
|
|
850
850
|
if (o.component !== i.component) {
|
|
851
|
-
let r =
|
|
851
|
+
let r = F(Se(e, t), {
|
|
852
852
|
surfaceId: n,
|
|
853
853
|
rootId: e
|
|
854
854
|
});
|
|
@@ -860,7 +860,7 @@ function be(e, t, n) {
|
|
|
860
860
|
continue;
|
|
861
861
|
}
|
|
862
862
|
if (JSON.stringify(i.children ?? i.child ?? []) !== JSON.stringify(o.children ?? o.child ?? [])) {
|
|
863
|
-
let r =
|
|
863
|
+
let r = F(Se(e, t), {
|
|
864
864
|
surfaceId: n,
|
|
865
865
|
rootId: e
|
|
866
866
|
});
|
|
@@ -953,7 +953,7 @@ var V = class {
|
|
|
953
953
|
* If a container is provided, it is used as the render target for new surfaces.
|
|
954
954
|
*/
|
|
955
955
|
receive(e, t) {
|
|
956
|
-
let n = typeof e == "string" ?
|
|
956
|
+
let n = typeof e == "string" ? D(e) : e;
|
|
957
957
|
if (!n) {
|
|
958
958
|
this.#t.onClientMessage?.({ error: {
|
|
959
959
|
surfaceId: "",
|
|
@@ -962,7 +962,7 @@ var V = class {
|
|
|
962
962
|
} });
|
|
963
963
|
return;
|
|
964
964
|
}
|
|
965
|
-
if (
|
|
965
|
+
if (ee(n)) {
|
|
966
966
|
this.#n(n.requestCatalog.surfaceId);
|
|
967
967
|
return;
|
|
968
968
|
}
|
|
@@ -971,7 +971,7 @@ var V = class {
|
|
|
971
971
|
#n(e) {
|
|
972
972
|
let t = { catalog: {
|
|
973
973
|
...e ? { surfaceId: e } : {},
|
|
974
|
-
supportedTypes: [...
|
|
974
|
+
supportedTypes: [...N()],
|
|
975
975
|
version: this.#t.version ?? "0.9"
|
|
976
976
|
} };
|
|
977
977
|
this.#t.onClientMessage?.(t);
|
|
@@ -981,7 +981,7 @@ var V = class {
|
|
|
981
981
|
* Returns null if invalid.
|
|
982
982
|
*/
|
|
983
983
|
parse(e) {
|
|
984
|
-
return
|
|
984
|
+
return D(e);
|
|
985
985
|
}
|
|
986
986
|
/**
|
|
987
987
|
* Convert a UIPlan to A2UI updateComponents format.
|
|
@@ -993,7 +993,7 @@ var V = class {
|
|
|
993
993
|
};
|
|
994
994
|
return { updateComponents: {
|
|
995
995
|
surfaceId: n,
|
|
996
|
-
components:
|
|
996
|
+
components: pe(e.root, r)
|
|
997
997
|
} };
|
|
998
998
|
}
|
|
999
999
|
/**
|
|
@@ -1015,7 +1015,7 @@ var V = class {
|
|
|
1015
1015
|
* Returns the list of A2UI component types supported by this adapter.
|
|
1016
1016
|
*/
|
|
1017
1017
|
getSupportedTypes() {
|
|
1018
|
-
return
|
|
1018
|
+
return N();
|
|
1019
1019
|
}
|
|
1020
1020
|
destroy() {
|
|
1021
1021
|
this.#e.destroy();
|
|
@@ -7797,7 +7797,7 @@ var W = [
|
|
|
7797
7797
|
this.#O?.destroy(), this.#O = null, this.removeEventListener("native:present", this.#fe), this.removeEventListener("native:dismiss", this.#pe), this.#k?.destroy(), this.#k = null, this.#A = null, this.#j = null, this.#b?.removeEventListener("native:resize-end", this.#xe), this.#x?.removeEventListener("pointerdown", this.#V), this.#x?.removeEventListener("dblclick", this.#W), document.removeEventListener("pointermove", this.#H), document.removeEventListener("pointerup", this.#U), this.#M = null, this.#b = null, this.#x = null, this.#S.clear(), this.#C.clear(), this.#w.clear(), this.#P(), this.#p = null, this.#m = null, this.#h = null, this.#g = null, this.#_ = null, this.#v = null, this.#y = null, super.teardown();
|
|
7798
7798
|
}
|
|
7799
7799
|
#N() {
|
|
7800
|
-
|
|
7800
|
+
x(), this.#T = new b({ allowUnregistered: !0 }), this.#E = we(this.#T, {
|
|
7801
7801
|
onClientMessage: (e) => {
|
|
7802
7802
|
this.#te("received", e);
|
|
7803
7803
|
},
|
|
@@ -7980,10 +7980,10 @@ var W = [
|
|
|
7980
7980
|
}
|
|
7981
7981
|
};
|
|
7982
7982
|
#G() {
|
|
7983
|
-
let e = document.createElement("
|
|
7983
|
+
let e = document.createElement("header"), t = document.createElement("n-toolbar");
|
|
7984
7984
|
t.setAttribute("size", "sm"), t.setAttribute("variant", "ghost");
|
|
7985
7985
|
let n = document.createElement("n-select");
|
|
7986
|
-
n.setAttribute("size", "sm"), n.setAttribute("inline", "")
|
|
7986
|
+
n.setAttribute("size", "sm"), n.setAttribute("inline", "");
|
|
7987
7987
|
let r = document.createElement("n-button");
|
|
7988
7988
|
r.setAttribute("justify", "spread"), r.innerHTML = "<span slot=\"label\">Presets</span><n-icon name=\"caret-up-down\" slot=\"trailing\"></n-icon>", n.appendChild(r);
|
|
7989
7989
|
let i = document.createElement("n-listbox");
|
|
@@ -8000,7 +8000,7 @@ var W = [
|
|
|
8000
8000
|
}
|
|
8001
8001
|
i.appendChild(n);
|
|
8002
8002
|
}
|
|
8003
|
-
n.appendChild(i), n.addEventListener("native:change", this.#me), e.appendChild(n)
|
|
8003
|
+
n.appendChild(i), n.addEventListener("native:change", this.#me), e.appendChild(n);
|
|
8004
8004
|
for (let e of W) {
|
|
8005
8005
|
let n = document.createElement("n-button");
|
|
8006
8006
|
n.setAttribute("variant", "ghost"), n.setAttribute("size", "sm"), n.textContent = Ne[e], this.#n.value.has(e) && n.toggleAttribute("data-active", !0), n.addEventListener("native:press", this.#Te(e)), t.appendChild(n), this.#w.set(e, n);
|
|
@@ -8020,19 +8020,17 @@ var W = [
|
|
|
8020
8020
|
for (let e of W) {
|
|
8021
8021
|
let t = document.createElement("div");
|
|
8022
8022
|
t.className = "a2ui-pane", t.dataset.panel = e, this.#n.value.has(e) || (t.hidden = !0);
|
|
8023
|
-
let n = document.createElement("n-
|
|
8024
|
-
|
|
8025
|
-
let r = document.createElement("n-icon");
|
|
8026
|
-
r.setAttribute("name", Pe[e]), r.setAttribute("slot", "leading"), n.appendChild(r);
|
|
8027
|
-
let i = document.createElement("span");
|
|
8028
|
-
i.setAttribute("slot", "label"), i.textContent = Ne[e], n.appendChild(i);
|
|
8023
|
+
let n = document.createElement("header"), r = document.createElement("nav"), i = document.createElement("n-icon");
|
|
8024
|
+
i.setAttribute("name", Pe[e]), r.appendChild(i), n.appendChild(r);
|
|
8029
8025
|
let a = document.createElement("span");
|
|
8030
|
-
|
|
8026
|
+
a.textContent = Ne[e], n.appendChild(a);
|
|
8027
|
+
let o = document.createElement("aside");
|
|
8028
|
+
if (e === "js" || e === "html" || e === "css") {
|
|
8031
8029
|
let t = document.createElement("n-button");
|
|
8032
|
-
t.setAttribute("variant", "ghost"), t.setAttribute("size", "sm"), t.title = "Reset to computed", t.innerHTML = "<n-icon name=\"arrow-counter-clockwise\"></n-icon>", t.addEventListener("native:press", this.#we(e)),
|
|
8030
|
+
t.setAttribute("variant", "ghost"), t.setAttribute("size", "sm"), t.title = "Reset to computed", t.innerHTML = "<n-icon name=\"arrow-counter-clockwise\"></n-icon>", t.addEventListener("native:press", this.#we(e)), o.appendChild(t);
|
|
8033
8031
|
}
|
|
8034
|
-
let
|
|
8035
|
-
if (
|
|
8032
|
+
let c = document.createElement("n-button");
|
|
8033
|
+
if (c.setAttribute("variant", "ghost"), c.setAttribute("size", "sm"), c.title = "Close pane", c.innerHTML = "<n-icon name=\"x\"></n-icon>", c.addEventListener("native:press", this.#Te(e)), o.appendChild(c), n.appendChild(o), t.appendChild(n), e === "json-in") {
|
|
8036
8034
|
let e = document.createElement("n-toolbar");
|
|
8037
8035
|
e.setAttribute("variant", "plain"), e.setAttribute("size", "sm"), e.setAttribute("fill", "");
|
|
8038
8036
|
let n = this.#K("Step back", "caret-left");
|
|
@@ -8054,13 +8052,13 @@ var W = [
|
|
|
8054
8052
|
let u = this.#K("Insert deleteSurface", "minus-circle");
|
|
8055
8053
|
u.addEventListener("native:press", this.#be("deleteSurface")), e.append(n, r, i, a, o, s, c, l, u), t.appendChild(e);
|
|
8056
8054
|
}
|
|
8057
|
-
let c = document.createElement("div");
|
|
8058
|
-
if (c.className = "a2ui-pane-content", t.appendChild(c), this.#C.set(e, c), e === "json-in" || e === "js" || e === "html" || e === "css") {
|
|
8059
|
-
let t = document.createElement("native-codemirror");
|
|
8060
|
-
t.setAttribute("line-numbers", "false"), c.appendChild(t), e === "json-in" ? this.#p = t : e === "js" ? this.#m = t : e === "html" ? this.#h = t : e === "css" && (this.#g = t);
|
|
8061
|
-
} else e === "components" && (this.#v = c);
|
|
8062
8055
|
let l = document.createElement("div");
|
|
8063
|
-
l.className = "a2ui-
|
|
8056
|
+
if (l.className = "a2ui-pane-content", t.appendChild(l), this.#C.set(e, l), e === "json-in" || e === "js" || e === "html" || e === "css") {
|
|
8057
|
+
let t = document.createElement("native-codemirror");
|
|
8058
|
+
t.setAttribute("line-numbers", "false"), l.appendChild(t), e === "json-in" ? this.#p = t : e === "js" ? this.#m = t : e === "html" ? this.#h = t : e === "css" && (this.#g = t);
|
|
8059
|
+
} else e === "components" && (this.#v = l);
|
|
8060
|
+
let u = document.createElement("div");
|
|
8061
|
+
u.className = "a2ui-resize-handle", t.appendChild(u), s.appendChild(t), this.#S.set(e, t);
|
|
8064
8062
|
}
|
|
8065
8063
|
e.appendChild(t), this.append(e, s);
|
|
8066
8064
|
}
|
|
@@ -8246,7 +8244,7 @@ var W = [
|
|
|
8246
8244
|
}
|
|
8247
8245
|
r.appendChild(i), n.appendChild(r);
|
|
8248
8246
|
let a = document.createElement("tbody");
|
|
8249
|
-
for (let [n, r] of
|
|
8247
|
+
for (let [n, r] of A) {
|
|
8250
8248
|
let n = document.createElement("tr");
|
|
8251
8249
|
n.className = "a2ui-map-row", t.has(r.a2uiType) && n.classList.add("a2ui-map-active");
|
|
8252
8250
|
let i = document.createElement("td");
|
|
@@ -8254,39 +8252,39 @@ var W = [
|
|
|
8254
8252
|
let o = document.createElement("td"), s = document.createElement("code");
|
|
8255
8253
|
s.textContent = r.nativeTag, o.appendChild(s);
|
|
8256
8254
|
let c = document.createElement("td");
|
|
8257
|
-
c.textContent =
|
|
8255
|
+
c.textContent = P(r.a2uiType), c.className = "a2ui-map-category", n.append(i, o, c), n.addEventListener("click", () => {
|
|
8258
8256
|
this.#ie = r.a2uiType, this.#oe(e, t);
|
|
8259
8257
|
}), a.appendChild(n);
|
|
8260
8258
|
}
|
|
8261
8259
|
n.appendChild(a);
|
|
8262
8260
|
let o = document.createElement("div");
|
|
8263
|
-
o.className = "a2ui-map-summary", o.textContent = t.size > 0 ? `${t.size} of ${
|
|
8261
|
+
o.className = "a2ui-map-summary", o.textContent = t.size > 0 ? `${t.size} of ${A.size} types active` : `${A.size} supported component types`, e.append(o, n);
|
|
8264
8262
|
}
|
|
8265
8263
|
#se(e, t, n) {
|
|
8266
|
-
let r =
|
|
8264
|
+
let r = A.get(t);
|
|
8267
8265
|
if (!r) return;
|
|
8268
|
-
let i = document.createElement("
|
|
8269
|
-
i.className = "a2ui-map-detail-header"
|
|
8270
|
-
let a = document.createElement("n-button");
|
|
8271
|
-
|
|
8266
|
+
let i = document.createElement("header");
|
|
8267
|
+
i.className = "a2ui-map-detail-header";
|
|
8268
|
+
let a = document.createElement("nav"), o = document.createElement("n-button");
|
|
8269
|
+
o.setAttribute("variant", "ghost"), o.setAttribute("size", "sm"), o.className = "a2ui-map-back", o.innerHTML = `<n-icon name="caret-left"></n-icon> ${r.a2uiType}`, o.addEventListener("native:press", () => {
|
|
8272
8270
|
this.#ie = null, this.#ae = "info", this.#_ = null, this.#oe(e, n);
|
|
8273
|
-
}), i.appendChild(a);
|
|
8274
|
-
let
|
|
8275
|
-
|
|
8276
|
-
let
|
|
8277
|
-
|
|
8278
|
-
let
|
|
8279
|
-
if (
|
|
8271
|
+
}), a.appendChild(o), i.appendChild(a);
|
|
8272
|
+
let s = this.#ce(t), c = s.length > 0, l = document.createElement("aside"), u = document.createElement("n-segmented-control");
|
|
8273
|
+
u.className = "a2ui-map-tab-bar", u.setAttribute("size", "xs"), u.setAttribute("inline", ""), u.value = this.#ae;
|
|
8274
|
+
let d = document.createElement("n-segment");
|
|
8275
|
+
d.setAttribute("value", "info"), d.textContent = "Info";
|
|
8276
|
+
let f = document.createElement("n-segment");
|
|
8277
|
+
if (f.setAttribute("value", "json"), f.textContent = c ? `JSON (${s.length})` : "JSON", c || f.setAttribute("disabled", ""), u.append(d, f), u.addEventListener("native:change", (t) => {
|
|
8280
8278
|
let r = t.detail;
|
|
8281
8279
|
(r?.value === "info" || r?.value === "json") && (this.#ae = r.value, this.#oe(e, n));
|
|
8282
|
-
}), i.appendChild(
|
|
8280
|
+
}), l.appendChild(u), i.appendChild(l), e.appendChild(i), this.#ae === "info") {
|
|
8283
8281
|
this.#_ = null;
|
|
8284
8282
|
let i = document.createElement("div");
|
|
8285
8283
|
i.className = "a2ui-map-detail";
|
|
8286
8284
|
let a = [
|
|
8287
8285
|
["Tag", r.nativeTag],
|
|
8288
8286
|
["Children", r.childStrategy],
|
|
8289
|
-
["Category",
|
|
8287
|
+
["Category", P(r.a2uiType)]
|
|
8290
8288
|
];
|
|
8291
8289
|
r.actionEvent && a.push(["Action", r.actionEvent]), r.defaultAttributes && a.push(["Defaults", Object.entries(r.defaultAttributes).map(([e, t]) => `${e}="${t}"`).join(", ")]), r.propertyMap && a.push(["Props", Object.entries(r.propertyMap).map(([e, t]) => `${e} → ${t}`).join(", ")]), r.variantMap && a.push(["Variants", Object.keys(r.variantMap).join(", ")]);
|
|
8292
8290
|
for (let [e, t] of a) {
|
|
@@ -8298,14 +8296,14 @@ var W = [
|
|
|
8298
8296
|
a.textContent = t, n.append(r, a), i.appendChild(n);
|
|
8299
8297
|
}
|
|
8300
8298
|
e.appendChild(i);
|
|
8301
|
-
let o =
|
|
8299
|
+
let o = de(r.a2uiType).filter((e) => e !== t), s = n.has(t);
|
|
8302
8300
|
if (o.length > 0) {
|
|
8303
8301
|
let r = document.createElement("div");
|
|
8304
8302
|
r.className = "a2ui-map-alternatives";
|
|
8305
8303
|
let i = document.createElement("div");
|
|
8306
8304
|
i.className = "a2ui-map-alt-title", i.textContent = s ? "Swap To" : "Compatible Alternatives", r.appendChild(i);
|
|
8307
8305
|
for (let i of o) {
|
|
8308
|
-
let a =
|
|
8306
|
+
let a = A.get(i);
|
|
8309
8307
|
if (!a) continue;
|
|
8310
8308
|
let o = document.createElement("div");
|
|
8311
8309
|
if (o.className = "a2ui-map-alt-row", n.has(i) && o.classList.add("a2ui-map-active"), s) {
|
|
@@ -8325,16 +8323,16 @@ var W = [
|
|
|
8325
8323
|
}
|
|
8326
8324
|
return;
|
|
8327
8325
|
}
|
|
8328
|
-
let
|
|
8329
|
-
|
|
8330
|
-
let
|
|
8331
|
-
|
|
8332
|
-
let
|
|
8333
|
-
|
|
8334
|
-
let
|
|
8335
|
-
|
|
8336
|
-
|
|
8337
|
-
}), e.appendChild(
|
|
8326
|
+
let p = document.createElement("div");
|
|
8327
|
+
p.className = "a2ui-map-editor-section";
|
|
8328
|
+
let m = document.createElement("n-toolbar");
|
|
8329
|
+
m.className = "a2ui-map-editor-toolbar";
|
|
8330
|
+
let h = document.createElement("n-button");
|
|
8331
|
+
h.setAttribute("variant", "ghost"), h.setAttribute("size", "sm"), h.title = "Apply changes to stream", h.innerHTML = "<n-icon name=\"play\" weight=\"fill\"></n-icon>", h.addEventListener("native:press", () => this.#le(t)), m.appendChild(h), p.appendChild(m);
|
|
8332
|
+
let g = document.createElement("native-codemirror");
|
|
8333
|
+
g.setAttribute("line-numbers", "false"), p.appendChild(g), this.#_ = g, requestAnimationFrame(() => {
|
|
8334
|
+
g.extensions = [v()], g.value = JSON.stringify(s, null, 2);
|
|
8335
|
+
}), e.appendChild(p);
|
|
8338
8336
|
}
|
|
8339
8337
|
/** Extract all component instances of a given A2UI type from the current envelopes. */
|
|
8340
8338
|
#ce(e) {
|
|
@@ -8550,7 +8548,7 @@ var G = class {
|
|
|
8550
8548
|
constructor(e, t, n) {
|
|
8551
8549
|
this.id = f("session"), this.agentId = n.agentId, this.catalog = n.catalog, this.#t = t, this.#i = new Set(n.surfaces ?? []), this.eventEmitter = new G(), this.#e = new V(e, {
|
|
8552
8550
|
onClientMessage: (e) => {
|
|
8553
|
-
if (
|
|
8551
|
+
if (te(e)) {
|
|
8554
8552
|
let t = e.action, n = {
|
|
8555
8553
|
surfaceId: t.surfaceId,
|
|
8556
8554
|
componentId: t.sourceComponentId,
|
|
@@ -8582,14 +8580,14 @@ var G = class {
|
|
|
8582
8580
|
*/
|
|
8583
8581
|
receive(e) {
|
|
8584
8582
|
if (this.#n === "terminated") return;
|
|
8585
|
-
let t = typeof e == "string" ?
|
|
8583
|
+
let t = typeof e == "string" ? D(e) : e;
|
|
8586
8584
|
if (!t) return;
|
|
8587
8585
|
let n = He(t);
|
|
8588
8586
|
if (n && !this.#i.has(n) && !this.#t.isOwner(n, this)) {
|
|
8589
8587
|
this.#s("catalog-violation", n, "");
|
|
8590
8588
|
return;
|
|
8591
8589
|
}
|
|
8592
|
-
if (
|
|
8590
|
+
if (w(t)) {
|
|
8593
8591
|
let e = this.catalog.filterComponents(t.updateComponents.components, (e, t) => this.#s("catalog-violation", e, t));
|
|
8594
8592
|
this.#a.set(t.updateComponents.surfaceId, e);
|
|
8595
8593
|
let n = { updateComponents: {
|
|
@@ -8623,10 +8621,10 @@ var G = class {
|
|
|
8623
8621
|
}
|
|
8624
8622
|
};
|
|
8625
8623
|
function He(e) {
|
|
8626
|
-
if (
|
|
8627
|
-
if (
|
|
8628
|
-
if (
|
|
8629
|
-
if (
|
|
8624
|
+
if (C(e)) return e.createSurface.surfaceId;
|
|
8625
|
+
if (w(e)) return e.updateComponents.surfaceId;
|
|
8626
|
+
if (T(e)) return e.updateDataModel.surfaceId;
|
|
8627
|
+
if (E(e)) return e.deleteSurface.surfaceId;
|
|
8630
8628
|
}
|
|
8631
8629
|
var Ue = class {
|
|
8632
8630
|
#e = /* @__PURE__ */ new Map();
|
|
@@ -8772,7 +8770,7 @@ function Ge(e) {
|
|
|
8772
8770
|
*/
|
|
8773
8771
|
function K(e = "core-only") {
|
|
8774
8772
|
let t = [];
|
|
8775
|
-
for (let [n, r] of
|
|
8773
|
+
for (let [n, r] of A) e === "core-only" && r.nativeTag.startsWith("native-dashboard-") || t.push(Ge(r));
|
|
8776
8774
|
return new We(t);
|
|
8777
8775
|
}
|
|
8778
8776
|
var Ke = class {
|
|
@@ -8904,7 +8902,7 @@ var Ke = class {
|
|
|
8904
8902
|
#a() {
|
|
8905
8903
|
let e = this.#e.endpoint;
|
|
8906
8904
|
this.#r = new EventSource(e), this.#r.onmessage = (e) => {
|
|
8907
|
-
let t =
|
|
8905
|
+
let t = D(e.data);
|
|
8908
8906
|
t && this.#n?.receive(t);
|
|
8909
8907
|
}, this.#r.onerror = () => {};
|
|
8910
8908
|
}
|
|
@@ -8957,7 +8955,7 @@ var Ke = class {
|
|
|
8957
8955
|
}
|
|
8958
8956
|
#a(e, t) {
|
|
8959
8957
|
if (e.type === t && e.data) {
|
|
8960
|
-
let t =
|
|
8958
|
+
let t = D(typeof e.data == "string" ? e.data : JSON.stringify(e.data));
|
|
8961
8959
|
t && this.#n?.receive(t);
|
|
8962
8960
|
return;
|
|
8963
8961
|
}
|
|
@@ -9261,34 +9259,34 @@ var Ke = class {
|
|
|
9261
9259
|
}
|
|
9262
9260
|
setup() {
|
|
9263
9261
|
super.setup(), this.hasAttribute("open") && (this.#r.value = !0);
|
|
9264
|
-
let i = document.createElement("
|
|
9262
|
+
let i = document.createElement("header");
|
|
9265
9263
|
i.setAttribute("dividers", "");
|
|
9266
|
-
let a = document.createElement("n-icon");
|
|
9267
|
-
|
|
9268
|
-
let o = document.createElement("span");
|
|
9269
|
-
o.setAttribute("slot", "label"), o.textContent = "Assistant", i.appendChild(o);
|
|
9264
|
+
let a = document.createElement("nav"), o = document.createElement("n-icon");
|
|
9265
|
+
o.setAttribute("name", "chat-dots"), a.appendChild(o), i.appendChild(a);
|
|
9270
9266
|
let s = document.createElement("span");
|
|
9271
|
-
s.
|
|
9272
|
-
let c = document.createElement("
|
|
9273
|
-
|
|
9274
|
-
let d = document.createElement("n-
|
|
9275
|
-
d.setAttribute("
|
|
9276
|
-
let f = document.createElement("
|
|
9277
|
-
|
|
9278
|
-
let
|
|
9279
|
-
|
|
9280
|
-
let h = document.createElement("n-
|
|
9281
|
-
|
|
9282
|
-
let g = document.createElement("n-
|
|
9283
|
-
g.setAttribute("
|
|
9284
|
-
let _ = document.createElement("n-
|
|
9285
|
-
_.setAttribute("
|
|
9286
|
-
let v = document.createElement("n-
|
|
9287
|
-
v.setAttribute("
|
|
9288
|
-
let y = document.createElement("n-
|
|
9289
|
-
y.setAttribute("
|
|
9290
|
-
let b = document.createElement("n-
|
|
9291
|
-
b.setAttribute("
|
|
9267
|
+
s.textContent = "Assistant", i.appendChild(s);
|
|
9268
|
+
let c = document.createElement("aside");
|
|
9269
|
+
c.className = "n-chat-panel-header-trailing", i.appendChild(c), this.#v = c;
|
|
9270
|
+
let l = document.createElement("section"), u = document.createElement("n-chat-content"), d = document.createElement("n-chat-feed");
|
|
9271
|
+
d.setAttribute("auto-scroll", ""), u.appendChild(d), this.#h = d, l.appendChild(u);
|
|
9272
|
+
let f = document.createElement("footer");
|
|
9273
|
+
f.setAttribute("dividers", ""), this.#m = f;
|
|
9274
|
+
let p = document.createElement("n-chat-input"), m = document.createElement("n-textarea");
|
|
9275
|
+
m.setAttribute("placeholder", "Ask anything"), m.setAttribute("autogrow", ""), m.setAttribute("rows", "3"), p.appendChild(m);
|
|
9276
|
+
let h = document.createElement("n-chat-input-actions");
|
|
9277
|
+
this.#y = h;
|
|
9278
|
+
let g = document.createElement("n-button");
|
|
9279
|
+
g.setAttribute("variant", "ghost"), g.setAttribute("inline", "");
|
|
9280
|
+
let _ = document.createElement("n-icon");
|
|
9281
|
+
_.setAttribute("name", "plus"), g.appendChild(_), h.appendChild(g);
|
|
9282
|
+
let v = document.createElement("n-button");
|
|
9283
|
+
v.setAttribute("variant", "ghost"), v.setAttribute("inline", "");
|
|
9284
|
+
let y = document.createElement("n-icon");
|
|
9285
|
+
y.setAttribute("name", "microphone"), v.appendChild(y), h.appendChild(v);
|
|
9286
|
+
let b = document.createElement("n-button");
|
|
9287
|
+
b.setAttribute("variant", "primary"), b.setAttribute("intent", "accent"), b.setAttribute("radius", "round"), b.setAttribute("inline", ""), b.setAttribute("disabled", ""), b.dataset.submit = "", b.dataset.role = "submit";
|
|
9288
|
+
let x = document.createElement("n-icon");
|
|
9289
|
+
x.setAttribute("name", "arrow-up"), b.appendChild(x), h.appendChild(b), p.appendChild(h), f.appendChild(p), this.append(i, l, f), this.addEffect(() => {
|
|
9292
9290
|
let e = this.#e.value;
|
|
9293
9291
|
if (e && !this.#g) {
|
|
9294
9292
|
let e = document.createElement("n-button");
|
|
@@ -11139,4 +11137,4 @@ var Ft = class {
|
|
|
11139
11137
|
});
|
|
11140
11138
|
}
|
|
11141
11139
|
};
|
|
11142
|
-
export { Je as A2AAdapter, V as A2UIAdapter, nt as ACTION_REGISTRY, Ye as AGUIAdapter, Q as CHAT_EVENTS,
|
|
11140
|
+
export { Je as A2AAdapter, V as A2UIAdapter, nt as ACTION_REGISTRY, Ye as AGUIAdapter, Q as CHAT_EVENTS, A as COMPONENT_MAP, qe as DirectAdapter, ze as NA2UI, Ve as NAgentSession, We as NCatalog, et as NChatAvatar, $e as NChatFeed, Xe as NChatInput, _t as NChatInputStructured, it as NChatMessage, ut as NChatMessageActivity, ht as NChatMessageGenUI, pt as NChatMessageSeed, st as NChatMessageText, ot as NChatMessages, Ze as NChatPanel, G as NEventEmitter, Ke as NSessionManager, Ue as NSurfaceRegistry, rt as ROLE_DEFAULTS, Ot as SAFE_FIELDS, kt as SENSITIVE_FIELDS, Ee as SSETransport, B as SurfaceManager, Ft as TelemetryEmitter, Te as WebSocketTransport, F as a2uiToUINode, Z as backoffDelay, K as buildCatalogFromRegistry, St as classifyHttpError, xt as classifyStreamEnd, R as conversionToPlan, we as createA2UIAdapter, wt as createChatStream, Tt as createChatTransport, $ as createDefaultRedactor, Oe as createSSETransport, Ce as createSurfaceManager, De as createWebSocketTransport, se as dateTimeInputType, Ct as detectFormat, N as getSupportedTypes, ke as installA2UI, te as isActionMessage, ee as isCatalogRequest, re as isCatalogResponse, C as isCreateSurface, S as isDataBinding, E as isDeleteSurface, ne as isErrorMessage, w as isUpdateComponents, T as isUpdateDataModel, bt as parseJSON, yt as parseNDJSON, vt as parseSSE, D as parseServerMessage, J as renderInline, Y as renderMarkdown, M as resolveA2UIType, z as resolveJsonPointer, j as resolveNativeTag, lt as sanitizeHtml, Nt as scrubPII, he as setJsonPointer, le as textFieldInputType, oe as textVariantTag, pe as uiNodeToA2UI };
|
package/dist/register.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { NBadge as e, NButton as t, NCard as n, NDialog as r, NIcon as i, NListbox as a, NOption as o, NOptionGroup as s, NOptionGroupHeader as c, NSegment as l, NSegmentedControl as u, NSelect as d, NTextarea as f, NToolbar as p, NativeElement as m, PresentController as h, ResizeController as g, VirtualScrollController as _, computed as v, createDisabledEffect as y, define as b, effect as ee, registerIcon as x, signal as S, uid as C } from "@nonoun/native-ui";
|
|
2
|
-
import { Decoration as w, EditorView as
|
|
2
|
+
import { Decoration as w, EditorView as T, StateEffect as te, StateField as ne, keymap as re } from "@nonoun/native-code";
|
|
3
3
|
import { json as E } from "@codemirror/lang-json";
|
|
4
4
|
import { linter as ie } from "@codemirror/lint";
|
|
5
5
|
import "@nonoun/native-code/register";
|
|
@@ -7528,7 +7528,7 @@ var U = [
|
|
|
7528
7528
|
css: "palette",
|
|
7529
7529
|
js: "terminal",
|
|
7530
7530
|
components: "squares-four"
|
|
7531
|
-
}, ze =
|
|
7531
|
+
}, ze = te.define(), Be = w.line({ class: "cm-a2ui-sent" }), Ve = w.line({ class: "cm-a2ui-next" }), He = ne.define({
|
|
7532
7532
|
create() {
|
|
7533
7533
|
return w.none;
|
|
7534
7534
|
},
|
|
@@ -7541,7 +7541,7 @@ var U = [
|
|
|
7541
7541
|
}
|
|
7542
7542
|
return e;
|
|
7543
7543
|
},
|
|
7544
|
-
provide: (e) =>
|
|
7544
|
+
provide: (e) => T.decorations.from(e)
|
|
7545
7545
|
}), Ue = class extends m {
|
|
7546
7546
|
static observedAttributes = ["stream"];
|
|
7547
7547
|
#e = S("");
|
|
@@ -7833,10 +7833,10 @@ var U = [
|
|
|
7833
7833
|
}
|
|
7834
7834
|
};
|
|
7835
7835
|
#G() {
|
|
7836
|
-
let e = document.createElement("
|
|
7836
|
+
let e = document.createElement("header"), t = document.createElement("n-toolbar");
|
|
7837
7837
|
t.setAttribute("size", "sm"), t.setAttribute("variant", "ghost");
|
|
7838
7838
|
let n = document.createElement("n-select");
|
|
7839
|
-
n.setAttribute("size", "sm"), n.setAttribute("inline", "")
|
|
7839
|
+
n.setAttribute("size", "sm"), n.setAttribute("inline", "");
|
|
7840
7840
|
let r = document.createElement("n-button");
|
|
7841
7841
|
r.setAttribute("justify", "spread"), r.innerHTML = "<span slot=\"label\">Presets</span><n-icon name=\"caret-up-down\" slot=\"trailing\"></n-icon>", n.appendChild(r);
|
|
7842
7842
|
let i = document.createElement("n-listbox");
|
|
@@ -7853,7 +7853,7 @@ var U = [
|
|
|
7853
7853
|
}
|
|
7854
7854
|
i.appendChild(n);
|
|
7855
7855
|
}
|
|
7856
|
-
n.appendChild(i), n.addEventListener("native:change", this.#me), e.appendChild(n)
|
|
7856
|
+
n.appendChild(i), n.addEventListener("native:change", this.#me), e.appendChild(n);
|
|
7857
7857
|
for (let e of U) {
|
|
7858
7858
|
let n = document.createElement("n-button");
|
|
7859
7859
|
n.setAttribute("variant", "ghost"), n.setAttribute("size", "sm"), n.textContent = Le[e], this.#n.value.has(e) && n.toggleAttribute("data-active", !0), n.addEventListener("native:press", this.#Te(e)), t.appendChild(n), this.#w.set(e, n);
|
|
@@ -7873,19 +7873,17 @@ var U = [
|
|
|
7873
7873
|
for (let e of U) {
|
|
7874
7874
|
let t = document.createElement("div");
|
|
7875
7875
|
t.className = "a2ui-pane", t.dataset.panel = e, this.#n.value.has(e) || (t.hidden = !0);
|
|
7876
|
-
let n = document.createElement("n-
|
|
7877
|
-
|
|
7878
|
-
let r = document.createElement("n-icon");
|
|
7879
|
-
r.setAttribute("name", Re[e]), r.setAttribute("slot", "leading"), n.appendChild(r);
|
|
7880
|
-
let i = document.createElement("span");
|
|
7881
|
-
i.setAttribute("slot", "label"), i.textContent = Le[e], n.appendChild(i);
|
|
7876
|
+
let n = document.createElement("header"), r = document.createElement("nav"), i = document.createElement("n-icon");
|
|
7877
|
+
i.setAttribute("name", Re[e]), r.appendChild(i), n.appendChild(r);
|
|
7882
7878
|
let a = document.createElement("span");
|
|
7883
|
-
|
|
7879
|
+
a.textContent = Le[e], n.appendChild(a);
|
|
7880
|
+
let o = document.createElement("aside");
|
|
7881
|
+
if (e === "js" || e === "html" || e === "css") {
|
|
7884
7882
|
let t = document.createElement("n-button");
|
|
7885
|
-
t.setAttribute("variant", "ghost"), t.setAttribute("size", "sm"), t.title = "Reset to computed", t.innerHTML = "<n-icon name=\"arrow-counter-clockwise\"></n-icon>", t.addEventListener("native:press", this.#we(e)),
|
|
7883
|
+
t.setAttribute("variant", "ghost"), t.setAttribute("size", "sm"), t.title = "Reset to computed", t.innerHTML = "<n-icon name=\"arrow-counter-clockwise\"></n-icon>", t.addEventListener("native:press", this.#we(e)), o.appendChild(t);
|
|
7886
7884
|
}
|
|
7887
|
-
let
|
|
7888
|
-
if (
|
|
7885
|
+
let c = document.createElement("n-button");
|
|
7886
|
+
if (c.setAttribute("variant", "ghost"), c.setAttribute("size", "sm"), c.title = "Close pane", c.innerHTML = "<n-icon name=\"x\"></n-icon>", c.addEventListener("native:press", this.#Te(e)), o.appendChild(c), n.appendChild(o), t.appendChild(n), e === "json-in") {
|
|
7889
7887
|
let e = document.createElement("n-toolbar");
|
|
7890
7888
|
e.setAttribute("variant", "plain"), e.setAttribute("size", "sm"), e.setAttribute("fill", "");
|
|
7891
7889
|
let n = this.#K("Step back", "caret-left");
|
|
@@ -7907,13 +7905,13 @@ var U = [
|
|
|
7907
7905
|
let u = this.#K("Insert deleteSurface", "minus-circle");
|
|
7908
7906
|
u.addEventListener("native:press", this.#be("deleteSurface")), e.append(n, r, i, a, o, s, c, l, u), t.appendChild(e);
|
|
7909
7907
|
}
|
|
7910
|
-
let c = document.createElement("div");
|
|
7911
|
-
if (c.className = "a2ui-pane-content", t.appendChild(c), this.#C.set(e, c), e === "json-in" || e === "js" || e === "html" || e === "css") {
|
|
7912
|
-
let t = document.createElement("native-codemirror");
|
|
7913
|
-
t.setAttribute("line-numbers", "false"), c.appendChild(t), e === "json-in" ? this.#p = t : e === "js" ? this.#m = t : e === "html" ? this.#h = t : e === "css" && (this.#g = t);
|
|
7914
|
-
} else e === "components" && (this.#v = c);
|
|
7915
7908
|
let l = document.createElement("div");
|
|
7916
|
-
l.className = "a2ui-
|
|
7909
|
+
if (l.className = "a2ui-pane-content", t.appendChild(l), this.#C.set(e, l), e === "json-in" || e === "js" || e === "html" || e === "css") {
|
|
7910
|
+
let t = document.createElement("native-codemirror");
|
|
7911
|
+
t.setAttribute("line-numbers", "false"), l.appendChild(t), e === "json-in" ? this.#p = t : e === "js" ? this.#m = t : e === "html" ? this.#h = t : e === "css" && (this.#g = t);
|
|
7912
|
+
} else e === "components" && (this.#v = l);
|
|
7913
|
+
let u = document.createElement("div");
|
|
7914
|
+
u.className = "a2ui-resize-handle", t.appendChild(u), s.appendChild(t), this.#S.set(e, t);
|
|
7917
7915
|
}
|
|
7918
7916
|
e.appendChild(t), this.append(e, s);
|
|
7919
7917
|
}
|
|
@@ -7937,10 +7935,10 @@ var U = [
|
|
|
7937
7935
|
], this.#p.addEventListener("native:input", (e) => {
|
|
7938
7936
|
this.#e.value = e.detail.value;
|
|
7939
7937
|
});
|
|
7940
|
-
let e =
|
|
7938
|
+
let e = re.of([{
|
|
7941
7939
|
key: "Mod-s",
|
|
7942
7940
|
run: () => (this.#L(), !0)
|
|
7943
|
-
}]), t =
|
|
7941
|
+
}]), t = re.of([{
|
|
7944
7942
|
key: "Mod-s",
|
|
7945
7943
|
run: () => (this.#R(), !0)
|
|
7946
7944
|
}]);
|
|
@@ -8118,21 +8116,21 @@ var U = [
|
|
|
8118
8116
|
#se(e, t, n) {
|
|
8119
8117
|
let r = j.get(t);
|
|
8120
8118
|
if (!r) return;
|
|
8121
|
-
let i = document.createElement("
|
|
8122
|
-
i.className = "a2ui-map-detail-header"
|
|
8123
|
-
let a = document.createElement("n-button");
|
|
8124
|
-
|
|
8119
|
+
let i = document.createElement("header");
|
|
8120
|
+
i.className = "a2ui-map-detail-header";
|
|
8121
|
+
let a = document.createElement("nav"), o = document.createElement("n-button");
|
|
8122
|
+
o.setAttribute("variant", "ghost"), o.setAttribute("size", "sm"), o.className = "a2ui-map-back", o.innerHTML = `<n-icon name="caret-left"></n-icon> ${r.a2uiType}`, o.addEventListener("native:press", () => {
|
|
8125
8123
|
this.#ie = null, this.#ae = "info", this.#_ = null, this.#oe(e, n);
|
|
8126
|
-
}), i.appendChild(a);
|
|
8127
|
-
let
|
|
8128
|
-
|
|
8129
|
-
let
|
|
8130
|
-
|
|
8131
|
-
let
|
|
8132
|
-
if (
|
|
8124
|
+
}), a.appendChild(o), i.appendChild(a);
|
|
8125
|
+
let s = this.#ce(t), c = s.length > 0, l = document.createElement("aside"), u = document.createElement("n-segmented-control");
|
|
8126
|
+
u.className = "a2ui-map-tab-bar", u.setAttribute("size", "xs"), u.setAttribute("inline", ""), u.value = this.#ae;
|
|
8127
|
+
let d = document.createElement("n-segment");
|
|
8128
|
+
d.setAttribute("value", "info"), d.textContent = "Info";
|
|
8129
|
+
let f = document.createElement("n-segment");
|
|
8130
|
+
if (f.setAttribute("value", "json"), f.textContent = c ? `JSON (${s.length})` : "JSON", c || f.setAttribute("disabled", ""), u.append(d, f), u.addEventListener("native:change", (t) => {
|
|
8133
8131
|
let r = t.detail;
|
|
8134
8132
|
(r?.value === "info" || r?.value === "json") && (this.#ae = r.value, this.#oe(e, n));
|
|
8135
|
-
}), i.appendChild(
|
|
8133
|
+
}), l.appendChild(u), i.appendChild(l), e.appendChild(i), this.#ae === "info") {
|
|
8136
8134
|
this.#_ = null;
|
|
8137
8135
|
let i = document.createElement("div");
|
|
8138
8136
|
i.className = "a2ui-map-detail";
|
|
@@ -8178,16 +8176,16 @@ var U = [
|
|
|
8178
8176
|
}
|
|
8179
8177
|
return;
|
|
8180
8178
|
}
|
|
8181
|
-
let
|
|
8182
|
-
|
|
8183
|
-
let
|
|
8184
|
-
|
|
8185
|
-
let
|
|
8186
|
-
|
|
8187
|
-
let
|
|
8188
|
-
|
|
8189
|
-
|
|
8190
|
-
}), e.appendChild(
|
|
8179
|
+
let p = document.createElement("div");
|
|
8180
|
+
p.className = "a2ui-map-editor-section";
|
|
8181
|
+
let m = document.createElement("n-toolbar");
|
|
8182
|
+
m.className = "a2ui-map-editor-toolbar";
|
|
8183
|
+
let h = document.createElement("n-button");
|
|
8184
|
+
h.setAttribute("variant", "ghost"), h.setAttribute("size", "sm"), h.title = "Apply changes to stream", h.innerHTML = "<n-icon name=\"play\" weight=\"fill\"></n-icon>", h.addEventListener("native:press", () => this.#le(t)), m.appendChild(h), p.appendChild(m);
|
|
8185
|
+
let g = document.createElement("native-codemirror");
|
|
8186
|
+
g.setAttribute("line-numbers", "false"), p.appendChild(g), this.#_ = g, requestAnimationFrame(() => {
|
|
8187
|
+
g.extensions = [E()], g.value = JSON.stringify(s, null, 2);
|
|
8188
|
+
}), e.appendChild(p);
|
|
8191
8189
|
}
|
|
8192
8190
|
/** Extract all component instances of a given A2UI type from the current envelopes. */
|
|
8193
8191
|
#ce(e) {
|
|
@@ -8314,7 +8312,7 @@ var U = [
|
|
|
8314
8312
|
let a = this.#p?.editorView;
|
|
8315
8313
|
if (a) {
|
|
8316
8314
|
let e = a.state.doc.lines;
|
|
8317
|
-
a.dispatch({ selection: { anchor: a.state.doc.line(e).from } }), a.dispatch({ effects:
|
|
8315
|
+
a.dispatch({ selection: { anchor: a.state.doc.line(e).from } }), a.dispatch({ effects: T.scrollIntoView(a.state.doc.line(e).from) });
|
|
8318
8316
|
}
|
|
8319
8317
|
};
|
|
8320
8318
|
#xe = () => {
|
|
@@ -9332,8 +9330,8 @@ function st(e) {
|
|
|
9332
9330
|
/**
|
|
9333
9331
|
* Stamped panel for the chat interface.
|
|
9334
9332
|
*
|
|
9335
|
-
* Creates `<
|
|
9336
|
-
* `<n-chat-content>`, and `<
|
|
9333
|
+
* Creates `<header>` (icon, title), `<section>` containing
|
|
9334
|
+
* `<n-chat-content>`, and `<footer>` with `<n-chat-input>` directly
|
|
9337
9335
|
* as children. The host element itself is the panel surface.
|
|
9338
9336
|
*
|
|
9339
9337
|
* ## Extension Points
|
|
@@ -9542,34 +9540,34 @@ var ct = class extends m {
|
|
|
9542
9540
|
}
|
|
9543
9541
|
setup() {
|
|
9544
9542
|
super.setup(), this.hasAttribute("open") && (this.#r.value = !0);
|
|
9545
|
-
let e = document.createElement("
|
|
9543
|
+
let e = document.createElement("header");
|
|
9546
9544
|
e.setAttribute("dividers", "");
|
|
9547
|
-
let t = document.createElement("n-icon");
|
|
9548
|
-
|
|
9549
|
-
let n = document.createElement("span");
|
|
9550
|
-
n.setAttribute("slot", "label"), n.textContent = "Assistant", e.appendChild(n);
|
|
9545
|
+
let t = document.createElement("nav"), n = document.createElement("n-icon");
|
|
9546
|
+
n.setAttribute("name", "chat-dots"), t.appendChild(n), e.appendChild(t);
|
|
9551
9547
|
let r = document.createElement("span");
|
|
9552
|
-
r.
|
|
9553
|
-
let i = document.createElement("
|
|
9554
|
-
|
|
9555
|
-
let s = document.createElement("n-
|
|
9556
|
-
s.setAttribute("
|
|
9557
|
-
let c = document.createElement("
|
|
9558
|
-
|
|
9559
|
-
let
|
|
9560
|
-
|
|
9561
|
-
let d = document.createElement("n-
|
|
9562
|
-
|
|
9563
|
-
let f = document.createElement("n-
|
|
9564
|
-
f.setAttribute("
|
|
9565
|
-
let p = document.createElement("n-
|
|
9566
|
-
p.setAttribute("
|
|
9567
|
-
let m = document.createElement("n-
|
|
9568
|
-
m.setAttribute("
|
|
9569
|
-
let h = document.createElement("n-
|
|
9570
|
-
h.setAttribute("
|
|
9571
|
-
let g = document.createElement("n-
|
|
9572
|
-
g.setAttribute("
|
|
9548
|
+
r.textContent = "Assistant", e.appendChild(r);
|
|
9549
|
+
let i = document.createElement("aside");
|
|
9550
|
+
i.className = "n-chat-panel-header-trailing", e.appendChild(i), this.#v = i;
|
|
9551
|
+
let a = document.createElement("section"), o = document.createElement("n-chat-content"), s = document.createElement("n-chat-feed");
|
|
9552
|
+
s.setAttribute("auto-scroll", ""), o.appendChild(s), this.#h = s, a.appendChild(o);
|
|
9553
|
+
let c = document.createElement("footer");
|
|
9554
|
+
c.setAttribute("dividers", ""), this.#m = c;
|
|
9555
|
+
let l = document.createElement("n-chat-input"), u = document.createElement("n-textarea");
|
|
9556
|
+
u.setAttribute("placeholder", "Ask anything"), u.setAttribute("autogrow", ""), u.setAttribute("rows", "3"), l.appendChild(u);
|
|
9557
|
+
let d = document.createElement("n-chat-input-actions");
|
|
9558
|
+
this.#y = d;
|
|
9559
|
+
let f = document.createElement("n-button");
|
|
9560
|
+
f.setAttribute("variant", "ghost"), f.setAttribute("inline", "");
|
|
9561
|
+
let p = document.createElement("n-icon");
|
|
9562
|
+
p.setAttribute("name", "plus"), f.appendChild(p), d.appendChild(f);
|
|
9563
|
+
let m = document.createElement("n-button");
|
|
9564
|
+
m.setAttribute("variant", "ghost"), m.setAttribute("inline", "");
|
|
9565
|
+
let h = document.createElement("n-icon");
|
|
9566
|
+
h.setAttribute("name", "microphone"), m.appendChild(h), d.appendChild(m);
|
|
9567
|
+
let g = document.createElement("n-button");
|
|
9568
|
+
g.setAttribute("variant", "primary"), g.setAttribute("intent", "accent"), g.setAttribute("radius", "round"), g.setAttribute("inline", ""), g.setAttribute("disabled", ""), g.dataset.submit = "", g.dataset.role = "submit";
|
|
9569
|
+
let _ = document.createElement("n-icon");
|
|
9570
|
+
_.setAttribute("name", "arrow-up"), g.appendChild(_), d.appendChild(g), l.appendChild(d), c.appendChild(l), this.append(e, a, c), this.addEffect(() => {
|
|
9573
9571
|
let e = this.#e.value;
|
|
9574
9572
|
if (e && !this.#g) {
|
|
9575
9573
|
let e = document.createElement("n-button");
|