@aparte/core 0.2.0-alpha.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/LICENSE +21 -0
- package/README.md +53 -0
- package/dist/client/aparte-client.d.ts +326 -0
- package/dist/client/aparte-client.d.ts.map +1 -0
- package/dist/client/stream-adapter.d.ts +197 -0
- package/dist/client/stream-adapter.d.ts.map +1 -0
- package/dist/components/bubble/aparte-chat-bubble.d.ts +153 -0
- package/dist/components/bubble/aparte-chat-bubble.d.ts.map +1 -0
- package/dist/components/bubble/bubble-sync.d.ts +44 -0
- package/dist/components/bubble/bubble-sync.d.ts.map +1 -0
- package/dist/components/bubble/index.d.ts +4 -0
- package/dist/components/bubble/index.d.ts.map +1 -0
- package/dist/components/chat/aparte-chat.d.ts +49 -0
- package/dist/components/chat/aparte-chat.d.ts.map +1 -0
- package/dist/components/chat/index.d.ts +2 -0
- package/dist/components/chat/index.d.ts.map +1 -0
- package/dist/components/composer/aparte-composer-action.d.ts +37 -0
- package/dist/components/composer/aparte-composer-action.d.ts.map +1 -0
- package/dist/components/composer/aparte-composer-add-attachment.d.ts +27 -0
- package/dist/components/composer/aparte-composer-add-attachment.d.ts.map +1 -0
- package/dist/components/composer/aparte-composer-attachments.d.ts +26 -0
- package/dist/components/composer/aparte-composer-attachments.d.ts.map +1 -0
- package/dist/components/composer/aparte-composer-cancel.d.ts +21 -0
- package/dist/components/composer/aparte-composer-cancel.d.ts.map +1 -0
- package/dist/components/composer/aparte-composer-input.d.ts +63 -0
- package/dist/components/composer/aparte-composer-input.d.ts.map +1 -0
- package/dist/components/composer/aparte-composer-send.d.ts +25 -0
- package/dist/components/composer/aparte-composer-send.d.ts.map +1 -0
- package/dist/components/composer/aparte-composer.d.ts +150 -0
- package/dist/components/composer/aparte-composer.d.ts.map +1 -0
- package/dist/components/composer/index.d.ts +9 -0
- package/dist/components/composer/index.d.ts.map +1 -0
- package/dist/components/conversation-list/aparte-conversation-list.d.ts +50 -0
- package/dist/components/conversation-list/aparte-conversation-list.d.ts.map +1 -0
- package/dist/components/conversation-list/index.d.ts +2 -0
- package/dist/components/conversation-list/index.d.ts.map +1 -0
- package/dist/components/elicitation/aparte-elicitation.d.ts +29 -0
- package/dist/components/elicitation/aparte-elicitation.d.ts.map +1 -0
- package/dist/components/index.d.ts +10 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/status/aparte-chat-status.d.ts +34 -0
- package/dist/components/status/aparte-chat-status.d.ts.map +1 -0
- package/dist/components/status/index.d.ts +2 -0
- package/dist/components/status/index.d.ts.map +1 -0
- package/dist/components/viewport/aparte-chat-viewport.d.ts +358 -0
- package/dist/components/viewport/aparte-chat-viewport.d.ts.map +1 -0
- package/dist/components/viewport/index.d.ts +2 -0
- package/dist/components/viewport/index.d.ts.map +1 -0
- package/dist/config/action-provider.d.ts +59 -0
- package/dist/config/action-provider.d.ts.map +1 -0
- package/dist/config/aparte-config.d.ts +490 -0
- package/dist/config/aparte-config.d.ts.map +1 -0
- package/dist/config/attachment-renderer.d.ts +28 -0
- package/dist/config/attachment-renderer.d.ts.map +1 -0
- package/dist/config/avatar-provider.d.ts +35 -0
- package/dist/config/avatar-provider.d.ts.map +1 -0
- package/dist/config/bubble-shell-renderer.d.ts +41 -0
- package/dist/config/bubble-shell-renderer.d.ts.map +1 -0
- package/dist/config/config-context.d.ts +47 -0
- package/dist/config/config-context.d.ts.map +1 -0
- package/dist/config/error-renderer.d.ts +26 -0
- package/dist/config/error-renderer.d.ts.map +1 -0
- package/dist/config/icon-provider.d.ts +63 -0
- package/dist/config/icon-provider.d.ts.map +1 -0
- package/dist/config/index.d.ts +19 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/locale.d.ts +60 -0
- package/dist/config/locale.d.ts.map +1 -0
- package/dist/config/sanitize.d.ts +31 -0
- package/dist/config/sanitize.d.ts.map +1 -0
- package/dist/config/sibling-nav-renderer.d.ts +27 -0
- package/dist/config/sibling-nav-renderer.d.ts.map +1 -0
- package/dist/config/skeleton-provider.d.ts +26 -0
- package/dist/config/skeleton-provider.d.ts.map +1 -0
- package/dist/config/status-renderer.d.ts +23 -0
- package/dist/config/status-renderer.d.ts.map +1 -0
- package/dist/conversations/conversation-controller.d.ts +126 -0
- package/dist/conversations/conversation-controller.d.ts.map +1 -0
- package/dist/conversations/conversation-manager.d.ts +98 -0
- package/dist/conversations/conversation-manager.d.ts.map +1 -0
- package/dist/conversations/index.d.ts +5 -0
- package/dist/conversations/index.d.ts.map +1 -0
- package/dist/conversations/types.d.ts +172 -0
- package/dist/conversations/types.d.ts.map +1 -0
- package/dist/custom-elements.json +15833 -0
- package/dist/elicitation/index.d.ts +20 -0
- package/dist/elicitation/index.d.ts.map +1 -0
- package/dist/elicitation/panel.d.ts +18 -0
- package/dist/elicitation/panel.d.ts.map +1 -0
- package/dist/elicitation/types.d.ts +98 -0
- package/dist/elicitation/types.d.ts.map +1 -0
- package/dist/host/aparte-chat-host.d.ts +176 -0
- package/dist/host/aparte-chat-host.d.ts.map +1 -0
- package/dist/host/index.d.ts +2 -0
- package/dist/host/index.d.ts.map +1 -0
- package/dist/index-D89k-n2Q.js +6294 -0
- package/dist/index-D89k-n2Q.js.map +1 -0
- package/dist/index.css +2554 -0
- package/dist/index.d.ts +62 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3763 -0
- package/dist/index.js.map +1 -0
- package/dist/index.node.d.ts +53 -0
- package/dist/index.node.d.ts.map +1 -0
- package/dist/index.node.js +49 -0
- package/dist/index.node.js.map +1 -0
- package/dist/interop/element-props.d.ts +23 -0
- package/dist/interop/element-props.d.ts.map +1 -0
- package/dist/parsers/aparte-event-stream.d.ts +13 -0
- package/dist/parsers/aparte-event-stream.d.ts.map +1 -0
- package/dist/parsers/aparte-stream-parser.d.ts +137 -0
- package/dist/parsers/aparte-stream-parser.d.ts.map +1 -0
- package/dist/parsers/index.d.ts +4 -0
- package/dist/parsers/index.d.ts.map +1 -0
- package/dist/primitives/index.d.ts +8 -0
- package/dist/primitives/index.d.ts.map +1 -0
- package/dist/primitives/progress-spinner/aparte-progress-spinner.d.ts +25 -0
- package/dist/primitives/progress-spinner/aparte-progress-spinner.d.ts.map +1 -0
- package/dist/primitives/progress-spinner/index.d.ts +2 -0
- package/dist/primitives/progress-spinner/index.d.ts.map +1 -0
- package/dist/primitives/select/aparte-optgroup.d.ts +32 -0
- package/dist/primitives/select/aparte-optgroup.d.ts.map +1 -0
- package/dist/primitives/select/aparte-option.d.ts +30 -0
- package/dist/primitives/select/aparte-option.d.ts.map +1 -0
- package/dist/primitives/select/aparte-select.d.ts +74 -0
- package/dist/primitives/select/aparte-select.d.ts.map +1 -0
- package/dist/primitives/select/index.d.ts +9 -0
- package/dist/primitives/select/index.d.ts.map +1 -0
- package/dist/renderers/index.d.ts +5 -0
- package/dist/renderers/index.d.ts.map +1 -0
- package/dist/renderers/segment-renderers.d.ts +31 -0
- package/dist/renderers/segment-renderers.d.ts.map +1 -0
- package/dist/runtime/message-repository.d.ts +111 -0
- package/dist/runtime/message-repository.d.ts.map +1 -0
- package/dist/transport/backend-handler.d.ts +50 -0
- package/dist/transport/backend-handler.d.ts.map +1 -0
- package/dist/transport/backend-transport.d.ts +39 -0
- package/dist/transport/backend-transport.d.ts.map +1 -0
- package/dist/transport/direct-transport.d.ts +36 -0
- package/dist/transport/direct-transport.d.ts.map +1 -0
- package/dist/transport/index.d.ts +6 -0
- package/dist/transport/index.d.ts.map +1 -0
- package/dist/transport/types.d.ts +73 -0
- package/dist/transport/types.d.ts.map +1 -0
- package/dist/types/chat.d.ts +223 -0
- package/dist/types/chat.d.ts.map +1 -0
- package/dist/types/errors.d.ts +25 -0
- package/dist/types/errors.d.ts.map +1 -0
- package/dist/types/event-map.d.ts +41 -0
- package/dist/types/event-map.d.ts.map +1 -0
- package/dist/types/events.d.ts +290 -0
- package/dist/types/events.d.ts.map +1 -0
- package/dist/types/imperative-api.d.ts +38 -0
- package/dist/types/imperative-api.d.ts.map +1 -0
- package/dist/types/index.d.ts +22 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/model-provider.d.ts +229 -0
- package/dist/types/model-provider.d.ts.map +1 -0
- package/dist/types/models.d.ts +173 -0
- package/dist/types/models.d.ts.map +1 -0
- package/dist/types/parsers.d.ts +42 -0
- package/dist/types/parsers.d.ts.map +1 -0
- package/dist/types/providers.d.ts +93 -0
- package/dist/types/providers.d.ts.map +1 -0
- package/dist/types/segments.d.ts +221 -0
- package/dist/types/segments.d.ts.map +1 -0
- package/dist/types/theming.d.ts +44 -0
- package/dist/types/theming.d.ts.map +1 -0
- package/dist/types/tools.d.ts +98 -0
- package/dist/types/tools.d.ts.map +1 -0
- package/dist/utils/assert-never.d.ts +9 -0
- package/dist/utils/assert-never.d.ts.map +1 -0
- package/dist/utils/css-escape.d.ts +15 -0
- package/dist/utils/css-escape.d.ts.map +1 -0
- package/package.json +68 -0
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Aparte Models
|
|
3
|
+
* Core data structures for message handling and attachments
|
|
4
|
+
*/
|
|
5
|
+
import type { AparteSegment } from './segments.js';
|
|
6
|
+
/**
|
|
7
|
+
* Generic status type for flow management
|
|
8
|
+
* Used to drive loading indicators, error states, and transitions
|
|
9
|
+
* without coupling to any specific data source
|
|
10
|
+
*/
|
|
11
|
+
export type AparteStatus = 'idle' | 'pending' | 'streaming' | 'completed' | 'error' | 'success';
|
|
12
|
+
/** Role of a message sender in the conversation */
|
|
13
|
+
export type AparteBubbleRole = 'user' | 'assistant';
|
|
14
|
+
/**
|
|
15
|
+
* Attachment interface for media and file support
|
|
16
|
+
* Future-proof structure for images, audio, documents, etc.
|
|
17
|
+
*/
|
|
18
|
+
export interface AparteAttachment {
|
|
19
|
+
/** Unique identifier for the attachment */
|
|
20
|
+
id: string;
|
|
21
|
+
/** Display name of the attachment */
|
|
22
|
+
name: string;
|
|
23
|
+
/** MIME type (e.g., 'image/png', 'application/pdf') */
|
|
24
|
+
type: string;
|
|
25
|
+
/** URL or data URI to access the attachment */
|
|
26
|
+
url: string;
|
|
27
|
+
/** Optional file size in bytes */
|
|
28
|
+
size?: number;
|
|
29
|
+
/** Optional thumbnail URL for previews */
|
|
30
|
+
thumbnailUrl?: string;
|
|
31
|
+
/** Optional metadata for custom properties */
|
|
32
|
+
metadata?: Record<string, unknown>;
|
|
33
|
+
/**
|
|
34
|
+
* Binary payload. Set at message-creation time (File from upload) so the
|
|
35
|
+
* persistence adapter can save it to its attachments table. Stripped from
|
|
36
|
+
* the serialised message row — the adapter reconstructs `url` via
|
|
37
|
+
* `URL.createObjectURL(blob)` on hydration. Not serialised to JSON.
|
|
38
|
+
*/
|
|
39
|
+
blob?: Blob;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* A single branch (alternative response) within an assistant message.
|
|
43
|
+
*
|
|
44
|
+
* @deprecated The active branching system is tree-based via `MessageRepository`
|
|
45
|
+
* (siblings under the same parent node). This in-message versioning struct is
|
|
46
|
+
* kept only for backwards compatibility with existing serialised payloads.
|
|
47
|
+
* New code should rely on viewport methods `addSiblingOf` / `navigateBranch`
|
|
48
|
+
* and on the `aparte-path-changed` event payload to drive the branch picker UI.
|
|
49
|
+
*/
|
|
50
|
+
export interface AparteMessageBranch {
|
|
51
|
+
/** Unique identifier for this branch */
|
|
52
|
+
id: string;
|
|
53
|
+
/** Text content of this branch */
|
|
54
|
+
content?: string;
|
|
55
|
+
/** Rich segments of this branch */
|
|
56
|
+
segments?: AparteSegment[];
|
|
57
|
+
/** Branch status */
|
|
58
|
+
status?: AparteStatus;
|
|
59
|
+
/** Creation timestamp */
|
|
60
|
+
timestamp: number;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Names of the individual action-bar buttons, used for explicit per-role
|
|
64
|
+
* ordered configuration (see `AparteBubbleActionsConfig.user` / `.assistant`).
|
|
65
|
+
*/
|
|
66
|
+
export type AparteBubbleActionName = 'copy' | 'edit' | 'retry' | 'thumbUp' | 'thumbDown';
|
|
67
|
+
/**
|
|
68
|
+
* Controls which action buttons are rendered in message bubbles.
|
|
69
|
+
* Pass to `AparteConfig.setBubbleActions()` to customise or disable actions.
|
|
70
|
+
*
|
|
71
|
+
* Two ways to configure:
|
|
72
|
+
* - Global flags (`copy`/`retry`/`edit`/`feedback`) — role-aware defaults, the
|
|
73
|
+
* original behaviour.
|
|
74
|
+
* - Explicit per-role ordered sets (`user`/`assistant`) — when provided for a
|
|
75
|
+
* role, they fully replace the flag-derived set for that role: buttons render
|
|
76
|
+
* in exactly the given order and nothing is auto-appended (not even the usage
|
|
77
|
+
* "info" button). Lets a theme match a specific product 1:1.
|
|
78
|
+
*/
|
|
79
|
+
export interface AparteBubbleActionsConfig {
|
|
80
|
+
/** Copy message text to clipboard. Default: true */
|
|
81
|
+
copy?: boolean;
|
|
82
|
+
/** Retry / regenerate the response (assistant bubbles). Default: true */
|
|
83
|
+
retry?: boolean;
|
|
84
|
+
/** Edit the sent message inline (user bubbles). Default: true */
|
|
85
|
+
edit?: boolean;
|
|
86
|
+
/** Thumbs-up / thumbs-down feedback (assistant bubbles). Default: false */
|
|
87
|
+
feedback?: boolean;
|
|
88
|
+
/** Explicit, ordered action set for USER bubbles. Example: `['edit', 'copy']`. */
|
|
89
|
+
user?: AparteBubbleActionName[];
|
|
90
|
+
/** Explicit, ordered action set for ASSISTANT bubbles. Example: `['copy', 'thumbUp', 'thumbDown', 'retry']`. */
|
|
91
|
+
assistant?: AparteBubbleActionName[];
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Core message structure for the chat
|
|
95
|
+
* Supports both simple content and rich multi-segment content
|
|
96
|
+
*/
|
|
97
|
+
export interface AparteMessage {
|
|
98
|
+
/** Unique identifier for the message */
|
|
99
|
+
id: string;
|
|
100
|
+
/** Role of the message sender */
|
|
101
|
+
role: AparteBubbleRole;
|
|
102
|
+
/**
|
|
103
|
+
* Simple text content (for basic messages)
|
|
104
|
+
* Use `segments` for rich content with multiple parts
|
|
105
|
+
*/
|
|
106
|
+
content?: string;
|
|
107
|
+
/**
|
|
108
|
+
* Rich content segments (thinking, code, terminal, etc.)
|
|
109
|
+
* Takes precedence over `content` if provided
|
|
110
|
+
*/
|
|
111
|
+
segments?: AparteSegment[];
|
|
112
|
+
/** Unix timestamp of message creation */
|
|
113
|
+
timestamp: number;
|
|
114
|
+
/** Whether the message is still being streamed */
|
|
115
|
+
isStreaming?: boolean;
|
|
116
|
+
/** Current status of the message */
|
|
117
|
+
status?: AparteStatus;
|
|
118
|
+
/** Optional attachments (images, files, etc.) */
|
|
119
|
+
attachments?: AparteAttachment[];
|
|
120
|
+
/** Token usage + timing reported by the provider for assistant messages. */
|
|
121
|
+
usage?: import('./chat.js').AparteUsage;
|
|
122
|
+
/**
|
|
123
|
+
* Alternative responses generated by retrying.
|
|
124
|
+
*
|
|
125
|
+
* @deprecated Use the tree-based branching exposed by `MessageRepository`
|
|
126
|
+
* (siblings under the same parent). The bubble no longer reads this field
|
|
127
|
+
* — sibling counts come from `aparte-path-changed` event metadata.
|
|
128
|
+
*/
|
|
129
|
+
branches?: AparteMessageBranch[];
|
|
130
|
+
/**
|
|
131
|
+
* Index of the currently displayed branch (default 0).
|
|
132
|
+
* @deprecated See {@link AparteMessage.branches}.
|
|
133
|
+
*/
|
|
134
|
+
activeBranchIndex?: number;
|
|
135
|
+
/** Optional metadata for custom properties */
|
|
136
|
+
metadata?: Record<string, unknown>;
|
|
137
|
+
}
|
|
138
|
+
/** Configuration options for AparteChatViewport */
|
|
139
|
+
export interface AparteViewportConfig {
|
|
140
|
+
/** Threshold in pixels for smart scroll detection */
|
|
141
|
+
scrollThreshold?: number;
|
|
142
|
+
/**
|
|
143
|
+
* DOM render cap: the max number of bubbles kept in the DOM at once (a perf
|
|
144
|
+
* ceiling for very long conversations). This does NOT evict messages from the
|
|
145
|
+
* conversation model — the full tree and its persistence snapshot stay intact.
|
|
146
|
+
* Defaults to 1000.
|
|
147
|
+
*/
|
|
148
|
+
maxRenderedBubbles?: number;
|
|
149
|
+
/**
|
|
150
|
+
* @deprecated Renamed to {@link maxRenderedBubbles}. This used to silently
|
|
151
|
+
* evict messages from the conversation model (data loss); it now only caps
|
|
152
|
+
* rendered bubbles. For real history retention, configure it on your
|
|
153
|
+
* ConversationManager instead.
|
|
154
|
+
*/
|
|
155
|
+
maxMessages?: number;
|
|
156
|
+
/**
|
|
157
|
+
* Duration in milliseconds to freeze spacer recalculation after resetSpacer().
|
|
158
|
+
* Set this to the duration of any CSS layout transition in the host app
|
|
159
|
+
* (e.g. the flex animation that moves the composer from center to bottom).
|
|
160
|
+
* Defaults to 0 (no freeze). Example: 350 when `transition: flex 0.3s ease` is used.
|
|
161
|
+
*/
|
|
162
|
+
layoutTransitionMs?: number;
|
|
163
|
+
}
|
|
164
|
+
/** Configuration options for the composer input. */
|
|
165
|
+
export interface AparteInputConfig {
|
|
166
|
+
/** Placeholder text for the input */
|
|
167
|
+
placeholder?: string;
|
|
168
|
+
/** Maximum height in pixels for auto-expand */
|
|
169
|
+
maxHeight?: number;
|
|
170
|
+
/** Minimum height in pixels */
|
|
171
|
+
minHeight?: number;
|
|
172
|
+
}
|
|
173
|
+
//# sourceMappingURL=models.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../src/types/models.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAMnD;;;;GAIG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,SAAS,GAAG,WAAW,GAAG,WAAW,GAAG,OAAO,GAAG,SAAS,CAAC;AAMhG,mDAAmD;AACnD,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,WAAW,CAAC;AAMpD;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC7B,2CAA2C;IAC3C,EAAE,EAAE,MAAM,CAAC;IAEX,qCAAqC;IACrC,IAAI,EAAE,M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in interface for external parsers
|
|
7
|
+
* Allows integration of Markdown, code highlighting, LaTeX, etc.
|
|
8
|
+
* without adding dependencies to the core
|
|
9
|
+
*/
|
|
10
|
+
export interface AparteContentParser {
|
|
11
|
+
/** Unique identifier for the parser */
|
|
12
|
+
id: string;
|
|
13
|
+
/** Priority for parser execution (higher = first) */
|
|
14
|
+
priority: number;
|
|
15
|
+
/**
|
|
16
|
+
* Check if this parser can handle the content
|
|
17
|
+
* @param content - Raw content to check
|
|
18
|
+
* @returns true if parser should process this content
|
|
19
|
+
*/
|
|
20
|
+
canParse(content: string): boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Parse content and return transformed output
|
|
23
|
+
* @param content - Raw content to parse
|
|
24
|
+
* @returns Parsed HTML string or transformed content
|
|
25
|
+
*/
|
|
26
|
+
parse(content: string): string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Parser registry interface for managing multiple parsers
|
|
30
|
+
* Optional interface for advanced parser management
|
|
31
|
+
*/
|
|
32
|
+
export interface AparteParserRegistry {
|
|
33
|
+
/** Register a new parser */
|
|
34
|
+
register(parser: AparteContentParser): void;
|
|
35
|
+
/** Unregister a parser by ID */
|
|
36
|
+
unregister(parserId: string): void;
|
|
37
|
+
/** Get all registered parsers */
|
|
38
|
+
getAll(): readonly AparteContentParser[];
|
|
39
|
+
/** Parse content through all applicable parsers */
|
|
40
|
+
parse(content: string): string;
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=parsers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parsers.d.ts","sourceRoot":"","sources":["../../src/types/parsers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH;;;;GAIG;AACH,MAAM,WAAW,mBAAmB;IAChC,uCAAuC;IACvC,EAAE,EAAE,MAAM,CAAC;IAEX,qDAAqD;IACrD,QAAQ,EAAE,MAAM,CAAC;IAEjB;;;;OAIG;IACH,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC;IAEnC;;;;OAIG;IACH,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC;CAClC;AAMD;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACjC,4BAA4B;IAC5B,QAAQ,CAAC,MAAM,EAAE,mBAAmB,GAAG,IAAI,CAAC;IAE5C,gCAAgC;IAChC,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IAEnC,iCAAiC;IACjC,MAAM,IAAI,SAAS,mBAAmB,EAAE,CAAC;IAEzC,mDAAmD;IACnD,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC;CAClC"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Aparte Providers
|
|
3
|
+
* Abstract interfaces for data providers and adapters
|
|
4
|
+
*/
|
|
5
|
+
import type { AparteMessage, AparteStatus } from './models.js';
|
|
6
|
+
import type { AparteControlEvent } from './events.js';
|
|
7
|
+
/**
|
|
8
|
+
* Abstract data provider interface
|
|
9
|
+
* Allows the viewport to receive data from any source
|
|
10
|
+
* (Fetch, WebSocket, Mock, or custom implementations)
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```typescript
|
|
14
|
+
* class WebSocketProvider implements AparteDataProvider {
|
|
15
|
+
* request(payload: unknown): void {
|
|
16
|
+
* this.socket.send(JSON.stringify(payload));
|
|
17
|
+
* }
|
|
18
|
+
* }
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export interface AparteDataProvider {
|
|
22
|
+
/**
|
|
23
|
+
* Send a request to the data source
|
|
24
|
+
* Implementation-agnostic method signature
|
|
25
|
+
*
|
|
26
|
+
* @param payload - Request payload (message, config, etc.)
|
|
27
|
+
*/
|
|
28
|
+
request(payload: unknown): void;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Extended provider interface for streaming responses
|
|
32
|
+
* Adds lifecycle hooks for stream management
|
|
33
|
+
*/
|
|
34
|
+
export interface AparteStreamProvider extends AparteDataProvider {
|
|
35
|
+
/**
|
|
36
|
+
* Optional: Called when streaming starts
|
|
37
|
+
* @param messageId - ID of the message being streamed
|
|
38
|
+
*/
|
|
39
|
+
onStreamStart?(messageId: string): void;
|
|
40
|
+
/**
|
|
41
|
+
* Optional: Called for each token received
|
|
42
|
+
* @param messageId - ID of the message
|
|
43
|
+
* @param chunk - Token chunk content
|
|
44
|
+
*/
|
|
45
|
+
onToken?(messageId: string, chunk: string): void;
|
|
46
|
+
/**
|
|
47
|
+
* Optional: Called when streaming completes
|
|
48
|
+
* @param messageId - ID of the completed message
|
|
49
|
+
*/
|
|
50
|
+
onStreamEnd?(messageId: string): void;
|
|
51
|
+
/**
|
|
52
|
+
* Optional: Called on error
|
|
53
|
+
* @param messageId - ID of the affected message
|
|
54
|
+
* @param error - Error details
|
|
55
|
+
*/
|
|
56
|
+
onError?(messageId: string, error: unknown): void;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Abstract message store interface
|
|
60
|
+
* Allows custom storage implementations (memory, IndexedDB, etc.)
|
|
61
|
+
*/
|
|
62
|
+
export interface AparteMessageStore {
|
|
63
|
+
/** Get a message by ID */
|
|
64
|
+
get(messageId: string): AparteMessage | undefined;
|
|
65
|
+
/** Get all messages */
|
|
66
|
+
getAll(): AparteMessage[];
|
|
67
|
+
/** Add or update a message */
|
|
68
|
+
set(message: AparteMessage): void;
|
|
69
|
+
/** Remove a message by ID */
|
|
70
|
+
delete(messageId: string): boolean;
|
|
71
|
+
/** Clear all messages */
|
|
72
|
+
clear(): void;
|
|
73
|
+
/** Get message count */
|
|
74
|
+
size(): number;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Interface for handling control events from external packages
|
|
78
|
+
* Allows decoupled communication between packages
|
|
79
|
+
*/
|
|
80
|
+
export interface AparteControlHandler {
|
|
81
|
+
/**
|
|
82
|
+
* Handle a control event
|
|
83
|
+
* @param event - Control event to process
|
|
84
|
+
*/
|
|
85
|
+
handleControl(event: AparteControlEvent): void;
|
|
86
|
+
/**
|
|
87
|
+
* Update message status
|
|
88
|
+
* @param messageId - Target message ID
|
|
89
|
+
* @param status - New status
|
|
90
|
+
*/
|
|
91
|
+
updateStatus(messageId: string, status: AparteStatus): void;
|
|
92
|
+
}
|
|
93
|
+
//# sourceMappingURL=providers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"providers.d.ts","sourceRoot":"","sources":["../../src/types/providers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC/D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAMtD;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,kBAAkB;IAC/B;;;;;OAKG;IACH,OAAO,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC;CACnC;AAMD;;;GAGG;AACH,MAAM,WAAW,oBAAqB,SAAQ,kBAAkB;IAC5D;;;OAGG;IACH,aAAa,CAAC,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAExC;;;;OAIG;IACH,OAAO,CAAC,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAEjD;;;OAGG;IACH,WAAW,CAAC,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAEtC;;;;OAIG;IACH,OAAO,CAAC,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI,CAAC;CACrD;AAMD;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IAC/B,0BAA0B;IAC1B,GAAG,CAAC,SAAS,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS,CAAC;IAElD,uBAAuB;IACvB,MAAM,IAAI,aAAa,EAAE,CAAC;IAE1B,8BAA8B;IAC9B,GAAG,CAAC,OAAO,EAAE,aAAa,GAAG,IAAI,CAAC;IAElC,6BAA6B;IAC7B,MAAM,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC;IAEnC,yBAAyB;IACzB,KAAK,IAAI,IAAI,CAAC;IAEd,wBAAwB;IACxB,IAAI,IAAI,MAAM,CAAC;CAClB;AAMD;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACjC;;;OAGG;IACH,aAAa,CAAC,KAAK,EAAE,kBAAkB,GAAG,IAAI,CAAC;IAE/C;;;;OAIG;IACH,YAAY,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,GAAG,IAAI,CAAC;CAC/D"}
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Aparte Segments
|
|
3
|
+
* Extensible segment types for rich message content
|
|
4
|
+
*/
|
|
5
|
+
/** Base segment interface - all segments extend this */
|
|
6
|
+
export interface AparteSegmentBase {
|
|
7
|
+
/** Unique segment identifier */
|
|
8
|
+
id: string;
|
|
9
|
+
/** Segment type discriminator */
|
|
10
|
+
type: string;
|
|
11
|
+
/** Whether segment is currently being streamed */
|
|
12
|
+
isStreaming?: boolean;
|
|
13
|
+
}
|
|
14
|
+
/** Text segment - plain text content */
|
|
15
|
+
export interface AparteTextSegment extends AparteSegmentBase {
|
|
16
|
+
type: 'text';
|
|
17
|
+
content: string;
|
|
18
|
+
}
|
|
19
|
+
/** Thinking/reasoning segment - collapsible */
|
|
20
|
+
export interface AparteThinkingSegment extends AparteSegmentBase {
|
|
21
|
+
type: 'thinking';
|
|
22
|
+
content: string;
|
|
23
|
+
collapsed?: boolean;
|
|
24
|
+
label?: string;
|
|
25
|
+
}
|
|
26
|
+
/** Code segment - syntax highlighted code block */
|
|
27
|
+
export interface AparteCodeSegment extends AparteSegmentBase {
|
|
28
|
+
type: 'code';
|
|
29
|
+
content: string;
|
|
30
|
+
language?: string;
|
|
31
|
+
filename?: string;
|
|
32
|
+
showLineNumbers?: boolean;
|
|
33
|
+
}
|
|
34
|
+
/** Diff segment - before/after code comparison */
|
|
35
|
+
export interface AparteDiffSegment extends AparteSegmentBase {
|
|
36
|
+
type: 'diff';
|
|
37
|
+
filename?: string;
|
|
38
|
+
hunks: AparteDiffHunk[];
|
|
39
|
+
}
|
|
40
|
+
export interface AparteDiffHunk {
|
|
41
|
+
oldStart: number;
|
|
42
|
+
newStart: number;
|
|
43
|
+
lines: AparteDiffLine[];
|
|
44
|
+
}
|
|
45
|
+
export interface AparteDiffLine {
|
|
46
|
+
type: 'add' | 'remove' | 'context';
|
|
47
|
+
content: string;
|
|
48
|
+
}
|
|
49
|
+
/** Terminal/console segment - command execution */
|
|
50
|
+
export interface AparteTerminalSegment extends AparteSegmentBase {
|
|
51
|
+
type: 'terminal';
|
|
52
|
+
command?: string;
|
|
53
|
+
output?: string;
|
|
54
|
+
exitCode?: number;
|
|
55
|
+
isRunning?: boolean;
|
|
56
|
+
}
|
|
57
|
+
/** File tree segment - directory structure */
|
|
58
|
+
export interface AparteFileTreeSegment extends AparteSegmentBase {
|
|
59
|
+
type: 'file-tree';
|
|
60
|
+
files: AparteFileNode[];
|
|
61
|
+
title?: string;
|
|
62
|
+
}
|
|
63
|
+
export interface AparteFileNode {
|
|
64
|
+
name: string;
|
|
65
|
+
path: string;
|
|
66
|
+
type: 'file' | 'directory';
|
|
67
|
+
children?: AparteFileNode[];
|
|
68
|
+
status?: 'added' | 'modified' | 'deleted';
|
|
69
|
+
}
|
|
70
|
+
/** Image segment */
|
|
71
|
+
export interface AparteImageSegment extends AparteSegmentBase {
|
|
72
|
+
type: 'image';
|
|
73
|
+
url: string;
|
|
74
|
+
alt?: string;
|
|
75
|
+
caption?: string;
|
|
76
|
+
}
|
|
77
|
+
/** Preview/iframe segment */
|
|
78
|
+
export interface ApartePreviewSegment extends AparteSegmentBase {
|
|
79
|
+
type: 'preview';
|
|
80
|
+
url: string;
|
|
81
|
+
title?: string;
|
|
82
|
+
height?: number;
|
|
83
|
+
}
|
|
84
|
+
/** Error segment */
|
|
85
|
+
export interface AparteErrorSegment extends AparteSegmentBase {
|
|
86
|
+
type: 'error';
|
|
87
|
+
content: string;
|
|
88
|
+
details?: string;
|
|
89
|
+
stack?: string;
|
|
90
|
+
}
|
|
91
|
+
/** Progress segment - for long operations */
|
|
92
|
+
export interface AparteProgressSegment extends AparteSegmentBase {
|
|
93
|
+
type: 'progress';
|
|
94
|
+
label: string;
|
|
95
|
+
percent?: number;
|
|
96
|
+
status?: 'pending' | 'running' | 'complete' | 'error';
|
|
97
|
+
}
|
|
98
|
+
/** Tool call segment - rendered while waiting for a tool handler to resolve */
|
|
99
|
+
export interface AparteToolCallSegment extends AparteSegmentBase {
|
|
100
|
+
type: 'tool_call';
|
|
101
|
+
toolCall: import('./tools.js').AparteToolCall;
|
|
102
|
+
/**
|
|
103
|
+
* `awaiting-approval` — paused for a human decision (needsApproval tools);
|
|
104
|
+
* `rejected` — the human declined to run it.
|
|
105
|
+
*/
|
|
106
|
+
status: 'pending' | 'resolved' | 'aborted' | 'awaiting-approval' | 'rejected';
|
|
107
|
+
result?: string;
|
|
108
|
+
}
|
|
109
|
+
/** Custom segment - for framework-specific views (Onboarding, Tools, etc.) */
|
|
110
|
+
export interface AparteCustomSegment extends AparteSegmentBase {
|
|
111
|
+
type: 'custom';
|
|
112
|
+
/** Unique string structure to identify the view (e.g. 'onboarding', 'webcontainer', 'weather-widget') */
|
|
113
|
+
subType: string;
|
|
114
|
+
/** Arbitrary data payload for the component */
|
|
115
|
+
data?: unknown;
|
|
116
|
+
/** Optional fallback text representation */
|
|
117
|
+
fallback?: string;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Artifact segment — a structured payload (React/HTML/SVG/JS/CSS, etc.) embedded in the
|
|
121
|
+
* assistant's reply. The payload is delimited in the stream by `<artifact type="...">…</artifact>`.
|
|
122
|
+
*
|
|
123
|
+
* The core only models the data and emits lifecycle events (`aparte-artifact-start|delta|ready`).
|
|
124
|
+
* Apps decide how to render the rich preview (typically a side panel with an iframe/code view).
|
|
125
|
+
*
|
|
126
|
+
* `mimeType` follows standard MIME conventions, with the Anthropic vendor namespace for
|
|
127
|
+
* framework-specific kinds:
|
|
128
|
+
* - `application/vnd.ant.react` (or `application/vnd.ant.html`, etc.)
|
|
129
|
+
* - `text/html`, `text/css`, `application/javascript`
|
|
130
|
+
* - `image/svg+xml`
|
|
131
|
+
*/
|
|
132
|
+
export interface AparteArtifactSegment extends AparteSegmentBase {
|
|
133
|
+
type: 'artifact';
|
|
134
|
+
/** Standard MIME type (verbatim from the `type="…"` attribute on the opening tag) */
|
|
135
|
+
mimeType: string;
|
|
136
|
+
/**
|
|
137
|
+
* Short kind identifier derived from `mimeType` (e.g. 'react', 'html', 'svg').
|
|
138
|
+
* Convenience for UIs that want to switch on a stable enum-like string.
|
|
139
|
+
*/
|
|
140
|
+
artifactType: string;
|
|
141
|
+
/** Optional human title (from the `title="…"` attribute on the opening tag) */
|
|
142
|
+
title?: string;
|
|
143
|
+
/** Body content between the opening and closing tag — accumulates while streaming. */
|
|
144
|
+
content: string;
|
|
145
|
+
/**
|
|
146
|
+
* When true, the renderer displays the artifact inline as a code block
|
|
147
|
+
* instead of a clickable pill that opens the side panel.
|
|
148
|
+
* Set by the client after the stream ends, based on content line count.
|
|
149
|
+
* Defaults to false (pill) while streaming.
|
|
150
|
+
*/
|
|
151
|
+
inline?: boolean;
|
|
152
|
+
}
|
|
153
|
+
/** Transient waiting indicator shown between pipeline phases */
|
|
154
|
+
export interface ApartePipelineWaitingSegment extends AparteSegmentBase {
|
|
155
|
+
type: 'pipeline-waiting';
|
|
156
|
+
}
|
|
157
|
+
/** All built-in segment types */
|
|
158
|
+
export type AparteSegment = AparteTextSegment | AparteThinkingSegment | AparteCodeSegment | AparteDiffSegment | AparteTerminalSegment | AparteFileTreeSegment | AparteImageSegment | ApartePreviewSegment | AparteErrorSegment | AparteProgressSegment | AparteCustomSegment | AparteToolCallSegment | AparteArtifactSegment | ApartePipelineWaitingSegment;
|
|
159
|
+
/** Segment type discriminator values */
|
|
160
|
+
export type AparteSegmentType = AparteSegment['type'];
|
|
161
|
+
/**
|
|
162
|
+
* Segment renderer interface for custom segment types
|
|
163
|
+
* Implement this to add new segment renderers
|
|
164
|
+
*/
|
|
165
|
+
export interface AparteSegmentRenderer<T extends AparteSegmentBase = AparteSegmentBase> {
|
|
166
|
+
/** Segment type this renderer handles */
|
|
167
|
+
type: string;
|
|
168
|
+
/**
|
|
169
|
+
* Render a segment to either an HTML string or a ready DOM element.
|
|
170
|
+
*
|
|
171
|
+
* Return a **string** for simple markup (inserted via innerHTML) — the built-in
|
|
172
|
+
* renderers do this. Return an **HTMLElement** to skip innerHTML entirely: you
|
|
173
|
+
* can attach event listeners and framework nodes directly, and there is no
|
|
174
|
+
* innerHTML XSS surface for values you interpolate. Either way, `setup()` (if
|
|
175
|
+
* provided) runs afterwards with the resulting element. For in-place streaming
|
|
176
|
+
* updates to find your element, keep a `data-segment-id="<segment.id>"` on its
|
|
177
|
+
* root (or implement `update()`).
|
|
178
|
+
*
|
|
179
|
+
* @param segment - Segment data to render
|
|
180
|
+
* @returns HTML string or a DOM element
|
|
181
|
+
*/
|
|
182
|
+
render(segment: T): string | HTMLElement;
|
|
183
|
+
/**
|
|
184
|
+
* Optional: Get CSS styles for this segment type
|
|
185
|
+
* @returns CSS string to inject
|
|
186
|
+
*/
|
|
187
|
+
getStyles?(): string;
|
|
188
|
+
/**
|
|
189
|
+
* Optional: Setup interactivity after render
|
|
190
|
+
* @param element - The rendered DOM element
|
|
191
|
+
* @param segment - Segment data
|
|
192
|
+
*/
|
|
193
|
+
setup?(element: HTMLElement, segment: T): void;
|
|
194
|
+
/**
|
|
195
|
+
* Optional: In-place DOM update during streaming.
|
|
196
|
+
* When provided, called instead of re-rendering the full element.
|
|
197
|
+
* Must not add/remove child nodes — only mutate attributes or textContent
|
|
198
|
+
* so the MutationObserver (childList) doesn't fire and scroll stays stable.
|
|
199
|
+
*/
|
|
200
|
+
update?(element: HTMLElement, segment: T): void;
|
|
201
|
+
/**
|
|
202
|
+
* Optional: Cleanup when segment is removed
|
|
203
|
+
* @param element - The DOM element being removed
|
|
204
|
+
*/
|
|
205
|
+
cleanup?(element: HTMLElement): void;
|
|
206
|
+
}
|
|
207
|
+
/** Event when a segment action is triggered (e.g., "Run", "Copy") */
|
|
208
|
+
export interface AparteSegmentActionEvent {
|
|
209
|
+
messageId: string;
|
|
210
|
+
segmentId: string;
|
|
211
|
+
action: string;
|
|
212
|
+
payload?: unknown;
|
|
213
|
+
}
|
|
214
|
+
/** Event when segment content is updated during streaming */
|
|
215
|
+
export interface AparteSegmentUpdateEvent {
|
|
216
|
+
messageId: string;
|
|
217
|
+
segmentId: string;
|
|
218
|
+
content: string;
|
|
219
|
+
append?: boolean;
|
|
220
|
+
}
|
|
221
|
+
//# sourceMappingURL=segments.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"segments.d.ts","sourceRoot":"","sources":["../../src/types/segments.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,wDAAwD;AACxD,MAAM,WAAW,iBAAiB;IAC9B,gCAAgC;IAChC,EAAE,EAAE,MAAM,CAAC;IAEX,iCAAiC;IACjC,IAAI,EAAE,MAAM,CAAC;IAEb,kDAAkD;IAClD,WAAW,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,wCAAwC;AACxC,MAAM,WAAW,iBAAkB,SAAQ,iBAAiB;IACxD,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACnB;AAED,+CAA+C;AAC/C,MAAM,WAAW,qBAAsB,SAAQ,iBAAiB;IAC5D,IAAI,EAAE,UAAU,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,mDAAmD;AACnD,MAAM,WAAW,iBAAkB,SAAQ,iBAAiB;IACxD,IAAI,EA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AAC,CAAC,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,CAAC,GAAG,IAAI,CAAC;IAEhD;;;OAGG;IACH,OAAO,CAAC,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,CAAC;CACxC;AAMD,qEAAqE;AACrE,MAAM,WAAW,wBAAwB;IACrC,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,6DAA6D;AAC7D,MAAM,WAAW,wBAAwB;IACrC,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,OAAO,CAAC;CACpB"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Aparte Theming
|
|
3
|
+
* CSS Custom Properties interfaces for theming
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* CSS Custom Properties available for theming
|
|
7
|
+
* All properties are optional - defaults are applied in components
|
|
8
|
+
*/
|
|
9
|
+
export interface AparteThemeVariables {
|
|
10
|
+
'--aparte-primary'?: string;
|
|
11
|
+
'--aparte-primary-hover'?: string;
|
|
12
|
+
'--aparte-secondary'?: string;
|
|
13
|
+
'--aparte-neutral'?: string;
|
|
14
|
+
'--aparte-message-content-bg-user'?: string;
|
|
15
|
+
'--aparte-message-content-bg-assistant'?: string;
|
|
16
|
+
'--aparte-message-content-text-user'?: string;
|
|
17
|
+
'--aparte-message-content-text-assistant'?: string;
|
|
18
|
+
'--aparte-message-content-radius'?: string;
|
|
19
|
+
'--aparte-message-content-radius-corner'?: string;
|
|
20
|
+
'--aparte-message-content-padding'?: string;
|
|
21
|
+
'--aparte-message-content-max-width'?: string;
|
|
22
|
+
'--aparte-message-content-font-size'?: string;
|
|
23
|
+
'--aparte-input-bg'?: string;
|
|
24
|
+
'--aparte-input-border'?: string;
|
|
25
|
+
'--aparte-input-text'?: string;
|
|
26
|
+
'--aparte-input-placeholder'?: string;
|
|
27
|
+
'--aparte-input-focus-border'?: string;
|
|
28
|
+
'--aparte-input-focus-ring'?: string;
|
|
29
|
+
'--aparte-input-radius'?: string;
|
|
30
|
+
'--aparte-input-font-size'?: string;
|
|
31
|
+
'--aparte-input-disabled-bg'?: string;
|
|
32
|
+
'--aparte-viewport-padding'?: string;
|
|
33
|
+
'--aparte-message-gap'?: string;
|
|
34
|
+
'--aparte-input-padding'?: string;
|
|
35
|
+
'--aparte-font-family'?: string;
|
|
36
|
+
'--aparte-timestamp-font-size'?: string;
|
|
37
|
+
'--aparte-status-color'?: string;
|
|
38
|
+
'--aparte-status-font-size'?: string;
|
|
39
|
+
'--aparte-status-dot-size'?: string;
|
|
40
|
+
'--aparte-status-padding'?: string;
|
|
41
|
+
'--aparte-button-radius'?: string;
|
|
42
|
+
'--aparte-button-text'?: string;
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=theming.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theming.d.ts","sourceRoot":"","sources":["../../src/types/theming.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IAEjC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAG5B,kCAAkC,CAAC,EAAE,MAAM,CAAC;IAC5C,uCAAuC,CAAC,EAAE,MAAM,CAAC;IACjD,oCAAoC,CAAC,EAAE,MAAM,CAAC;IAC9C,yCAAyC,CAAC,EAAE,MAAM,CAAC;IACnD,iCAAiC,CAAC,EAAE,MAAM,CAAC;IAC3C,wCAAwC,CAAC,EAAE,MAAM,CAAC;IAClD,kCAAkC,CAAC,EAAE,MAAM,CAAC;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