svelte-streamdown 2.4.0 → 2.4.2

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.
@@ -72,8 +72,11 @@
72
72
  </div>
73
73
  <div style="height: fit-content; width: 100%;" class={streamdown.theme.code.container}>
74
74
  {#if highlighter.isReady(streamdown.shikiTheme, token.lang)}
75
- {@const tokens = highlighter.highlightCode(token.text, token.lang, streamdown.shikiTheme)}
76
- <pre class={streamdown.theme.code.pre}><code>{@render Tokens(tokens)}</code></pre>
75
+ <pre class={streamdown.theme.code.pre}><code
76
+ >{@render Tokens(
77
+ highlighter.highlightCode(token.text, token.lang, streamdown.shikiTheme)
78
+ )}</code
79
+ ></pre>
77
80
  {:else}
78
81
  <pre class={streamdown.theme.code.pre}><code>{@render Skeleton(token.text.split('\n'))}</code
79
82
  ></pre>
@@ -81,12 +84,12 @@
81
84
  </div>
82
85
  </div>
83
86
 
84
- {#snippet Tokens(tokens: ThemedToken[][])}
85
- {#each tokens as line}
87
+ {#snippet Tokens(lines: ThemedToken[][])}
88
+ {#each lines as tokens}
86
89
  <span class={streamdown.theme.code.line}>
87
- {#each line as token}
90
+ {#each tokens as token}
88
91
  <span
89
- style={streamdown.animationTextStyle}
92
+ style={streamdown.isMounted ? streamdown.animationTextStyle : ''}
90
93
  style:color={token.color}
91
94
  style:background-color={token.bgColor}
92
95
  >
@@ -99,7 +102,7 @@
99
102
 
100
103
  {#snippet Skeleton(lines: string[])}
101
104
  {#each lines as line}
102
- <span style={streamdown.animationTextStyle} class={streamdown.theme.code.skeleton}>
105
+ <span class={streamdown.theme.code.skeleton}>
103
106
  {line.trim().length > 0 ? line : '\u200B'}
104
107
  </span>
105
108
  {/each}
@@ -97,7 +97,6 @@
97
97
  {@attach clickOutside.attachment}
98
98
  {@attach popoverAttachment}
99
99
  open
100
- popover="auto"
101
100
  class={`${streamdown.theme.footnotePopover.base}`}
102
101
  >
103
102
  {#each token.content.lines as line}
@@ -107,22 +106,24 @@
107
106
  </Slot>
108
107
  {/if}
109
108
 
110
- <Slot
111
- props={{
112
- token
113
- }}
114
- render={streamdown.snippets.footnoteRef}
115
- >
116
- <button
117
- style={streamdown.animationBlockStyle}
118
- bind:this={reference}
119
- class={streamdown.theme.footnoteRef.base}
120
- onclick={() => (isOpen = !isOpen)}
121
- aria-expanded={isOpen}
122
- aria-haspopup="dialog"
123
- aria-controls={'footnote-popover-' + id}
124
- {@attach clickOutside.attachment}
109
+ {#if token.label !== 'streamdown:footnote'}
110
+ <Slot
111
+ props={{
112
+ token
113
+ }}
114
+ render={streamdown.snippets.footnoteRef}
125
115
  >
126
- {token.label.replace('^', '')}
127
- </button>
128
- </Slot>
116
+ <button
117
+ style={streamdown.animationBlockStyle}
118
+ bind:this={reference}
119
+ class={streamdown.theme.footnoteRef.base}
120
+ onclick={() => (isOpen = !isOpen)}
121
+ aria-expanded={isOpen}
122
+ aria-haspopup="dialog"
123
+ aria-controls={'footnote-popover-' + id}
124
+ {@attach clickOutside.attachment}
125
+ >
126
+ {token.label.replace('^', '')}
127
+ </button>
128
+ </Slot>
129
+ {/if}