@mieweb/ui 0.10.0-dev.11 → 0.10.0-dev.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.
Files changed (130) hide show
  1. package/dist/Input-yN516s5_.d.cts +3 -0
  2. package/dist/Input-yN516s5_.d.ts +3 -0
  3. package/dist/ag-grid.d.cts +142 -1
  4. package/dist/ag-grid.d.ts +142 -1
  5. package/dist/{chunk-3M7TAXNR.js → chunk-3YFJBUX4.js} +3 -3
  6. package/dist/{chunk-3M7TAXNR.js.map → chunk-3YFJBUX4.js.map} +1 -1
  7. package/dist/{chunk-ACCAXVOG.js → chunk-4CXGT3P7.js} +61 -41
  8. package/dist/chunk-4CXGT3P7.js.map +1 -0
  9. package/dist/{chunk-OD47TTAW.cjs → chunk-V43ZFGCE.cjs} +9 -9
  10. package/dist/{chunk-OD47TTAW.cjs.map → chunk-V43ZFGCE.cjs.map} +1 -1
  11. package/dist/{chunk-X4XPNTCZ.cjs → chunk-YQ2NQV5C.cjs} +61 -41
  12. package/dist/chunk-YQ2NQV5C.cjs.map +1 -0
  13. package/dist/components/Alert/index.d.cts +1 -1
  14. package/dist/components/Alert/index.d.ts +1 -1
  15. package/dist/components/AlertDialog/index.d.cts +28 -3
  16. package/dist/components/AlertDialog/index.d.ts +28 -3
  17. package/dist/components/AudioRecorder/index.d.cts +2 -2
  18. package/dist/components/AudioRecorder/index.d.ts +2 -2
  19. package/dist/components/Autocomplete/index.d.cts +8 -2
  20. package/dist/components/Autocomplete/index.d.ts +8 -2
  21. package/dist/components/Avatar/index.d.cts +1 -1
  22. package/dist/components/Avatar/index.d.ts +1 -1
  23. package/dist/components/Badge/index.d.cts +1 -1
  24. package/dist/components/Badge/index.d.ts +1 -1
  25. package/dist/components/BoardView/index.d.cts +91 -4
  26. package/dist/components/BoardView/index.d.ts +91 -4
  27. package/dist/components/Button/index.d.cts +1 -1
  28. package/dist/components/Button/index.d.ts +1 -1
  29. package/dist/components/CalendarView/index.d.cts +1 -2
  30. package/dist/components/CalendarView/index.d.ts +1 -2
  31. package/dist/components/Card/index.d.cts +3 -3
  32. package/dist/components/Card/index.d.ts +3 -3
  33. package/dist/components/Dropdown/index.d.cts +2 -1
  34. package/dist/components/Dropdown/index.d.ts +2 -1
  35. package/dist/components/GanttView/index.d.cts +1 -2
  36. package/dist/components/GanttView/index.d.ts +1 -2
  37. package/dist/components/ListView/index.d.cts +2 -3
  38. package/dist/components/ListView/index.d.ts +2 -3
  39. package/dist/components/MediaEditor/index.d.cts +91 -2
  40. package/dist/components/MediaEditor/index.d.ts +91 -2
  41. package/dist/components/MediaPlayer/index.d.cts +1 -1
  42. package/dist/components/MediaPlayer/index.d.ts +1 -1
  43. package/dist/components/Pagination/index.d.cts +1 -1
  44. package/dist/components/Pagination/index.d.ts +1 -1
  45. package/dist/components/PhoneInput/index.d.cts +36 -3
  46. package/dist/components/PhoneInput/index.d.ts +36 -3
  47. package/dist/components/Progress/index.d.cts +1 -1
  48. package/dist/components/Progress/index.d.ts +1 -1
  49. package/dist/components/Q/index.d.cts +2 -2
  50. package/dist/components/Q/index.d.ts +2 -2
  51. package/dist/components/QuickAction/index.d.cts +1 -1
  52. package/dist/components/QuickAction/index.d.ts +1 -1
  53. package/dist/components/RecordButton/index.d.cts +1 -1
  54. package/dist/components/RecordButton/index.d.ts +1 -1
  55. package/dist/components/RichTextEditor/index.d.cts +7 -2
  56. package/dist/components/RichTextEditor/index.d.ts +7 -2
  57. package/dist/components/ScrollArea/index.d.cts +1 -1
  58. package/dist/components/ScrollArea/index.d.ts +1 -1
  59. package/dist/components/Select/index.d.cts +1 -2
  60. package/dist/components/Select/index.d.ts +1 -2
  61. package/dist/components/Skeleton/index.d.cts +1 -1
  62. package/dist/components/Skeleton/index.d.ts +1 -1
  63. package/dist/components/Slider/index.d.cts +2 -2
  64. package/dist/components/Slider/index.d.ts +2 -2
  65. package/dist/components/Spinner/index.d.cts +2 -2
  66. package/dist/components/Spinner/index.d.ts +2 -2
  67. package/dist/components/SuperChat/index.cjs +3 -3
  68. package/dist/components/SuperChat/index.d.cts +2 -4
  69. package/dist/components/SuperChat/index.d.ts +2 -4
  70. package/dist/components/SuperChat/index.js +1 -1
  71. package/dist/components/SuperChat/plugins/index.cjs +3 -3
  72. package/dist/components/SuperChat/plugins/index.d.cts +2 -3
  73. package/dist/components/SuperChat/plugins/index.d.ts +2 -3
  74. package/dist/components/SuperChat/plugins/index.js +2 -2
  75. package/dist/components/Text/index.d.cts +3 -3
  76. package/dist/components/Text/index.d.ts +3 -3
  77. package/dist/components/Textarea/index.d.cts +1 -2
  78. package/dist/components/Textarea/index.d.ts +1 -2
  79. package/dist/components/ThemeProvider/index.d.cts +3 -1
  80. package/dist/components/ThemeProvider/index.d.ts +3 -1
  81. package/dist/components/TranscriptView/index.d.cts +85 -4
  82. package/dist/components/TranscriptView/index.d.ts +85 -4
  83. package/dist/components/ViewSet/index.d.cts +120 -9
  84. package/dist/components/ViewSet/index.d.ts +120 -9
  85. package/dist/components/ViewSwitcher/index.d.cts +4 -40
  86. package/dist/components/ViewSwitcher/index.d.ts +4 -40
  87. package/dist/datavis.d.cts +167 -13
  88. package/dist/datavis.d.ts +167 -13
  89. package/dist/esheet.d.cts +183 -1
  90. package/dist/esheet.d.ts +183 -1
  91. package/dist/hooks/index.d.cts +383 -31
  92. package/dist/hooks/index.d.ts +383 -31
  93. package/dist/index-DoYYWsNc.d.cts +127 -0
  94. package/dist/index-DoYYWsNc.d.ts +127 -0
  95. package/dist/index.cjs +47 -47
  96. package/dist/index.d.cts +7600 -414
  97. package/dist/index.d.ts +7600 -414
  98. package/dist/index.js +4 -4
  99. package/dist/motion.d.cts +186 -2
  100. package/dist/motion.d.ts +186 -2
  101. package/dist/q.d.cts +25 -3
  102. package/dist/q.d.ts +25 -3
  103. package/dist/styles.css +1 -1
  104. package/dist/{types-B97JNRNQ.d.cts → types-DOxdTwmq.d.cts} +170 -2
  105. package/dist/{types-gZXrfLj6.d.ts → types-DOxdTwmq.d.ts} +170 -2
  106. package/dist/{types-CbWXIKbe.d.cts → types-DsdZvEI1.d.cts} +1 -28
  107. package/dist/{types-CbWXIKbe.d.ts → types-DsdZvEI1.d.ts} +1 -28
  108. package/dist/utils/index.d.cts +13 -2
  109. package/dist/utils/index.d.ts +13 -2
  110. package/package.json +3 -2
  111. package/dist/Animated-XmH6k8pZ.d.cts +0 -188
  112. package/dist/Animated-XmH6k8pZ.d.ts +0 -188
  113. package/dist/MedicationEditor-Bp4NLy7y.d.cts +0 -352
  114. package/dist/MedicationEditor-Bp4NLy7y.d.ts +0 -352
  115. package/dist/chunk-ACCAXVOG.js.map +0 -1
  116. package/dist/chunk-X4XPNTCZ.cjs.map +0 -1
  117. package/dist/html-MdxqSzjD.d.cts +0 -13
  118. package/dist/html-MdxqSzjD.d.ts +0 -13
  119. package/dist/orderRows-BUJYgSc7.d.cts +0 -221
  120. package/dist/orderRows-BUJYgSc7.d.ts +0 -221
  121. package/dist/transcript-Cg7uSW-C.d.cts +0 -84
  122. package/dist/transcript-Cg7uSW-C.d.ts +0 -84
  123. package/dist/types-CnPEwzlp.d.cts +0 -254
  124. package/dist/types-CnPEwzlp.d.ts +0 -254
  125. package/dist/useAnchoredPosition-CKwLSQW8.d.cts +0 -76
  126. package/dist/useAnchoredPosition-CKwLSQW8.d.ts +0 -76
  127. package/dist/useTheme-B9SWu6ui.d.cts +0 -24
  128. package/dist/useTheme-B9SWu6ui.d.ts +0 -24
  129. package/dist/useTranscriptEdits-CGzlemHT.d.cts +0 -182
  130. package/dist/useTranscriptEdits-D32bLs0l.d.ts +0 -182
