@makolabs/ripple 2.5.9 → 3.0.1
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 +403 -497
- package/dist/adapters/storage/S3Adapter.d.ts +49 -1
- package/dist/adapters/storage/S3Adapter.js +38 -1
- package/dist/adapters/storage/types.d.ts +20 -0
- package/dist/ai/AIChatInterface.svelte +2 -1
- package/dist/ai/AIChatInterface.svelte.d.ts +2 -1
- package/dist/ai/CodeRenderer.svelte +7 -2
- package/dist/ai/CodeRenderer.svelte.d.ts +2 -1
- package/dist/ai/ComposeDropdown.svelte +1 -1
- package/dist/ai/MessageBox.svelte +3 -3
- package/dist/ai/MessageBox.svelte.d.ts +3 -2
- package/dist/ai/ThinkingDisplay.svelte +4 -3
- package/dist/ai/ThinkingDisplay.svelte.d.ts +2 -1
- package/dist/ai/ai-types.d.ts +55 -1
- package/dist/button/Button.svelte +5 -5
- package/dist/button/button-types.d.ts +49 -4
- package/dist/button/button.d.ts +9 -9
- package/dist/button/button.js +6 -6
- package/dist/charts/Chart.svelte +8 -16
- package/dist/charts/chart-types.d.ts +78 -1
- package/dist/drawer/Drawer.svelte +6 -26
- package/dist/drawer/drawer-types.d.ts +33 -12
- package/dist/drawer/drawer.d.ts +3 -3
- package/dist/drawer/drawer.js +1 -1
- package/dist/elements/accordion/Accordion.svelte +6 -17
- package/dist/elements/accordion/accordion-types.d.ts +53 -6
- package/dist/elements/alert/Alert.svelte +3 -0
- package/dist/elements/badge/Badge.svelte +1 -1
- package/dist/elements/badge/badge-types.d.ts +22 -0
- package/dist/elements/badge/badge.d.ts +3 -3
- package/dist/elements/badge/badge.js +1 -1
- package/dist/elements/combobox/ComboBox.svelte +244 -0
- package/dist/elements/combobox/ComboBox.svelte.d.ts +4 -0
- package/dist/elements/combobox/combobox-types.d.ts +41 -0
- package/dist/elements/combobox/combobox-types.js +1 -0
- package/dist/elements/context-menu/ContextMenu.svelte +137 -0
- package/dist/elements/context-menu/ContextMenu.svelte.d.ts +4 -0
- package/dist/elements/context-menu/context-menu-types.d.ts +40 -0
- package/dist/elements/context-menu/context-menu-types.js +1 -0
- package/dist/elements/dropdown/Dropdown.svelte +1 -1
- package/dist/elements/dropdown/Select.svelte +4 -1
- package/dist/elements/dropdown/dropdown-types.d.ts +114 -0
- package/dist/elements/dropdown/dropdown.d.ts +3 -3
- package/dist/elements/dropdown/dropdown.js +2 -2
- package/dist/elements/dropdown/select.d.ts +3 -108
- package/dist/elements/dropdown/select.js +38 -47
- package/dist/elements/empty-state/EmptyState.svelte +1 -1
- package/dist/elements/empty-state/empty-state-types.d.ts +32 -1
- package/dist/elements/empty-state/empty-state.d.ts +3 -3
- package/dist/elements/empty-state/empty-state.js +2 -2
- package/dist/elements/file-upload/FileUpload.svelte +5 -0
- package/dist/elements/file-upload/file-upload-types.d.ts +59 -0
- package/dist/elements/pagination/Pagination.svelte +53 -21
- package/dist/elements/pagination/Pagination.svelte.d.ts +33 -5
- package/dist/elements/popover/Popover.svelte +254 -0
- package/dist/elements/popover/Popover.svelte.d.ts +4 -0
- package/dist/elements/popover/index.d.ts +2 -0
- package/dist/elements/popover/index.js +1 -0
- package/dist/elements/popover/popover-types.d.ts +60 -0
- package/dist/elements/popover/popover-types.js +1 -0
- package/dist/elements/progress/Progress.svelte +32 -7
- package/dist/elements/progress/progress-types.d.ts +48 -1
- package/dist/elements/skeleton/Skeleton.svelte +56 -0
- package/dist/elements/skeleton/Skeleton.svelte.d.ts +4 -0
- package/dist/elements/skeleton/index.d.ts +2 -0
- package/dist/elements/skeleton/index.js +1 -0
- package/dist/elements/skeleton/skeleton-types.d.ts +50 -0
- package/dist/elements/skeleton/skeleton-types.js +1 -0
- package/dist/elements/spinner/Spinner.svelte +1 -1
- package/dist/elements/spinner/spinner-types.d.ts +20 -0
- package/dist/elements/spinner/spinner.d.ts +3 -3
- package/dist/elements/spinner/spinner.js +2 -2
- package/dist/elements/tooltip/Tooltip.svelte +108 -11
- package/dist/elements/tooltip/tooltip-types.d.ts +49 -1
- package/dist/file-browser/FileBrowser.svelte +21 -12
- package/dist/filters/CompactFilters.svelte +221 -33
- package/dist/filters/CompactFilters.svelte.d.ts +1 -1
- package/dist/filters/FilterBar.svelte +184 -0
- package/dist/filters/FilterBar.svelte.d.ts +4 -0
- package/dist/filters/FilterPopover.svelte +346 -0
- package/dist/filters/FilterPopover.svelte.d.ts +4 -0
- package/dist/filters/date-presets.d.ts +15 -0
- package/dist/filters/date-presets.js +107 -0
- package/dist/filters/filter-types.d.ts +69 -3
- package/dist/filters/index.d.ts +5 -0
- package/dist/filters/index.js +4 -0
- package/dist/filters/sync-filters-to-url.svelte.d.ts +37 -0
- package/dist/filters/sync-filters-to-url.svelte.js +114 -0
- package/dist/forms/Checkbox.svelte +24 -9
- package/dist/forms/DateRange.svelte +23 -6
- package/dist/forms/Input.svelte +19 -19
- package/dist/forms/MarketSelector.svelte +9 -4
- package/dist/forms/NumberInput.svelte +14 -18
- package/dist/forms/RadioGroup.svelte +127 -0
- package/dist/forms/RadioGroup.svelte.d.ts +4 -0
- package/dist/forms/SegmentedControl.svelte +11 -4
- package/dist/forms/Slider.svelte +72 -3
- package/dist/forms/Tags.svelte +44 -14
- package/dist/forms/Textarea.svelte +121 -0
- package/dist/forms/Textarea.svelte.d.ts +4 -0
- package/dist/forms/Toggle.svelte +30 -22
- package/dist/forms/calendar/Calendar.svelte +315 -0
- package/dist/forms/calendar/Calendar.svelte.d.ts +4 -0
- package/dist/forms/calendar/calendar-types.d.ts +54 -0
- package/dist/forms/calendar/calendar-types.js +1 -0
- package/dist/forms/calendar/index.d.ts +2 -0
- package/dist/forms/calendar/index.js +1 -0
- package/dist/forms/date-picker/DatePicker.svelte +141 -0
- package/dist/forms/date-picker/DatePicker.svelte.d.ts +4 -0
- package/dist/forms/date-picker/date-picker-types.d.ts +29 -0
- package/dist/forms/date-picker/date-picker-types.js +1 -0
- package/dist/forms/form-size.d.ts +37 -0
- package/dist/forms/form-size.js +67 -0
- package/dist/forms/form-types.d.ts +430 -6
- package/dist/forms/market/market-selector-types.d.ts +52 -1
- package/dist/forms/segmented-control.d.ts +5 -2
- package/dist/forms/segmented-control.js +25 -13
- package/dist/forms/slider.d.ts +3 -3
- package/dist/forms/slider.js +37 -30
- package/dist/funcs/user-management.remote.js +1 -1
- package/dist/header/Breadcrumbs.svelte +4 -20
- package/dist/header/PageHeader.svelte +6 -14
- package/dist/header/breadcrumbs.d.ts +3 -11
- package/dist/header/breadcrumbs.js +10 -5
- package/dist/header/header-types.d.ts +62 -11
- package/dist/index.d.ts +35 -9
- package/dist/index.js +24 -4
- package/dist/layout/activity-list/ActivityList.svelte +13 -7
- package/dist/layout/activity-list/activity-list-types.d.ts +46 -7
- package/dist/layout/card/Card.svelte +12 -15
- package/dist/layout/card/MetricCard.svelte +50 -32
- package/dist/layout/card/card-types.d.ts +114 -4
- package/dist/layout/navbar/navbar-types.d.ts +48 -0
- package/dist/layout/navbar/navbar.d.ts +3 -3
- package/dist/layout/navbar/navbar.js +2 -2
- package/dist/layout/sidebar/Sidebar.svelte +87 -11
- package/dist/layout/sidebar/sidebar-types.d.ts +60 -1
- package/dist/layout/stepper/Stepper.svelte +288 -0
- package/dist/layout/stepper/Stepper.svelte.d.ts +4 -0
- package/dist/layout/stepper/stepper-types.d.ts +80 -0
- package/dist/layout/stepper/stepper-types.js +1 -0
- package/dist/layout/table/Table.svelte +91 -85
- package/dist/layout/table/table-types.d.ts +148 -24
- package/dist/layout/table/table.d.ts +3 -3
- package/dist/layout/table/table.js +2 -2
- package/dist/layout/tabs/Tab.svelte +6 -2
- package/dist/layout/tabs/Tab.svelte.d.ts +4 -1
- package/dist/layout/tabs/TabGroup.svelte +9 -2
- package/dist/layout/tabs/tabs-types.d.ts +63 -0
- package/dist/layout/tabs/tabs.d.ts +3 -3
- package/dist/layout/tabs/tabs.js +12 -6
- package/dist/modal/ConfirmDialog.svelte +65 -0
- package/dist/modal/ConfirmDialog.svelte.d.ts +4 -0
- package/dist/modal/Modal.svelte +6 -26
- package/dist/modal/confirm-dialog-types.d.ts +39 -0
- package/dist/modal/confirm-dialog-types.js +1 -0
- package/dist/modal/modal-types.d.ts +51 -12
- package/dist/modal/modal.d.ts +3 -3
- package/dist/modal/modal.js +3 -3
- package/dist/pipeline/Pipeline.svelte +8 -3
- package/dist/pipeline/pipeline-types.d.ts +55 -3
- package/dist/pipeline/pipeline.d.ts +18 -3
- package/dist/pipeline/pipeline.js +7 -2
- package/dist/server/s3.d.ts +35 -3
- package/dist/sonner/Toaster.svelte +29 -0
- package/dist/sonner/Toaster.svelte.d.ts +4 -0
- package/dist/sonner/index.d.ts +21 -0
- package/dist/sonner/index.js +20 -0
- package/dist/user-management/UserManagement.svelte +22 -16
- package/dist/user-management/UserModal.svelte +10 -7
- package/dist/user-management/UserTable.svelte +16 -17
- package/dist/user-management/UserViewModal.svelte +11 -11
- package/dist/user-management/user-management-types.d.ts +118 -31
- package/dist/variants.d.ts +1 -1
- package/dist/variants.js +1 -1
- package/package.json +7 -4
- package/dist/config/ai.d.ts +0 -13
- package/dist/config/ai.js +0 -44
- package/dist/elements/empty-state/EmptyStateTestWrapper.svelte +0 -25
- package/dist/elements/empty-state/EmptyStateTestWrapper.svelte.d.ts +0 -8
- package/dist/elements/tooltip/TooltipTestWrapper.svelte +0 -14
- package/dist/elements/tooltip/TooltipTestWrapper.svelte.d.ts +0 -7
- package/dist/helper/deprecation.d.ts +0 -14
- package/dist/helper/deprecation.js +0 -24
- package/dist/modal/ModalFooterTestWrapper.svelte +0 -17
- package/dist/modal/ModalFooterTestWrapper.svelte.d.ts +0 -8
|
@@ -1,7 +1,36 @@
|
|
|
1
1
|
import type { FileItem, FileListResult } from './types.js';
|
|
2
2
|
import { BaseAdapter } from './BaseAdapter.js';
|
|
3
3
|
/**
|
|
4
|
-
* S3 storage adapter
|
|
4
|
+
* S3 storage adapter — the client-side half of the FileBrowser component.
|
|
5
|
+
*
|
|
6
|
+
* Talks to **two HTTP endpoints your app must expose**:
|
|
7
|
+
* - `GET /api/s3/list?prefix=<path>&search=<term>` — returns `{ folders, files }`
|
|
8
|
+
* - `GET /api/s3/download?key=<objectKey>` — returns a presigned URL as plain text
|
|
9
|
+
*
|
|
10
|
+
* The easiest way to implement the server side is with `createS3Handlers`
|
|
11
|
+
* from `@makolabs/ripple/server`, which keeps AWS credentials server-side
|
|
12
|
+
* and matches this adapter's expected request/response contract.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```svelte
|
|
16
|
+
* <script lang="ts">
|
|
17
|
+
* import { FileBrowser, S3Adapter } from '@makolabs/ripple';
|
|
18
|
+
*
|
|
19
|
+
* // Browse the whole bucket:
|
|
20
|
+
* const adapter = new S3Adapter({ basePath: '/' });
|
|
21
|
+
*
|
|
22
|
+
* // Or scope to a prefix and only list CSV/JSON files:
|
|
23
|
+
* // const adapter = new S3Adapter({
|
|
24
|
+
* // basePath: 'imports/',
|
|
25
|
+
* // fileExtensions: ['csv', 'json']
|
|
26
|
+
* // });
|
|
27
|
+
* </script>
|
|
28
|
+
*
|
|
29
|
+
* <FileBrowser {adapter} />
|
|
30
|
+
* ```
|
|
31
|
+
*
|
|
32
|
+
* @see `createS3Handlers` in `@makolabs/ripple/server` for the matching
|
|
33
|
+
* server-side SvelteKit route handlers.
|
|
5
34
|
*/
|
|
6
35
|
export declare class S3Adapter extends BaseAdapter {
|
|
7
36
|
private basePath;
|
|
@@ -10,9 +39,28 @@ export declare class S3Adapter extends BaseAdapter {
|
|
|
10
39
|
private displayNameStripPattern;
|
|
11
40
|
/** Default pattern strips common compression extensions (.gz, .bz2, .zip, .zst, .xz, .lz4). */
|
|
12
41
|
private static DEFAULT_STRIP_PATTERN;
|
|
42
|
+
/**
|
|
43
|
+
* @param basePathOrOptions Either a plain `basePath` string (e.g. `'imports/'`)
|
|
44
|
+
* or an options object. Pass an options object for anything beyond the
|
|
45
|
+
* basePath — it's the preferred form. A trailing string arg is supported
|
|
46
|
+
* for legacy callers.
|
|
47
|
+
* @param publicS3BasePath Legacy positional fallback for `basePath`. Prefer
|
|
48
|
+
* the options-object form.
|
|
49
|
+
*/
|
|
13
50
|
constructor(basePathOrOptions?: string | {
|
|
51
|
+
/** Prefix that scopes the browser (e.g. `'imports/'`). Shown as the root. @default '/' */
|
|
14
52
|
basePath?: string;
|
|
53
|
+
/**
|
|
54
|
+
* Override the bucket passed to the server endpoints via the
|
|
55
|
+
* `?bucket=` query param. Only has effect if the server's
|
|
56
|
+
* `createS3Handlers` was created with `allowBucketOverride: true`.
|
|
57
|
+
*/
|
|
15
58
|
bucket?: string;
|
|
59
|
+
/**
|
|
60
|
+
* If set, only files with one of these extensions (case-insensitive,
|
|
61
|
+
* no dot — e.g. `['csv', 'json']`) appear in the list. Folders are
|
|
62
|
+
* always shown.
|
|
63
|
+
*/
|
|
16
64
|
fileExtensions?: string[];
|
|
17
65
|
/** Regex applied to the filename to produce displayNameKey. @default strips .gz/.bz2/.zip/.zst/.xz/.lz4 */
|
|
18
66
|
displayNameStripPattern?: RegExp;
|
|
@@ -1,6 +1,35 @@
|
|
|
1
1
|
import { BaseAdapter } from './BaseAdapter.js';
|
|
2
2
|
/**
|
|
3
|
-
* S3 storage adapter
|
|
3
|
+
* S3 storage adapter — the client-side half of the FileBrowser component.
|
|
4
|
+
*
|
|
5
|
+
* Talks to **two HTTP endpoints your app must expose**:
|
|
6
|
+
* - `GET /api/s3/list?prefix=<path>&search=<term>` — returns `{ folders, files }`
|
|
7
|
+
* - `GET /api/s3/download?key=<objectKey>` — returns a presigned URL as plain text
|
|
8
|
+
*
|
|
9
|
+
* The easiest way to implement the server side is with `createS3Handlers`
|
|
10
|
+
* from `@makolabs/ripple/server`, which keeps AWS credentials server-side
|
|
11
|
+
* and matches this adapter's expected request/response contract.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```svelte
|
|
15
|
+
* <script lang="ts">
|
|
16
|
+
* import { FileBrowser, S3Adapter } from '@makolabs/ripple';
|
|
17
|
+
*
|
|
18
|
+
* // Browse the whole bucket:
|
|
19
|
+
* const adapter = new S3Adapter({ basePath: '/' });
|
|
20
|
+
*
|
|
21
|
+
* // Or scope to a prefix and only list CSV/JSON files:
|
|
22
|
+
* // const adapter = new S3Adapter({
|
|
23
|
+
* // basePath: 'imports/',
|
|
24
|
+
* // fileExtensions: ['csv', 'json']
|
|
25
|
+
* // });
|
|
26
|
+
* </script>
|
|
27
|
+
*
|
|
28
|
+
* <FileBrowser {adapter} />
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* @see `createS3Handlers` in `@makolabs/ripple/server` for the matching
|
|
32
|
+
* server-side SvelteKit route handlers.
|
|
4
33
|
*/
|
|
5
34
|
export class S3Adapter extends BaseAdapter {
|
|
6
35
|
basePath;
|
|
@@ -9,6 +38,14 @@ export class S3Adapter extends BaseAdapter {
|
|
|
9
38
|
displayNameStripPattern;
|
|
10
39
|
/** Default pattern strips common compression extensions (.gz, .bz2, .zip, .zst, .xz, .lz4). */
|
|
11
40
|
static DEFAULT_STRIP_PATTERN = /\.(gz|bz2|zip|zst|xz|lz4)$/i;
|
|
41
|
+
/**
|
|
42
|
+
* @param basePathOrOptions Either a plain `basePath` string (e.g. `'imports/'`)
|
|
43
|
+
* or an options object. Pass an options object for anything beyond the
|
|
44
|
+
* basePath — it's the preferred form. A trailing string arg is supported
|
|
45
|
+
* for legacy callers.
|
|
46
|
+
* @param publicS3BasePath Legacy positional fallback for `basePath`. Prefer
|
|
47
|
+
* the options-object form.
|
|
48
|
+
*/
|
|
12
49
|
constructor(basePathOrOptions, publicS3BasePath) {
|
|
13
50
|
super();
|
|
14
51
|
if (typeof basePathOrOptions === 'object' && basePathOrOptions !== null) {
|
|
@@ -93,18 +93,38 @@ export interface ErrorReportOptions {
|
|
|
93
93
|
userAction?: string;
|
|
94
94
|
}
|
|
95
95
|
type URLString = string;
|
|
96
|
+
/**
|
|
97
|
+
* Contract every `FileBrowser` adapter implements. Ripple ships `S3Adapter`
|
|
98
|
+
* and `GoogleDriveAdapter`; extend `BaseAdapter` (or implement this directly)
|
|
99
|
+
* to add a new storage backend.
|
|
100
|
+
*/
|
|
96
101
|
export interface StorageAdapter {
|
|
102
|
+
/** Human-readable provider name for UI display (e.g. `'S3'`, `'Google Drive'`). */
|
|
97
103
|
getName(): string;
|
|
104
|
+
/**
|
|
105
|
+
* List folders and files at the given path. `searchQuery` is a
|
|
106
|
+
* case-insensitive substring filter applied by the adapter.
|
|
107
|
+
*/
|
|
98
108
|
list(path: string, searchQuery?: string): Promise<FileListResult>;
|
|
109
|
+
/** Returns a URL the browser can GET to download the file (presigned for S3). */
|
|
99
110
|
download(file: FileItem): Promise<URLString>;
|
|
111
|
+
/** Start an import of a single file. Only implemented by adapters that support import. */
|
|
100
112
|
import?(file: FileItem, options: ImportOptions): Promise<ImportResult>;
|
|
113
|
+
/** Start a batch import. Only implemented by adapters that support import. */
|
|
101
114
|
batchImport?(files: FileItem[], options: ImportOptions): Promise<BatchImportResult>;
|
|
115
|
+
/** Poll the status of an in-flight import. */
|
|
102
116
|
getImportStatus?(importId: string, fileKey?: string): Promise<ImportStatus>;
|
|
117
|
+
/** Report a detailed error for a file import (for telemetry/support). */
|
|
103
118
|
reportError?(importId: string, options: ErrorReportOptions): Promise<boolean>;
|
|
119
|
+
/** True when the adapter has what it needs to operate (env vars set, tokens valid, etc.). */
|
|
104
120
|
isConfigured(): Promise<boolean>;
|
|
121
|
+
/** Optional OAuth-style authentication step. Called by the browser on first open. */
|
|
105
122
|
authenticate?(): Promise<boolean>;
|
|
123
|
+
/** Set a localStorage flag so the browser can auto-reopen after an OAuth redirect. */
|
|
106
124
|
setReopenFlag(): void;
|
|
125
|
+
/** Check whether the browser should auto-reopen after an OAuth redirect. */
|
|
107
126
|
shouldReopenBrowser(): boolean;
|
|
127
|
+
/** Clear the auto-reopen flag after the browser has been restored. */
|
|
108
128
|
clearReopenFlag(): void;
|
|
109
129
|
}
|
|
110
130
|
export {};
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
import ThinkingDisplay from './ThinkingDisplay.svelte';
|
|
7
7
|
import type { ChatMessage, ChatAction, VariantColors, StreamingCallback } from '../index.js';
|
|
8
8
|
import type { AIAdapter } from '../adapters/ai/index.js';
|
|
9
|
+
import type { ClassValue } from 'tailwind-variants';
|
|
9
10
|
|
|
10
11
|
interface AIChatInterfaceProps {
|
|
11
12
|
adapter: AIAdapter;
|
|
@@ -16,7 +17,7 @@
|
|
|
16
17
|
disabled?: boolean;
|
|
17
18
|
loading?: boolean;
|
|
18
19
|
messages?: ChatMessage[];
|
|
19
|
-
class?:
|
|
20
|
+
class?: ClassValue;
|
|
20
21
|
context?: Record<string, unknown>;
|
|
21
22
|
}
|
|
22
23
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ChatMessage, VariantColors } from '../index.js';
|
|
2
2
|
import type { AIAdapter } from '../adapters/ai/index.js';
|
|
3
|
+
import type { ClassValue } from 'tailwind-variants';
|
|
3
4
|
interface AIChatInterfaceProps {
|
|
4
5
|
adapter: AIAdapter;
|
|
5
6
|
title?: string;
|
|
@@ -9,7 +10,7 @@ interface AIChatInterfaceProps {
|
|
|
9
10
|
disabled?: boolean;
|
|
10
11
|
loading?: boolean;
|
|
11
12
|
messages?: ChatMessage[];
|
|
12
|
-
class?:
|
|
13
|
+
class?: ClassValue;
|
|
13
14
|
context?: Record<string, unknown>;
|
|
14
15
|
}
|
|
15
16
|
declare const AIChatInterface: import("svelte").Component<AIChatInterfaceProps, {}, "messages">;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import Highlight from 'svelte-highlight';
|
|
3
3
|
import { HighlightAuto } from 'svelte-highlight';
|
|
4
|
+
import type { ClassValue } from 'tailwind-variants';
|
|
5
|
+
import { cn } from '../helper/cls.js';
|
|
4
6
|
|
|
5
7
|
// Import common languages
|
|
6
8
|
import javascript from 'svelte-highlight/languages/javascript';
|
|
@@ -31,7 +33,7 @@
|
|
|
31
33
|
interface Props {
|
|
32
34
|
code: string;
|
|
33
35
|
language?: string;
|
|
34
|
-
class?:
|
|
36
|
+
class?: ClassValue;
|
|
35
37
|
}
|
|
36
38
|
|
|
37
39
|
let { code, language = 'text', class: className = '' }: Props = $props();
|
|
@@ -102,7 +104,10 @@
|
|
|
102
104
|
</svelte:head>
|
|
103
105
|
|
|
104
106
|
<div
|
|
105
|
-
class=
|
|
107
|
+
class={cn(
|
|
108
|
+
'code-renderer border-default-700 bg-default-900 my-4 overflow-hidden rounded-lg border',
|
|
109
|
+
className
|
|
110
|
+
)}
|
|
106
111
|
>
|
|
107
112
|
<!-- Header -->
|
|
108
113
|
<div
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import type { ClassValue } from 'tailwind-variants';
|
|
1
2
|
interface Props {
|
|
2
3
|
code: string;
|
|
3
4
|
language?: string;
|
|
4
|
-
class?:
|
|
5
|
+
class?: ClassValue;
|
|
5
6
|
}
|
|
6
7
|
declare const CodeRenderer: import("svelte").Component<Props, {}, "">;
|
|
7
8
|
type CodeRenderer = ReturnType<typeof CodeRenderer>;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { cn } from '../helper/cls.js';
|
|
3
3
|
import { formatTime } from '../helper/date.js';
|
|
4
4
|
import { marked } from 'marked';
|
|
5
|
-
import { tv } from 'tailwind-variants';
|
|
5
|
+
import { tv, type ClassValue } from 'tailwind-variants';
|
|
6
6
|
import type { VariantColors } from '../index.js';
|
|
7
7
|
import { parseContentSegments } from './content-detector.js';
|
|
8
8
|
import MermaidRenderer from './MermaidRenderer.svelte';
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
isUser: boolean;
|
|
14
14
|
color?: VariantColors;
|
|
15
15
|
timestamp?: Date;
|
|
16
|
-
userMessageClass?:
|
|
17
|
-
aiMessageClass?:
|
|
16
|
+
userMessageClass?: ClassValue;
|
|
17
|
+
aiMessageClass?: ClassValue;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
let {
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
+
import { type ClassValue } from 'tailwind-variants';
|
|
1
2
|
import type { VariantColors } from '../index.js';
|
|
2
3
|
interface Props {
|
|
3
4
|
content: string;
|
|
4
5
|
isUser: boolean;
|
|
5
6
|
color?: VariantColors;
|
|
6
7
|
timestamp?: Date;
|
|
7
|
-
userMessageClass?:
|
|
8
|
-
aiMessageClass?:
|
|
8
|
+
userMessageClass?: ClassValue;
|
|
9
|
+
aiMessageClass?: ClassValue;
|
|
9
10
|
}
|
|
10
11
|
declare const MessageBox: import("svelte").Component<Props, {}, "">;
|
|
11
12
|
type MessageBox = ReturnType<typeof MessageBox>;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import { tv } from 'tailwind-variants';
|
|
2
|
+
import { tv, type ClassValue } from 'tailwind-variants';
|
|
3
|
+
import { cn } from '../helper/cls.js';
|
|
3
4
|
|
|
4
5
|
interface ThinkingDisplayProps {
|
|
5
6
|
content: string;
|
|
6
7
|
isComplete?: boolean;
|
|
7
8
|
isVisible?: boolean;
|
|
8
|
-
class?:
|
|
9
|
+
class?: ClassValue;
|
|
9
10
|
}
|
|
10
11
|
|
|
11
12
|
let {
|
|
@@ -156,7 +157,7 @@
|
|
|
156
157
|
</script>
|
|
157
158
|
|
|
158
159
|
{#if isVisible && content}
|
|
159
|
-
<div bind:this={containerRef} class={
|
|
160
|
+
<div bind:this={containerRef} class={cn(containerClasses, className)}>
|
|
160
161
|
<!-- Header -->
|
|
161
162
|
<div
|
|
162
163
|
class={headerClasses}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { type ClassValue } from 'tailwind-variants';
|
|
1
2
|
interface ThinkingDisplayProps {
|
|
2
3
|
content: string;
|
|
3
4
|
isComplete?: boolean;
|
|
4
5
|
isVisible?: boolean;
|
|
5
|
-
class?:
|
|
6
|
+
class?: ClassValue;
|
|
6
7
|
}
|
|
7
8
|
declare const ThinkingDisplay: import("svelte").Component<ThinkingDisplayProps, {}, "">;
|
|
8
9
|
type ThinkingDisplay = ReturnType<typeof ThinkingDisplay>;
|
package/dist/ai/ai-types.d.ts
CHANGED
|
@@ -1,39 +1,93 @@
|
|
|
1
1
|
import type { Component } from 'svelte';
|
|
2
|
+
import type { ClassValue } from 'tailwind-variants';
|
|
2
3
|
import type { FileAction, FileItem, StorageAdapter } from '../adapters/storage/types.js';
|
|
4
|
+
/**
|
|
5
|
+
* Kind of message in the chat stream:
|
|
6
|
+
* - `'chat'` — normal user/assistant text turn
|
|
7
|
+
* - `'action'` — a tool call / structured action emitted by the model
|
|
8
|
+
* - `'thinking'` — reasoning content (model's internal monologue)
|
|
9
|
+
*/
|
|
3
10
|
export type ChatMessageType = 'chat' | 'action' | 'thinking';
|
|
11
|
+
/** Callback signature for streaming chat responses — fires per chunk. */
|
|
4
12
|
export type StreamingCallback = (response: ChatResponse) => void;
|
|
13
|
+
/**
|
|
14
|
+
* Structured action emitted by an AI message (tool call, function
|
|
15
|
+
* invocation, navigation request, etc.). The `type` discriminator is
|
|
16
|
+
* consumer-defined; `data` carries the action payload.
|
|
17
|
+
*/
|
|
5
18
|
export interface ChatAction {
|
|
6
19
|
type: string;
|
|
7
20
|
data: any;
|
|
8
21
|
metadata?: Record<string, any>;
|
|
9
22
|
}
|
|
23
|
+
/** A single message in the chat history (rendered by `<AIChatInterface>`). */
|
|
10
24
|
export interface ChatMessage {
|
|
11
25
|
id: string;
|
|
12
26
|
type: ChatMessageType;
|
|
13
27
|
content: string;
|
|
14
28
|
timestamp: Date;
|
|
15
29
|
action?: ChatAction;
|
|
30
|
+
/** Reasoning text rendered separately from `content` (collapsible). */
|
|
16
31
|
thinkingContent?: string;
|
|
32
|
+
/** Set true once the thinking stream has finished. */
|
|
17
33
|
isThinkingComplete?: boolean;
|
|
18
34
|
}
|
|
35
|
+
/**
|
|
36
|
+
* Response chunk from a streaming AI adapter. Adapters call the
|
|
37
|
+
* StreamingCallback once per chunk while a response is in flight; the
|
|
38
|
+
* final chunk has `isStreamEnd: true`.
|
|
39
|
+
*/
|
|
19
40
|
export interface ChatResponse {
|
|
20
41
|
type: ChatMessageType;
|
|
21
42
|
content: string;
|
|
22
43
|
action?: ChatAction;
|
|
44
|
+
/** ID of the message being updated (for streaming). */
|
|
23
45
|
messageId?: string;
|
|
46
|
+
/** Indicates if this is a streaming response. */
|
|
24
47
|
isStreaming?: boolean;
|
|
48
|
+
/** Indicates if this is the final chunk. */
|
|
25
49
|
isStreamEnd?: boolean;
|
|
50
|
+
/** Reasoning/thinking content. */
|
|
26
51
|
thinkingContent?: string;
|
|
52
|
+
/** Indicates if thinking is complete. */
|
|
27
53
|
isThinkingComplete?: boolean;
|
|
28
54
|
}
|
|
55
|
+
/**
|
|
56
|
+
* Suggested prompt button shown above the input in `<AIChatInterface>`.
|
|
57
|
+
* Clicking it pre-fills the input with `prompt`.
|
|
58
|
+
*/
|
|
29
59
|
export interface QuickAction {
|
|
30
60
|
label: string;
|
|
31
61
|
prompt: string;
|
|
32
62
|
icon?: Component;
|
|
33
63
|
}
|
|
34
64
|
export interface FileBrowserProps {
|
|
65
|
+
/**
|
|
66
|
+
* Storage adapter that backs the browser. Typically `S3Adapter` from
|
|
67
|
+
* `@makolabs/ripple` paired with `createS3Handlers` from
|
|
68
|
+
* `@makolabs/ripple/server`, but any class implementing `StorageAdapter`
|
|
69
|
+
* works (Google Drive adapter ships too).
|
|
70
|
+
*
|
|
71
|
+
* @example
|
|
72
|
+
* ```svelte
|
|
73
|
+
* <script>
|
|
74
|
+
* import { FileBrowser, S3Adapter } from '@makolabs/ripple';
|
|
75
|
+
* const adapter = new S3Adapter({ basePath: '/' });
|
|
76
|
+
* </script>
|
|
77
|
+
* <FileBrowser {adapter} />
|
|
78
|
+
* ```
|
|
79
|
+
*/
|
|
35
80
|
adapter: StorageAdapter;
|
|
81
|
+
/**
|
|
82
|
+
* Initial path/prefix the browser opens at. For S3, this is a key prefix
|
|
83
|
+
* like `'imports/2025/'`. @default '' (adapter's root)
|
|
84
|
+
*/
|
|
36
85
|
startPath?: string;
|
|
86
|
+
/**
|
|
87
|
+
* Per-file or batch actions shown in the row menu / selection toolbar.
|
|
88
|
+
* Each entry is either `FileActionSingle` (one file) or `FileActionBatch`
|
|
89
|
+
* (multi-select). `isAllowed` gates visibility per row/selection.
|
|
90
|
+
*/
|
|
37
91
|
actions?: FileAction[];
|
|
38
92
|
/**
|
|
39
93
|
* Bindable list of selected files as full FileItem objects. Consumers
|
|
@@ -54,7 +108,7 @@ export interface FileBrowserProps {
|
|
|
54
108
|
/** Tailwind height class for the browser container. @default 'h-[500px]' */
|
|
55
109
|
height?: string;
|
|
56
110
|
/** Additional CSS classes for the outer container. */
|
|
57
|
-
class?:
|
|
111
|
+
class?: ClassValue;
|
|
58
112
|
/**
|
|
59
113
|
* Custom sidebar snippet. When omitted, the FileBrowser renders a default
|
|
60
114
|
* sidebar with Clear All, batch action buttons, and per-file status icons.
|
|
@@ -8,10 +8,10 @@
|
|
|
8
8
|
let {
|
|
9
9
|
variant = 'solid',
|
|
10
10
|
color = Color.DEFAULT,
|
|
11
|
-
size = Size.
|
|
12
|
-
rounded = '
|
|
11
|
+
size = Size.MD,
|
|
12
|
+
rounded = 'md',
|
|
13
13
|
disabled = false,
|
|
14
|
-
|
|
14
|
+
loading = false,
|
|
15
15
|
class: className = '',
|
|
16
16
|
testId,
|
|
17
17
|
children,
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
color,
|
|
26
26
|
size,
|
|
27
27
|
rounded,
|
|
28
|
-
|
|
28
|
+
loading
|
|
29
29
|
}),
|
|
30
30
|
{
|
|
31
31
|
'opacity-50 pointer-events-none cursor-not-allowed': disabled
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
<button
|
|
46
46
|
class={buttonClasses}
|
|
47
47
|
data-testid={buildTestId('button', undefined, testId)}
|
|
48
|
-
disabled={disabled ||
|
|
48
|
+
disabled={disabled || loading}
|
|
49
49
|
{...restProps}
|
|
50
50
|
>
|
|
51
51
|
{#if children}
|
|
@@ -1,25 +1,70 @@
|
|
|
1
1
|
import type { ClassValue } from 'tailwind-variants';
|
|
2
2
|
import type { Snippet } from 'svelte';
|
|
3
3
|
import type { HTMLButtonAttributes, HTMLAttributeAnchorTarget } from 'svelte/elements';
|
|
4
|
-
import type { VariantColors, VariantSizes } from '../index.js';
|
|
4
|
+
import type { RoundedSizes, VariantColors, VariantSizes } from '../index.js';
|
|
5
|
+
/**
|
|
6
|
+
* Shared props for `<Button>` regardless of whether it renders as a
|
|
7
|
+
* `<button>` or `<a>`. Combine with one of `ButtonHTMLProps` /
|
|
8
|
+
* `AnchorHTMLProps` via the `ButtonProps` discriminated union — setting
|
|
9
|
+
* `href` switches to anchor mode.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```svelte
|
|
13
|
+
* <Button color="primary" onclick={save}>Save</Button>
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```svelte
|
|
18
|
+
* <!-- Renders as <a> when href is set -->
|
|
19
|
+
* <Button href="/settings" variant="link">Settings</Button>
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```svelte
|
|
24
|
+
* <!-- Async handler with loading state -->
|
|
25
|
+
* <Button {loading} onclick={async () => { loading = true; await save(); loading = false; }}>
|
|
26
|
+
* Save
|
|
27
|
+
* </Button>
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
5
30
|
export type BaseButtonProps = {
|
|
6
31
|
class?: ClassValue;
|
|
32
|
+
/**
|
|
33
|
+
* Visual weight:
|
|
34
|
+
* - `'solid'` (default) — filled background
|
|
35
|
+
* - `'outline'` — transparent bg + border
|
|
36
|
+
* - `'ghost'` — transparent bg + hover tint, no border
|
|
37
|
+
* - `'link'` — text-only, looks like an underlined link
|
|
38
|
+
*/
|
|
7
39
|
variant?: 'solid' | 'outline' | 'ghost' | 'link';
|
|
40
|
+
/** @default 'default' */
|
|
8
41
|
color?: VariantColors;
|
|
9
42
|
size?: VariantSizes;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
43
|
+
/** Corner radius scale. @default 'md' */
|
|
44
|
+
rounded?: RoundedSizes;
|
|
45
|
+
disabled?: boolean;
|
|
46
|
+
/** Show a loading animation and disable interaction. Async handlers pair well with this. @default false */
|
|
47
|
+
loading?: boolean;
|
|
48
|
+
/** Button content. */
|
|
13
49
|
children?: Snippet;
|
|
14
50
|
testId?: string;
|
|
15
51
|
};
|
|
52
|
+
/** Button-mode props: any `<button>` attribute is valid except `href`. */
|
|
16
53
|
export type ButtonHTMLProps = {
|
|
17
54
|
href?: never;
|
|
18
55
|
} & HTMLButtonAttributes;
|
|
56
|
+
/**
|
|
57
|
+
* Anchor-mode props: setting `href` switches the Button to render as
|
|
58
|
+
* `<a>` and exposes anchor-specific attributes (`target`, `rel`, etc.).
|
|
59
|
+
*/
|
|
19
60
|
export type AnchorHTMLProps = {
|
|
20
61
|
rel?: string | undefined | null;
|
|
21
62
|
target?: HTMLAttributeAnchorTarget | undefined | null;
|
|
22
63
|
referrerpolicy?: 'no-referrer' | 'no-referrer-when-downgrade' | 'origin' | 'origin-when-cross-origin' | 'same-origin' | 'strict-origin' | 'strict-origin-when-cross-origin' | 'unsafe-url' | undefined | null;
|
|
23
64
|
href: string;
|
|
24
65
|
} & Record<string, unknown>;
|
|
66
|
+
/**
|
|
67
|
+
* Full `<Button>` props. Discriminated by presence of `href` — with it,
|
|
68
|
+
* you get anchor attributes; without it, you get `<button>` attributes.
|
|
69
|
+
*/
|
|
25
70
|
export type ButtonProps = BaseButtonProps & (ButtonHTMLProps | AnchorHTMLProps);
|
package/dist/button/button.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ export declare const buttonVariants: import("tailwind-variants").TVReturnType<{
|
|
|
17
17
|
size: {
|
|
18
18
|
xs: string;
|
|
19
19
|
sm: string;
|
|
20
|
-
|
|
20
|
+
md: string;
|
|
21
21
|
lg: string;
|
|
22
22
|
xl: string;
|
|
23
23
|
"2xl": string;
|
|
@@ -26,13 +26,13 @@ export declare const buttonVariants: import("tailwind-variants").TVReturnType<{
|
|
|
26
26
|
none: string;
|
|
27
27
|
xs: string;
|
|
28
28
|
sm: string;
|
|
29
|
-
|
|
29
|
+
md: string;
|
|
30
30
|
lg: string;
|
|
31
31
|
xl: string;
|
|
32
32
|
'2xl': string;
|
|
33
33
|
full: string;
|
|
34
34
|
};
|
|
35
|
-
|
|
35
|
+
loading: {
|
|
36
36
|
true: string;
|
|
37
37
|
};
|
|
38
38
|
}, undefined, "\n\t\tinline-flex items-center justify-center font-medium transition-colors focus-visible:outline-none\n\t\tfocus-visible:ring-2 focus-visible:ring-offset-2 cursor-pointer\n\t\t", {
|
|
@@ -54,7 +54,7 @@ export declare const buttonVariants: import("tailwind-variants").TVReturnType<{
|
|
|
54
54
|
size: {
|
|
55
55
|
xs: string;
|
|
56
56
|
sm: string;
|
|
57
|
-
|
|
57
|
+
md: string;
|
|
58
58
|
lg: string;
|
|
59
59
|
xl: string;
|
|
60
60
|
"2xl": string;
|
|
@@ -63,13 +63,13 @@ export declare const buttonVariants: import("tailwind-variants").TVReturnType<{
|
|
|
63
63
|
none: string;
|
|
64
64
|
xs: string;
|
|
65
65
|
sm: string;
|
|
66
|
-
|
|
66
|
+
md: string;
|
|
67
67
|
lg: string;
|
|
68
68
|
xl: string;
|
|
69
69
|
'2xl': string;
|
|
70
70
|
full: string;
|
|
71
71
|
};
|
|
72
|
-
|
|
72
|
+
loading: {
|
|
73
73
|
true: string;
|
|
74
74
|
};
|
|
75
75
|
}, undefined, import("tailwind-variants").TVReturnType<{
|
|
@@ -91,7 +91,7 @@ export declare const buttonVariants: import("tailwind-variants").TVReturnType<{
|
|
|
91
91
|
size: {
|
|
92
92
|
xs: string;
|
|
93
93
|
sm: string;
|
|
94
|
-
|
|
94
|
+
md: string;
|
|
95
95
|
lg: string;
|
|
96
96
|
xl: string;
|
|
97
97
|
"2xl": string;
|
|
@@ -100,13 +100,13 @@ export declare const buttonVariants: import("tailwind-variants").TVReturnType<{
|
|
|
100
100
|
none: string;
|
|
101
101
|
xs: string;
|
|
102
102
|
sm: string;
|
|
103
|
-
|
|
103
|
+
md: string;
|
|
104
104
|
lg: string;
|
|
105
105
|
xl: string;
|
|
106
106
|
'2xl': string;
|
|
107
107
|
full: string;
|
|
108
108
|
};
|
|
109
|
-
|
|
109
|
+
loading: {
|
|
110
110
|
true: string;
|
|
111
111
|
};
|
|
112
112
|
}, undefined, "\n\t\tinline-flex items-center justify-center font-medium transition-colors focus-visible:outline-none\n\t\tfocus-visible:ring-2 focus-visible:ring-offset-2 cursor-pointer\n\t\t", unknown, unknown, undefined>>;
|
package/dist/button/button.js
CHANGED
|
@@ -24,7 +24,7 @@ export const buttonVariants = tv({
|
|
|
24
24
|
size: {
|
|
25
25
|
[Size.XS]: 'h-7 px-2 text-xs',
|
|
26
26
|
[Size.SM]: 'h-8 px-3 text-sm',
|
|
27
|
-
[Size.
|
|
27
|
+
[Size.MD]: 'h-9 px-4 text-sm',
|
|
28
28
|
[Size.LG]: 'h-10 px-5 text-base',
|
|
29
29
|
[Size.XL]: 'h-12 px-6 text-lg',
|
|
30
30
|
[Size.XXL]: 'h-14 px-8 text-xl'
|
|
@@ -33,13 +33,13 @@ export const buttonVariants = tv({
|
|
|
33
33
|
none: 'rounded-none',
|
|
34
34
|
xs: 'rounded-xs',
|
|
35
35
|
sm: 'rounded-sm',
|
|
36
|
-
|
|
36
|
+
md: 'rounded-md',
|
|
37
37
|
lg: 'rounded-lg',
|
|
38
38
|
xl: 'rounded-xl',
|
|
39
39
|
'2xl': 'rounded-2xl',
|
|
40
40
|
full: 'rounded-full'
|
|
41
41
|
},
|
|
42
|
-
|
|
42
|
+
loading: {
|
|
43
43
|
true: 'animate-pulse'
|
|
44
44
|
}
|
|
45
45
|
},
|
|
@@ -161,8 +161,8 @@ export const buttonVariants = tv({
|
|
|
161
161
|
defaultVariants: {
|
|
162
162
|
variant: 'solid',
|
|
163
163
|
color: 'default',
|
|
164
|
-
size: '
|
|
165
|
-
rounded: '
|
|
166
|
-
|
|
164
|
+
size: 'md',
|
|
165
|
+
rounded: 'md',
|
|
166
|
+
loading: false
|
|
167
167
|
}
|
|
168
168
|
});
|