@rokkit/ui 1.0.0-next.152 → 1.0.0-next.153

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rokkit/ui",
3
- "version": "1.0.0-next.152",
3
+ "version": "1.0.0-next.153",
4
4
  "description": "Data driven UI components for Rokkit applications",
5
5
  "repository": {
6
6
  "type": "git",
@@ -48,7 +48,7 @@
48
48
  "@rokkit/states": "latest",
49
49
  "@rokkit/actions": "latest",
50
50
  "marked": "^15.0.0",
51
- "isomorphic-dompurify": "^2.0.0"
51
+ "dompurify": "^3.0.0"
52
52
  },
53
53
  "peerDependencies": {
54
54
  "shiki": "^3.23.0",
@@ -1,7 +1,6 @@
1
1
  <script lang="ts">
2
2
  import { marked } from 'marked'
3
3
  import type { Token, TokensList } from 'marked'
4
- import DOMPurify from 'isomorphic-dompurify'
5
4
  import type { Component, Snippet } from 'svelte'
6
5
  import type { MarkdownPlugin } from './markdown-plugin.js'
7
6
 
@@ -16,6 +15,13 @@
16
15
 
17
16
  let { markdown, plugins = [], crossfilterWrapper }: Props = $props()
18
17
 
18
+ let purify: { sanitize: (s: string) => string } | null = $state(null)
19
+ $effect(() => {
20
+ import('dompurify').then((m) => {
21
+ purify = m.default
22
+ })
23
+ })
24
+
19
25
  const pluginMap = $derived(
20
26
  Object.fromEntries(plugins.map((p) => [p.language.toLowerCase(), p.component]))
21
27
  )
@@ -27,7 +33,7 @@
27
33
  links: (tokens as TokensList).links ?? {}
28
34
  }) as TokensList
29
35
  const raw = marked.parser(tokenList)
30
- return DOMPurify.sanitize(raw)
36
+ return purify ? purify.sanitize(raw) : raw
31
37
  }
32
38
 
33
39
  /** Extract crossfilter group ID from a code token's text, or null if absent/invalid. */