@human-synthesis/norns-ui 0.1.0 → 0.2.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.
@@ -0,0 +1,21 @@
1
+ import type { Component } from 'svelte';
2
+
3
+ export type ChartType = 'bar' | 'line' | 'area';
4
+
5
+ export type ChartProps = {
6
+ /** Rows to plot — typically a generated Query result. */
7
+ data?: Record<string, unknown>[];
8
+ type?: ChartType;
9
+ /** Field for the x axis / labels. Defaults to the first string field. */
10
+ x?: string;
11
+ /** Field for the y axis values. Defaults to the first numeric field. */
12
+ y?: string;
13
+ /** Accessible label for the rendered svg. */
14
+ label?: string;
15
+ /** Show per-point x labels under the plot. */
16
+ labels?: boolean;
17
+ class?: string;
18
+ };
19
+
20
+ declare const Chart: Component<ChartProps>;
21
+ export default Chart;
@@ -0,0 +1,27 @@
1
+ import type { Component, Snippet } from 'svelte';
2
+
3
+ export type ChatMessage = {
4
+ text?: string;
5
+ from?: string;
6
+ /** True for messages appended locally by this client's composer. */
7
+ self?: boolean;
8
+ [key: string]: unknown;
9
+ };
10
+
11
+ export type ChatThreadProps = {
12
+ /** Room name — a generated Page binds a `room: true` Worker here. */
13
+ roomChannel?: string;
14
+ /** Message type sent by the composer (default 'chat'). */
15
+ send?: string;
16
+ /** Message type appended to the thread (defaults to `send`). */
17
+ receive?: string;
18
+ placeholder?: string;
19
+ sendLabel?: string;
20
+ emptyMessage?: string;
21
+ /** Message renderer snippet — replaces the default from/text row. */
22
+ message?: Snippet<[ChatMessage]>;
23
+ class?: string;
24
+ };
25
+
26
+ declare const ChatThread: Component<ChatThreadProps>;
27
+ export default ChatThread;
@@ -1,4 +1,4 @@
1
- import type { Component } from 'svelte';
1
+ import type { Component, Snippet } from 'svelte';
2
2
 
