@ai-matrx/media 0.13.0 → 0.14.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/dist/react.d.cts CHANGED
@@ -1,7 +1,8 @@
1
1
  import * as react from 'react';
2
- import react__default, { SVGProps, HTMLAttributes, InputHTMLAttributes, ReactNode } from 'react';
2
+ import react__default, { SVGProps, HTMLAttributes, InputHTMLAttributes, ReactNode, ComponentProps } from 'react';
3
3
  import { MediaRefLike, DurableSrc, MediaUploadOptions, MediaActionKind } from './index.cjs';
4
4
  import { M as MediaUploadEntry } from './use-media-upload-v5Uq9Ruq.cjs';
5
+ import { Volume2TapButton } from '@ai-matrx/tap-target/buttons';
5
6
 
6
7
  /**
7
8
  * src/react/cn.ts — conditional class join with last-wins Tailwind conflict
@@ -342,4 +343,27 @@ interface MediaLightboxProps {
342
343
  }
343
344
  declare function MediaLightbox({ open, onClose, mediaRef, fileName, alt, as, autoPlay, playsInline, poster, playbackLabel, actions, hideUnavailableActions, headerExtra, className, }: MediaLightboxProps): react.JSX.Element | null;
344
345
 
345
- export { AlertCircleIcon, ArchiveIcon, BracesIcon, CheckCircle2Icon, CheckIcon, CodeIcon, CopyIcon, DatabaseIcon, DownloadIcon, ExternalLinkIcon, FileAudioIcon, FileCodeIcon, FileIcon, type FileIconProps, FileJsonIcon, FileSpreadsheetIcon, FileTextIcon, FileTypeIcon, FileUploadDropzone, type FileUploadDropzoneActions, type FileUploadDropzoneProps, FileVideoIcon, FolderIcon, FolderOpenIcon, GlobeIcon, ImageIcon, ImageOffIcon, InlineMediaRef, type InlineMediaRefFit, type InlineMediaRefProps, type InlineMediaRefSize, Link2Icon, MediaActionToolbar, type MediaActionToolbarProps, type MediaDropzoneOptions, type MediaDropzoneState, type MediaIconProps, MediaLightbox, type MediaLightboxProps, MediaThumbnail, type MediaThumbnailProps, MusicIcon, PackageBoxIcon, PauseIcon, PenToolIcon, PlayIcon, PlusIcon, SearchIcon, Settings2Icon, Share2Icon, SpinnerIcon, SubtitlesIcon, UploadIcon, UploadProgressList, type UploadProgressListProps, VideoIcon, VideoOffIcon, VolumeXIcon, XIcon, cn, useMediaDropzone };
346
+ type ReadAloudStatus = "idle" | "loading" | "playing" | "paused" | "error";
347
+ type TapVariant = ComponentProps<typeof Volume2TapButton>["variant"];
348
+ interface ReadAloudButtonProps {
349
+ status: ReadAloudStatus;
350
+ onPress: () => void;
351
+ /** The host's sentence for the person when `status` is "error". */
352
+ error?: string | null;
353
+ /** Nothing to read (empty text) or the host forbids it right now. */
354
+ disabled?: boolean;
355
+ variant?: TapVariant;
356
+ className?: string;
357
+ /** Label for the idle state. Default "Read aloud". */
358
+ label?: string;
359
+ }
360
+ declare function ReadAloudButton({ status, onPress, error, disabled, variant, className, label, }: ReadAloudButtonProps): react.JSX.Element;
361
+
362
+ interface ReadAloudLanguagePickerProps {
363
+ value: string;
364
+ onChange: (code: string) => void;
365
+ className?: string;
366
+ }
367
+ declare function ReadAloudLanguagePicker({ value, onChange, className }: ReadAloudLanguagePickerProps): react.JSX.Element;
368
+
369
+ export { AlertCircleIcon, ArchiveIcon, BracesIcon, CheckCircle2Icon, CheckIcon, CodeIcon, CopyIcon, DatabaseIcon, DownloadIcon, ExternalLinkIcon, FileAudioIcon, FileCodeIcon, FileIcon, type FileIconProps, FileJsonIcon, FileSpreadsheetIcon, FileTextIcon, FileTypeIcon, FileUploadDropzone, type FileUploadDropzoneActions, type FileUploadDropzoneProps, FileVideoIcon, FolderIcon, FolderOpenIcon, GlobeIcon, ImageIcon, ImageOffIcon, InlineMediaRef, type InlineMediaRefFit, type InlineMediaRefProps, type InlineMediaRefSize, Link2Icon, MediaActionToolbar, type MediaActionToolbarProps, type MediaDropzoneOptions, type MediaDropzoneState, type MediaIconProps, MediaLightbox, type MediaLightboxProps, MediaThumbnail, type MediaThumbnailProps, MusicIcon, PackageBoxIcon, PauseIcon, PenToolIcon, PlayIcon, PlusIcon, ReadAloudButton, type ReadAloudButtonProps, ReadAloudLanguagePicker, type ReadAloudLanguagePickerProps, type ReadAloudStatus, SearchIcon, Settings2Icon, Share2Icon, SpinnerIcon, SubtitlesIcon, UploadIcon, UploadProgressList, type UploadProgressListProps, VideoIcon, VideoOffIcon, VolumeXIcon, XIcon, cn, useMediaDropzone };
package/dist/react.d.ts CHANGED
@@ -1,7 +1,8 @@
1
1
  import * as react from 'react';
