@nonoun/native-chat 0.5.16 → 0.5.21
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 +51 -0
- package/dist/adapter-mock-DQ_CxuNu.js +845 -0
- package/dist/avatar/chat-avatar-element.d.ts +18 -0
- package/dist/avatar/chat-avatar-element.d.ts.map +1 -0
- package/dist/avatar/index.d.ts +2 -0
- package/dist/avatar/index.d.ts.map +1 -0
- package/dist/avatar/n-chat-avatar.d.ts +2 -0
- package/dist/avatar/n-chat-avatar.d.ts.map +1 -0
- package/dist/chat-input-element.d.ts +32 -0
- package/dist/chat-input-element.d.ts.map +1 -0
- package/dist/{chat-input-structured-element-C_5MDbpb.js → chat-input-structured-element-Xm4nCA2K.js} +508 -241
- package/dist/chat-panel-element.d.ts +100 -0
- package/dist/chat-panel-element.d.ts.map +1 -0
- package/dist/feed/chat-feed-element.d.ts +48 -0
- package/dist/feed/chat-feed-element.d.ts.map +1 -0
- package/dist/feed/index.d.ts +2 -0
- package/dist/feed/index.d.ts.map +1 -0
- package/dist/feed/n-chat-feed.d.ts +2 -0
- package/dist/feed/n-chat-feed.d.ts.map +1 -0
- package/dist/gateway/adapter-chatgpt.d.ts +67 -0
- package/dist/gateway/adapter-chatgpt.d.ts.map +1 -0
- package/dist/gateway/adapter-claude.d.ts +68 -0
- package/dist/gateway/adapter-claude.d.ts.map +1 -0
- package/dist/gateway/adapter-mock.d.ts +3 -0
- package/dist/gateway/adapter-mock.d.ts.map +1 -0
- package/dist/gateway/adapter.d.ts +71 -0
- package/dist/gateway/adapter.d.ts.map +1 -0
- package/dist/gateway/controller.d.ts +46 -0
- package/dist/gateway/controller.d.ts.map +1 -0
- package/dist/gateway/index.d.ts +10 -0
- package/dist/gateway/index.d.ts.map +1 -0
- package/dist/gateway/runtime.d.ts +53 -0
- package/dist/gateway/runtime.d.ts.map +1 -0
- package/dist/gateway/types.d.ts +73 -0
- package/dist/gateway/types.d.ts.map +1 -0
- package/dist/gateway.d.ts +2 -0
- package/dist/gateway.d.ts.map +1 -0
- package/dist/gateway.js +33 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/message/chat-input-structured-element.d.ts +43 -0
- package/dist/message/chat-input-structured-element.d.ts.map +1 -0
- package/dist/message/chat-message-activity-element.d.ts +32 -0
- package/dist/message/chat-message-activity-element.d.ts.map +1 -0
- package/dist/message/chat-message-element.d.ts +44 -0
- package/dist/message/chat-message-element.d.ts.map +1 -0
- package/dist/message/chat-message-genui-element.d.ts +45 -0
- package/dist/message/chat-message-genui-element.d.ts.map +1 -0
- package/dist/message/chat-message-seed-element.d.ts +33 -0
- package/dist/message/chat-message-seed-element.d.ts.map +1 -0
- package/dist/message/chat-message-text-element.d.ts +37 -0
- package/dist/message/chat-message-text-element.d.ts.map +1 -0
- package/dist/message/chat-messages-element.d.ts +39 -0
- package/dist/message/chat-messages-element.d.ts.map +1 -0
- package/dist/message/index.d.ts +8 -0
- package/dist/message/index.d.ts.map +1 -0
- package/dist/message/n-chat-message.d.ts +2 -0
- package/dist/message/n-chat-message.d.ts.map +1 -0
- package/dist/native-chat.css +116 -48
- package/dist/native-chat.js +1 -1
- package/dist/register.d.ts +13 -0
- package/dist/register.d.ts.map +1 -0
- package/dist/register.js +3 -3
- package/dist/stream/classify.d.ts +19 -0
- package/dist/stream/classify.d.ts.map +1 -0
- package/dist/stream/create-transport.d.ts +19 -0
- package/dist/stream/create-transport.d.ts.map +1 -0
- package/dist/stream/index.d.ts +9 -0
- package/dist/stream/index.d.ts.map +1 -0
- package/dist/stream/parse-json.d.ts +9 -0
- package/dist/stream/parse-json.d.ts.map +1 -0
- package/dist/stream/parse-ndjson.d.ts +9 -0
- package/dist/stream/parse-ndjson.d.ts.map +1 -0
- package/dist/stream/parse-sse.d.ts +9 -0
- package/dist/stream/parse-sse.d.ts.map +1 -0
- package/dist/stream/types.d.ts +42 -0
- package/dist/stream/types.d.ts.map +1 -0
- package/dist/telemetry/emitter.d.ts +20 -0
- package/dist/telemetry/emitter.d.ts.map +1 -0
- package/dist/telemetry/events.d.ts +11 -0
- package/dist/telemetry/events.d.ts.map +1 -0
- package/dist/telemetry/index.d.ts +5 -0
- package/dist/telemetry/index.d.ts.map +1 -0
- package/dist/telemetry/redactor.d.ts +17 -0
- package/dist/telemetry/redactor.d.ts.map +1 -0
- package/dist/telemetry/types.d.ts +27 -0
- package/dist/telemetry/types.d.ts.map +1 -0
- package/package.json +5 -1
package/dist/gateway.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { a as e, c as t, d as n, f as r, h as i, i as a, l as o, m as s, n as c, o as l, p as u, r as d, s as f, t as p, u as m } from "./adapter-mock-DQ_CxuNu.js";
|
|
2
|
+
function h(e) {
|
|
3
|
+
return typeof e == "object" && !!e && "kind" in e && "message" in e;
|
|
4
|
+
}
|
|
5
|
+
var g = class {
|
|
6
|
+
adapter;
|
|
7
|
+
capabilities;
|
|
8
|
+
constructor(e, t) {
|
|
9
|
+
this.adapter = e, this.capabilities = t;
|
|
10
|
+
}
|
|
11
|
+
bootstrapSession(e) {
|
|
12
|
+
return this.adapter.bootstrapSession(e);
|
|
13
|
+
}
|
|
14
|
+
sendMessage(e) {
|
|
15
|
+
return this.adapter.sendMessage(e);
|
|
16
|
+
}
|
|
17
|
+
sendMessageStream(e) {
|
|
18
|
+
return this.adapter.sendMessageStream(e);
|
|
19
|
+
}
|
|
20
|
+
checkHealth(e) {
|
|
21
|
+
return this.adapter.checkHealth(e);
|
|
22
|
+
}
|
|
23
|
+
getClientMetadata(e) {
|
|
24
|
+
return this.adapter.getClientMetadata(e);
|
|
25
|
+
}
|
|
26
|
+
listModels(e) {
|
|
27
|
+
return this.adapter.listModels ? this.adapter.listModels(e) : Promise.resolve([]);
|
|
28
|
+
}
|
|
29
|
+
getCapabilities() {
|
|
30
|
+
return this.capabilities;
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
export { c as ClaudeGatewayAdapter, t as DEFAULT_REQUEST_TIMEOUT_MS, o as DEFAULT_RETRY_DELAYS_MS, m as GatewayRequestError, g as LLMGatewayController, g as GatewayController, g as ChatGatewayController, e as OpenAiGatewayAdapter, n as classifyByStatus, d as createClaudeGatewayAdapter, p as createMockGatewayAdapter, l as createOpenAiGatewayAdapter, r as createRequestId, u as fetchWithRetry, h as isGatewayErrorLike, s as parseJsonResponse, i as parseSseEvent, a as validateClaudeGatewayConfig, f as validateOpenAiGatewayConfig };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import './register.ts';
|
|
2
|
+
export { NChatInput } from './chat-input-element.ts';
|
|
3
|
+
export { NChatPanel } from './chat-panel-element.ts';
|
|
4
|
+
export type { AutoFocusPolicy, ChatPanelOpenOptions, FocusComposerOptions, ModelOption } from './chat-panel-element.ts';
|
|
5
|
+
export { NChatFeed } from './feed/index.ts';
|
|
6
|
+
export { NChatAvatar } from './avatar/index.ts';
|
|
7
|
+
export { NChatMessage, NChatMessages, NChatMessageText, NChatMessageActivity, NChatMessageSeed, NChatMessageGenUI, NChatInputStructured, } from './message/index.ts';
|
|
8
|
+
export type { ChatMessageActionDef } from './message/chat-message-element.ts';
|
|
9
|
+
export { ACTION_REGISTRY, ROLE_DEFAULTS } from './message/chat-message-element.ts';
|
|
10
|
+
export type { SeedOption } from './message/chat-message-seed-element.ts';
|
|
11
|
+
export type { StructuredOption } from './message/chat-input-structured-element.ts';
|
|
12
|
+
export type { GenUINode } from './message/chat-message-genui-element.ts';
|
|
13
|
+
export { renderMarkdown, renderInline, sanitizeHtml } from './message/chat-message-text-element.ts';
|
|
14
|
+
export type { ChatStreamChunk, StreamFormat, ChatTransportOptions, ChatStreamEvent, ChatTransport, TransportState, TransportStatus, TransportStateCallback, RetryOptions, StreamEndReason, } from './stream/index.ts';
|
|
15
|
+
export { parseSSE, parseNDJSON, parseJSON, detectFormat, createChatStream, createChatTransport, classifyStreamEnd, classifyHttpError, backoffDelay, } from './stream/index.ts';
|
|
16
|
+
export type { TelemetryCorrelation, TelemetryTiming, TelemetryRetry, TelemetryLevel, TelemetryEvent, TelemetryRedactor, } from './telemetry/index.ts';
|
|
17
|
+
export { CHAT_EVENTS, SAFE_FIELDS, SENSITIVE_FIELDS, scrubPII, createDefaultRedactor, TelemetryEmitter, } from './telemetry/index.ts';
|
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,CAAC;AAGvB,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,YAAY,EAAE,eAAe,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAGxH,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAG5C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGhD,OAAO,EACL,YAAY,EACZ,aAAa,EACb,gBAAgB,EAChB,oBAAoB,EACpB,gBAAgB,EAChB,iBAAiB,EACjB,oBAAoB,GACrB,MAAM,oBAAoB,CAAC;AAG5B,YAAY,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AAC9E,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAGnF,YAAY,EAAE,UAAU,EAAE,MAAM,wCAAwC,CAAC;AACzE,YAAY,EAAE,gBAAgB,EAAE,MAAM,4CAA4C,CAAC;AACnF,YAAY,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAGzE,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAC;AAGpG,YAAY,EACV,eAAe,EACf,YAAY,EACZ,oBAAoB,EACpB,eAAe,EACf,aAAa,EACb,cAAc,EACd,eAAe,EACf,sBAAsB,EACtB,YAAY,EACZ,eAAe,GAChB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,QAAQ,EACR,WAAW,EACX,SAAS,EACT,YAAY,EACZ,gBAAgB,EAChB,mBAAmB,EACnB,iBAAiB,EACjB,iBAAiB,EACjB,YAAY,GACb,MAAM,mBAAmB,CAAC;AAG3B,YAAY,EACV,oBAAoB,EACpB,eAAe,EACf,cAAc,EACd,cAAc,EACd,cAAc,EACd,iBAAiB,GAClB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,WAAW,EACX,WAAW,EACX,gBAAgB,EAChB,QAAQ,EACR,qBAAqB,EACrB,gBAAgB,GACjB,MAAM,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { NativeElement } from '@nonoun/native-ui';
|
|
2
|
+
export interface StructuredOption {
|
|
3
|
+
value: string;
|
|
4
|
+
label: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
icon?: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Structured multi-choice input — appears before submission for
|
|
10
|
+
* guided input (like modern Claude chat's multiple-choice UI).
|
|
11
|
+
*
|
|
12
|
+
* ```html
|
|
13
|
+
* <n-chat-input-structured
|
|
14
|
+
* question="What would you like to do?"
|
|
15
|
+
* type="single"
|
|
16
|
+
* options='[{"value":"a","label":"Option A"},{"value":"b","label":"Option B"}]'>
|
|
17
|
+
* </n-chat-input-structured>
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
* @attr {string} question - Prompt text
|
|
21
|
+
* @attr {string} type - `single` (default) | `multi`
|
|
22
|
+
* @attr {string} options - JSON array of `{ value, label, description?, icon? }`
|
|
23
|
+
* @attr {boolean} required - At least one selection required before submit
|
|
24
|
+
* @attr {boolean} disabled - Disables interaction
|
|
25
|
+
* @fires native:structured-submit - Fired on submit with selections
|
|
26
|
+
* @fires native:structured-cancel - Fired when dismissed without selecting
|
|
27
|
+
*/
|
|
28
|
+
export declare class NChatInputStructured extends NativeElement {
|
|
29
|
+
#private;
|
|
30
|
+
static observedAttributes: string[];
|
|
31
|
+
constructor();
|
|
32
|
+
get question(): string;
|
|
33
|
+
set question(val: string);
|
|
34
|
+
get options(): StructuredOption[];
|
|
35
|
+
set options(val: StructuredOption[]);
|
|
36
|
+
get selections(): StructuredOption[];
|
|
37
|
+
get disabled(): boolean;
|
|
38
|
+
set disabled(val: boolean);
|
|
39
|
+
attributeChangedCallback(name: string, old: string | null, val: string | null): void;
|
|
40
|
+
setup(): void;
|
|
41
|
+
teardown(): void;
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=chat-input-structured-element.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-input-structured-element.d.ts","sourceRoot":"","sources":["../../src/message/chat-input-structured-element.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAgC,MAAM,mBAAmB,CAAC;AAEhF,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,qBAAa,oBAAqB,SAAQ,aAAa;;IACrD,MAAM,CAAC,kBAAkB,WAA2D;;IAiBpF,IAAI,QAAQ,IAAI,MAAM,CAAiC;IACvD,IAAI,QAAQ,CAAC,GAAG,EAAE,MAAM,EAGvB;IAED,IAAI,OAAO,IAAI,gBAAgB,EAAE,CAAgC;IACjE,IAAI,OAAO,CAAC,GAAG,EAAE,gBAAgB,EAAE,EAGlC;IAED,IAAI,UAAU,IAAI,gBAAgB,EAAE,CAGnC;IAED,IAAI,QAAQ,IAAI,OAAO,CAAiC;IACxD,IAAI,QAAQ,CAAC,GAAG,EAAE,OAAO,EAGxB;IAID,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAiBpF,KAAK,IAAI,IAAI;IAkCb,QAAQ,IAAI,IAAI;CA4HjB"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { NativeElement } from '@nonoun/native-ui';
|
|
2
|
+
/**
|
|
3
|
+
* Streaming activity indicator — typing, thinking, or tool-use status.
|
|
4
|
+
*
|
|
5
|
+
* When `active`, shows an animated indicator with elapsed time.
|
|
6
|
+
* When `expandable`, clicking toggles visibility of slotted trace content.
|
|
7
|
+
*
|
|
8
|
+
* ```html
|
|
9
|
+
* <n-chat-message-activity type="thinking" active>
|
|
10
|
+
* <pre>Reasoning trace here...</pre>
|
|
11
|
+
* </n-chat-message-activity>
|
|
12
|
+
* ```
|
|
13
|
+
*
|
|
14
|
+
* @attr {string} type - `typing` | `thinking` | `tool-use`
|
|
15
|
+
* @attr {string} label - Custom label text (overrides default per-type label)
|
|
16
|
+
* @attr {boolean} active - Currently streaming / in progress
|
|
17
|
+
* @attr {boolean} expandable - Allow click to expand trace content
|
|
18
|
+
* @fires native:activity-toggle - Fired when trace is expanded/collapsed
|
|
19
|
+
*/
|
|
20
|
+
export declare class NChatMessageActivity extends NativeElement {
|
|
21
|
+
#private;
|
|
22
|
+
static observedAttributes: string[];
|
|
23
|
+
constructor();
|
|
24
|
+
get active(): boolean;
|
|
25
|
+
set active(val: boolean);
|
|
26
|
+
get expanded(): boolean;
|
|
27
|
+
set expanded(val: boolean);
|
|
28
|
+
attributeChangedCallback(name: string, old: string | null, val: string | null): void;
|
|
29
|
+
setup(): void;
|
|
30
|
+
teardown(): void;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=chat-message-activity-element.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-message-activity-element.d.ts","sourceRoot":"","sources":["../../src/message/chat-message-activity-element.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAU,MAAM,mBAAmB,CAAC;AAE1D;;;;;;;;;;;;;;;;;GAiBG;AACH,qBAAa,oBAAqB,SAAQ,aAAa;;IACrD,MAAM,CAAC,kBAAkB,WAA6C;;IAsBtE,IAAI,MAAM,IAAI,OAAO,CAA+B;IACpD,IAAI,MAAM,CAAC,GAAG,EAAE,OAAO,EAGtB;IAED,IAAI,QAAQ,IAAI,OAAO,CAAiC;IACxD,IAAI,QAAQ,CAAC,GAAG,EAAE,OAAO,EAGxB;IAID,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAapF,KAAK,IAAI,IAAI;IAyCb,QAAQ,IAAI,IAAI;CAoFjB"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { NativeElement } from '@nonoun/native-ui';
|
|
2
|
+
export interface ChatMessageActionDef {
|
|
3
|
+
label: string;
|
|
4
|
+
icon: string;
|
|
5
|
+
}
|
|
6
|
+
export declare const ACTION_REGISTRY: Record<string, ChatMessageActionDef>;
|
|
7
|
+
export declare const ROLE_DEFAULTS: Record<string, string[]>;
|
|
8
|
+
/**
|
|
9
|
+
* Individual chat message bubble.
|
|
10
|
+
*
|
|
11
|
+
* Accepts slotted content: `n-chat-message-text`, `n-chat-message-genui`,
|
|
12
|
+
* `n-chat-message-seed`, or any custom content.
|
|
13
|
+
*
|
|
14
|
+
* @attr {string} role - `user` | `assistant` | `system`
|
|
15
|
+
* @attr {string} message-id - Unique message identifier
|
|
16
|
+
* @attr {string} timestamp - Epoch milliseconds
|
|
17
|
+
* @attr {string} status - `sending` | `sent` | `error` | `streaming` | `partial`
|
|
18
|
+
* @attr {string} actions - Comma-separated action list, or `"none"` to suppress
|
|
19
|
+
* @attr {string} actions-style - `"icon"` (default) | `"label"` | `"icon-label"`
|
|
20
|
+
* @attr {string} actions-position - `"below"` (default) | `"inside"` — toolbar placement
|
|
21
|
+
* @fires native:message-action - Fired when an action button is clicked
|
|
22
|
+
* @fires native:continue-request - Fired when continue is requested for a partial message
|
|
23
|
+
*/
|
|
24
|
+
export declare class NChatMessage extends NativeElement {
|
|
25
|
+
#private;
|
|
26
|
+
static observedAttributes: string[];
|
|
27
|
+
constructor();
|
|
28
|
+
get role(): string;
|
|
29
|
+
set role(val: string);
|
|
30
|
+
get messageId(): string;
|
|
31
|
+
get timestamp(): number;
|
|
32
|
+
get status(): string;
|
|
33
|
+
set status(val: string);
|
|
34
|
+
get actions(): string | null;
|
|
35
|
+
set actions(val: string | null);
|
|
36
|
+
get actionsStyle(): string;
|
|
37
|
+
set actionsStyle(val: string);
|
|
38
|
+
get actionsPosition(): string;
|
|
39
|
+
set actionsPosition(val: string);
|
|
40
|
+
attributeChangedCallback(name: string, old: string | null, val: string | null): void;
|
|
41
|
+
setup(): void;
|
|
42
|
+
teardown(): void;
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=chat-message-element.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-message-element.d.ts","sourceRoot":"","sources":["../../src/message/chat-message-element.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAe,MAAM,mBAAmB,CAAC;AAI/D,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CACd;AAED,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAOhE,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAGlD,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,YAAa,SAAQ,aAAa;;IAC7C,MAAM,CAAC,kBAAkB,WAAsG;;IAoB/H,IAAI,IAAI,IAAI,MAAM,CAA6B;IAC/C,IAAI,IAAI,CAAC,GAAG,EAAE,MAAM,EAGnB;IAED,IAAI,SAAS,IAAI,MAAM,CAAkD;IAEzE,IAAI,SAAS,IAAI,MAAM,CAAwD;IAE/E,IAAI,MAAM,IAAI,MAAM,CAA+B;IACnD,IAAI,MAAM,CAAC,GAAG,EAAE,MAAM,EAGrB;IAED,IAAI,OAAO,IAAI,MAAM,GAAG,IAAI,CAAgC;IAC5D,IAAI,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,EAO7B;IAED,IAAI,YAAY,IAAI,MAAM,CAAqC;IAC/D,IAAI,YAAY,CAAC,GAAG,EAAE,MAAM,EAG3B;IAED,IAAI,eAAe,IAAI,MAAM,CAAwC;IACrE,IAAI,eAAe,CAAC,GAAG,EAAE,MAAM,EAG9B;IAID,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAcpF,KAAK,IAAI,IAAI;IAqBb,QAAQ,IAAI,IAAI;CAoJjB"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { NativeElement } from '@nonoun/native-ui';
|
|
2
|
+
/** Minimal UINode shape for schema-driven rendering. */
|
|
3
|
+
export interface GenUINode {
|
|
4
|
+
tag: string;
|
|
5
|
+
id?: string;
|
|
6
|
+
attributes?: Record<string, string>;
|
|
7
|
+
properties?: Record<string, unknown>;
|
|
8
|
+
children?: GenUINode[];
|
|
9
|
+
text?: string;
|
|
10
|
+
slot?: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* GenUI message card — renders UI from a schema (A2UI, MCPUI, etc).
|
|
14
|
+
*
|
|
15
|
+
* Validates the schema before rendering. Forbidden tags are rejected.
|
|
16
|
+
*
|
|
17
|
+
* ```html
|
|
18
|
+
* <n-chat-message-genui schema-type="a2ui" mode="inline"></n-chat-message-genui>
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* Set the schema via property:
|
|
22
|
+
* ```js
|
|
23
|
+
* el.schema = { tag: 'n-card', children: [{ tag: 'p', text: 'Hello' }] };
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* @attr {string} schema-type - `a2ui` | `mcpui`
|
|
27
|
+
* @attr {string} mode - `inline` (default) | `lightbox`
|
|
28
|
+
* @fires native:genui-action - Fired when an action occurs within the rendered UI
|
|
29
|
+
* @fires native:genui-error - Fired when schema validation fails
|
|
30
|
+
*/
|
|
31
|
+
export declare class NChatMessageGenUI extends NativeElement {
|
|
32
|
+
#private;
|
|
33
|
+
static observedAttributes: string[];
|
|
34
|
+
constructor();
|
|
35
|
+
get schema(): GenUINode | null;
|
|
36
|
+
set schema(val: GenUINode | null);
|
|
37
|
+
get schemaType(): string;
|
|
38
|
+
set schemaType(val: string);
|
|
39
|
+
get mode(): 'inline' | 'lightbox';
|
|
40
|
+
set mode(val: 'inline' | 'lightbox');
|
|
41
|
+
attributeChangedCallback(name: string, old: string | null, val: string | null): void;
|
|
42
|
+
setup(): void;
|
|
43
|
+
teardown(): void;
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=chat-message-genui-element.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-message-genui-element.d.ts","sourceRoot":"","sources":["../../src/message/chat-message-genui-element.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAU,MAAM,mBAAmB,CAAC;AAE1D,wDAAwD;AACxD,MAAM,WAAW,SAAS;IACxB,GAAG,EAAE,MAAM,CAAC;IACZ,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrC,QAAQ,CAAC,EAAE,SAAS,EAAE,CAAC;IACvB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAQD;;;;;;;;;;;;;;;;;;GAkBG;AACH,qBAAa,iBAAkB,SAAQ,aAAa;;IAClD,MAAM,CAAC,kBAAkB,WAA2B;;IAgBpD,IAAI,MAAM,IAAI,SAAS,GAAG,IAAI,CAA+B;IAC7D,IAAI,MAAM,CAAC,GAAG,EAAE,SAAS,GAAG,IAAI,EAE/B;IAED,IAAI,UAAU,IAAI,MAAM,CAAmC;IAC3D,IAAI,UAAU,CAAC,GAAG,EAAE,MAAM,EAGzB;IAED,IAAI,IAAI,IAAI,QAAQ,GAAG,UAAU,CAA6B;IAC9D,IAAI,IAAI,CAAC,GAAG,EAAE,QAAQ,GAAG,UAAU,EAGlC;IAID,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAWpF,KAAK,IAAI,IAAI;IA0Cb,QAAQ,IAAI,IAAI;CAwFjB"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { NativeElement } from '@nonoun/native-ui';
|
|
2
|
+
export interface SeedOption {
|
|
3
|
+
value: string;
|
|
4
|
+
label: string;
|
|
5
|
+
icon?: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Suggestion chips — pre-seeded quick responses.
|
|
9
|
+
*
|
|
10
|
+
* Options can be provided as JSON attribute or via the `options` property.
|
|
11
|
+
*
|
|
12
|
+
* ```html
|
|
13
|
+
* <n-chat-message-seed options='[{"value":"yes","label":"Yes"},{"value":"no","label":"No"}]'>
|
|
14
|
+
* </n-chat-message-seed>
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* @attr {string} options - JSON array of `{ value, label, icon? }`
|
|
18
|
+
* @attr {boolean} disabled - Disables all chips
|
|
19
|
+
* @fires native:seed-select - Fired when a chip is clicked
|
|
20
|
+
*/
|
|
21
|
+
export declare class NChatMessageSeed extends NativeElement {
|
|
22
|
+
#private;
|
|
23
|
+
static observedAttributes: string[];
|
|
24
|
+
constructor();
|
|
25
|
+
get options(): SeedOption[];
|
|
26
|
+
set options(val: SeedOption[]);
|
|
27
|
+
get disabled(): boolean;
|
|
28
|
+
set disabled(val: boolean);
|
|
29
|
+
attributeChangedCallback(name: string, old: string | null, val: string | null): void;
|
|
30
|
+
setup(): void;
|
|
31
|
+
teardown(): void;
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=chat-message-seed-element.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-message-seed-element.d.ts","sourceRoot":"","sources":["../../src/message/chat-message-seed-element.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAgC,MAAM,mBAAmB,CAAC;AAEhF,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;;;;;;;;;;;GAaG;AACH,qBAAa,gBAAiB,SAAQ,aAAa;;IACjD,MAAM,CAAC,kBAAkB,WAA2B;;IAapD,IAAI,OAAO,IAAI,UAAU,EAAE,CAAgC;IAC3D,IAAI,OAAO,CAAC,GAAG,EAAE,UAAU,EAAE,EAG5B;IAED,IAAI,QAAQ,IAAI,OAAO,CAAiC;IACxD,IAAI,QAAQ,CAAC,GAAG,EAAE,OAAO,EAGxB;IAID,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAgBpF,KAAK,IAAI,IAAI;IAyCb,QAAQ,IAAI,IAAI;CAsBjB"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { NativeElement } from '@nonoun/native-ui';
|
|
2
|
+
/**
|
|
3
|
+
* Rich text message renderer with lightweight markdown support.
|
|
4
|
+
*
|
|
5
|
+
* Renders a markdown subset (paragraphs, headings, lists, code fences,
|
|
6
|
+
* inline code, bold, italic, links, blockquotes) to sanitized HTML.
|
|
7
|
+
*
|
|
8
|
+
* ```html
|
|
9
|
+
* <n-chat-message-text format="markdown">
|
|
10
|
+
* Hello **world**!
|
|
11
|
+
* </n-chat-message-text>
|
|
12
|
+
* ```
|
|
13
|
+
*
|
|
14
|
+
* Or set content via property:
|
|
15
|
+
* ```js
|
|
16
|
+
* el.content = '# Title\nSome **bold** text';
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* @attr {string} format - `markdown` (default) | `plain`
|
|
20
|
+
*/
|
|
21
|
+
export declare class NChatMessageText extends NativeElement {
|
|
22
|
+
#private;
|
|
23
|
+
static observedAttributes: string[];
|
|
24
|
+
get content(): string;
|
|
25
|
+
set content(val: string);
|
|
26
|
+
get format(): 'markdown' | 'plain';
|
|
27
|
+
set format(val: 'markdown' | 'plain');
|
|
28
|
+
attributeChangedCallback(name: string, old: string | null, val: string | null): void;
|
|
29
|
+
setup(): void;
|
|
30
|
+
teardown(): void;
|
|
31
|
+
}
|
|
32
|
+
declare function renderInline(text: string): string;
|
|
33
|
+
declare function renderMarkdown(src: string): string;
|
|
34
|
+
/** Sanitize rendered HTML — strip any tags not in allowlist. */
|
|
35
|
+
export declare function sanitizeHtml(html: string): string;
|
|
36
|
+
export { renderMarkdown, renderInline };
|
|
37
|
+
//# sourceMappingURL=chat-message-text-element.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-message-text-element.d.ts","sourceRoot":"","sources":["../../src/message/chat-message-text-element.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAU,MAAM,mBAAmB,CAAC;AAE1D;;;;;;;;;;;;;;;;;;GAkBG;AACH,qBAAa,gBAAiB,SAAQ,aAAa;;IACjD,MAAM,CAAC,kBAAkB,WAAc;IASvC,IAAI,OAAO,IAAI,MAAM,CAAgC;IACrD,IAAI,OAAO,CAAC,GAAG,EAAE,MAAM,EAEtB;IAED,IAAI,MAAM,IAAI,UAAU,GAAG,OAAO,CAA+B;IACjE,IAAI,MAAM,CAAC,GAAG,EAAE,UAAU,GAAG,OAAO,EAGnC;IAID,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAUpF,KAAK,IAAI,IAAI;IAoCb,QAAQ,IAAI,IAAI;CAKjB;AAuBD,iBAAS,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAmB1C;AAED,iBAAS,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CA4F3C;AAED,gEAAgE;AAChE,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAOjD;AAED,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { NativeElement } from '@nonoun/native-ui';
|
|
2
|
+
/**
|
|
3
|
+
* Message group — cluster of messages from the same sender.
|
|
4
|
+
*
|
|
5
|
+
* Provides a 2×2 grid layout:
|
|
6
|
+
* - Col 1, row 1–2: avatar (bottom-aligned)
|
|
7
|
+
* - Col 2, row 1: context area (metadata, reasoning, timestamps)
|
|
8
|
+
* - Col 2, row 2: messages area (chat bubbles, flex column)
|
|
9
|
+
*
|
|
10
|
+
* On setup, non-avatar children are sorted into two wrapper divs:
|
|
11
|
+
* - `.n-chat-context` — non-message children (row 1)
|
|
12
|
+
* - `.n-chat-bubbles` — `n-chat-message` children (row 2)
|
|
13
|
+
*
|
|
14
|
+
* A MutationObserver routes dynamically added children into the
|
|
15
|
+
* correct wrapper automatically.
|
|
16
|
+
*
|
|
17
|
+
* ```html
|
|
18
|
+
* <n-chat-messages role="assistant" sender="AI">
|
|
19
|
+
* <n-chat-avatar>AI</n-chat-avatar>
|
|
20
|
+
* <span class="reasoning">Thinking...</span>
|
|
21
|
+
* <n-chat-message role="assistant">
|
|
22
|
+
* <n-chat-message-text>Hello!</n-chat-message-text>
|
|
23
|
+
* </n-chat-message>
|
|
24
|
+
* </n-chat-messages>
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* @attr {string} role - `user` | `assistant` | `system`
|
|
28
|
+
* @attr {string} sender - Display name of the sender
|
|
29
|
+
* @attr {string} avatar-align - `"top"` | `"center"` | `"bottom"` (default) — avatar vertical alignment
|
|
30
|
+
*/
|
|
31
|
+
export declare class NChatMessages extends NativeElement {
|
|
32
|
+
#private;
|
|
33
|
+
static observedAttributes: string[];
|
|
34
|
+
constructor();
|
|
35
|
+
attributeChangedCallback(name: string, old: string | null, val: string | null): void;
|
|
36
|
+
setup(): void;
|
|
37
|
+
teardown(): void;
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=chat-messages-element.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-messages-element.d.ts","sourceRoot":"","sources":["../../src/message/chat-messages-element.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,qBAAa,aAAc,SAAQ,aAAa;;IAC9C,MAAM,CAAC,kBAAkB,WAA2C;;IAYpE,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAKpF,KAAK,IAAI,IAAI;IA8Bb,QAAQ,IAAI,IAAI;CA4CjB"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { NChatMessage } from './chat-message-element.ts';
|
|
2
|
+
export { NChatMessages } from './chat-messages-element.ts';
|
|
3
|
+
export { NChatMessageText } from './chat-message-text-element.ts';
|
|
4
|
+
export { NChatMessageActivity } from './chat-message-activity-element.ts';
|
|
5
|
+
export { NChatMessageSeed } from './chat-message-seed-element.ts';
|
|
6
|
+
export { NChatMessageGenUI } from './chat-message-genui-element.ts';
|
|
7
|
+
export { NChatInputStructured } from './chat-input-structured-element.ts';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/message/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"n-chat-message.d.ts","sourceRoot":"","sources":["../../src/message/n-chat-message.ts"],"names":[],"mappings":""}
|