@kouji-ui/components 0.8.0 → 0.9.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": "@kouji-ui/components",
3
- "version": "0.8.0",
3
+ "version": "0.9.0",
4
4
  "description": "Opinionated styled Angular components built on @kouji-ui/core directives. Themed at runtime via @kouji-ui/themes.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -25,26 +25,27 @@
25
25
  "directory": "../../dist/kj-components"
26
26
  },
27
27
  "peerDependencies": {
28
+ "@angular/cdk": "^22.0.0",
28
29
  "@angular/common": "^22.0.0",
29
30
  "@angular/core": "^22.0.0",
30
- "@angular/cdk": "^22.0.0",
31
- "@kouji-ui/core": ">=0.3.0",
32
- "lucide-static": "^1.14.0",
33
31
  "@angular/forms": "^22.0.0",
34
- "rxjs": "^7.8.0",
35
- "lexical": "^0.38.0",
36
- "@lexical/rich-text": "^0.38.0",
37
- "@lexical/list": "^0.38.0",
38
- "@lexical/link": "^0.38.0",
39
- "@lexical/history": "^0.38.0",
40
- "@lexical/markdown": "^0.38.0",
32
+ "@kouji-ui/core": ">=0.3.0",
41
33
  "@lexical/code": "^0.38.0",
34
+ "@lexical/history": "^0.38.0",
42
35
  "@lexical/html": "^0.38.0",
43
- "@lexical/selection": "^0.38.0"
36
+ "@lexical/link": "^0.38.0",
37
+ "@lexical/list": "^0.38.0",
38
+ "@lexical/markdown": "^0.38.0",
39
+ "@lexical/rich-text": "^0.38.0",
40
+ "@lexical/selection": "^0.38.0",
41
+ "lexical": "^0.38.0",
42
+ "lucide-static": "^1.14.0",
43
+ "rxjs": "^7.8.0"
44
44
  },
45
45
  "sideEffects": false,
46
46
  "dependencies": {
47
47
  "@tanstack/virtual-core": "^3.14.0",
48
+ "marked": "^18.0.11",
48
49
  "tslib": "^2.3.0"
49
50
  },