2
- import react__default, { SVGProps, HTMLAttributes, InputHTMLAttributes, ReactNode } from 'react';
2
+ import react__default, { SVGProps, HTMLAttributes, InputHTMLAttributes, ReactNode, ComponentProps } from 'react';
3
3
  import { MediaRefLike, DurableSrc, MediaUploadOptions, MediaActionKind } from './index.js';
4
4
  import { M as MediaUploadEntry } from './use-media-upload-Dg2HSvTq.js';
5
+ import { Volume2TapButton } from '@ai-matrx/tap-target/buttons';
5
6
 
6
7
  /**
7
8
  * src/react/cn.ts — conditional class join with last-wins Tailwind conflict
@@ -342,4 +343,27 @@ interface MediaLightboxProps {
342
343
  }
343
344
  declare function MediaLightbox({ open, onClose, mediaRef, fileName, alt, as, autoPlay, playsInline, poster, playbackLabel, actions, hideUnavailableActions, headerExtra, className, }: MediaLightboxProps): react.JSX.Element | null;
344
345
 
345
- export { AlertCircleIcon, ArchiveIcon, BracesIcon, CheckCircle2Icon, CheckIcon, CodeIcon, CopyIcon, DatabaseIcon, DownloadIcon, ExternalLinkIcon, FileAudioIcon, FileCodeIcon, FileIcon, type FileIconProps, FileJsonIcon, FileSpreadsheetIcon, FileTextIcon, FileTypeIcon, FileUploadDropzone, type FileUploadDropzoneActions, type FileUploadDropzoneProps, FileVideoIcon, FolderIcon, FolderOpenIcon, GlobeIcon, ImageIcon, ImageOffIcon, InlineMediaRef, type InlineMediaRefFit, type InlineMediaRefProps, type InlineMediaRefSize, Link2Icon, MediaActionToolbar, type MediaActionToolbarProps, type MediaDropzoneOptions, type MediaDropzoneState, type MediaIconProps, MediaLightbox, type MediaLightboxProps, MediaThumbnail, type MediaThumbnailProps, MusicIcon, PackageBoxIcon, PauseIcon, PenToolIcon, PlayIcon, PlusIcon, SearchIcon, Settings2Icon, Share2Icon, SpinnerIcon, SubtitlesIcon, UploadIcon, UploadProgressList, type UploadProgressListProps, VideoIcon, VideoOffIcon, VolumeXIcon, XIcon, cn, useMediaDropzone };
346
+ type ReadAloudStatus = "idle" | "loading" | "playing" | "paused" | "error";
347
+ type TapVariant = ComponentProps<typeof Volume2TapButton>["variant"];
348
+ interface ReadAloudButtonProps {
349
+ status: ReadAloudStatus;
350
+ onPress: () => void;
351
+ /** The host's sentence for the person when `status` is "error". */
352
+ error?: string | null;
353
+ /** Nothing to read (empty text) or the host forbids it right now. */
354
+ disabled?: boolean;
355
+ variant?: TapVariant;
356
+ className?: string;
357
+ /** Label for the idle state. Default "Read aloud". */
358
+ label?: string;
359
+ }
360
+ declare function ReadAloudButton({ status, onPress, error, disabled, variant, className, label, }: ReadAloudButtonProps): react.JSX.Element;
361
+
362
+ interface ReadAloudLanguagePickerProps {
363
+ value: string;
364
+ onChange: (code: string) => void;
365
+ className?: string;
366
+ }
367
+ declare function ReadAloudLanguagePicker({ value, onChange, className }: ReadAloudLanguagePickerProps): react.JSX.Element;
368
+
369
+ export { AlertCircleIcon, ArchiveIcon, BracesIcon, CheckCircle2Icon, CheckIcon, CodeIcon, CopyIcon, DatabaseIcon, DownloadIcon, ExternalLinkIcon, FileAudioIcon, FileCodeIcon, FileIcon, type FileIconProps, FileJsonIcon, FileSpreadsheetIcon, FileTextIcon, FileTypeIcon, FileUploadDropzone, type FileUploadDropzoneActions, type FileUploadDropzoneProps, FileVideoIcon, FolderIcon, FolderOpenIcon, GlobeIcon, ImageIcon, ImageOffIcon, InlineMediaRef, type InlineMediaRefFit, type InlineMediaRefProps, type InlineMediaRefSize, Link2Icon, MediaActionToolbar, type MediaActionToolbarProps, type MediaDropzoneOptions, type MediaDropzoneState, type MediaIconProps, MediaLightbox, type MediaLightboxProps, MediaThumbnail, type MediaThumbnailProps, MusicIcon, PackageBoxIcon, PauseIcon, PenToolIcon, PlayIcon, PlusIcon, ReadAloudButton, type ReadAloudButtonProps, ReadAloudLanguagePicker, type ReadAloudLanguagePickerProps, type ReadAloudStatus, SearchIcon, Settings2Icon, Share2Icon, SpinnerIcon, SubtitlesIcon, UploadIcon, UploadProgressList, type UploadProgressListProps, VideoIcon, VideoOffIcon, VolumeXIcon, XIcon, cn, useMediaDropzone };
package/dist/react.js CHANGED
@@ -2475,6 +2475,124 @@ function MediaLightbox({
2475
2475
  }
2476
2476
  );