@@ -1,254 +0,0 @@
1
- import * as React from 'react';
2
-
3
- /**
4
- * AI Component Types
5
- *
6
- * Type definitions for AI-related components including MCP (Model Context Protocol)
7
- * interactions, tool calls, and chat messages.
8
- */
9
-
10
- /**
11
- * Status of an MCP tool invocation
12
- */
13
- type MCPToolStatus = 'pending' | 'running' | 'success' | 'error' | 'cancelled';
14
- /**
15
- * MCP Tool parameter definition
16
- */
17
- interface MCPToolParameter {
18
- name: string;
19
- type: string;
20
- value: unknown;
21
- description?: string;
22
- }
23
- /**
24
- * MCP Tool invocation
25
- */
26
- interface MCPToolCall {
27
- /** Unique identifier for this tool call */
28
- id: string;
29
- /** Name of the tool being invoked */
30
- toolName: string;
31
- /** Human-readable description of what the tool does */
32
- description?: string;
33
- /** Parameters passed to the tool */
34
- parameters: MCPToolParameter[];
35
- /** Current status of the tool execution */
36
- status: MCPToolStatus;
37
- /** Timestamp when tool was invoked */
38
- startedAt: Date | string;
39
- /** Timestamp when tool completed */
40
- completedAt?: Date | string;
41
- /** Duration in milliseconds */
42
- duration?: number;
43
- /** Result data if successful */
44
- result?: MCPToolResult;
45
- /** Error message if failed */
46
- error?: string;
47
- }
48
- /**
49
- * Result from an MCP tool execution
50
- */
51
- interface MCPToolResult {
52
- /** Type of result data */
53
- type: 'text' | 'json' | 'link' | 'resource' | 'error';
54
- /** The result data */
55
- data: unknown;
56
- /** Human-readable summary of the result */
57
- summary?: string;
58
- /** Link to a resource (for link type) */
59
- link?: MCPResourceLink;
60
- /** Resources created or modified */
61
- resources?: MCPResource[];
62
- }
63
- /**
64
- * Link to a resource
65
- */
66
- interface MCPResourceLink {
67
- /** URL or path to the resource */
68
- href: string;
69
- /** Display text for the link */
70
- label: string;
71
- /** Type of resource */
72
- type?: 'patient' | 'document' | 'appointment' | 'order' | 'provider' | 'external' | 'internal';
73
- /** Icon name or component */
74
- icon?: string;
75
- }
76
- /**
77
- * MCP Resource definition
78
- */
79
- interface MCPResource {
80
- /** Unique identifier */
81
- id: string;
82
- /** Resource type (e.g., 'patient', 'appointment', 'document') */
83
- type: string;
84
- /** Display name */
85
- name: string;
86
- /** URL to access the resource */
87
- uri?: string;
88
- /** Brief description */
89
- description?: string;
90
- /** Additional metadata */
91
- metadata?: Record<string, unknown>;
92
- }
93
- /**
94
- * Role of the message sender
95
- */
96
- type AIMessageRole = 'user' | 'assistant' | 'system' | 'tool';
97
- /**
98
- * Status of an AI message
99
- */
100
- type AIMessageStatus = 'pending' | 'streaming' | 'complete' | 'error';
101
- /**
102
- * Content block within a message
103
- */
104
- interface AIMessageContent {
105
- /** Type of content */
106
- type: 'text' | 'tool_use' | 'tool_result' | 'thinking' | 'code' | 'image' | 'file' | 'audio' | 'video';
107
- /** Text content (also used as the label for `audio` and `video` blocks) */
108
- text?: string;
109
- /** Tool call reference */
110
- toolCall?: MCPToolCall;
111
- /** Language for code blocks */
112
- language?: string;
113
- /** Whether this content is collapsed by default */
114
- collapsed?: boolean;
115
- /** Image source URL (for `image` blocks) */
116
- imageUrl?: string;
117
- /** Alt text / file name (for `image` and `file` blocks) */
118
- name?: string;
119
- /** File size in bytes (for `file` blocks) */
120
- fileSize?: number;
121
- /** MIME type (for `file`, `audio`, and `video` blocks) */
122
- mimeType?: string;
123
- /** Download/open URL (for `file` blocks) */
124
- fileUrl?: string;
125
- /** Source URL for `audio` blocks */
126
- audioUrl?: string;
127
- /** Source URL for `video` blocks */
128
- videoUrl?: string;
129
- /** Duration in seconds for `audio` blocks */
130
- duration?: number;
131
- }
132
- /**
133
- * AI Chat Message
134
- */
135
- interface AIMessage {
136
- /** Unique identifier */
137
- id: string;
138
- /** Role of sender */
139
- role: AIMessageRole;
140
- /** Message content blocks */
141
- content: AIMessageContent[];
142
- /** Timestamp */
143
- timestamp: Date | string;
144
- /** Current status */
145
- status: AIMessageStatus;
146
- /** Model used (for assistant messages) */
147
- model?: string;
148
- /** Token usage info */
149
- usage?: {
150
- promptTokens?: number;
151
- completionTokens?: number;
152
- totalTokens?: number;
153
- };
154
- /** Custom metadata */
155
- metadata?: Record<string, unknown>;
156
- }
157
- /** Context passed to a custom text content renderer. */
158
- interface AITextRenderContext {
159
- /** id of the parent message (useful as a render cache key) */
160
- messageId: string;
161
- /** true while the message is still streaming */
162
- streaming: boolean;
163
- /** role of the parent message */
164
- role: AIMessage['role'];
165
- }
166
- /**
167
- * Render-prop for customizing `text` content blocks. Host is responsible
168
- * for sanitizing untrusted input.
169
- */
170
- type AIRenderTextContent = (text: string, ctx: AITextRenderContext) => React.ReactNode;
171
- /** Render-prop for appending custom content below a message bubble. */
172
- type AIRenderMessageFooter = (message: AIMessage) => React.ReactNode;
173
- /**
174
- * Suggested action/prompt
175
- */
176
- interface AISuggestedAction {
177
- /** Unique identifier */
178
- id: string;
179
- /** Display label */
180
- label: string;
181
- /** Full prompt text */
182
- prompt: string;
183
- /** Icon name */
184
- icon?: string;
185
- /** Category for grouping */
186
- category?: string;
187
- }
188
- /**
189
- * AI Chat session
190
- */
191
- interface AIChatSession {
192
- /** Unique session identifier */
193
- id: string;
194
- /** Session title */
195
- title?: string;
196
- /** Messages in the session */
197
- messages: AIMessage[];
198
- /** Available tools */
199
- availableTools?: MCPToolInfo[];
200
- /** Created timestamp */
201
- createdAt: Date | string;
202
- /** Last updated timestamp */
203
- updatedAt: Date | string;
204
- /** Whether the assistant is currently generating */
205
- isGenerating: boolean;
206
- /** Context information */
207
- context?: {
208
- /** Current page/location */
209
- page?: string;
210
- /** Selected entity */
211
- entity?: MCPResource;
212
- /** Additional context */
213
- custom?: Record<string, unknown>;
214
- };
215
- }
216
- /**
217
- * Information about an available MCP tool
218
- */
219
- interface MCPToolInfo {
220
- /** Tool name */
221
- name: string;
222
- /** Human-readable description */
223
- description: string;
224
- /** Input schema */
225
- inputSchema?: Record<string, unknown>;
226
- /** Category for grouping */
227
- category?: string;
228
- /** Whether the tool is enabled */
229
- enabled?: boolean;
230
- }
231
- interface AIChatCallbacks {
232
- /**
233
- * Called when user sends a message. When attachments are enabled via
234
- * `composerProps`, the staged files arrive as the second argument
235
- * (attachment-only sends invoke this with an empty string).
236
- */
237
- onSendMessage?: (message: string, attachments?: File[]) => void | Promise<void>;
238
- /** Called when a tool call is initiated */
239
- onToolCall?: (toolCall: MCPToolCall) => void | Promise<void>;
240
- /** Called when a tool call completes */
241
- onToolComplete?: (toolCall: MCPToolCall, result: MCPToolResult) => void;
242
- /** Called when user clicks a resource link */
243
- onResourceClick?: (resource: MCPResource | MCPResourceLink) => void;
244
- /** Called when user selects a suggested action */
245
- onSuggestedAction?: (action: AISuggestedAction) => void;
246
- /** Called when user wants to cancel generation */
247
- onCancel?: () => void;
248
- /** Called when user wants to retry */
249
- onRetry?: () => void;
250
- /** Called when session is cleared */
251
- onClear?: () => void;
252
- }
253
-
254
- export type { AIMessageContent as A, MCPResourceLink as M, AIMessageStatus as a, AIRenderTextContent as b, AITextRenderContext as c, MCPToolCall as d, MCPToolStatus as e, AIMessage as f, AIRenderMessageFooter as g, AIChatCallbacks as h, AIChatSession as i, AISuggestedAction as j, AIMessageRole as k, MCPResource as l, MCPToolInfo as m, MCPToolParameter as n, MCPToolResult as o };
@@ -1,76 +0,0 @@
1
- import * as React from 'react';
2
-
3
- type AnchoredPlacement = 'bottom-start' | 'bottom-end' | 'bottom' | 'top-start' | 'top-end' | 'top' | 'right-start' | 'right-end' | 'right' | 'left-start' | 'left-end' | 'left';
4
- type AnchoredSide = 'top' | 'bottom' | 'left' | 'right';
5
- interface UseAnchoredPositionOptions {
6
- /** Whether the floating element is currently shown */
7
- open: boolean;
8
- /** Preferred placement relative to the anchor (flips when out of space) */
9
- placement?: AnchoredPlacement;
10
- /** Gap between the anchor and the floating element, in px */
11
- offset?: number;
12
- /** Force the floating element to the anchor's width */
13
- matchWidth?: boolean;
14
- /** Use the anchor's width as the floating element's minimum width */
15
- matchMinWidth?: boolean;
16
- /** Minimum distance from the viewport edges, in px */
17
- viewportPadding?: number;
18
- /** Flip to the opposite vertical side when the preferred side is cramped */
19
- allowFlip?: boolean;
20
- /** Optional element whose visible rectangle also constrains the popup */
21
- boundaryRef?: React.RefObject<HTMLElement | null>;
22
- /**
23
- * Additional cap on the floating element's height, in px. The height is
24
- * always clamped to the available viewport space; this only lowers that
25
- * limit further (omitting it does not remove the viewport constraint).
26
- */
27
- maxHeight?: number;
28
- }
29
- interface UseAnchoredPositionReturn<TAnchor extends HTMLElement, TFloating extends HTMLElement> {
30
- /** Attach to the element the popup is anchored to (trigger/input) */
31
- anchorRef: React.RefObject<TAnchor | null>;
32
- /** Attach to the floating element (menu/listbox/panel) */
33
- floatingRef: React.RefObject<TFloating | null>;
34
- /** Fixed-position style for the floating element — spread onto it */
35
- style: React.CSSProperties;
36
- /**
37
- * Side of the anchor in use after flipping.
38
- *
39
- * Widened from `'top' | 'bottom'` to {@link AnchoredSide} in 0.8.0 alongside
40
- * the new horizontal (`left*` / `right*`) placements — consumers that
41
- * annotate this as `'top' | 'bottom'` need to widen their annotation.
42
- */
43
- actualSide: AnchoredSide;
44
- /** Recompute the position (e.g. after async content loads) */
45
- update: () => void;
46
- }
47
- /**
48
- * Positions a floating element (dropdown menu, autocomplete listbox,
49
- * date-picker calendar, …) relative to an anchor using `position: fixed`,
50
- * so it is never clipped by `overflow: hidden` ancestors.
51
- *
52
- * Render the floating element through `createPortal(..., document.body)`
53
- * and spread the returned `style` onto it. The hook:
54
- * - flips vertically when there is not enough space on the preferred side
55
- * - clamps horizontally to the viewport or optional boundary element
56
- * - constrains `maxHeight` to the available space (add `overflow-auto`)
57
- * - tracks scroll, resize, and anchor/content size changes while open
58
- *
59
- * @example
60
- * ```tsx
61
- * const { anchorRef, floatingRef, style } = useAnchoredPosition<
62
- * HTMLButtonElement,
63
- * HTMLDivElement
64
- * >({ open, placement: 'bottom-start' });
65
- *
66
- * <button ref={anchorRef} onClick={() => setOpen(!open)}>Open</button>
67
- * {open &&
68
- * createPortal(
69
- * <div ref={floatingRef} style={style} className="overflow-auto …">…</div>,
70
- * document.body
71
- * )}
72
- * ```
73
- */
74
- declare function useAnchoredPosition<TAnchor extends HTMLElement = HTMLElement, TFloating extends HTMLElement = HTMLElement>({ open, placement, offset, matchWidth, matchMinWidth, viewportPadding, allowFlip, boundaryRef, maxHeight, }: UseAnchoredPositionOptions): UseAnchoredPositionReturn<TAnchor, TFloating>;
75
-
76
- export { type AnchoredPlacement as A, type UseAnchoredPositionOptions as U, type UseAnchoredPositionReturn as a, useAnchoredPosition as u };
@@ -1,76 +0,0 @@
1
- import * as React from 'react';
2
-
3
- type AnchoredPlacement = 'bottom-start' | 'bottom-end' | 'bottom' | 'top-start' | 'top-end' | 'top' | 'right-start' | 'right-end' | 'right' | 'left-start' | 'left-end' | 'left';
4
- type AnchoredSide = 'top' | 'bottom' | 'left' | 'right';
5
- interface UseAnchoredPositionOptions {
6
- /** Whether the floating element is currently shown */
7
- open: boolean;
8
- /** Preferred placement relative to the anchor (flips when out of space) */
9
- placement?: AnchoredPlacement;
10
- /** Gap between the anchor and the floating element, in px */
11
- offset?: number;
12
- /** Force the floating element to the anchor's width */
13
- matchWidth?: boolean;
14
- /** Use the anchor's width as the floating element's minimum width */
15
- matchMinWidth?: boolean;
16
- /** Minimum distance from the viewport edges, in px */
17
- viewportPadding?: number;
18
- /** Flip to the opposite vertical side when the preferred side is cramped */
19
- allowFlip?: boolean;
20
- /** Optional element whose visible rectangle also constrains the popup */
21
- boundaryRef?: React.RefObject<HTMLElement | null>;
22
- /**
23
- * Additional cap on the floating element's height, in px. The height is
24
- * always clamped to the available viewport space; this only lowers that
25
- * limit further (omitting it does not remove the viewport constraint).
26
- */
27
- maxHeight?: number;
28
- }
29
- interface UseAnchoredPositionReturn<TAnchor extends HTMLElement, TFloating extends HTMLElement> {
30
- /** Attach to the element the popup is anchored to (trigger/input) */
31
- anchorRef: React.RefObject<TAnchor | null>;
32
- /** Attach to the floating element (menu/listbox/panel) */
33
- floatingRef: React.RefObject<TFloating | null>;
34
- /** Fixed-position style for the floating element — spread onto it */
35
- style: React.CSSProperties;
36
- /**
37
- * Side of the anchor in use after flipping.
38
- *
39
- * Widened from `'top' | 'bottom'` to {@link AnchoredSide} in 0.8.0 alongside
40
- * the new horizontal (`left*` / `right*`) placements — consumers that
41
- * annotate this as `'top' | 'bottom'` need to widen their annotation.
42
- */
43
- actualSide: AnchoredSide;
44
- /** Recompute the position (e.g. after async content loads) */
45
- update: () => void;
46
- }
47
- /**
48
- * Positions a floating element (dropdown menu, autocomplete listbox,
49
- * date-picker calendar, …) relative to an anchor using `position: fixed`,
50
- * so it is never clipped by `overflow: hidden` ancestors.
51
- *
52
- * Render the floating element through `createPortal(..., document.body)`
53
- * and spread the returned `style` onto it. The hook:
54
- * - flips vertically when there is not enough space on the preferred side
55
- * - clamps horizontally to the viewport or optional boundary element
56
- * - constrains `maxHeight` to the available space (add `overflow-auto`)
57
- * - tracks scroll, resize, and anchor/content size changes while open
58
- *
59
- * @example
60
- * ```tsx
61
- * const { anchorRef, floatingRef, style } = useAnchoredPosition<
62
- * HTMLButtonElement,
63
- * HTMLDivElement
64
- * >({ open, placement: 'bottom-start' });
65
- *
66
- * <button ref={anchorRef} onClick={() => setOpen(!open)}>Open</button>
67
- * {open &&
68
- * createPortal(
69
- * <div ref={floatingRef} style={style} className="overflow-auto …">…</div>,
70
- * document.body
71
- * )}
72
- * ```
73
- */
74
- declare function useAnchoredPosition<TAnchor extends HTMLElement = HTMLElement, TFloating extends HTMLElement = HTMLElement>({ open, placement, offset, matchWidth, matchMinWidth, viewportPadding, allowFlip, boundaryRef, maxHeight, }: UseAnchoredPositionOptions): UseAnchoredPositionReturn<TAnchor, TFloating>;
75
-
76
- export { type AnchoredPlacement as A, type UseAnchoredPositionOptions as U, type UseAnchoredPositionReturn as a, useAnchoredPosition as u };
@@ -1,24 +0,0 @@
1
- type Theme = 'light' | 'dark' | 'system';
2
- type ResolvedTheme = 'light' | 'dark';
3
- /**
4
- * Hook for managing theme state with localStorage persistence and system preference support.
5
- *
6
- * @example
7
- * ```tsx
8
- * function ThemeToggle() {
9
- * const { theme, setTheme, resolvedTheme } = useTheme();
10
- * return (
11
- * <button onClick={() => setTheme(resolvedTheme === 'dark' ? 'light' : 'dark')}>
12
- * {resolvedTheme === 'dark' ? '☀️' : '🌙'}
13
- * </button>
14
- * );
15
- * }
16
- * ```
17
- */
18
- declare function useTheme(): {
19
- theme: Theme;
20
- setTheme: (newTheme: Theme) => void;
21
- resolvedTheme: ResolvedTheme;
22
- };
23
-
24
- export { type ResolvedTheme as R, type Theme as T, useTheme as u };
@@ -1,24 +0,0 @@
1
- type Theme = 'light' | 'dark' | 'system';
2
- type ResolvedTheme = 'light' | 'dark';
3
- /**
4
- * Hook for managing theme state with localStorage persistence and system preference support.
5
- *
6
- * @example
7
- * ```tsx
8
- * function ThemeToggle() {
9
- * const { theme, setTheme, resolvedTheme } = useTheme();
10
- * return (
11
- * <button onClick={() => setTheme(resolvedTheme === 'dark' ? 'light' : 'dark')}>
12
- * {resolvedTheme === 'dark' ? '☀️' : '🌙'}
13
- * </button>
14
- * );
15
- * }
16
- * ```
17
- */
18
- declare function useTheme(): {
19
- theme: Theme;
20
- setTheme: (newTheme: Theme) => void;
21
- resolvedTheme: ResolvedTheme;
22
- };
23
-
24
- export { type ResolvedTheme as R, type Theme as T, useTheme as u };
@@ -1,182 +0,0 @@
1
- import { E as EditableWord, T as Transcript, S as SpeedMarker, P as PlaybackSpeed, a as PlaybackSegment, b as TranscriptWord } from './transcript-Cg7uSW-C.cjs';
2
-
3
- /**
4
- * useTranscriptEdits — headless transcript-editing state hook.
5
- *
6
- * Extracted from pulseclip's TranscriptViewer for @mieweb/ui. Holds the
7
- * edited word timeline (deletions, insertions, text edits, silence
8
- * splitting), a single-level undo stack, an internal clipboard, speed
9
- * markers, and derived playback/statistics data.
10
- *
11
- * Controlled + persistence-agnostic: no DOM, no fetches. Selection lives in
12
- * the UI layer — mutations take explicit indices. State flows out via
13
- * `onChange` and back in via `initialEditedWords` / `initialUndoStack`.
14
- */
15
-
16
- /** Default filler words offered for removal */
17
- declare const DEFAULT_FILLER_WORDS: string[];
18
- /** Default minimum silence duration in milliseconds to detect and insert */
19
- declare const DEFAULT_MIN_SILENCE_MS = 400;
20
- /** Default threshold for "newline" silences - longer pauses that indicate paragraph breaks */
21
- declare const DEFAULT_NL_SILENCE_MS = 1500;
22
- /** Clipboard data for cut/copy/paste operations */
23
- interface TranscriptClipboard {
24
- words: EditableWord[];
25
- operation: 'cut' | 'copy';
26
- }
27
- /** Count and total duration of silences above a given threshold (seconds) */
28
- interface SilenceThresholdCount {
29
- threshold: number;
30
- count: number;
31
- durationMs: number;
32
- }
33
- /**
34
- * Builds playback segments from the edited word list.
35
- * Consecutive words in original order are merged into single segments.
36
- * Inserted (pasted) words each get their own segment since they may be duplicates.
37
- */
38
- declare function buildPlaybackSegments(editedWords: EditableWord[]): PlaybackSegment[];
39
- /**
40
- * Get the effective playback speed at a given word index.
41
- * Finds the most recent speed marker at or before the word index,
42
- * or returns the default speed if no marker applies.
43
- */
44
- declare function getSpeedAtIndex(wordIndex: number, speedMarkers: SpeedMarker[], defaultSpeed: PlaybackSpeed): PlaybackSpeed;
45
- /**
46
- * Detect silences between words and return a new array with silence pseudo-words inserted.
47
- * Silences are detected as gaps between the endMs of one word and startMs of the next.
48
- * Silences >= nlSilenceMs are marked as 'silence-newline' for visual line breaks.
49
- */
50
- declare function insertSilences(words: TranscriptWord[], minSilenceMs?: number, nlSilenceMs?: number): TranscriptWord[];
51
- /** Initialize editable words from transcript, inserting detected silences */
52
- declare function initEditableWords(transcript: Transcript, minSilenceMs?: number, nlSilenceMs?: number): EditableWord[];
53
- interface UseTranscriptEditsOptions {
54
- /** The source transcript (canonical, immutable) */
55
- transcript: Transcript;
56
- /** Initial edited words (from saved edits) */
57
- initialEditedWords?: EditableWord[];
58
- /** Initial undo stack (from saved edits) */
59
- initialUndoStack?: EditableWord[][];
60
- /** Fired after every mutation (for persistence) */
61
- onChange?: (editedWords: EditableWord[], undoStack: EditableWord[][]) => void;
62
- /** Minimum silence duration (ms) to detect and insert. Default 400 */
63
- minSilenceMs?: number;
64
- /** Threshold (ms) for "newline" silences (paragraph breaks). Default 1500 */
65
- nlSilenceMs?: number;
66
- /** Initial speed markers (from saved edits) */
67
- initialSpeedMarkers?: SpeedMarker[];
68
- /** Initial default playback speed (from saved edits). Default 1 */
69
- initialDefaultSpeed?: PlaybackSpeed;
70
- }
71
- interface TranscriptEditStats {
72
- /** Non-deleted spoken words (silences excluded) */
73
- activeWordCount: number;
74
- /** Non-deleted silence entries */
75
- activeSilenceCount: number;
76
- /** Deleted spoken words */
77
- deletedWordCount: number;
78
- /** Deleted silence entries */
79
- deletedSilenceCount: number;
80
- /** Total duration of non-deleted entries, adjusted for speed markers */
81
- editedDurationMs: number;
82
- }
83
- interface FillerAnalysis {
84
- /** Occurrence count per normalized word (fillers and every active word) */
85
- matchCounts: Map<string, number>;
86
- /** Total duration (ms) per normalized word */
87
- durations: Map<string, number>;
88
- /** Count + total duration of active silences above each analysis threshold */
89
- silenceCounts: SilenceThresholdCount[];
90
- /** The built-in filler word list */
91
- defaultFillerWords: string[];
92
- }
93
- interface UseTranscriptEditsResult {
94
- /** The edited timeline (words + silence pseudo-words) */
95
- editedWords: EditableWord[];
96
- /** Undo snapshots, oldest first */
97
- undoStack: EditableWord[][];
98
- /** Internal clipboard from the last cut/copy, or null */
99
- clipboard: TranscriptClipboard | null;
100
- /** Whether any edit has been made (deletions, insertions, text edits, speed markers) */
101
- hasEdits: boolean;
102
- /** Push the current editedWords onto the undo stack (call before external batch mutations) */
103
- pushUndo: () => void;
104
- /** Restore the most recent undo snapshot */
105
- undo: () => void;
106
- /** Step forward again after an undo. Cleared by any new edit. */
107
- redo: () => void;
108
- /** Whether there is anything to redo */
109
- canRedo: boolean;
110
- /** Toggle the deleted flag on a single word */
111
- toggleWordDeleted: (index: number) => void;
112
- /**
113
- * Toggle the deleted state of a contiguous range. The first index acts as
114
- * the anchor: all words are set to the opposite of the anchor's state
115
- * (delete all if anchor active, restore all if anchor deleted).
116
- */
117
- deleteRange: (indices: number[]) => void;
118
- /** Cut words at the given indices into the clipboard (marks them deleted) */
119
- cut: (indices: number[]) => void;
120
- /** Copy non-deleted words at the given indices into the clipboard */
121
- copy: (indices: number[]) => void;
122
- /**
123
- * Paste the clipboard at a word index. `before` (default true) inserts
124
- * before the word at `atIndex`; false inserts after it. Returns the index
125
- * where the first pasted word landed, or null if the clipboard was empty.
126
- */
127
- paste: (atIndex: number, before?: boolean) => number | null;
128
- /** Replace a word's text (no-op if unchanged) */
129
- setWordText: (index: number, text: string) => void;
130
- /** Split a silence at the given index into segments with the given durations (seconds) */
131
- splitSilence: (index: number, durationsSec: number[]) => void;
132
- /** Toggle the word at the index deleted (editor "delete" action) */
133
- deleteWord: (index: number) => void;
134
- /** Replace the entire edit state from an external source (e.g. an editable script view); undo-safe */
135
- replaceEditedWords: (next: EditableWord[]) => void;
136
- /** Mark matching filler words (and silences above the given seconds threshold) deleted */
137
- removeFillers: (fillerWords: string[], removeSilenceAboveSec: number | null) => void;
138
- /** Rebuild silence detection with new thresholds, preserving word deletions.
139
- * Not undoable — clears the undo stack (prior snapshots reference the old silence layout). */
140
- setSilenceThresholds: (minMs: number, nlMs: number) => void;
141
- /** Current silence detection thresholds (ms) */
142
- silenceThresholds: {
143
- minSilenceMs: number;
144
- nlSilenceMs: number;
145
- };
146
- /** Speed markers, sorted by word index */
147
- speedMarkers: SpeedMarker[];
148
- /** Default playback speed when no marker applies */
149
- defaultSpeed: PlaybackSpeed;
150
- /** Set the default playback speed (undoable) */
151
- setDefaultSpeed: (speed: PlaybackSpeed) => void;
152
- /** Add/update/remove a speed marker (re-selecting the same speed removes it; undoable) */
153
- toggleSpeedMarker: (index: number, speed: PlaybackSpeed) => void;
154
- /** Remove the speed marker at a word index, if any (undoable) */
155
- removeSpeedMarker: (index: number) => void;
156
- /**
157
- * Apply one speed across an index range (typically the selection): marks the
158
- * start, restores the prior effective speed after the end. One undo step.
159
- */
160
- setSpeedForRange: (startIndex: number, endIndex: number, speed: PlaybackSpeed) => void;
161
- /** Effective playback speed at a word index */
162
- getSpeedAtIndex: (index: number) => PlaybackSpeed;
163
- /** The speed marker at a word index, if any */
164
- getSpeedMarkerAtIndex: (index: number) => SpeedMarker | undefined;
165
- /** Contiguous playback segments built from the edited timeline */
166
- playbackSegments: PlaybackSegment[];
167
- /** Word/silence counts and speed-adjusted edited duration */
168
- stats: TranscriptEditStats;
169
- /** Filler word and silence analysis for removal UIs */
170
- fillerAnalysis: FillerAnalysis;
171
- }
172
- /**
173
- * Headless transcript-editing hook. See module docs for scope.
174
- *
175
- * Undo semantics: each mutation snapshots the full `editedWords` array onto
176
- * a single-level stack before applying; `undo` pops one snapshot. Speed
177
- * markers and silence-threshold changes are NOT part of the undo stack
178
- * (matching the source component).
179
- */
180
- declare function useTranscriptEdits(options: UseTranscriptEditsOptions): UseTranscriptEditsResult;
181
-
182
- export { DEFAULT_FILLER_WORDS as D, type FillerAnalysis as F, type SilenceThresholdCount as S, type TranscriptClipboard as T, type UseTranscriptEditsOptions as U, DEFAULT_MIN_SILENCE_MS as a, DEFAULT_NL_SILENCE_MS as b, type TranscriptEditStats as c, type UseTranscriptEditsResult as d, buildPlaybackSegments as e, insertSilences as f, getSpeedAtIndex as g, initEditableWords as i, useTranscriptEdits as u };