@mieweb/ui 0.6.1-dev.148 → 0.6.1-dev.150

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 (82) hide show
  1. package/dist/brands/index.cjs +22 -22
  2. package/dist/brands/index.js +5 -5
  3. package/dist/chunk-2T4JU5RH.cjs +1156 -0
  4. package/dist/chunk-2T4JU5RH.cjs.map +1 -0
  5. package/dist/chunk-3SSXDWD7.js +363 -0
  6. package/dist/chunk-3SSXDWD7.js.map +1 -0
  7. package/dist/{chunk-MARLXJQO.cjs → chunk-6R2ZPDN7.cjs} +7 -7
  8. package/dist/{chunk-MARLXJQO.cjs.map → chunk-6R2ZPDN7.cjs.map} +1 -1
  9. package/dist/{chunk-WHUD3XHR.cjs → chunk-7PA26KBF.cjs} +15 -3
  10. package/dist/chunk-7PA26KBF.cjs.map +1 -0
  11. package/dist/chunk-ASLZUFH4.js +1967 -0
  12. package/dist/chunk-ASLZUFH4.js.map +1 -0
  13. package/dist/chunk-FADQVM4M.cjs +2017 -0
  14. package/dist/chunk-FADQVM4M.cjs.map +1 -0
  15. package/dist/{chunk-DFT7TYKL.cjs → chunk-H4T5T65N.cjs} +6 -3
  16. package/dist/chunk-H4T5T65N.cjs.map +1 -0
  17. package/dist/chunk-I6CY5C6A.js +12 -0
  18. package/dist/chunk-I6CY5C6A.js.map +1 -0
  19. package/dist/chunk-JFLC7SHM.cjs +35 -0
  20. package/dist/chunk-JFLC7SHM.cjs.map +1 -0
  21. package/dist/chunk-LZPPH5BW.cjs +368 -0
  22. package/dist/chunk-LZPPH5BW.cjs.map +1 -0
  23. package/dist/{chunk-3OHVUXDG.js → chunk-M7BLVBL4.js} +6 -3
  24. package/dist/chunk-M7BLVBL4.js.map +1 -0
  25. package/dist/chunk-PM2I3QKM.cjs +1419 -0
  26. package/dist/chunk-PM2I3QKM.cjs.map +1 -0
  27. package/dist/{chunk-TW6DXMSD.js → chunk-R6PBBPU3.js} +2 -2
  28. package/dist/{chunk-TW6DXMSD.js.map → chunk-R6PBBPU3.js.map} +1 -1
  29. package/dist/{chunk-33PO3J4O.js → chunk-RXY5SD3O.js} +15 -3
  30. package/dist/chunk-RXY5SD3O.js.map +1 -0
  31. package/dist/{chunk-AEGYWRSL.js → chunk-TXYTMU3K.js} +3 -3
  32. package/dist/{chunk-AEGYWRSL.js.map → chunk-TXYTMU3K.js.map} +1 -1
  33. package/dist/chunk-UHPQYBXQ.js +1124 -0
  34. package/dist/chunk-UHPQYBXQ.js.map +1 -0
  35. package/dist/chunk-XQE26F3G.js +1383 -0
  36. package/dist/chunk-XQE26F3G.js.map +1 -0
  37. package/dist/{chunk-26YNFCOC.cjs → chunk-Z6NRP4Z5.cjs} +2 -2
  38. package/dist/{chunk-26YNFCOC.cjs.map → chunk-Z6NRP4Z5.cjs.map} +1 -1
  39. package/dist/components/Dropdown/index.cjs +7 -7
  40. package/dist/components/Dropdown/index.d.cts +1 -1
  41. package/dist/components/Dropdown/index.d.ts +1 -1
  42. package/dist/components/Dropdown/index.js +1 -1
  43. package/dist/components/RichTextEditor/index.cjs +5 -5
  44. package/dist/components/RichTextEditor/index.js +2 -2
  45. package/dist/components/SuperChat/index.cjs +1319 -0
  46. package/dist/components/SuperChat/index.cjs.map +1 -0
  47. package/dist/components/SuperChat/index.d.cts +189 -0
  48. package/dist/components/SuperChat/index.d.ts +189 -0
  49. package/dist/components/SuperChat/index.js +1282 -0
  50. package/dist/components/SuperChat/index.js.map +1 -0
  51. package/dist/components/SuperChat/plugins/index.cjs +1221 -0
  52. package/dist/components/SuperChat/plugins/index.cjs.map +1 -0
  53. package/dist/components/SuperChat/plugins/index.d.cts +253 -0
  54. package/dist/components/SuperChat/plugins/index.d.ts +253 -0
  55. package/dist/components/SuperChat/plugins/index.js +1181 -0
  56. package/dist/components/SuperChat/plugins/index.js.map +1 -0
  57. package/dist/datavis.cjs +18 -362
  58. package/dist/datavis.cjs.map +1 -1
  59. package/dist/datavis.js +1 -361
  60. package/dist/datavis.js.map +1 -1
  61. package/dist/index.cjs +1297 -5412
  62. package/dist/index.cjs.map +1 -1
  63. package/dist/index.d.cts +44 -240
  64. package/dist/index.d.ts +44 -240
  65. package/dist/index.js +759 -5037
  66. package/dist/index.js.map +1 -1
  67. package/dist/nitroTableGrid-FWRCDE4N.js +22 -0
  68. package/dist/nitroTableGrid-FWRCDE4N.js.map +1 -0
  69. package/dist/nitroTableGrid-IY75TQJ2.cjs +44 -0
  70. package/dist/nitroTableGrid-IY75TQJ2.cjs.map +1 -0
  71. package/dist/styles.css +1 -1
  72. package/dist/tailwind-preset.cjs +4 -4
  73. package/dist/tailwind-preset.js +1 -1
  74. package/dist/types-BFFgW6qy.d.ts +240 -0
  75. package/dist/types-BzeY_kYO.d.cts +242 -0
  76. package/dist/types-BzeY_kYO.d.ts +242 -0
  77. package/dist/types-CRt5IPNL.d.cts +240 -0
  78. package/package.json +41 -4
  79. package/dist/chunk-33PO3J4O.js.map +0 -1
  80. package/dist/chunk-3OHVUXDG.js.map +0 -1
  81. package/dist/chunk-DFT7TYKL.cjs.map +0 -1
  82. package/dist/chunk-WHUD3XHR.cjs.map +0 -1