2477
2477
  }
2478
+
2479
+ // src/react/read-aloud-button.tsx
2480
+ import { PauseTapButton, TriangleAlertTapButton, Volume2TapButton } from "@ai-matrx/tap-target/buttons";
2481
+ import { jsx as jsx9 } from "react/jsx-runtime";
2482
+ function ReadAloudButton({
2483
+ status,
2484
+ onPress,
2485
+ error,
2486
+ disabled = false,
2487
+ variant,
2488
+ className,
2489
+ label = "Read aloud"
2490
+ }) {
2491
+ if (status === "playing") {
2492
+ return /* @__PURE__ */ jsx9(PauseTapButton, { variant, onClick: onPress, disabled, ariaLabel: "Pause", className });
2493
+ }
2494
+ if (status === "error") {
2495
+ return /* @__PURE__ */ jsx9(
2496
+ TriangleAlertTapButton,
2497
+ {
2498
+ variant,
2499
+ onClick: onPress,
2500
+ disabled,
2501
+ ariaLabel: error || "Read aloud failed. Press to try again.",
2502
+ className
2503
+ }
2504
+ );
2505
+ }
2506
+ const loading = status === "loading";
2507
+ return /* @__PURE__ */ jsx9(
2508
+ Volume2TapButton,
2509
+ {
2510
+ variant,
2511
+ onClick: onPress,
2512
+ disabled: disabled || loading,
2513
+ ariaLabel: loading ? "Connecting\u2026" : status === "paused" ? "Resume" : label,
2514
+ className
2515
+ }
2516
+ );
2517
+ }
2518
+
2519
+ // src/react/read-aloud-language-picker.tsx
2520
+ import { Button, Popover, PopoverContent, PopoverTrigger } from "@ai-matrx/design-system";
2521
+ import { Check, Languages } from "lucide-react";
2522
+ import { useState as useState10 } from "react";
2523
+
2524
+ // src/voices/read-aloud-languages.ts
2525
+ var READ_ALOUD_LANGUAGES = [
2526
+ { code: "en", englishName: "English", nativeName: "English" },
2527
+ { code: "es", englishName: "Spanish", nativeName: "Espa\xF1ol" },
2528
+ { code: "fr", englishName: "French", nativeName: "Fran\xE7ais" },
2529
+ { code: "de", englishName: "German", nativeName: "Deutsch" },
2530
+ { code: "it", englishName: "Italian", nativeName: "Italiano" },
2531
+ { code: "pt", englishName: "Portuguese", nativeName: "Portugu\xEAs" },
2532
+ { code: "zh", englishName: "Chinese", nativeName: "\u4E2D\u6587" },
2533
+ { code: "ja", englishName: "Japanese", nativeName: "\u65E5\u672C\u8A9E" },
2534
+ { code: "ko", englishName: "Korean", nativeName: "\uD55C\uAD6D\uC5B4" },
2535
+ { code: "ru", englishName: "Russian", nativeName: "\u0420\u0443\u0441\u0441\u043A\u0438\u0439" },
2536
+ { code: "hi", englishName: "Hindi", nativeName: "\u0939\u093F\u0928\u094D\u0926\u0940" },
2537
+ { code: "nl", englishName: "Dutch", nativeName: "Nederlands" },
2538
+ { code: "pl", englishName: "Polish", nativeName: "Polski" },
2539
+ { code: "sv", englishName: "Swedish", nativeName: "Svenska" },
2540
+ { code: "tr", englishName: "Turkish", nativeName: "T\xFCrk\xE7e" },
2541
+ { code: "fa", englishName: "Persian", nativeName: "\u0641\u0627\u0631\u0633\u06CC" }
2542
+ ];
2543
+ function readAloudLanguage(code) {
2544
+ return READ_ALOUD_LANGUAGES.find((l) => l.code === code) ?? READ_ALOUD_LANGUAGES[0];
2545
+ }
2546
+
2547
+ // src/react/read-aloud-language-picker.tsx
2548
+ import { jsx as jsx10, jsxs as jsxs7 } from "react/jsx-runtime";
2549
+ function ReadAloudLanguagePicker({ value, onChange, className }) {
2550
+ const [open, setOpen] = useState10(false);
2551
+ const selected = readAloudLanguage(value);
2552
+ return /* @__PURE__ */ jsxs7(Popover, { open, onOpenChange: setOpen, children: [
2553
+ /* @__PURE__ */ jsx10(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx10(
2554
+ Button,
2555
+ {
2556
+ variant: "ghost",
2557
+ size: "icon",
2558
+ className: cn("size-7 text-muted-foreground", className),
2559
+ title: `Voice language: ${selected.englishName}`,
2560
+ "aria-label": `Voice language, currently ${selected.englishName}`,
2561
+ children: /* @__PURE__ */ jsx10(Languages, { className: "size-3.5" })
2562
+ }
2563
+ ) }),
2564
+ /* @__PURE__ */ jsxs7(PopoverContent, { className: "max-h-80 w-56 overflow-y-auto p-1", align: "end", children: [
2565
+ /* @__PURE__ */ jsx10("div", { className: "px-2.5 py-1.5 text-[10px] font-medium uppercase tracking-wide text-muted-foreground", children: "Voice language" }),
2566
+ READ_ALOUD_LANGUAGES.map((option) => {
2567
+ const isSelected = option.code === selected.code;
2568
+ return /* @__PURE__ */ jsxs7(
2569
+ "button",
2570
+ {
2571
+ type: "button",
2572
+ role: "menuitemradio",
2573
+ "aria-checked": isSelected,
2574
+ onClick: () => {
2575
+ onChange(option.code);
2576
+ setOpen(false);
2577
+ },
2578
+ className: cn(
2579
+ "flex w-full items-center gap-2.5 rounded-md px-2.5 py-1.5 text-left transition-colors hover:bg-accent",
2580
+ isSelected && "bg-accent"
2581
+ ),
2582
+ children: [
2583
+ /* @__PURE__ */ jsxs7("span", { className: "min-w-0 flex-1", children: [
2584
+ /* @__PURE__ */ jsx10("span", { className: "block text-sm", children: option.nativeName }),
2585
+ option.nativeName !== option.englishName ? /* @__PURE__ */ jsx10("span", { className: "block text-[11px] text-muted-foreground", children: option.englishName }) : null
2586
+ ] }),
2587
+ isSelected ? /* @__PURE__ */ jsx10(Check, { className: "size-3.5 shrink-0 text-primary" }) : null
2588
+ ]
2589
+ },
2590
+ option.code
2591
+ );
2592
+ })
2593
+ ] })
2594
+ ] });
2595
+ }
2478
2596
  export {
2479
2597
  AlertCircleIcon,
2480
2598
  ArchiveIcon,
@@ -2511,6 +2629,8 @@ export {
2511
2629
  PenToolIcon,
2512
2630
  PlayIcon,
2513
2631
  PlusIcon,
2632
+ ReadAloudButton,
2633
+ ReadAloudLanguagePicker,
2514
2634
  SearchIcon,
2515
2635
  Settings2Icon,
2516
2636
  Share2Icon,