50
51
  "peerDependenciesMeta": {
@@ -1,5 +1,5 @@
1
1
  import * as i1 from '@kouji-ui/core';
2
- import { KjAlertMode, KjAvatarShape, KjOverflowContent, KjBadgeVariant, KjButtonGroupOrientation, KjCarousel, KjLiveRegion, KjCarouselSlide, KjCarouselAlign, KjChatStore, KjChatAnnouncer, KjChatMessageData, KjSlashCommand, KjColorFormat, KjColorPreset, KjColorValue, KjColorPicker, KjCombobox, KjOverlayTriggerLike, KjDatePicker, KjDateRange, KjDateRangePreset, KjEditorLanguage, KjEditorLineNumbers, KjEditorWordWrap, KjEditorInstance, KjFileRejection, KjUploadableFile, KjFileUpload, KjInput, KjDividerOrientation, KjDividerAlign, KjListAs, KjListOrientation, KjPasswordAutocomplete, KjPasswordScore, KjOverflowContext, KjRichTextFeature, KjRichTextEditor, KjRteToolbarItem, KjActiveOverlay, KjSkeletonShape, KjSkeletonAnimation, KjSpinnerAnimation, KjResourceResult, KjStorageAdapter, KjTableState, KjTable, KjNumberFilterType, KjTabPanel, KjTagList, KjTextareaResize, KjTextareaAutoresize, KjHourCycle, TimeParts, KjToastVariant, KjCascadeSelectOption, KjTreeSelect, KjTreeNode } from '@kouji-ui/core';
2
+ import { KjAlertMode, KjAvatarShape, KjOverflowContent, KjBadgeVariant, KjButtonGroupOrientation, KjCarousel, KjLiveRegion, KjCarouselSlide, KjCarouselAlign, KjChatStore, KjChatAnnouncer, KjChatMessageData, KjChatRenderer, KjChatItemInput, KjSlashCommand, KjColorFormat, KjColorPreset, KjColorValue, KjColorPicker, KjCombobox, KjOverlayTriggerLike, KjDatePicker, KjDateRange, KjDateRangePreset, KjEditorLanguage, KjEditorLineNumbers, KjEditorWordWrap, KjEditorInstance, KjFileRejection, KjUploadableFile, KjFileUpload, KjInput, KjDividerOrientation, KjDividerAlign, KjListAs, KjListOrientation, KjPasswordAutocomplete, KjPasswordScore, KjOverflowContext, KjRichTextFeature, KjRichTextEditor, KjRteToolbarItem, KjActiveOverlay, KjSkeletonShape, KjSkeletonAnimation, KjSpinnerAnimation, KjResourceResult, KjStorageAdapter, KjTableState, KjTable, KjNumberFilterType, KjTabPanel, KjTagList, KjTextareaResize, KjTextareaAutoresize, KjHourCycle, TimeParts, KjToastVariant, KjCascadeSelectOption, KjTreeSelect, KjTreeNode } from '@kouji-ui/core';
3
3
  export { KJ_DROPDOWN_MENU, KjActiveOverlay, KjAlertMode, KjAvatarGroupAriaLabelFormat, KjAvatarShape, KjBadgeVariant, KjBlockquote, KjButtonGroupOrientation, KjCarousel, KjCarouselAlign, KjCarouselControlPattern, KjCarouselOrientation, KjCarouselSlide, KjCascadeSelectOption, KjChatAnnouncer, KjChatMessageData, KjChatRole, KjChatSide, KjChatState, KjChatStore, KjCode, KjColorFormat, KjColorPicker, KjColorPreset, KjColorValue, KjCombobox, KjDatePicker, KjDateRange, KjDateRangePreset, KjDialog, KjDialogOpenOptions, KjDialogRef, KjDialogService, KjDividerAlign, KjDividerOrientation, KjDrawer, KjDrawerOpenOptions, KjDrawerRef, KjDrawerService, KjDrawerSide, KjDropdownMenuCloseReason, KjDropdownMenuContent, KjDropdownMenuContext, KjDropdownMenuGroup, KjDropdownMenuItem, KjDropdownMenuLabel, KjDropdownMenuMount, KjDropdownMenuSeparator, KjDropdownMenuTrigger, KjDropdownMenuTriggerKind, KjEditorInstance, KjEditorLanguage, KjEditorLineNumbers, KjEditorWordWrap, KjFileRejection, KjFileUpload, KjHourCycle, KjInput, KjLead, KjListAs, KjListOrientation, KjLiveRegion, KjMuted, KjNumberFilterType, KjOverlayPanel, KjOverlayTriggerLike, KjPasswordAutocomplete, KjPasswordScore, KjPopoverArrow, KjPopoverClose, KjPopoverContent, KjPopoverTitle, KjPopoverTrigger, KjResourceResult, KjRichTextEditor, KjRichTextFeature, KjRteToolbarItem, KjSheet, KjSheetDetent, KjSheetOpenOptions, KjSheetRef, KjSheetService, KjSkeletonAnimation, KjSkeletonShape, KjSlashCommand, KjSpeedDialDirection, KjSpinnerAnimation, KjStorageAdapter, KjTabPanel, KjTable, KjTableState, KjTextareaAutoresize, KjTextareaResize, KjToastVariant, KjTooltipArrow, KjTooltipContent, KjTooltipGroup, KjTooltipTrigger, KjTreeNode, KjTreeSelect, KjTruncate, KjUploadableFile, SHEET_ARIA_LABEL, SHEET_DATA, SHEET_DETENT, SHEET_DISMISSIBLE } from '@kouji-ui/core';
4
4
  import * as _angular_core from '@angular/core';
5
5
  import { TemplateRef, ModelSignal, AfterViewInit, ElementRef, OnDestroy, EventEmitter, EnvironmentProviders, OnInit, Injector, ResourceRef, Type, InjectionToken } from '@angular/core';
@@ -1009,6 +1009,10 @@ declare class KjButtonComponent {
1009
1009
  * @doc-example Variants
1010
1010
  * Set `kjVariant` on the group to cascade onto every child button.
1011
1011
  * @doc-file button-group.variants.example.ts
1012
+ * @doc-example Segmented
1013
+ * `kjVariant="segmented"` moves the border onto the group and fills only
1014
+ * the pressed child — a mode switcher rather than a toolbar.
1015
+ * @doc-file button-group.segmented.example.ts
1012
1016
  * @doc-example Toggle
1013
1017
  * Pair with `[kjPressed]` on each child to build a segmented control.
1014
1018
  * @doc-file button-group.toggle.example.ts
@@ -1040,7 +1044,17 @@ declare class KjButtonComponent {
1040
1044
  * @doc-related button,toggle,tabs
1041
1045
  *
1042
1046
  * @doc-css-var
1043
- * --kj-button-group-gap — Gap between adjacent buttons. Defaults to 0 (segmented look); raise for a spaced cluster.
1047
+ * --kj-button-group-gap — Gap between adjacent buttons. Defaults to 0 (segmented look); raise for a spaced cluster.
1048
+ * --kj-segmented-border — Shell and divider colour, `kjVariant="segmented"` only. Defaults to `--kj-border-default`.
1049
+ * --kj-segmented-bg-on — Fill behind the pressed segment. Defaults to `--kj-bg-surface`.
1050
+ * --kj-segmented-fg-on — Ink on the pressed segment. Defaults to `--kj-fg-default`.
1051
+ *
1052
+ * Typography needs no dedicated hook: set the ordinary `--kj-button-font`,
1053
+ * `--kj-button-font-size`, `--kj-button-letter-spacing` and
1054
+ * `--kj-button-text-transform` on this host and they reach each child,
1055
+ * since every knob is read as `var(name, default)`. The on-state colours
1056
+ * are the exception — variant rules declare those knobs on the element,
1057
+ * so they get their own `--kj-segmented-*` indirection.
1044
1058
  *
1045
1059
  * @doc-category Library/Actions
1046
1060
  * @doc
@@ -1057,7 +1071,9 @@ declare class KjButtonGroupComponent {
1057
1071
  readonly kjOrientation: _angular_core.InputSignal<KjButtonGroupOrientation>;
1058
1072
  /**
1059
1073
  * Default variant forwarded to children via `KJ_BUTTON_GROUP`. Children
1060
- * that set their own `kjVariant` override this fallback.
1074
+ * that set their own `kjVariant` override this fallback. Also mirrored to
1075
+ * `data-variant` on the host, which is how `segmented` draws its shared
1076
+ * shell and dividers.
1061
1077
  */
1062
1078
  readonly kjVariant: _angular_core.InputSignal<string | undefined>;
1063
1079
  /**
@@ -1771,6 +1787,10 @@ declare class KjChatFooterComponent {
1771
1787
  * Provider-agnostic: pair with `KjPromptInput` and drive `KjChatStore` from any
1772
1788
  * model / stream — the kit ships **no** LLM SDK or backend.
1773
1789
  *
1790
+ * @doc-example Custom thread items
1791
+ * `provideKjChat` maps an item `type` to a component, so a thread can render
1792
+ * turns the kit knows nothing about. Ordinary messages are untouched.
1793
+ * @doc-file ai-chat.custom-items.example.ts
1774
1794
  * @doc-example Streaming (simulated)
1775
1795
  * A full send → simulated-stream → reply loop with slash commands, a Stop
1776
1796
  * button, tool-call cards and citations. No backend — a fake token generator
@@ -1810,6 +1830,19 @@ declare class KjChatThread {
1810
1830
  readonly kjLabel: _angular_core.InputSignal<string | undefined>;
1811
1831
  /** @internal — the coalescing announcer for the polite live region. */
1812
1832
  readonly announcer: KjChatAnnouncer;
1833
+ private readonly config;
1834
+ /**
1835
+ * The registered component for a message's `type`, or `null` to let the
1836
+ * built-in renderer draw it. A message with no `type` never consults the
1837
+ * registry — that is the overwhelmingly common case and must stay free.
1838
+ *
1839
+ * An unknown `type` falls back to the configured `fallback`, and failing
1840
+ * that to the built-in renderer: a transcript that silently drops a turn is
1841
+ * worse than one that renders it plainly.
1842
+ */
1843
+ protected rendererFor(message: KjChatMessageData): KjChatRenderer | null;
1844
+ /** The neutral shape handed to a registered renderer's `item` input. */
1845
+ protected itemFor(message: KjChatMessageData): KjChatItemInput;
1813
1846
  private readonly injector;
1814
1847
  private readonly logEl;
1815
1848
  private lastId;
@@ -1822,9 +1855,13 @@ declare class KjChatThread {
1822
1855
  }
1823
1856
 
1824
1857
  /**
1825
- * A parsed markdown block. Prose blocks carry a **pre-sanitised** HTML string
1826
- * (escaped first, then a whitelist of inline tags applied); code blocks are
1827
- * kept structural so the view can render a `<pre><code>` with a copy button.
1858
+ * A parsed markdown block. Prose blocks carry an HTML string; code blocks stay
1859
+ * structural so the view can render a `<pre><code>` with a copy button.
1860
+ *
1861
+ * Raw HTML in the source is escaped, never emitted (see the renderer override
1862
+ * below), so the prose HTML only ever contains tags this module produced. The
1863
+ * view sanitises it again anyway — a model's output is not a trust boundary
1864
+ * worth betting one layer on.
1828
1865
  */
1829
1866
  type KjMdBlock = {
1830
1867
  readonly kind: 'prose';
@@ -1835,13 +1872,12 @@ type KjMdBlock = {
1835
1872
  readonly code: string;
1836
1873
  };
1837
1874
  /**
1838
- * Parse a lightweight markdown subset into blocks: fenced code blocks
1839
- * (```lang) become structural `code` blocks; everything else becomes `prose`
1840
- * blocks with sanitised inline HTML.
1875
+ * Parse markdown into blocks: fenced code becomes a structural `code` block,
1876
+ * everything else is rendered to HTML as a `prose` block.
1841
1877
  *
1842
- * Deliberately minimal (no tables / nested lists) and **self-contained** the
1843
- * repo ships no markdown engine on `main`. Swap in a full parser later without
1844
- * touching the view.
1878
+ * Code is split out at the TOKEN level rather than by regex so an indented
1879
+ * block, a `~~~` fence, or a fence inside a list is still recognised — and so
1880
+ * a stray fence in a partial stream cannot swallow the rest of the message.
1845
1881
  */
1846
1882
  declare function renderMarkdown(src: string): KjMdBlock[];
1847
1883
 
@@ -1873,6 +1909,13 @@ declare class KjChatMessage {
1873
1909
  readonly blocks: _angular_core.Signal<KjMdBlock[]>;
1874
1910
  private readonly _copied;
1875
1911
  readonly copiedIndex: _angular_core.Signal<number | null>;
1912
+ /**
1913
+ * Sanitise rather than bypass. `renderMarkdown` already escapes raw HTML at
1914
+ * the parse layer, but a chat body is model or user output — the one place
1915
+ * in a UI kit where trusting a single layer is a bad bet. `sanitize` strips
1916
+ * anything the parser somehow let through instead of waving it past
1917
+ * Angular's checks.
1918
+ */
1876
1919
  safe(html: string): SafeHtml;
1877
1920
  copy(code: string, index: number): Promise<void>;
1878
1921
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<KjChatMessage, never>;