@@ -0,0 +1,253 @@
1
+ import { a as SuperChatRenderPlugin, e as GenUIRegistry } from '../../../types-BFFgW6qy.js';
2
+ export { f as GenUIWidgetEntry, g as GenUIWidgetProps } from '../../../types-BFFgW6qy.js';
3
+ import 'react';
4
+ import '../../../types-BzeY_kYO.js';
5
+
6
+ /**
7
+ * SuperChat code plugin (opt-in).
8
+ *
9
+ * Syntax-highlights fenced code blocks with `rehype-highlight` (emits `.hljs-*`
10
+ * classes that map to `--mieweb-*` theme tokens for light/dark), and adds a copy
11
+ * button. `shiki` is reserved as an upgrade path if highlight fidelity disappoints.
12
+ */
13
+
14
+ /** Create the syntax-highlighting + copy-button render plugin. */
15
+ declare function createCodePlugin(): SuperChatRenderPlugin;
16
+
17
+ /**
18
+ * SuperChat math plugin (opt-in).
19
+ *
20
+ * Renders `$…$` (inline) and `$$…$$` (block) math with `remark-math` +
21
+ * `rehype-katex` (KaTeX). Consumers must also load KaTeX's stylesheet:
22
+ *
23
+ * ```ts
24
+ * import 'katex/dist/katex.min.css';
25
+ * ```
26
+ *
27
+ * The sanitize allow-list is extended so KaTeX's HTML + MathML output survives
28
+ * the untrusted-content sanitizer.
29
+ */
30
+
31
+ /** Create the math (KaTeX) render plugin. */
32
+ declare function createMathPlugin(): SuperChatRenderPlugin;
33
+
34
+ /**
35
+ * SuperChat GenUI plugin (opt-in).
36
+ *
37
+ * Interactive widgets expressed as fenced ```genui JSON blocks:
38
+ *
39
+ * ````md
40
+ * ```genui
41
+ * { "widget": "math_block", "version": 2, "prefetch": "eager", "props": { "content": "a^2+b^2=c^2" } }
42
+ * ```
43
+ * ````
44
+ *
45
+ * Widgets are **host-registered, lazy, and schema-validated**. Unknown widgets
46
+ * degrade to an inert code block. Prefetch is split into component (code) vs.
47
+ * data, with `eager` / `visible` / `idle` policies; the **registry policy
48
+ * overrides the wire hint**. Mount + data fetch are gated on `streaming` and a
49
+ * complete/valid payload (a `MCPToolCall`-style pending card shows until then).
50
+ */
51
+
52
+ declare const GENUI_TAG = "genui-widget";
53
+ /** Create the GenUI render plugin from a host widget registry. */
54
+ declare function createGenUIPlugin(registry: GenUIRegistry): SuperChatRenderPlugin;
55
+
56
+ /**
57
+ * SuperChat Mermaid plugin (opt-in).
58
+ *
59
+ * Renders fenced ```mermaid blocks as diagrams via the lazily-loaded `mermaid`
60
+ * library:
61
+ *
62
+ * ````md
63
+ * ```mermaid
64
+ * graph TD; A-->B; A-->C;
65
+ * ```
66
+ * ````
67
+ *
68
+ * `mermaid` is heavy, so it loads on first render (never in the SuperChat base
69
+ * bundle). Rendering is gated on `streaming` — partial diagram source mid-stream
70
+ * shows a pending card and only renders once the message settles. Diagrams are
71
+ * rendered with mermaid's `securityLevel: 'strict'`, which sanitizes labels and
72
+ * strips scripts; the resulting SVG is inserted directly (it bypasses
73
+ * `rehype-sanitize`, so strict mode is the trust boundary here).
74
+ */
75
+
76
+ declare const MERMAID_TAG = "mermaid-diagram";
77
+ /** Create the Mermaid diagram render plugin. */
78
+ declare function createMermaidPlugin(): SuperChatRenderPlugin;
79
+
80
+ /**
81
+ * SuperChat image plugin (opt-in).
82
+ *
83
+ * Makes inline Markdown images (`![alt](url)`) click-to-zoom, reusing the
84
+ * Messaging module's full-screen {@link LightboxModal}. The image `src`/`alt`
85
+ * come from (untrusted) Markdown and are already protocol-restricted by
86
+ * `rehype-sanitize`; this plugin only adds the zoom affordance.
87
+ */
88
+
89
+ /** Create the image (click-to-zoom lightbox) render plugin. */
90
+ declare function createImagePlugin(): SuperChatRenderPlugin;
91
+
92
+ /**
93
+ * SuperChat NITRO table plugin (opt-in).
94
+ *
95
+ * Renders GFM tables through **NITRO DataVis** (sortable / filterable /
96
+ * resizable) instead of a static `<table>`. The heavy grid is `React.lazy`-loaded
97
+ * only when a table appears, and if the `datavis` engine can't load (e.g. the
98
+ * submodule isn't installed) it **degrades gracefully** to the themed HTML table.
99
+ *
100
+ * @example
101
+ * import { createNitroTablePlugin } from '@mieweb/ui/components/SuperChat/plugins';
102
+ * const render = createMarkdownRenderer({ plugins: [createNitroTablePlugin()] });
103
+ */
104
+
105
+ /** Create the NITRO DataVis table render plugin. */
106
+ declare function createNitroTablePlugin(): SuperChatRenderPlugin;
107
+
108
+ /**
109
+ * SuperChat attachment plugin (opt-in, offline-first).
110
+ *
111
+ * Renders file attachments (image / video / audio / pdf / generic) inline in a
112
+ * message via a fenced ` ```superchat-attachment ` block whose body is a small
113
+ * JSON descriptor:
114
+ *
115
+ * ````md
116
+ * ```superchat-attachment
117
+ * { "id": "att-1", "type": "video/mp4", "name": "clip.mp4" }
118
+ * ```
119
+ * ````
120
+ *
121
+ * Use {@link attachmentMarkdown} to build the block. The descriptor carries an
122
+ * attachment **id**; the player resolves a `blob:` URL from the
123
+ * {@link attachmentCache} (IndexedDB) at render time, so previously sent media
124
+ * keeps rendering offline without storing base64 in the conversation. An
125
+ * optional inline `src` (`data:` URL) is used as a fallback when the cache is
126
+ * empty or unavailable, and is opportunistically persisted for next time.
127
+ *
128
+ * Mirrors the GenUI plugin's fence→custom-element rehype transform so the
129
+ * payload never travels through `urlTransform` / raw-HTML, keeping the pipeline
130
+ * robust under `rehype-sanitize`.
131
+ */
132
+
133
+ /** Custom element the fenced block is rewritten to before sanitization. */
134
+ declare const ATTACHMENT_TAG = "superchat-attachment";
135
+ /** Fenced-code language that marks an attachment block. */
136
+ declare const ATTACHMENT_FENCE = "superchat-attachment";
137
+ /** JSON payload carried by a ` ```superchat-attachment ` block. */
138
+ interface AttachmentBlockPayload {
139
+ /** Attachment id used as the {@link attachmentCache} key. */
140
+ id?: string;
141
+ /** MIME type, e.g. `video/mp4`. */
142
+ type: string;
143
+ /** File name (shown as a label / download name). */
144
+ name: string;
145
+ /** Optional inline `data:` URL fallback when the cache has no entry. */
146
+ src?: string;
147
+ }
148
+ /**
149
+ * Build the Markdown for an attachment block. Embed the result in a message so
150
+ * the attachment plugin renders it.
151
+ *
152
+ * @example
153
+ * const md = attachmentMarkdown({ id: att.id, type: att.type, name: att.name });
154
+ */
155
+ declare function attachmentMarkdown(payload: AttachmentBlockPayload): string;
156
+ type AttachmentUrlStatus = 'idle' | 'loading' | 'ready' | 'missing';
157
+ /**
158
+ * Resolve a displayable URL for an attachment. Prefers a cached `blob:` URL
159
+ * (offline), falling back to the inline `data:` URL when the cache is empty or
160
+ * unavailable. The returned object URL is revoked automatically on unmount /
161
+ * id change.
162
+ */
163
+ declare function useAttachmentUrl(id?: string, fallbackSrc?: string): {
164
+ url?: string;
165
+ status: AttachmentUrlStatus;
166
+ };
167
+ /**
168
+ * Create the attachment render plugin: renders ` ```superchat-attachment `
169
+ * blocks as inline image/video/audio/pdf players backed by the offline
170
+ * {@link attachmentCache}.
171
+ */
172
+ declare function createAttachmentPlugin(): SuperChatRenderPlugin;
173
+
174
+ /**
175
+ * SuperChat attachment cache (opt-in, offline-first).
176
+ *
177
+ * A tiny IndexedDB-backed blob store keyed by **attachment id**. Hosts persist
178
+ * a composer attachment's bytes here once (e.g. on send), embed only the id in
179
+ * the message, and the attachment render plugin resolves a fresh `blob:` URL
180
+ * from the cache at render time — so previously sent media keeps rendering
181
+ * while offline without bloating the stored conversation with base64.
182
+ *
183
+ * Everything degrades gracefully: when IndexedDB is unavailable (SSR, private
184
+ * mode, older browsers) the methods resolve to safe no-op values and callers
185
+ * fall back to any inline `src` they were given.
186
+ */
187
+ /** A blob persisted in the cache, plus its descriptive metadata. */
188
+ interface CachedAttachment {
189
+ /** Stable attachment id (the object-store key). */
190
+ id: string;
191
+ /** Original file name. */
192
+ name: string;
193
+ /** MIME type, e.g. `video/mp4`. */
194
+ type: string;
195
+ /** The raw file bytes. */
196
+ blob: Blob;
197
+ /** Byte length of {@link blob}. */
198
+ size: number;
199
+ /** Epoch ms the entry was written. */
200
+ cachedAt: number;
201
+ /** Epoch ms of the last read (drives LRU eviction). */
202
+ lastAccessed: number;
203
+ }
204
+ /** Input accepted by {@link AttachmentCache.put}. Provide `blob` or `dataUrl`. */
205
+ interface PutAttachmentInput {
206
+ id: string;
207
+ name: string;
208
+ type: string;
209
+ blob?: Blob;
210
+ /** Base64 (or URL-encoded) `data:` URL; converted to a Blob before storage. */
211
+ dataUrl?: string;
212
+ }
213
+ declare function hasIndexedDB(): boolean;
214
+ /**
215
+ * Offline blob store for SuperChat attachments. All methods are safe to call in
216
+ * any environment; without IndexedDB they resolve to no-ops / `undefined`.
217
+ */
218
+ declare const attachmentCache: {
219
+ /** Whether a persistent IndexedDB store is available in this environment. */
220
+ isAvailable: typeof hasIndexedDB;
221
+ /**
222
+ * Tune the cache. `maxBytes` is the eviction budget (default 100 MB); when a
223
+ * `put` pushes the total past it, least-recently-used entries are dropped
224
+ * until it fits. Set `Infinity` to disable eviction.
225
+ */
226
+ configure(options: {
227
+ maxBytes?: number;
228
+ }): void;
229
+ /** Total bytes currently held by the cache (0 when unavailable). */
230
+ usage(): Promise<number>;
231
+ /**
232
+ * Persist an attachment's bytes by id. Pass a `blob` or a `dataUrl`. Resolves
233
+ * to `true` when stored, `false` if unavailable or the input was unusable.
234
+ * Writing past the configured `maxBytes` evicts least-recently-used entries.
235
+ */
236
+ put(input: PutAttachmentInput): Promise<boolean>;
237
+ /** Read a cached attachment (blob + metadata) by id, or `undefined`. */
238
+ get(id: string): Promise<CachedAttachment | undefined>;
239
+ /**
240
+ * Resolve a fresh `blob:` object URL for a cached attachment, or `undefined`
241
+ * if it isn't cached. **The caller owns the URL** and must
242
+ * `URL.revokeObjectURL` it when done (the {@link useAttachmentUrl} hook does
243
+ * this automatically).
244
+ */
245
+ getObjectURL(id: string): Promise<string | undefined>;
246
+ /** Remove a cached attachment by id. */
247
+ delete(id: string): Promise<void>;
248
+ /** Drop every cached attachment. */
249
+ clear(): Promise<void>;
250
+ };
251
+ type AttachmentCache = typeof attachmentCache;
252
+
253
+ export { ATTACHMENT_FENCE, ATTACHMENT_TAG, type AttachmentBlockPayload, type AttachmentCache, type CachedAttachment, GENUI_TAG, GenUIRegistry, MERMAID_TAG, type PutAttachmentInput, attachmentCache, attachmentMarkdown, createAttachmentPlugin, createCodePlugin, createGenUIPlugin, createImagePlugin, createMathPlugin, createMermaidPlugin, createNitroTablePlugin, useAttachmentUrl };