@particle-academy/react-fancy 5.49.1 → 5.50.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.
Files changed (59) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/dist/button.cjs +4 -4
  3. package/dist/button.js +2 -2
  4. package/dist/chunk-6TBRBN7H.js +212 -0
  5. package/dist/chunk-6TBRBN7H.js.map +1 -0
  6. package/dist/{chunk-VM5BNL4L.js → chunk-7MJ7VEKE.js} +3 -3
  7. package/dist/{chunk-VM5BNL4L.js.map → chunk-7MJ7VEKE.js.map} +1 -1
  8. package/dist/{chunk-JHDO6CRT.js → chunk-FU6R6BZ4.js} +3 -3
  9. package/dist/{chunk-JHDO6CRT.js.map → chunk-FU6R6BZ4.js.map} +1 -1
  10. package/dist/{chunk-3XJKJQSY.cjs → chunk-FWA4PCW7.cjs} +4 -4
  11. package/dist/{chunk-3XJKJQSY.cjs.map → chunk-FWA4PCW7.cjs.map} +1 -1
  12. package/dist/{chunk-EEKXWXYO.cjs → chunk-GCWIZNN2.cjs} +4 -4
  13. package/dist/{chunk-EEKXWXYO.cjs.map → chunk-GCWIZNN2.cjs.map} +1 -1
  14. package/dist/{chunk-TKDUT7ZA.cjs → chunk-IPBEVSSC.cjs} +6 -6
  15. package/dist/{chunk-TKDUT7ZA.cjs.map → chunk-IPBEVSSC.cjs.map} +1 -1
  16. package/dist/{chunk-GMNMJLZO.js → chunk-K6EJLBBQ.js} +12 -6
  17. package/dist/chunk-K6EJLBBQ.js.map +1 -0
  18. package/dist/{chunk-ZLYOMQ2J.js → chunk-KODD54GT.js} +3 -3
  19. package/dist/{chunk-ZLYOMQ2J.js.map → chunk-KODD54GT.js.map} +1 -1
  20. package/dist/{chunk-ODAPI4QJ.cjs → chunk-M52IS5SO.cjs} +11 -11
  21. package/dist/{chunk-ODAPI4QJ.cjs.map → chunk-M52IS5SO.cjs.map} +1 -1
  22. package/dist/{chunk-FNYUUVOK.cjs → chunk-MFQ5NBSV.cjs} +14 -7
  23. package/dist/chunk-MFQ5NBSV.cjs.map +1 -0
  24. package/dist/{chunk-I6XHZ3S2.cjs → chunk-NAQJF3G6.cjs} +4 -4
  25. package/dist/{chunk-I6XHZ3S2.cjs.map → chunk-NAQJF3G6.cjs.map} +1 -1
  26. package/dist/{chunk-K74R6IEB.js → chunk-PCTZNK2Z.js} +4 -4
  27. package/dist/{chunk-K74R6IEB.js.map → chunk-PCTZNK2Z.js.map} +1 -1
  28. package/dist/{chunk-62WPAKFS.js → chunk-UDEEPMQ4.js} +3 -3
  29. package/dist/{chunk-62WPAKFS.js.map → chunk-UDEEPMQ4.js.map} +1 -1
  30. package/dist/{chunk-RLC2BE3D.cjs → chunk-VWBKFQQN.cjs} +15 -15
  31. package/dist/{chunk-RLC2BE3D.cjs.map → chunk-VWBKFQQN.cjs.map} +1 -1
  32. package/dist/chunk-X2FC7ODX.cjs +215 -0
  33. package/dist/chunk-X2FC7ODX.cjs.map +1 -0
  34. package/dist/{chunk-SK4AEUO4.js → chunk-XBC3M4BL.js} +3 -3
  35. package/dist/{chunk-SK4AEUO4.js.map → chunk-XBC3M4BL.js.map} +1 -1
  36. package/dist/content-renderer.cjs +5 -5
  37. package/dist/content-renderer.js +2 -2
  38. package/dist/editor.cjs +5 -5
  39. package/dist/editor.js +3 -3
  40. package/dist/index.cjs +39 -35
  41. package/dist/index.d.cts +74 -7
  42. package/dist/index.d.ts +74 -7
  43. package/dist/index.js +8 -8
  44. package/dist/json-editor.cjs +14 -14
  45. package/dist/json-editor.js +3 -3
  46. package/dist/magic-wand.cjs +4 -4
  47. package/dist/magic-wand.js +3 -3
  48. package/dist/prompt-input.cjs +4 -4
  49. package/dist/prompt-input.js +3 -3
  50. package/dist/reason-tag.cjs +4 -4
  51. package/dist/reason-tag.js +3 -3
  52. package/docs/ContentRenderer.md +36 -0
  53. package/package.json +1 -1
  54. package/dist/chunk-FNYUUVOK.cjs.map +0 -1
  55. package/dist/chunk-GMNMJLZO.js.map +0 -1
  56. package/dist/chunk-LRNWD26Z.cjs +0 -82
  57. package/dist/chunk-LRNWD26Z.cjs.map +0 -1
  58. package/dist/chunk-QXYO76NZ.js +0 -79
  59. package/dist/chunk-QXYO76NZ.js.map +0 -1
package/dist/index.cjs CHANGED
@@ -21,7 +21,7 @@ var chunkCOH45MGW_cjs = require('./chunk-COH45MGW.cjs');
21
21
  var chunkYMDYDUBH_cjs = require('./chunk-YMDYDUBH.cjs');
22
22
  var chunkRLMU3NHQ_cjs = require('./chunk-RLMU3NHQ.cjs');
23
23
  var chunkUBZFOTZN_cjs = require('./chunk-UBZFOTZN.cjs');
24
- var chunkEEKXWXYO_cjs = require('./chunk-EEKXWXYO.cjs');
24
+ var chunkGCWIZNN2_cjs = require('./chunk-GCWIZNN2.cjs');
25
25
  var chunk5P3PISAX_cjs = require('./chunk-5P3PISAX.cjs');
26
26
  var chunkOS2QC3NE_cjs = require('./chunk-OS2QC3NE.cjs');
27
27
  var chunk6IBBAOQC_cjs = require('./chunk-6IBBAOQC.cjs');
