@medicaresoft/dicom-viewer 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -45,6 +45,45 @@ El host decide de dónde salen los bytes: API propia, DICOMweb, disco local
45
45
  | `onBack` | `() => void` | Si se define, muestra botón volver |
46
46
  | `actions` | `ReactNode` | `<Action/>` inyectadas en slots |
47
47
  | `modals` | `ReactNode` | `<ViewerModal/>` inyectados |
48
+ | `theme` | `DicomViewerTheme` | Colores primario/secundario + contrastes y superficies |
49
+
50
+ ## Tema (`theme`)
51
+
52
+ El visor se personaliza en runtime sin recompilar estilos:
53
+
54
+ ```tsx
55
+ <DicomViewer
56
+ study={study}
57
+ getDicomFile={fetcher}
58
+ theme={{
59
+ primary: "#0a5f8a",
60
+ primaryForeground: "#ffffff",
61
+ secondary: "#e63946",
62
+ secondaryForeground: "#ffffff",
63
+ // superficies opcionales (tema oscuro completo):
64
+ background: "#0e1017",
65
+ chrome: "#060608",
66
+ panel: "#1a1d27",
67
+ panelHover: "#202432",
68
+ border: "#242735",
69
+ // ...
70
+ }}
71
+ />
72
+ ```
73
+
74
+ El prop se inyecta como variables CSS (`--dv-*`) en el elemento raíz del
75
+ visor — alcance por instancia, sin contaminar el `:root` del host. Todos los
76
+ campos son opcionales; los no definidos usan los defaults del paquete (o el
77
+ tema del host, en el caso de Symphony).
78
+
79
+ También puedes sobreescribir las variables globalmente en tu CSS:
80
+
81
+ ```css
82
+ :root {
83
+ --dv-secondary: #e63946;
84
+ --dv-primary: #0a5f8a;
85
+ }
86
+ ```
48
87
 
49
88
  ## Acciones y modales (slots)
50
89
 
@@ -1,5 +1,5 @@
1
1
  import { type ReactNode } from "react";
2
- import type { DicomFileFetcher, DicomStudy, PresetsConfig, ThumbnailUrlResolver, ViewerBranding } from "./types";
2
+ import type { DicomFileFetcher, DicomStudy, DicomViewerTheme, PresetsConfig, ThumbnailUrlResolver, ViewerBranding } from "./types";
3
3
  export interface DicomViewerProps {
4
4
  /** Metadatos del estudio (el host los obtiene de donde quiera). */
5
5
  study: DicomStudy;
@@ -19,6 +19,11 @@ export interface DicomViewerProps {
19
19
  actions?: ReactNode;
20
20
  /** Modales inyectados: <ViewerModal open=...>...</ViewerModal>. */
21
21
  modals?: ReactNode;
22
+ /**
23
+ * Tema de colores: primario/secundario con contrastes y tokens de
24
+ * superficie. Se aplica como variables CSS scoped al visor.
25
+ */
26
+ theme?: DicomViewerTheme;
22
27
  className?: string;
23
28
  }
24
29
  /**
@@ -26,5 +31,5 @@ export interface DicomViewerProps {
26
31
  * lógica de negocio, sin router y sin HTTP propio. Todo lo específico del
27
32
  * host llega por props (datos, fetchers, branding, acciones y modales).
28
33
  */
29
- export declare const DicomViewer: ({ study, getDicomFile, getThumbnailUrl, presets, maxConcurrentDownloads, branding, onBack, actions: actionsProp, modals: modalsProp, className, }: DicomViewerProps) => import("react/jsx-runtime").JSX.Element;
34
+ export declare const DicomViewer: ({ study, getDicomFile, getThumbnailUrl, presets, maxConcurrentDownloads, branding, onBack, actions: actionsProp, modals: modalsProp, theme, className, }: DicomViewerProps) => import("react/jsx-runtime").JSX.Element;
30
35
  export default DicomViewer;
@@ -0,0 +1,16 @@
1
+ interface ImageUnavailableProps {
2
+ /** Título principal. */
3
+ title?: string;
4
+ /** Texto secundario. */
5
+ description?: string;
6
+ /** Variante para miniaturas de series. */
7
+ compact?: boolean;
8
+ className?: string;
9
+ }
10
+ /**
11
+ * Placeholder visual para imágenes DICOM que no pudieron cargarse.
12
+ * Es un SVG/HTML temático (no un DICOM falso): no altera mediciones ni
13
+ * overlays y se adapta a los colores del visor.
14
+ */
15
+ export declare function ImageUnavailable({ title, description, compact, className, }: ImageUnavailableProps): import("react/jsx-runtime").JSX.Element;
16
+ export {};
@@ -0,0 +1,11 @@
1
+ interface SeriesThumbnailProps {
2
+ src?: string;
3
+ alt: string;
4
+ className?: string;
5
+ }
6
+ /**
7
+ * Miniatura de serie con fallback estético cuando la URL falla o no existe.
8
+ * El estado de error es local a cada miniatura.
9
+ */
10
+ export declare function SeriesThumbnail({ src, alt, className }: SeriesThumbnailProps): import("react/jsx-runtime").JSX.Element;
11
+ export {};
@@ -6,6 +6,7 @@ export declare function useCornerstoneViewer(study: DicomStudy, seriesIndex?: nu
6
6
  loadingProgress: number;
7
7
  downloadedCount: number;
8
8
  totalImages: number;
9
+ loadError: boolean;
9
10
  currentImageIndex: number;
10
11
  activeTool: string;
11
12
  toolBindings: Record<number, string>;
package/dist/index.d.ts CHANGED
@@ -1,7 +1,6 @@
1
- import "./style.css";
2
1
  export { DicomViewer } from "./DicomViewer";
3
2
  export type { DicomViewerProps } from "./DicomViewer";
4
3
  export { Action, ViewerModal } from "./Action";
5
4
  export { DicomToolbarButton } from "./components/DicomToolbarButton";
6
5
  export { useDicomContext, useViewerActions, DicomViewerContext } from "./context";
7
- export type { ActionContext, ActionPlacement, ActionProps, DicomFile, DicomFileFetcher, DicomSeries, DicomStudy, PresetsConfig, ThumbnailUrlResolver, ViewerBranding, ViewerModalProps, } from "./types";
6
+ export type { ActionContext, ActionPlacement, ActionProps, DicomFile, DicomFileFetcher, DicomSeries, DicomStudy, DicomViewerTheme, PresetsConfig, ThumbnailUrlResolver, ViewerBranding, ViewerModalProps, } from "./types";