3
3
  export type DataTableColumn = {
4
4
  key: string;
@@ -20,6 +20,10 @@ export type DataTableProps = {
20
20
  sortKey?: string;
21
21
  sortDir?: 'asc' | 'desc';
22
22
  onrowclick?: (row: Record<string, unknown>, index: number) => void;
23
+ /** Cell renderer snippet — receives (row, columnKey, value). */
24
+ cell?: Snippet<[Record<string, unknown>, string, unknown]>;
25
+ /** Rendered instead of emptyMessage when there are no rows. */
26
+ empty?: Snippet;
23
27
  class?: string;
24
28
  };
25
29
 
@@ -0,0 +1,19 @@
1
+ import type { Component, Snippet } from 'svelte';
2
+
3
+ export type FeedProps = {
4
+ /** SSE endpoint URL — frames append as entries. */
5
+ streamSource?: string;
6
+ /** Room name — received frames append as entries. */
7
+ roomChannel?: string;
8
+ /** Room message type to append ('*' for all, the default). */
9
+ receive?: string;
10
+ /** Newest entries kept (default 100). */
11
+ max?: number | string;
12
+ emptyMessage?: string;
13
+ /** Entry renderer snippet — replaces the default text/JSON line. */
14
+ item?: Snippet<[unknown]>;
15
+ class?: string;
16
+ };
17
+
18
+ declare const Feed: Component<FeedProps>;
19
+ export default Feed;
@@ -0,0 +1,26 @@
1
+ import type { Component, Snippet } from 'svelte';
2
+
3
+ export type KanbanCard = Record<string, unknown>;
4
+
5
+ export type KanbanProps = {
6
+ /** Cards grouped by column key — typically a grouped Query result. */
7
+ data?: Record<string, KanbanCard[]>;
8
+ /** Column order/labels: comma-separated keys, key list, or {key,label} list. */
9
+ columns?: string | Array<string | { key: string; label?: string }>;
10
+ /** Card field used as the card title. Defaults to the first string field. */
11
+ title?: string;
12
+ /** Card field rendered under the title when present. */
13
+ subtitle?: string;
14
+ /** Called after a drag between columns; binding an Action enables dragging. */
15
+ onMove?: (card: KanbanCard, to: string, from: string) => unknown;
16
+ oncardclick?: (card: KanbanCard) => void;
17
+ emptyMessage?: string;
18
+ /** Card renderer snippet — replaces the default title/subtitle block. */
19
+ card?: Snippet<[KanbanCard]>;
20
+ /** Rendered instead of emptyMessage in an empty column. */
21
+ empty?: Snippet;
22
+ class?: string;
23
+ };
24
+
25
+ declare const Kanban: Component<KanbanProps>;
26
+ export default Kanban;
@@ -0,0 +1,19 @@
1
+ import type { Component } from 'svelte';
2
+
3
+ export type ListboxItem =
4
+ | string
5
+ | { value: unknown; label?: string; disabled?: boolean };
6
+
7
+ export type ListboxProps = {
8
+ items?: ListboxItem[];
9
+ /** Selected value (array when `multiple`). Bindable. */
10
+ value?: unknown;
11
+ multiple?: boolean;
12
+ disabled?: boolean;
13
+ emptyMessage?: string;
14
+ onchange?: (value: unknown) => void;
15
+ class?: string;
16
+ };
17
+
18
+ declare const Listbox: Component<ListboxProps>;
19
+ export default Listbox;
@@ -0,0 +1,16 @@
1
+ import type { Component } from 'svelte';
2
+
3
+ export type LiveLogProps = {
4
+ /** SSE endpoint URL — each frame becomes a log line. */
5
+ streamSource?: string;
6
+ /** Room name — received frames become log lines. */
7
+ roomChannel?: string;
8
+ /** Room message type to log ('*' for all, the default). */
9
+ receive?: string;
10
+ /** Newest lines kept (default 200). */
11
+ maxLines?: number | string;
12
+ class?: string;
13
+ };
14
+
15
+ declare const LiveLog: Component<LiveLogProps>;
16
+ export default LiveLog;
@@ -0,0 +1,17 @@
1
+ import type { Component } from 'svelte';
2
+
3
+ export type PresenceAvatarsProps = {
4
+ /** Room name — client count comes from the Room's presence broadcasts. */
5
+ roomChannel?: string;
6
+ /** Avatars shown before the +N overflow (default 5). */
7
+ max?: number | string;
8
+ size?: 'xs' | 'sm' | 'md' | 'lg';
9
+ /** Suffix after the count (default 'online'). */
10
+ label?: string;
11
+ /** Show the numeric count next to the avatars (default true). */
12
+ showCount?: boolean;
13
+ class?: string;
14
+ };
15
+
16
+ declare const PresenceAvatars: Component<PresenceAvatarsProps>;
17
+ export default PresenceAvatars;
@@ -0,0 +1,12 @@
1
+ import type { Component } from 'svelte';
2
+
3
+ export type SpinnerProps = {
4
+ /** Tailwind size utility for the spinner glyph. */
5
+ size?: string;
6
+ /** Accessible label announced to screen readers. */
7
+ label?: string;
8
+ class?: string;
9
+ };
10
+
11
+ declare const Spinner: Component<SpinnerProps>;
12
+ export default Spinner;
@@ -0,0 +1,18 @@
1
+ import type { Component } from 'svelte';
2
+
3
+ export type StreamTextProps = {
4
+ /** SSE endpoint URL — a generated Page binds a `stream:` Endpoint here. */
5
+ streamSource?: string;
6
+ /** JSON-able request body; the stream opens with POST when set. */
7
+ input?: unknown;
8
+ /** Open the stream on mount (default true). */
9
+ autostart?: boolean;
10
+ /** Called with each parsed frame as it arrives. */
11
+ onframe?: (frame: unknown) => void;
12
+ /** Called with the full accumulated text when the stream ends. */
13
+ ondone?: (text: string) => void;
14
+ class?: string;
15
+ };
16
+
17
+ declare const StreamText: Component<StreamTextProps>;
18
+ export default StreamText;
@@ -1,4 +1,4 @@
1
- import type { Component } from 'svelte';
1
+ import type { Component, Snippet } from 'svelte';
2
2
  import type { DataTableColumn } from './DataTable.js';
3
3
 
4
4
  export type TableColumn = DataTableColumn;
@@ -18,6 +18,10 @@ export type TableProps = {
18
18
  stickyHeader?: boolean;
19
19
  emptyMessage?: string;
20
20
  onrowclick?: (row: Record<string, unknown>, index: number) => void;
21
+ /** Cell renderer snippet — receives (row, columnKey, value). */
22
+ cell?: Snippet<[Record<string, unknown>, string, unknown]>;
23
+ /** Rendered instead of emptyMessage when there are no rows. */
24
+ empty?: Snippet;
21
25
  class?: string;
22
26
  };
23
27
 
@@ -10,6 +10,8 @@ export type TimelineItem = {
10
10
 
11
11
  export type TimelineProps = {
12
12
  items?: TimelineItem[];
13
+ /** Alias for `items` — the prop a generated Page binds a Query result to. */
14
+ data?: TimelineItem[];
13
15
  class?: string;
14
16
  };
15
17
 
@@ -9,6 +9,8 @@ export type TreeNode = {
9
9
 
10
10
  export type TreeProps = {
11
11
  items?: TreeNode[];
12
+ /** Alias for `items` — the prop a generated Page binds a Query result to. */
13
+ data?: TreeNode[];
12
14
  /** Array of node ids that are expanded. Bindable. */
13
15
  expanded?: (string | number)[];
14
16
  /** Currently-selected node id. Bindable. */
@@ -0,0 +1,17 @@
1
+ import type { Component, Snippet } from 'svelte';
2
+
3
+ export type WindowProps = {
4
+ title?: string;
5
+ hideHeader?: boolean;
6
+ /** Renders the header close button when supplied. */
7
+ onClose?: (event: MouseEvent) => void;
8
+ onHeaderDoubleClick?: (event: MouseEvent) => void;
9
+ /** Extra header actions, rendered before the close button. */
10
+ actions?: Snippet;
11
+ children?: Snippet;
12
+ class?: string;
13
+ bodyClass?: string;
14
+ };
15
+
16
+ declare const Window: Component<WindowProps>;
17
+ export default Window;