@@ -33,7 +33,7 @@ var chunkLLA33GKC_cjs = require('./chunk-LLA33GKC.cjs');
33
33
  var chunkWKNVZUWZ_cjs = require('./chunk-WKNVZUWZ.cjs');
34
34
  var chunkPFEFKLUV_cjs = require('./chunk-PFEFKLUV.cjs');
35
35
  var chunkRWOH2ADL_cjs = require('./chunk-RWOH2ADL.cjs');
36
- var chunkTKDUT7ZA_cjs = require('./chunk-TKDUT7ZA.cjs');
36
+ var chunkIPBEVSSC_cjs = require('./chunk-IPBEVSSC.cjs');
37
37
  var chunkWKAEAGMT_cjs = require('./chunk-WKAEAGMT.cjs');
38
38
  var chunkAE53RKWR_cjs = require('./chunk-AE53RKWR.cjs');
39
39
  var chunkGBGJWAXZ_cjs = require('./chunk-GBGJWAXZ.cjs');
@@ -43,14 +43,14 @@ var chunkQSFTWIUH_cjs = require('./chunk-QSFTWIUH.cjs');
43
43
  var chunkXK5WHQ3O_cjs = require('./chunk-XK5WHQ3O.cjs');
44
44
  var chunkHIN6PHSE_cjs = require('./chunk-HIN6PHSE.cjs');
45
45
  var chunkF7YCIII4_cjs = require('./chunk-F7YCIII4.cjs');
46
- var chunkRLC2BE3D_cjs = require('./chunk-RLC2BE3D.cjs');
46
+ var chunkVWBKFQQN_cjs = require('./chunk-VWBKFQQN.cjs');
47
47
  var chunk2QIGXSSZ_cjs = require('./chunk-2QIGXSSZ.cjs');
48
48
  var chunkAR3JOPGT_cjs = require('./chunk-AR3JOPGT.cjs');
49
49
  var chunkY52NXM73_cjs = require('./chunk-Y52NXM73.cjs');
50
50
  var chunkBZZDHDMK_cjs = require('./chunk-BZZDHDMK.cjs');
51
51
  var chunkQAFAPHAF_cjs = require('./chunk-QAFAPHAF.cjs');
52
52
  var chunkSUCBR6L5_cjs = require('./chunk-SUCBR6L5.cjs');
53
- var chunkI6XHZ3S2_cjs = require('./chunk-I6XHZ3S2.cjs');
53
+ var chunkNAQJF3G6_cjs = require('./chunk-NAQJF3G6.cjs');
54
54
  var chunkV6VFSX6V_cjs = require('./chunk-V6VFSX6V.cjs');
55
55
  require('./chunk-7EZBMGEE.cjs');
56
56
  var chunkXKDW6B7X_cjs = require('./chunk-XKDW6B7X.cjs');
@@ -72,10 +72,10 @@ require('./chunk-S3TRSECD.cjs');
72
72
  var chunkPV5WDIGM_cjs = require('./chunk-PV5WDIGM.cjs');
73
73
  var chunkZ43BI7CQ_cjs = require('./chunk-Z43BI7CQ.cjs');
74
74
  var chunkT5OCRKPD_cjs = require('./chunk-T5OCRKPD.cjs');
75
- var chunkODAPI4QJ_cjs = require('./chunk-ODAPI4QJ.cjs');
75
+ var chunkM52IS5SO_cjs = require('./chunk-M52IS5SO.cjs');
76
76
  var chunkHPNIEYSJ_cjs = require('./chunk-HPNIEYSJ.cjs');
77
77
  var chunkT6YELZPJ_cjs = require('./chunk-T6YELZPJ.cjs');
78
- var chunkFNYUUVOK_cjs = require('./chunk-FNYUUVOK.cjs');
78
+ var chunkMFQ5NBSV_cjs = require('./chunk-MFQ5NBSV.cjs');
79
79
  var chunkAVU4JOYM_cjs = require('./chunk-AVU4JOYM.cjs');
80
80
  var chunkWIS4QRGK_cjs = require('./chunk-WIS4QRGK.cjs');
81
81
  var chunkVGBZWDMM_cjs = require('./chunk-VGBZWDMM.cjs');
@@ -99,8 +99,8 @@ var chunkMOU6O324_cjs = require('./chunk-MOU6O324.cjs');
99
99
  var chunkLMPPAQKP_cjs = require('./chunk-LMPPAQKP.cjs');
100
100
  var chunkJFOORUUD_cjs = require('./chunk-JFOORUUD.cjs');
101
101
  require('./chunk-M5MUGSON.cjs');
102
- var chunk3XJKJQSY_cjs = require('./chunk-3XJKJQSY.cjs');
103
- var chunkLRNWD26Z_cjs = require('./chunk-LRNWD26Z.cjs');
102
+ var chunkFWA4PCW7_cjs = require('./chunk-FWA4PCW7.cjs');
103
+ var chunkX2FC7ODX_cjs = require('./chunk-X2FC7ODX.cjs');
104
104
  var chunkXCZZVRBY_cjs = require('./chunk-XCZZVRBY.cjs');
105
105
  var chunkQKFOJKVE_cjs = require('./chunk-QKFOJKVE.cjs');
106
106
  var chunkQOGKO6JH_cjs = require('./chunk-QOGKO6JH.cjs');
@@ -199,7 +199,7 @@ Object.defineProperty(exports, "useToast", {
199
199
  });
200
200
  Object.defineProperty(exports, "ReasonTag", {
201
201
  enumerable: true,
202
- get: function () { return chunkEEKXWXYO_cjs.ReasonTag; }
202
+ get: function () { return chunkGCWIZNN2_cjs.ReasonTag; }
203
203
  });
