svelte-streamdown 2.5.0 → 2.5.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.
@@ -198,6 +198,11 @@ export const usePanzoom = (opts = {}) => {
198
198
  dragOffMove = dragOffUp = null;
199
199
  }
200
200
  function onTouchStart(e) {
201
+ const hasButton = e
202
+ .composedPath()
203
+ .some((el) => el.tagName?.toLowerCase?.() === 'button');
204
+ if (hasButton)
205
+ return;
201
206
  if (!node)
202
207
  return;
203
208
  if (animating) {
@@ -352,7 +357,15 @@ export const usePanzoom = (opts = {}) => {
352
357
  const first = eventTarget.getBoundingClientRect();
353
358
  if (expand) {
354
359
  // Expanding: immediately apply expanded state
355
- eventTarget.parentElement.style.height = eventTarget.clientHeight + 'px';
360
+ // We should add margin to the parent element to account for the expanded height
361
+ if (eventTarget.parentElement) {
362
+ const styleAttributes = ['margin-block', 'height'];
363
+ styleAttributes.forEach((attribute) => {
364
+ if (eventTarget?.parentElement) {
365
+ eventTarget.parentElement.style.setProperty(attribute, getComputedStyle(eventTarget).getPropertyValue(attribute));
366
+ }
367
+ });
368
+ }
356
369
  eventTarget.dataset.expanded = 'true';
357
370
  isExpanded = true;
358
371
  zoomToFit();
@@ -1,2 +1,3 @@
1
1
  export declare const parseUrl: (url: unknown, defaultOrigin?: string) => URL | null;
2
+ export declare const isPathRelativeUrl: (url: unknown) => boolean;
2
3
  export declare const transformUrl: (url: unknown, allowedPrefixes: string[], defaultOrigin?: string) => string | null;
package/dist/utils/url.js CHANGED
@@ -20,7 +20,7 @@ export const parseUrl = (url, defaultOrigin) => {
20
20
  return null;
21
21
  }
22
22
  };
23
- const isPathRelativeUrl = (url) => {
23
+ export const isPathRelativeUrl = (url) => {
24
24
  if (typeof url !== 'string')
25
25
  return false;
26
26
  return url.startsWith('/');
@@ -29,6 +29,7 @@ export const transformUrl = (url, allowedPrefixes, defaultOrigin) => {
29
29
  if (!url)
30
30
  return null;
31
31
  const parsedUrl = parseUrl(url, defaultOrigin);
32
+ console.log('parsedUrl', { parsedUrl, url });
32
33
  if (!parsedUrl)
33
34
  return null;
34
35
  // If the input is path relative, we output a path relative URL as well,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svelte-streamdown",
3
- "version": "2.5.0",
3
+ "version": "2.5.2",
4
4
  "scripts": {
5
5
  "dev": "vite dev",
6
6
  "build": "vite build && npm run prepack",