@m6d/cortex-angular 0.7.0 → 0.8.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@m6d/cortex-angular",
3
- "version": "0.7.0",
3
+ "version": "0.8.0",
4
4
  "description": "Reusable AI agent chat UI library for Angular",
5
5
  "license": "MIT",
6
6
  "sideEffects": false,
package/theme.css CHANGED
@@ -63,6 +63,15 @@
63
63
  );
64
64
  --cortex-font-size: 0.8125rem;
65
65
 
66
+ /* These read --cortex-font-size (or the color named) when unset, so they ship
67
+ * unset: declaring one here gives that part its own value.
68
+ *
69
+ * --cortex-font-size-message: 0.875rem; message bubbles and the composer
70
+ * --cortex-font-size-header: 0.875rem; the chat and history titles
71
+ * --cortex-color-send-empty: transparent; the send button with nothing to send
72
+ * --cortex-color-send-empty-text: var(--cortex-color-text-muted);
73
+ */
74
+
66
75
  /* The widget's headings read --cortex-font-display and fall back to `inherit`,
67
76
  * so it ships unset on purpose — declaring it here is how you opt in:
68
77
  *
@@ -1,7 +1,7 @@
1
1
  // Generated by dts-bundle-generator v9.5.1
2
2
 
3
3
  import * as i0 from '@angular/core';
4
- import { Injector, OnInit, Signal, Type } from '@angular/core';
4
+ import { Injector, OnInit, Signal, TemplateRef, Type } from '@angular/core';
5
5
  import { ToolCallPart, UIMessage } from '@tanstack/ai';
6
6
  import { Observable } from 'rxjs';
7
7
 
@@ -92,6 +92,31 @@ export type MediaRenderers = Partial<Record<string, MediaRenderer>>;
92
92
  export type Localized<T> = T | Partial<Record<Locale, T>>;
93
93
  export type CortexViewMode = "helper" | "full";
94
94
  export type CortexTheme = "light" | "dark" | "system";
95
+ /**
96
+ * What a host's own header receives in place of the widget's: where the
97
+ * widget is, what to show, and the actions the default header offers. One
98
+ * header serves both screens; `screen` says which is showing.
99
+ */
100
+ export type CortexHeaderContext = {
101
+ screen: "chat" | "threads";
102
+ viewMode: CortexViewMode;
103
+ /** The open thread's title; null on a new chat. */
104
+ title: string | null;
105
+ /** `agentName` in the widget's locale. */
106
+ agentName: string | undefined;
107
+ isWorking: boolean;
108
+ /** Whether the host enabled the debug switch, and whether it is on. */
109
+ debug: {
110
+ shown: boolean;
111
+ on: boolean;
112
+ };
113
+ newChat: () => void;
114
+ /** Shows the history: the history screen, or in full mode the sidebar where it is hidden. */
115
+ openHistory: () => void;
116
+ /** Returns to the open chat from wherever `openHistory` went. */
117
+ closeHistory: () => void;
118
+ toggleDebug: () => void;
119
+ };
95
120
  export type CortexToolCallContext = {
96
121
  threadId: string;
97
122
  };
@@ -315,19 +340,72 @@ declare class CortexChatService {
315
340
  static ɵfac: i0.ɵɵFactoryDeclaration<CortexChatService, never>;
316
341
  static ɵprov: i0.ɵɵInjectableDeclaration<any>;
317
342
  }
343
+ export type HeaderTemplateContext = {
344
+ $implicit: CortexHeaderContext;
345
+ };
346
+ /**
347
+ * Marks the host's own header for `<cortex-chat-widget>`. When present it
348
+ * replaces the default header on both the chat and the history screen, and
349
+ * receives the widget's state and actions as its context:
350
+ *
351
+ * <cortex-chat-widget [config]="config">
352
+ * <ng-template cortexHeader let-chat>
353
+ * <div class="cortex-widget__chat-header">{{ chat.title ?? chat.agentName }}</div>
354
+ * </ng-template>
355
+ * </cortex-chat-widget>
356
+ */
357
+ export declare class CortexHeaderDirective {
358
+ readonly template: TemplateRef<HeaderTemplateContext>;
359
+ static ngTemplateContextGuard(_directive: CortexHeaderDirective, _context: unknown): _context is HeaderTemplateContext;
360
+ static ɵfac: i0.ɵɵFactoryDeclaration<CortexHeaderDirective, never>;
361
+ static ɵdir: i0.ɵɵDirectiveDeclaration<CortexHeaderDirective, "ng-template[cortexHeader]", never, {}, {}, never, never, true, never>;
362
+ }
318
363
  /** The chat widget: the thread list, the open conversation and its composer, for the agent `config` points at. */
319
364
  export declare class CortexChatWidgetComponent implements OnInit {
320
365
  readonly config: import("@angular/core").InputSignal<CortexAngularConfig>;
321
366
  protected readonly debugMode: import("@angular/core").WritableSignal<boolean>;
322
- protected readonly screen: import("@angular/core").WritableSignal<"threads" | "chat">;
367
+ protected readonly screen: import("@angular/core").WritableSignal<"chat" | "threads">;
323
368
  protected readonly sidebarOpen: import("@angular/core").WritableSignal<boolean>;
324
369
  protected readonly viewMode: import("@angular/core").Signal<CortexViewMode>;
325
370
  private readonly composer;
371
+ /** The host's own header, if it gave one; it replaces the default on both screens. */
372
+ protected readonly customHeader: import("@angular/core").Signal<CortexHeaderDirective | undefined>;
373
+ protected readonly chatHeader: import("@angular/core").Signal<{
374
+ screen: "chat" | "threads";
375
+ viewMode: CortexViewMode;
376
+ title: string | null;
377
+ agentName: string | undefined;
378
+ isWorking: boolean;
379
+ debug: {
380
+ shown: boolean;
381
+ on: boolean;
382
+ };
383
+ newChat: () => void;
384
+ openHistory: () => void;
385
+ closeHistory: () => void;
386
+ toggleDebug: () => void;
387
+ }>;
388
+ protected readonly threadsHeader: import("@angular/core").Signal<{
389
+ screen: "chat" | "threads";
390
+ viewMode: CortexViewMode;
391
+ title: string | null;
392
+ agentName: string | undefined;
393
+ isWorking: boolean;
394
+ debug: {
395
+ shown: boolean;
396
+ on: boolean;
397
+ };
398
+ newChat: () => void;
399
+ openHistory: () => void;
400
+ closeHistory: () => void;
401
+ toggleDebug: () => void;
402
+ }>;
326
403
  protected chatService: CortexChatService;
327
404
  protected queue: AttachmentQueueService;
328
405
  private readonly injector;
329
406
  private readonly destroyRef;
330
407
  ngOnInit(): void;
408
+ private headerContext;
331
409
  protected toggleSidebar(): void;
332
410
  protected closeSidebar(): void;
333
411
  protected toggleDebugMode(): void;
@@ -344,7 +422,9 @@ export declare class CortexChatWidgetComponent implements OnInit {
344
422
  "required": true;
345
423
  "isSignal": true;
346
424
  };
347
- }, {}, never, never, true, never>;
425
+ }, {}, [
426
+ "customHeader"
427
+ ], never, true, never>;
348
428
  }
349
429
 
350
430
  export {};