204
204
  Object.defineProperty(exports, "Section", {
205
205
  enumerable: true,
@@ -259,19 +259,19 @@ Object.defineProperty(exports, "Progress", {
259
259
  });
260
260
  Object.defineProperty(exports, "PromptInput", {
261
261
  enumerable: true,
262
- get: function () { return chunkTKDUT7ZA_cjs.PromptInput; }
262
+ get: function () { return chunkIPBEVSSC_cjs.PromptInput; }
263
263
  });
264
264
  Object.defineProperty(exports, "browserPlatformHints", {
265
265
  enumerable: true,
266
- get: function () { return chunkTKDUT7ZA_cjs.browserPlatformHints; }
266
+ get: function () { return chunkIPBEVSSC_cjs.browserPlatformHints; }
267
267
  });
268
268
  Object.defineProperty(exports, "detectPlatform", {
269
269
  enumerable: true,
270
- get: function () { return chunkTKDUT7ZA_cjs.detectPlatform; }
270
+ get: function () { return chunkIPBEVSSC_cjs.detectPlatform; }
271
271
  });
272
272
  Object.defineProperty(exports, "modifierKeyLabel", {
273
273
  enumerable: true,
274
- get: function () { return chunkTKDUT7ZA_cjs.modifierKeyLabel; }
274
+ get: function () { return chunkIPBEVSSC_cjs.modifierKeyLabel; }
275
275
  });
276
276
  Object.defineProperty(exports, "PullQuote", {
277
277
  enumerable: true,
@@ -347,51 +347,51 @@ Object.defineProperty(exports, "textareaAdapter", {
347
347
  });
348
348
  Object.defineProperty(exports, "JSON_FIELD_TYPES", {
349
349
  enumerable: true,
350
- get: function () { return chunkRLC2BE3D_cjs.JSON_FIELD_TYPES; }
350
+ get: function () { return chunkVWBKFQQN_cjs.JSON_FIELD_TYPES; }
351
351
  });
352
352
  Object.defineProperty(exports, "JsonEditor", {
353
353
  enumerable: true,
354
- get: function () { return chunkRLC2BE3D_cjs.JsonEditor; }
354
+ get: function () { return chunkVWBKFQQN_cjs.JsonEditor; }
355
355
  });
356
356
  Object.defineProperty(exports, "applyJsonEdit", {
357
357
  enumerable: true,
358
- get: function () { return chunkRLC2BE3D_cjs.applyJsonEdit; }
358
+ get: function () { return chunkVWBKFQQN_cjs.applyJsonEdit; }
359
359
  });
360
360
  Object.defineProperty(exports, "describeEdit", {
361
361
  enumerable: true,
362
- get: function () { return chunkRLC2BE3D_cjs.describeEdit; }
362
+ get: function () { return chunkVWBKFQQN_cjs.describeEdit; }
363
363
  });
364
364
  Object.defineProperty(exports, "findJsonConflicts", {
365
365
  enumerable: true,
366
- get: function () { return chunkRLC2BE3D_cjs.findJsonConflicts; }
366
+ get: function () { return chunkVWBKFQQN_cjs.findJsonConflicts; }
367
367
  });
368
368
  Object.defineProperty(exports, "getAtPath", {
369
369
  enumerable: true,
370
- get: function () { return chunkRLC2BE3D_cjs.getAtPath; }
370
+ get: function () { return chunkVWBKFQQN_cjs.getAtPath; }
371
371
  });
372
372
  Object.defineProperty(exports, "inferType", {
373
373
  enumerable: true,
374
- get: function () { return chunkRLC2BE3D_cjs.inferType; }
374
+ get: function () { return chunkVWBKFQQN_cjs.inferType; }
375
375
  });
376
376
  Object.defineProperty(exports, "parseKeyMap", {
377
377
  enumerable: true,
378
- get: function () { return chunkRLC2BE3D_cjs.parseKeyMap; }
378
+ get: function () { return chunkVWBKFQQN_cjs.parseKeyMap; }
379
379
  });
380
380
  Object.defineProperty(exports, "parsePath", {
381
381
  enumerable: true,
382
- get: function () { return chunkRLC2BE3D_cjs.parsePath; }
382
+ get: function () { return chunkVWBKFQQN_cjs.parsePath; }
383
383
  });
384
384
  Object.defineProperty(exports, "pathToString", {
385
385
  enumerable: true,
386
- get: function () { return chunkRLC2BE3D_cjs.pathToString; }
386
+ get: function () { return chunkVWBKFQQN_cjs.pathToString; }
387
387
  });
388
388
  Object.defineProperty(exports, "resolveKeyRule", {
389
389
  enumerable: true,
390
- get: function () { return chunkRLC2BE3D_cjs.resolveKeyRule; }
390
+ get: function () { return chunkVWBKFQQN_cjs.resolveKeyRule; }
391
391
  });
392
392
  Object.defineProperty(exports, "typeMatches", {
393
393
  enumerable: true,
394
- get: function () { return chunkRLC2BE3D_cjs.typeMatches; }
394
+ get: function () { return chunkVWBKFQQN_cjs.typeMatches; }
395
395
  });
396
396
  Object.defineProperty(exports, "Input", {
397
397
  enumerable: true,
@@ -423,7 +423,7 @@ Object.defineProperty(exports, "Kbd", {
423
423
  });
424
424
  Object.defineProperty(exports, "MagicWand", {
425
425
  enumerable: true,
426
- get: function () { return chunkI6XHZ3S2_cjs.MagicWand; }
426
+ get: function () { return chunkNAQJF3G6_cjs.MagicWand; }
427
427
  });
428
428
  Object.defineProperty(exports, "Textarea", {
429
429
  enumerable: true,
@@ -531,11 +531,11 @@ Object.defineProperty(exports, "useDropdown", {
531
531
  });
532
532
  Object.defineProperty(exports, "Editor", {
533
533
  enumerable: true,
534
- get: function () { return chunkODAPI4QJ_cjs.Editor; }
534
+ get: function () { return chunkM52IS5SO_cjs.Editor; }
535
535
  });
536
536
  Object.defineProperty(exports, "useEditor", {
537
537
  enumerable: true,
538
- get: function () { return chunkODAPI4QJ_cjs.useEditor; }
538
+ get: function () { return chunkM52IS5SO_cjs.useEditor; }
539
539
  });
540
540
  Object.defineProperty(exports, "THEME_STORAGE_KEY", {
541
541
  enumerable: true,
@@ -579,15 +579,19 @@ Object.defineProperty(exports, "usePanZoom", {
579
579
  });
580
580
  Object.defineProperty(exports, "ContentRenderer", {
581
581
  enumerable: true,
582
- get: function () { return chunkFNYUUVOK_cjs.ContentRenderer; }
582
+ get: function () { return chunkMFQ5NBSV_cjs.ContentRenderer; }
583
583
  });
584
584
  Object.defineProperty(exports, "registerExtension", {
585
585
  enumerable: true,
586
- get: function () { return chunkFNYUUVOK_cjs.registerExtension; }
586
+ get: function () { return chunkMFQ5NBSV_cjs.registerExtension; }
587
587
  });
588
588
  Object.defineProperty(exports, "registerExtensions", {
589
589
  enumerable: true,
590
- get: function () { return chunkFNYUUVOK_cjs.registerExtensions; }
590
+ get: function () { return chunkMFQ5NBSV_cjs.registerExtensions; }
591
+ });
592
+ Object.defineProperty(exports, "renderMarkdown", {
593
+ enumerable: true,
594
+ get: function () { return chunkMFQ5NBSV_cjs.renderMarkdown; }
591
595
  });
592
596
  Object.defineProperty(exports, "Emoji", {
593
597
  enumerable: true,
@@ -695,19 +699,19 @@ Object.defineProperty(exports, "Breadcrumbs", {
695
699
  });
696
700
  Object.defineProperty(exports, "Action", {
697
701
  enumerable: true,
698
- get: function () { return chunk3XJKJQSY_cjs.Action; }
702
+ get: function () { return chunkFWA4PCW7_cjs.Action; }
699
703
  });
700
704
  Object.defineProperty(exports, "Button", {
701
705
  enumerable: true,
702
- get: function () { return chunk3XJKJQSY_cjs.Button; }
706
+ get: function () { return chunkFWA4PCW7_cjs.Button; }
703
707
  });
704
708
  Object.defineProperty(exports, "sanitizeHref", {
705
709
  enumerable: true,
706
- get: function () { return chunkLRNWD26Z_cjs.sanitizeHref; }
710
+ get: function () { return chunkX2FC7ODX_cjs.sanitizeHref; }
707
711
  });
708
712
  Object.defineProperty(exports, "sanitizeHtml", {
709
713
  enumerable: true,
710
- get: function () { return chunkLRNWD26Z_cjs.sanitizeHtml; }
714
+ get: function () { return chunkX2FC7ODX_cjs.sanitizeHtml; }
711
715
  });
712
716
  Object.defineProperty(exports, "EMOJI_CATEGORY_ORDER", {
713
717
  enumerable: true,
package/dist/index.d.cts CHANGED
@@ -131,14 +131,81 @@ declare function cn(...inputs: ClassValue[]): string;
131
131
  */
132
132
  declare function sanitizeHref(href: string | undefined | null): string | undefined;
133
133
  /**
134
- * Sanitize an HTML string by removing dangerous tags (script, iframe, etc.),
135
- * event-handler attributes (`onclick`, `onerror`, ...), and dangerous URI
136
- * schemes in `href`/`src` attributes.
134
+ * Allowlist options for {@link sanitizeHtml}. Passing ANY options object
135
+ * (even `{}`) switches from the default blocklist to allowlist mode, where
136
+ * everything not listed is removed.
137
+ */
138
+ interface SanitizeHtmlOptions {
139
+ /**
140
+ * Tags to keep, e.g. `["p", "a", "strong"]`. A tag that is not listed is
141
+ * removed but its text and (cleaned) children are kept. Default: none, so
142
+ * only text survives.
143
+ *
144
+ * Some tags are removed WITH their content even when listed, because no
145
+ * attribute filtering makes them safe: `script`, `style`, `iframe`, `frame`,
146
+ * `frameset`, `object`, `embed`, `applet`, `link`, `meta`, `base`, `form`,
147
+ * `title`, `template`, `noscript`, `noembed`, `noframes`, `xmp`,
148
+ * `plaintext`, `svg` and `math`.
149
+ */
150
+ allowedTags?: readonly string[];
151
+ /**
152
+ * Attributes to keep. Either one list for every allowed tag, or a map from
153
+ * tag name to its list, where the key `"*"` applies to every tag. A trailing
154
+ * `*` matches a prefix (`"data-*"`, `"aria-*"`). Default: none.
155
+ *
156
+ * Never kept, even when listed: event handlers (`on*`), `srcdoc` and
157
+ * `srcset`.
158
+ */
159
+ allowedAttributes?: readonly string[] | Readonly<Record<string, readonly string[]>>;
160
+ /**
161
+ * URL schemes allowed in URL attributes (`href`, `src`, `action`,
162
+ * `formaction`, `cite`, `poster`, `background`, `ping`, `xlink:href`), with
163
+ * the colon: `["https:", "mailto:"]`. A URL attribute whose scheme is not
164
+ * listed is removed. Default: `["http:", "https:", "mailto:"]`.
165
+ *
166
+ * `javascript:` and `vbscript:` are never kept, even when listed.
167
+ */
168
+ allowedSchemes?: readonly string[];
169
+ /**
170
+ * Keep URLs with no scheme that stay on this site: `/x`, `x/y`, `../x`,
171
+ * `?q`, `#frag`. Protocol-relative URLs (`//host/x`, and the backslash
172
+ * spellings a browser treats the same way) leave the site and are always
173
+ * removed. Default: `false`.
174
+ */
175
+ allowRelative?: boolean;
176
+ }
177
+ /**
178
+ * Sanitize an HTML string.
179
+ *
180
+ * **With no options** (the default blocklist): removes dangerous tags (script,
181
+ * iframe, etc.), event-handler attributes (`onclick`, `onerror`, ...), and
182
+ * dangerous URI schemes in `href`/`src` attributes. Everything else is kept.
183
+ * In non-browser environments returns the input unchanged — sanitize on the
184
+ * server in those cases.
185
+ *
186
+ * **With options** (allowlist mode): keeps ONLY the listed tags, attributes and
187
+ * URL schemes; see {@link SanitizeHtmlOptions}. The allowlist can only narrow:
188
+ * event handlers, `javascript:` URLs and script-capable tags never survive,
189
+ * even when listed. In non-browser environments the input is returned as
190
+ * escaped text (fail closed).
191
+ *
192
+ * Uses the browser's `DOMParser`.
193
+ */
194
+ declare function sanitizeHtml(html: string, options?: SanitizeHtmlOptions): string;
195
+
196
+ /**
197
+ * Render markdown (GitHub-flavoured) to sanitised HTML — the same parser and
198
+ * output `ContentRenderer` uses, so a host never has to import the parser
199
+ * itself.
200
+ *
201
+ * With no `sanitize` options the default blocklist of {@link sanitizeHtml} is
202
+ * applied; pass allowlist options to keep only what you list:
137
203
  *
138
- * Uses the browser's `DOMParser`. In non-browser environments returns the
139
- * input unchanged — sanitize on the server in those cases.
204
+ * ```ts
205
+ * renderMarkdown(md, { allowedTags: ["p", "strong", "a"], allowedAttributes: ["href"] })
206
+ * ```
140
207
  */
141
- declare function sanitizeHtml(html: string): string;
208
+ declare function renderMarkdown(markdown: string, sanitize?: SanitizeHtmlOptions): string;
142
209
 
143
210
  /**
144
211
  * One state slot that works controlled or uncontrolled.
@@ -316,4 +383,4 @@ type UseThemeResult = {
316
383
  */
317
384
  declare function useTheme(): UseThemeResult;
318
385
 
319
- export { type NodeRect, Placement, type ResolvedTheme, THEME_STORAGE_KEY, type ThemePreference, type UseThemeResult, cn, getThemePreference, initTheme, resolveTheme, sanitizeHref, sanitizeHtml, setThemePreference, subscribeTheme, useAnimation, useControllableState, useEscapeKey, useFloatingPosition, useFocusTrap, useId, useNodeRegistry, useOutsideClick, usePanZoom, useTheme };
386
+ export { type NodeRect, Placement, type ResolvedTheme, type SanitizeHtmlOptions, THEME_STORAGE_KEY, type ThemePreference, type UseThemeResult, cn, getThemePreference, initTheme, renderMarkdown, resolveTheme, sanitizeHref, sanitizeHtml, setThemePreference, subscribeTheme, useAnimation, useControllableState, useEscapeKey, useFloatingPosition, useFocusTrap, useId, useNodeRegistry, useOutsideClick, usePanZoom, useTheme };
package/dist/index.d.ts CHANGED
@@ -131,14 +131,81 @@ declare function cn(...inputs: ClassValue[]): string;
131
131
  */
132
132
  declare function sanitizeHref(href: string | undefined | null): string | undefined;
133
133
  /**
134
- * Sanitize an HTML string by removing dangerous tags (script, iframe, etc.),
135
- * event-handler attributes (`onclick`, `onerror`, ...), and dangerous URI
136
- * schemes in `href`/`src` attributes.
134
+ * Allowlist options for {@link sanitizeHtml}. Passing ANY options object
135
+ * (even `{}`) switches from the default blocklist to allowlist mode, where
136
+ * everything not listed is removed.
137
+ */
138
+ interface SanitizeHtmlOptions {
139
+ /**
140
+ * Tags to keep, e.g. `["p", "a", "strong"]`. A tag that is not listed is
141
+ * removed but its text and (cleaned) children are kept. Default: none, so
142
+ * only text survives.
143
+ *
144
+ * Some tags are removed WITH their content even when listed, because no
145
+ * attribute filtering makes them safe: `script`, `style`, `iframe`, `frame`,
146
+ * `frameset`, `object`, `embed`, `applet`, `link`, `meta`, `base`, `form`,
147
+ * `title`, `template`, `noscript`, `noembed`, `noframes`, `xmp`,
148
+ * `plaintext`, `svg` and `math`.
149
+ */
150
+ allowedTags?: readonly string[];
151
+ /**
152
+ * Attributes to keep. Either one list for every allowed tag, or a map from
153
+ * tag name to its list, where the key `"*"` applies to every tag. A trailing
154
+ * `*` matches a prefix (`"data-*"`, `"aria-*"`). Default: none.
155
+ *
156
+ * Never kept, even when listed: event handlers (`on*`), `srcdoc` and
157
+ * `srcset`.
158
+ */
159
+ allowedAttributes?: readonly string[] | Readonly<Record<string, readonly string[]>>;
160
+ /**
161
+ * URL schemes allowed in URL attributes (`href`, `src`, `action`,
162
+ * `formaction`, `cite`, `poster`, `background`, `ping`, `xlink:href`), with
163
+ * the colon: `["https:", "mailto:"]`. A URL attribute whose scheme is not
164
+ * listed is removed. Default: `["http:", "https:", "mailto:"]`.
165
+ *
166
+ * `javascript:` and `vbscript:` are never kept, even when listed.
167
+ */
168
+ allowedSchemes?: readonly string[];
169
+ /**
170
+ * Keep URLs with no scheme that stay on this site: `/x`, `x/y`, `../x`,
171
+ * `?q`, `#frag`. Protocol-relative URLs (`//host/x`, and the backslash
172
+ * spellings a browser treats the same way) leave the site and are always
173
+ * removed. Default: `false`.
174
+ */
175
+ allowRelative?: boolean;
176
+ }
177
+ /**
178
+ * Sanitize an HTML string.
179
+ *
180
+ * **With no options** (the default blocklist): removes dangerous tags (script,
181
+ * iframe, etc.), event-handler attributes (`onclick`, `onerror`, ...), and
182
+ * dangerous URI schemes in `href`/`src` attributes. Everything else is kept.
183
+ * In non-browser environments returns the input unchanged — sanitize on the
184
+ * server in those cases.
185
+ *
186
+ * **With options** (allowlist mode): keeps ONLY the listed tags, attributes and
187
+ * URL schemes; see {@link SanitizeHtmlOptions}. The allowlist can only narrow:
188
+ * event handlers, `javascript:` URLs and script-capable tags never survive,
189
+ * even when listed. In non-browser environments the input is returned as
190
+ * escaped text (fail closed).
191
+ *
192
+ * Uses the browser's `DOMParser`.
193
+ */
194
+ declare function sanitizeHtml(html: string, options?: SanitizeHtmlOptions): string;
195
+
196
+ /**
197
+ * Render markdown (GitHub-flavoured) to sanitised HTML — the same parser and
198
+ * output `ContentRenderer` uses, so a host never has to import the parser
199
+ * itself.
200
+ *
201
+ * With no `sanitize` options the default blocklist of {@link sanitizeHtml} is
202
+ * applied; pass allowlist options to keep only what you list:
137
203
  *
138
- * Uses the browser's `DOMParser`. In non-browser environments returns the
139
- * input unchanged — sanitize on the server in those cases.
204
+ * ```ts
205
+ * renderMarkdown(md, { allowedTags: ["p", "strong", "a"], allowedAttributes: ["href"] })
206
+ * ```
140
207
  */
141
- declare function sanitizeHtml(html: string): string;
208
+ declare function renderMarkdown(markdown: string, sanitize?: SanitizeHtmlOptions): string;
142
209
 
143
210
  /**
144
211
  * One state slot that works controlled or uncontrolled.
@@ -316,4 +383,4 @@ type UseThemeResult = {
316
383
  */
317
384
  declare function useTheme(): UseThemeResult;
318
385
 
319
- export { type NodeRect, Placement, type ResolvedTheme, THEME_STORAGE_KEY, type ThemePreference, type UseThemeResult, cn, getThemePreference, initTheme, resolveTheme, sanitizeHref, sanitizeHtml, setThemePreference, subscribeTheme, useAnimation, useControllableState, useEscapeKey, useFloatingPosition, useFocusTrap, useId, useNodeRegistry, useOutsideClick, usePanZoom, useTheme };
386
+ export { type NodeRect, Placement, type ResolvedTheme, type SanitizeHtmlOptions, THEME_STORAGE_KEY, type ThemePreference, type UseThemeResult, cn, getThemePreference, initTheme, renderMarkdown, resolveTheme, sanitizeHref, sanitizeHtml, setThemePreference, subscribeTheme, useAnimation, useControllableState, useEscapeKey, useFloatingPosition, useFocusTrap, useId, useNodeRegistry, useOutsideClick, usePanZoom, useTheme };
package/dist/index.js CHANGED
@@ -19,7 +19,7 @@ export { TimeGrid } from './chunk-7CN7IHES.js';
19
19
  export { TimePicker } from './chunk-OTCLBINT.js';
20
20
  export { Timeline } from './chunk-7JDVCQXD.js';
21
21
  export { Toast, useToast } from './chunk-3AQLEMH7.js';
22
- export { ReasonTag } from './chunk-62WPAKFS.js';
22
+ export { ReasonTag } from './chunk-UDEEPMQ4.js';
23
23
  export { Section } from './chunk-SLJD25VV.js';
24
24
  export { Separator } from './chunk-ZLWCZV7R.js';
25
25
  export { Sidebar, useSidebar } from './chunk-YD4SXA6K.js';
@@ -31,7 +31,7 @@ export { Pillbox } from './chunk-FSRPZYZZ.js';
31
31
  export { Popover, usePopover } from './chunk-6KXAFP2T.js';
32
32
  export { Profile } from './chunk-KQQA7JBC.js';
33
33
  export { Progress } from './chunk-P7PKK5BO.js';
34
- export { PromptInput, browserPlatformHints, detectPlatform, modifierKeyLabel } from './chunk-SK4AEUO4.js';
34
+ export { PromptInput, browserPlatformHints, detectPlatform, modifierKeyLabel } from './chunk-XBC3M4BL.js';
35
35
  export { PullQuote } from './chunk-NDUEPDNS.js';
36
36
  export { QrCode, encodeQr, selectMode } from './chunk-RLE5WYY6.js';
37
37
  export { MobileMenu, useMobileMenu } from './chunk-P7F32HIH.js';
@@ -41,14 +41,14 @@ export { Navbar, useNavbar } from './chunk-IWXP2YUP.js';
41
41
  export { OtpInput } from './chunk-XDJSFGXW.js';
42
42
  export { Pagination } from './chunk-YF2EHBTV.js';
43
43
  export { InputTag, contentEditableAdapter, controlledAdapter, inputAdapter, textareaAdapter } from './chunk-Q7O5TLVU.js';
44
- export { JSON_FIELD_TYPES, JsonEditor, applyJsonEdit, describeEdit, findJsonConflicts, getAtPath, inferType, parseKeyMap, parsePath, pathToString, resolveKeyRule, typeMatches } from './chunk-VM5BNL4L.js';
44
+ export { JSON_FIELD_TYPES, JsonEditor, applyJsonEdit, describeEdit, findJsonConflicts, getAtPath, inferType, parseKeyMap, parsePath, pathToString, resolveKeyRule, typeMatches } from './chunk-7MJ7VEKE.js';
45
45
  export { Input } from './chunk-EEWRLFTI.js';
46
46
  export { Select } from './chunk-IECPLOSZ.js';
47
47
  export { Switch } from './chunk-NBAHXZHJ.js';
48
48
  export { DatePicker } from './chunk-OC75GWX5.js';
49
49
  export { Kanban, useKanban } from './chunk-O6E2WC3J.js';
50
50
  export { Kbd } from './chunk-TJJ63UJV.js';
51
- export { MagicWand } from './chunk-JHDO6CRT.js';
51
+ export { MagicWand } from './chunk-FU6R6BZ4.js';
52
52
  export { Textarea } from './chunk-DEFGT75G.js';
53
53
  import './chunk-PWEZCMIY.js';
54
54
  export { DisplayValue } from './chunk-KKWNKBKR.js';
@@ -70,10 +70,10 @@ import './chunk-AUTW5O4W.js';
70
70
  export { ContextMenu, useContextMenu } from './chunk-SWBF2BXA.js';
71
71
  export { Drawer, useDrawer } from './chunk-VFIVF5YO.js';
72
72
  export { Dropdown, useDropdown } from './chunk-YQJWD53X.js';
73
- export { Editor, useEditor } from './chunk-K74R6IEB.js';
73
+ export { Editor, useEditor } from './chunk-PCTZNK2Z.js';
74
74
  export { THEME_STORAGE_KEY, getThemePreference, initTheme, resolveTheme, setThemePreference, subscribeTheme, useId, useNodeRegistry, useTheme } from './chunk-FWCREAIT.js';
75
75
  export { usePanZoom } from './chunk-CPY7NHXM.js';
76
- export { ContentRenderer, registerExtension, registerExtensions } from './chunk-GMNMJLZO.js';
76
+ export { ContentRenderer, registerExtension, registerExtensions, renderMarkdown } from './chunk-K6EJLBBQ.js';
77
77
  export { Emoji } from './chunk-YTMQ2K64.js';
78
78
  export { EmojiSelect } from './chunk-VYHZEQIG.js';
79
79
  export { Eyebrow } from './chunk-Y4UPKJN5.js';
@@ -97,8 +97,8 @@ export { Badge } from './chunk-6FCQD2KQ.js';
97
97
  export { Brand, BrandMark } from './chunk-FCSR2WVS.js';
98
98
  export { Breadcrumbs } from './chunk-TDDWWAM5.js';
99
99
  import './chunk-LQ4ICCN2.js';
100
- export { Action, Button } from './chunk-ZLYOMQ2J.js';
101
- export { sanitizeHref, sanitizeHtml } from './chunk-QXYO76NZ.js';
100
+ export { Action, Button } from './chunk-KODD54GT.js';
101
+ export { sanitizeHref, sanitizeHtml } from './chunk-6TBRBN7H.js';
102
102
  export { EMOJI_CATEGORY_ORDER, EMOJI_DATA, EMOJI_ENTRIES, SKIN_TONES, applyTone, find, hasSkinTones, resolve, search, skinTones } from './chunk-45BBNJQD.js';
103
103
  export { Icon, configureIcons, registerIconAddendum, registerIconSet, registerIcons } from './chunk-IVRYSSM7.js';
104
104
  export { Calendar } from './chunk-NTMHP7FS.js';
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkRLC2BE3D_cjs = require('./chunk-RLC2BE3D.cjs');
3
+ var chunkVWBKFQQN_cjs = require('./chunk-VWBKFQQN.cjs');
4
4
  require('./chunk-2QIGXSSZ.cjs');
5
5
  require('./chunk-AR3JOPGT.cjs');
6
6
  require('./chunk-Y52NXM73.cjs');
@@ -14,8 +14,8 @@ require('./chunk-BVRPDMB7.cjs');
14
14
  require('./chunk-MSRYJETY.cjs');
15
15
  require('./chunk-X7H75WVP.cjs');
16
16
  require('./chunk-MOU6O324.cjs');
17
- require('./chunk-3XJKJQSY.cjs');
18
- require('./chunk-LRNWD26Z.cjs');
17
+ require('./chunk-FWA4PCW7.cjs');
18
+ require('./chunk-X2FC7ODX.cjs');
19
19
  require('./chunk-XCZZVRBY.cjs');
20
20
  require('./chunk-QKFOJKVE.cjs');
21
21
  require('./chunk-LCNHEYIM.cjs');
@@ -33,47 +33,47 @@ require('./chunk-ZU5Q77OT.cjs');
33
33
 
34
34
  Object.defineProperty(exports, "JsonEditor", {
35
35
  enumerable: true,
36
- get: function () { return chunkRLC2BE3D_cjs.JsonEditor; }
36
+ get: function () { return chunkVWBKFQQN_cjs.JsonEditor; }
37
37
  });
38
38
  Object.defineProperty(exports, "applyJsonEdit", {
39
39
  enumerable: true,
40
- get: function () { return chunkRLC2BE3D_cjs.applyJsonEdit; }
40
+ get: function () { return chunkVWBKFQQN_cjs.applyJsonEdit; }
41
41
  });
42
42
  Object.defineProperty(exports, "describeEdit", {
43
43
  enumerable: true,
44
- get: function () { return chunkRLC2BE3D_cjs.describeEdit; }
44
+ get: function () { return chunkVWBKFQQN_cjs.describeEdit; }
45
45
  });
46
46
  Object.defineProperty(exports, "findJsonConflicts", {
47
47
  enumerable: true,
48
- get: function () { return chunkRLC2BE3D_cjs.findJsonConflicts; }
48
+ get: function () { return chunkVWBKFQQN_cjs.findJsonConflicts; }
49
49
  });
50
50
  Object.defineProperty(exports, "getAtPath", {
51
51
  enumerable: true,
52
- get: function () { return chunkRLC2BE3D_cjs.getAtPath; }
52
+ get: function () { return chunkVWBKFQQN_cjs.getAtPath; }
53
53
  });
54
54
  Object.defineProperty(exports, "inferType", {
55
55
  enumerable: true,
56
- get: function () { return chunkRLC2BE3D_cjs.inferType; }
56
+ get: function () { return chunkVWBKFQQN_cjs.inferType; }
57
57
  });
58
58
  Object.defineProperty(exports, "parseKeyMap", {
59
59
  enumerable: true,
60
- get: function () { return chunkRLC2BE3D_cjs.parseKeyMap; }
60
+ get: function () { return chunkVWBKFQQN_cjs.parseKeyMap; }
61
61
  });
62
62
  Object.defineProperty(exports, "parsePath", {
63
63
  enumerable: true,
64
- get: function () { return chunkRLC2BE3D_cjs.parsePath; }
64
+ get: function () { return chunkVWBKFQQN_cjs.parsePath; }
65
65
  });
66
66
  Object.defineProperty(exports, "pathToString", {
67
67
  enumerable: true,
68
- get: function () { return chunkRLC2BE3D_cjs.pathToString; }
68
+ get: function () { return chunkVWBKFQQN_cjs.pathToString; }
69
69
  });
70
70
  Object.defineProperty(exports, "resolveKeyRule", {
71
71
  enumerable: true,
72
- get: function () { return chunkRLC2BE3D_cjs.resolveKeyRule; }
72
+ get: function () { return chunkVWBKFQQN_cjs.resolveKeyRule; }
73
73
  });
74
74
  Object.defineProperty(exports, "typeMatches", {
75
75
  enumerable: true,
76
- get: function () { return chunkRLC2BE3D_cjs.typeMatches; }
76
+ get: function () { return chunkVWBKFQQN_cjs.typeMatches; }
77
77
  });
78
78
  //# sourceMappingURL=json-editor.cjs.map
79
79
  //# sourceMappingURL=json-editor.cjs.map
@@ -1,4 +1,4 @@
1
- export { JsonEditor, applyJsonEdit, describeEdit, findJsonConflicts, getAtPath, inferType, parseKeyMap, parsePath, pathToString, resolveKeyRule, typeMatches } from './chunk-VM5BNL4L.js';
1
+ export { JsonEditor, applyJsonEdit, describeEdit, findJsonConflicts, getAtPath, inferType, parseKeyMap, parsePath, pathToString, resolveKeyRule, typeMatches } from './chunk-7MJ7VEKE.js';
2
2
  import './chunk-EEWRLFTI.js';
3
3
  import './chunk-IECPLOSZ.js';
4
4
  import './chunk-NBAHXZHJ.js';
@@ -12,8 +12,8 @@ import './chunk-F2GAZZVS.js';
12
12
  import './chunk-KYZNCVRD.js';
13
13
  import './chunk-CF5KRDN4.js';
14
14
  import './chunk-6FCQD2KQ.js';
15
- import './chunk-ZLYOMQ2J.js';
16
- import './chunk-QXYO76NZ.js';
15
+ import './chunk-KODD54GT.js';
16
+ import './chunk-6TBRBN7H.js';
17
17
  import './chunk-45BBNJQD.js';
18
18
  import './chunk-IVRYSSM7.js';
19
19
  import './chunk-ZXZJYVWP.js';
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkI6XHZ3S2_cjs = require('./chunk-I6XHZ3S2.cjs');
3
+ var chunkNAQJF3G6_cjs = require('./chunk-NAQJF3G6.cjs');
4
4
  require('./chunk-V6VFSX6V.cjs');
5
5
  require('./chunk-7EZBMGEE.cjs');
6
6
  require('./chunk-XKDW6B7X.cjs');
@@ -9,8 +9,8 @@ require('./chunk-YLGTDBB2.cjs');
9
9
  require('./chunk-VBWRH4UW.cjs');
10
10
  require('./chunk-MOU6O324.cjs');
11
11
  require('./chunk-M5MUGSON.cjs');
12
- require('./chunk-3XJKJQSY.cjs');
13
- require('./chunk-LRNWD26Z.cjs');
12
+ require('./chunk-FWA4PCW7.cjs');
13
+ require('./chunk-X2FC7ODX.cjs');
14
14
  require('./chunk-XCZZVRBY.cjs');
15
15
  require('./chunk-QKFOJKVE.cjs');
16
16
  require('./chunk-KJ22KE56.cjs');
@@ -21,7 +21,7 @@ require('./chunk-ZU5Q77OT.cjs');
21
21
 
22
22
  Object.defineProperty(exports, "MagicWand", {
23
23
  enumerable: true,
24
- get: function () { return chunkI6XHZ3S2_cjs.MagicWand; }
24
+ get: function () { return chunkNAQJF3G6_cjs.MagicWand; }
25
25
  });
26
26
  //# sourceMappingURL=magic-wand.cjs.map
27
27
  //# sourceMappingURL=magic-wand.cjs.map
@@ -1,4 +1,4 @@
1
- export { MagicWand } from './chunk-JHDO6CRT.js';
1
+ export { MagicWand } from './chunk-FU6R6BZ4.js';
2
2
  import './chunk-DEFGT75G.js';
3
3
  import './chunk-PWEZCMIY.js';
4
4
  import './chunk-KKWNKBKR.js';
@@ -7,8 +7,8 @@ import './chunk-GFYSELJF.js';
7
7
  import './chunk-IQ4KQJAO.js';
8
8
  import './chunk-6FCQD2KQ.js';
9
9
  import './chunk-LQ4ICCN2.js';
10
- import './chunk-ZLYOMQ2J.js';
11
- import './chunk-QXYO76NZ.js';
10
+ import './chunk-KODD54GT.js';
11
+ import './chunk-6TBRBN7H.js';
12
12
  import './chunk-45BBNJQD.js';
13
13
  import './chunk-IVRYSSM7.js';
14
14
  import './chunk-OL53XYHF.js';
@@ -1,12 +1,12 @@
1
1
  'use strict';
2
2
 
3
- var chunkTKDUT7ZA_cjs = require('./chunk-TKDUT7ZA.cjs');
3
+ var chunkIPBEVSSC_cjs = require('./chunk-IPBEVSSC.cjs');
4
4
  require('./chunk-AIA5UNQ5.cjs');
5
5
  require('./chunk-MSRYJETY.cjs');
6
6
  require('./chunk-X7H75WVP.cjs');
7
7
  require('./chunk-M5MUGSON.cjs');
8
- require('./chunk-3XJKJQSY.cjs');
9
- require('./chunk-LRNWD26Z.cjs');
8
+ require('./chunk-FWA4PCW7.cjs');
9
+ require('./chunk-X2FC7ODX.cjs');
10
10
  require('./chunk-XCZZVRBY.cjs');
11
11
  require('./chunk-QKFOJKVE.cjs');
12
12
  require('./chunk-J2DI6RMR.cjs');
@@ -18,7 +18,7 @@ require('./chunk-ZU5Q77OT.cjs');
18
18
 
19
19
  Object.defineProperty(exports, "PromptInput", {
20
20
  enumerable: true,
21
- get: function () { return chunkTKDUT7ZA_cjs.PromptInput; }
21
+ get: function () { return chunkIPBEVSSC_cjs.PromptInput; }
22
22
  });
23
23
  //# sourceMappingURL=prompt-input.cjs.map
24
24
  //# sourceMappingURL=prompt-input.cjs.map
@@ -1,10 +1,10 @@
1
- export { PromptInput } from './chunk-SK4AEUO4.js';
1
+ export { PromptInput } from './chunk-XBC3M4BL.js';
2
2
  import './chunk-TJ66S5K6.js';
3
3
  import './chunk-KYZNCVRD.js';
4
4
  import './chunk-CF5KRDN4.js';
5
5
  import './chunk-LQ4ICCN2.js';
6
- import './chunk-ZLYOMQ2J.js';
7
- import './chunk-QXYO76NZ.js';
6
+ import './chunk-KODD54GT.js';
7
+ import './chunk-6TBRBN7H.js';
8
8
  import './chunk-45BBNJQD.js';
9
9
  import './chunk-IVRYSSM7.js';
10
10
  import './chunk-MQ6VGG62.js';