@memoreco/ui 0.2.12 → 0.2.13
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/dist/index.js +40 -45
- package/dist/index.mjs +3892 -3290
- package/dist/ui/src/components/avatar-with-thumbhash.d.ts +23 -0
- package/dist/ui/src/components/chat/ChatPanel.d.ts +1 -1
- package/dist/ui/src/components/chat/MarkdownText.d.ts +15 -3
- package/dist/ui/src/components/chat/TimecodeTag.d.ts +18 -4
- package/dist/ui/src/components/chat/types.d.ts +35 -1
- package/dist/ui/src/components/squircle.d.ts +17 -1
- package/dist/ui/src/index.d.ts +5 -1
- package/dist/ui/src/lib/squircle-path.d.ts +63 -0
- package/package.json +6 -5
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export interface AvatarWithThumbhashProps {
|
|
2
|
+
src?: string | null;
|
|
3
|
+
/** Base64 ThumbHash string */
|
|
4
|
+
thumbhash?: string | null;
|
|
5
|
+
alt?: string;
|
|
6
|
+
title?: string;
|
|
7
|
+
className?: string;
|
|
8
|
+
imgClassName?: string;
|
|
9
|
+
/** Used when there is no image (or it errors) */
|
|
10
|
+
fallbackText?: string;
|
|
11
|
+
/** Optional srcset for responsive image loading (CDN-transformed variants) */
|
|
12
|
+
srcSet?: string;
|
|
13
|
+
/** Optional sizes hint for responsive image selection */
|
|
14
|
+
sizes?: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Avatar that renders instantly from ThumbHash and fades the real image in.
|
|
18
|
+
*
|
|
19
|
+
* - Shows a ThumbHash placeholder immediately (if provided)
|
|
20
|
+
* - Cross-fades the real image in once it has loaded (works even when cached)
|
|
21
|
+
* - Falls back to initials when no src is available
|
|
22
|
+
*/
|
|
23
|
+
export declare function AvatarWithThumbhash({ src, thumbhash, alt, title, className, fallbackText, imgClassName, srcSet, sizes, }: AvatarWithThumbhashProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { ChatPanelProps } from './types';
|
|
2
2
|
|
|
3
|
-
export declare function ChatPanel({ transport, language, storageKey, persist, playerReady, onPlayMoment, onAddToNotes, followUps, emptyStateTitle, emptyStateSubtitle, inputPlaceholder, variant, className, }: ChatPanelProps): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export declare function ChatPanel({ transport, language, storageKey, persist, playerReady, onPlayMoment, activeMomentInstanceId, isPlaying, activeMomentCurrentSeconds, isSegmentEnded, onHoverMoment, onHoverMomentEnd, onAddToNotes, followUps, emptyStateTitle, emptyStateSubtitle, inputPlaceholder, variant, className, }: ChatPanelProps): import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
export default ChatPanel;
|
|
@@ -1,10 +1,22 @@
|
|
|
1
1
|
export interface MarkdownTextProps {
|
|
2
2
|
/** Markdown content to render */
|
|
3
3
|
markdown: string;
|
|
4
|
-
/** Callback when a time reference is clicked */
|
|
5
|
-
onSeekToMoment: (seconds: number, endSeconds?: number) => void;
|
|
4
|
+
/** Callback when a time reference is clicked — includes optional instanceId */
|
|
5
|
+
onSeekToMoment: (seconds: number, endSeconds?: number, instanceId?: string) => void;
|
|
6
|
+
/** Instance id of the currently active pill (only that exact pill highlights) */
|
|
7
|
+
activeMomentInstanceId?: string | null;
|
|
8
|
+
/** Whether media is currently playing (paired with `activeMomentInstanceId`) */
|
|
9
|
+
isPlaying?: boolean;
|
|
10
|
+
/** Current playback time in seconds for the active pill */
|
|
11
|
+
activeMomentCurrentSeconds?: number | null;
|
|
12
|
+
/** Whether the active segment has ended (shows replay icon on the active pill) */
|
|
13
|
+
isSegmentEnded?: boolean;
|
|
14
|
+
/** Called when the user hovers over a pill (for segment hint preview) */
|
|
15
|
+
onHoverMoment?: (startSeconds: number, endSeconds?: number) => void;
|
|
16
|
+
/** Called when the user stops hovering over a pill */
|
|
17
|
+
onHoverMomentEnd?: () => void;
|
|
6
18
|
/** Size variant */
|
|
7
19
|
size?: "sm" | "md";
|
|
8
20
|
}
|
|
9
|
-
export declare function MarkdownText({ markdown, onSeekToMoment, size, }: MarkdownTextProps): import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
export declare function MarkdownText({ markdown, onSeekToMoment, activeMomentInstanceId, isPlaying, activeMomentCurrentSeconds, isSegmentEnded, onHoverMoment, onHoverMomentEnd, size, }: MarkdownTextProps): import("react/jsx-runtime").JSX.Element;
|
|
10
22
|
export default MarkdownText;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export interface TimecodeTagProps {
|
|
2
|
-
/** Display label (
|
|
2
|
+
/** Display label (original markdown label) */
|
|
3
3
|
label: string;
|
|
4
4
|
/** Start time in seconds */
|
|
5
5
|
seconds: number;
|
|
@@ -7,10 +7,24 @@ export interface TimecodeTagProps {
|
|
|
7
7
|
endSeconds?: number;
|
|
8
8
|
/** Whether the tag is disabled */
|
|
9
9
|
disabled?: boolean;
|
|
10
|
-
/** Click handler */
|
|
11
|
-
onClick: (seconds: number, endSeconds?: number) => void;
|
|
10
|
+
/** Click handler — receives seconds, endSeconds, and optional instance id */
|
|
11
|
+
onClick: (seconds: number, endSeconds?: number, instanceId?: string) => void;
|
|
12
12
|
/** Size variant */
|
|
13
13
|
size?: "sm" | "md";
|
|
14
|
+
/** Whether this tag represents the currently playing moment (solid blue + pause icon) */
|
|
15
|
+
isActive?: boolean;
|
|
16
|
+
/** Whether media is currently playing (used with `isActive` to show pause icon) */
|
|
17
|
+
isPlaying?: boolean;
|
|
18
|
+
/** Current playback time for this active pill (used for live start-time display) */
|
|
19
|
+
activeMomentCurrentSeconds?: number | null;
|
|
20
|
+
/** Whether the active segment has ended (shows replay icon instead of play) */
|
|
21
|
+
isSegmentEnded?: boolean;
|
|
22
|
+
/** Unique instance id for this pill (distinguishes duplicates with same times) */
|
|
23
|
+
instanceId?: string;
|
|
24
|
+
/** Called when the user hovers over the pill (for segment hint preview) */
|
|
25
|
+
onHoverStart?: (seconds: number, endSeconds?: number) => void;
|
|
26
|
+
/** Called when the user stops hovering over the pill */
|
|
27
|
+
onHoverEnd?: () => void;
|
|
14
28
|
}
|
|
15
|
-
export declare function TimecodeTag({ label, seconds, endSeconds, disabled, onClick, size, }: TimecodeTagProps): import("react/jsx-runtime").JSX.Element;
|
|
29
|
+
export declare function TimecodeTag({ label, seconds, endSeconds, disabled, onClick, size, isActive, isPlaying, activeMomentCurrentSeconds, isSegmentEnded, instanceId, onHoverStart, onHoverEnd, }: TimecodeTagProps): import("react/jsx-runtime").JSX.Element;
|
|
16
30
|
export default TimecodeTag;
|
|
@@ -91,12 +91,46 @@ export interface ChatPanelProps {
|
|
|
91
91
|
playerReady?: boolean;
|
|
92
92
|
/**
|
|
93
93
|
* Callback when a time moment is clicked.
|
|
94
|
-
* Receives the start time in seconds.
|
|
94
|
+
* Receives the start time in seconds plus an optional unique instanceId.
|
|
95
95
|
*/
|
|
96
96
|
onPlayMoment?: (params: {
|
|
97
97
|
startSeconds: number;
|
|
98
98
|
endSeconds?: number;
|
|
99
|
+
instanceId?: string;
|
|
99
100
|
}) => void;
|
|
101
|
+
/**
|
|
102
|
+
* Instance id of the currently active pill.
|
|
103
|
+
* Only the pill with this exact id will be styled as "selected".
|
|
104
|
+
*/
|
|
105
|
+
activeMomentInstanceId?: string | null;
|
|
106
|
+
/**
|
|
107
|
+
* Whether media is currently playing.
|
|
108
|
+
* Used with `activeMomentInstanceId` to show a pause icon on the selected tag.
|
|
109
|
+
*/
|
|
110
|
+
isPlaying?: boolean;
|
|
111
|
+
/**
|
|
112
|
+
* Current playback time in seconds for the active moment.
|
|
113
|
+
* Used to show a live-advancing start time on the active pill while playing.
|
|
114
|
+
*/
|
|
115
|
+
activeMomentCurrentSeconds?: number | null;
|
|
116
|
+
/**
|
|
117
|
+
* Whether the active segment has ended (reached its end boundary).
|
|
118
|
+
* Shows a replay icon on the active pill instead of a play icon.
|
|
119
|
+
*/
|
|
120
|
+
isSegmentEnded?: boolean;
|
|
121
|
+
/**
|
|
122
|
+
* Keep the active pill visually highlighted even while paused.
|
|
123
|
+
* Useful for persistent "segment selected" UX.
|
|
124
|
+
*/
|
|
125
|
+
keepActiveMomentHighlighted?: boolean;
|
|
126
|
+
/**
|
|
127
|
+
* Called when the user hovers over a time pill (for segment hint preview on the player).
|
|
128
|
+
*/
|
|
129
|
+
onHoverMoment?: (startSeconds: number, endSeconds?: number) => void;
|
|
130
|
+
/**
|
|
131
|
+
* Called when the user stops hovering over a time pill.
|
|
132
|
+
*/
|
|
133
|
+
onHoverMomentEnd?: () => void;
|
|
100
134
|
/**
|
|
101
135
|
* Optional callback to add answer text to notes.
|
|
102
136
|
* If provided, shows "Add to notes" button.
|
|
@@ -1,10 +1,26 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
+
import { RadiusInput } from '../lib/squircle-path';
|
|
2
3
|
|
|
3
4
|
export interface SquircleProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
4
|
-
|
|
5
|
+
/** Corner radius in px (uniform or per-corner). Default 12. */
|
|
6
|
+
cornerRadius?: RadiusInput;
|
|
7
|
+
/** @deprecated Ignored — kept for API compatibility. Native smoothing is always applied. */
|
|
5
8
|
cornerSmoothing?: number;
|
|
6
9
|
borderWidth?: number;
|
|
7
10
|
borderColor?: string;
|
|
11
|
+
/** @deprecated Ignored — kept for API compatibility. */
|
|
8
12
|
asChild?: boolean;
|
|
9
13
|
}
|
|
14
|
+
/**
|
|
15
|
+
* A div whose corners use squircle (Apple-like superellipse) rounding.
|
|
16
|
+
*
|
|
17
|
+
* Prefers native `corner-shape: squircle` when the browser supports it
|
|
18
|
+
* (Chrome 138+). Falls back to an SVG `clip-path` generated from the
|
|
19
|
+
* OrgPad 3-Bézier-per-corner approximation.
|
|
20
|
+
*
|
|
21
|
+
* Usage:
|
|
22
|
+
* <Squircle cornerRadius={24} className="bg-blue-500 w-32 h-32">
|
|
23
|
+
* ...
|
|
24
|
+
* </Squircle>
|
|
25
|
+
*/
|
|
10
26
|
export declare const Squircle: React.ForwardRefExoticComponent<SquircleProps & React.RefAttributes<HTMLDivElement>>;
|
package/dist/ui/src/index.d.ts
CHANGED
|
@@ -22,6 +22,10 @@ export { ThumbnailCard } from './components/thumbnail-card';
|
|
|
22
22
|
export { ThumbnailPreviewOverlay } from './components/thumbnail-preview';
|
|
23
23
|
export { ThumbnailStrip } from './components/thumbnail-strip';
|
|
24
24
|
export { Squircle } from './components/squircle';
|
|
25
|
+
export type { SquircleProps } from './components/squircle';
|
|
26
|
+
export { buildSquircleRoundedRectPath, buildSquircleOBBPath, supportsCornerShapeSquircle, applyNativeSquircleStyle, removeNativeSquircleStyle, } from './lib/squircle-path';
|
|
27
|
+
export type { SquirclePathOptions, SquircleOBBPathOptions, PerCornerRadii as SquirclePerCornerRadii, RadiusInput as SquircleRadiusInput, } from './lib/squircle-path';
|
|
28
|
+
export { AvatarWithThumbhash } from './components/avatar-with-thumbhash';
|
|
25
29
|
export { ChatPanel, TimecodeTag, MarkdownText, safeReadChatFromStorage, safeWriteChatToStorage, safeRemoveChatFromStorage, messagesToStored, storedToMessages, parseSseEvent, readSseStream, parseTimecodeToSeconds, formatSecondsAsTimecode, linkifyTimeReferencesInMarkdown, getDefaultSuggestions, getBrowserLanguage, DEFAULT_SUGGESTIONS, } from './components/chat';
|
|
26
30
|
export type { ButtonProps } from './components/button';
|
|
27
31
|
export type { CardProps } from './components/card';
|
|
@@ -38,4 +42,4 @@ export type { ThumbnailPreviewOverlayProps } from './components/thumbnail-previe
|
|
|
38
42
|
export type { ThumbnailStripProps, ThumbnailData as UIThumbnailData } from './components/thumbnail-strip';
|
|
39
43
|
export type { ChatPanelProps, ChatTransport, ChatStreamRequest, ChatMessage, ChatResponse, ChatAnswerItem, ChatMoment, ChatSuggestion, StoredChatMessage, TimecodeTagProps, MarkdownTextProps, SSEEvent, SSEChunkEvent, SSECompleteEvent, SSEErrorEvent, } from './components/chat';
|
|
40
44
|
export { cn } from './lib/utils';
|
|
41
|
-
export declare const UI_LIBRARY_VERSION = "0.2.
|
|
45
|
+
export declare const UI_LIBRARY_VERSION = "0.2.13";
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OrgPad-style squircle path generator.
|
|
3
|
+
*
|
|
4
|
+
* Uses 3 cubic Bézier curves per corner (12 total) to approximate a
|
|
5
|
+
* superellipse rounded rectangle. This produces the smooth, Apple-like
|
|
6
|
+
* "squircle" corners that CSS `border-radius` alone cannot achieve.
|
|
7
|
+
*
|
|
8
|
+
* Reference: https://orgpad.info/blog/squircles
|
|
9
|
+
*
|
|
10
|
+
* Usage:
|
|
11
|
+
* const d = buildSquircleRoundedRectPath({ width: 200, height: 100, radius: 24 });
|
|
12
|
+
* // → SVG path `d` string in px coordinates
|
|
13
|
+
*
|
|
14
|
+
* For browsers that support `corner-shape: squircle` (Chrome 138+), you can
|
|
15
|
+
* skip the path entirely and use native CSS. Use `supportsCornerShapeSquircle()`
|
|
16
|
+
* to check.
|
|
17
|
+
*/
|
|
18
|
+
export interface PerCornerRadii {
|
|
19
|
+
nw: number;
|
|
20
|
+
ne: number;
|
|
21
|
+
se: number;
|
|
22
|
+
sw: number;
|
|
23
|
+
}
|
|
24
|
+
export type RadiusInput = number | PerCornerRadii;
|
|
25
|
+
export interface SquirclePathOptions {
|
|
26
|
+
width: number;
|
|
27
|
+
height: number;
|
|
28
|
+
/** Corner radius in px — single value or per-corner. Clamped to half the shorter side. */
|
|
29
|
+
radius: RadiusInput;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Generate an SVG path `d` string for a squircle-rounded rectangle.
|
|
33
|
+
*
|
|
34
|
+
* Coordinates are in user-space px matching the element's width/height.
|
|
35
|
+
* Use in an SVG `<clipPath clipPathUnits="userSpaceOnUse">` or directly
|
|
36
|
+
* as a CSS `clip-path: path(...)`.
|
|
37
|
+
*/
|
|
38
|
+
export declare function buildSquircleRoundedRectPath(opts: SquirclePathOptions): string;
|
|
39
|
+
export interface SquircleOBBPathOptions {
|
|
40
|
+
/**
|
|
41
|
+
* Corner radius as a fraction of the shorter dimension (0..0.5).
|
|
42
|
+
* 0 = sharp rectangle, 0.5 = maximum rounding.
|
|
43
|
+
*/
|
|
44
|
+
radiusFraction: RadiusInput;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Generate a squircle path in objectBoundingBox coordinates (0..1).
|
|
48
|
+
* Use with `<clipPath clipPathUnits="objectBoundingBox">`.
|
|
49
|
+
*/
|
|
50
|
+
export declare function buildSquircleOBBPath(opts: SquircleOBBPathOptions): string;
|
|
51
|
+
/**
|
|
52
|
+
* Returns true if the browser supports `corner-shape: squircle` natively.
|
|
53
|
+
* Result is cached after the first call.
|
|
54
|
+
*/
|
|
55
|
+
export declare function supportsCornerShapeSquircle(): boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Apply `corner-shape: squircle` to an element (bypasses TS CSSStyleDeclaration typing).
|
|
58
|
+
*/
|
|
59
|
+
export declare function applyNativeSquircleStyle(el: HTMLElement, radiusPx: string): void;
|
|
60
|
+
/**
|
|
61
|
+
* Remove native squircle styling from an element.
|
|
62
|
+
*/
|
|
63
|
+
export declare function removeNativeSquircleStyle(el: HTMLElement): void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@memoreco/ui",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.13",
|
|
4
4
|
"description": "Memoreco shared UI components with Shadcn",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"dist"
|
|
18
18
|
],
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@
|
|
20
|
+
"@phosphor-icons/react": "^2.1.10",
|
|
21
21
|
"@radix-ui/react-accordion": "^1.2.11",
|
|
22
22
|
"@radix-ui/react-alert-dialog": "^1.1.15",
|
|
23
23
|
"@radix-ui/react-checkbox": "^1.3.3",
|
|
@@ -31,7 +31,8 @@
|
|
|
31
31
|
"react-markdown": "^10.1.0",
|
|
32
32
|
"remark-gfm": "^4.0.1",
|
|
33
33
|
"sonner": "^2.0.7",
|
|
34
|
-
"tailwind-merge": "^2.2.1"
|
|
34
|
+
"tailwind-merge": "^2.2.1",
|
|
35
|
+
"thumbhash": "^0.1.1"
|
|
35
36
|
},
|
|
36
37
|
"devDependencies": {
|
|
37
38
|
"@types/node": "^22.19.0",
|
|
@@ -48,8 +49,8 @@
|
|
|
48
49
|
"vite": "^5.0.12",
|
|
49
50
|
"vite-plugin-dts": "^3.7.2",
|
|
50
51
|
"vitest": "^1.2.2",
|
|
51
|
-
"@memoreco/
|
|
52
|
-
"@memoreco/
|
|
52
|
+
"@memoreco/types": "0.2.0",
|
|
53
|
+
"@memoreco/utils": "0.2.0"
|
|
53
54
|
},
|
|
54
55
|
"peerDependencies": {
|
|
55
56
|
"react": ">=18.0.0",
|