@bendyline/squisq-react 2.12.16 → 2.12.18

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.
@@ -61,7 +61,7 @@ COMPONENTS
61
61
  - decode-named-character-reference@1.3.0 (MIT); files: license
62
62
  - delaunator@5.1.0 (ISC); files: LICENSE
63
63
  - devlop@1.1.0 (MIT); files: license
64
- - dompurify@3.4.16 ((MPL-2.0 OR Apache-2.0)); files: LICENSE, LICENSE-MPL
64
+ - dompurify@3.4.17 ((MPL-2.0 OR Apache-2.0)); files: LICENSE, LICENSE-MPL
65
65
  - entities@6.0.1 (BSD-2-Clause); files: LICENSE
66
66
  - es-toolkit@1.49.0 (MIT); files: LICENSE
67
67
  - escape-string-regexp@5.0.0 (MIT); files: license
@@ -1571,7 +1571,7 @@ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
1571
1571
  SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1572
1572
 
1573
1573
  ==============================================================================
1574
- dompurify@3.4.16 - LICENSE
1574
+ dompurify@3.4.17 - LICENSE
1575
1575
  ==============================================================================
1576
1576
 
1577
1577
  Apache License
@@ -1777,7 +1777,7 @@ dompurify@3.4.16 - LICENSE
1777
1777
  limitations under the License.
1778
1778
 
1779
1779
  ==============================================================================
1780
- dompurify@3.4.16 - LICENSE-MPL
1780
+ dompurify@3.4.17 - LICENSE-MPL
1781
1781
  ==============================================================================
1782
1782
  Mozilla Public License Version 2.0
1783
1783
  ==================================
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-TT6ENR6T.js";
4
4
  import {
5
5
  MarkdownRenderer
6
- } from "./chunk-FLPGMUXM.js";
6
+ } from "./chunk-OWC7DNGJ.js";
7
7
 
8
8
  // src/jsonView/useJsonViewTokens.ts
9
9
  import { useMemo } from "react";
@@ -1,30 +1,30 @@
1
1
  import {
2
2
  LinearDocView
3
- } from "./chunk-Z23W4GCL.js";
3
+ } from "./chunk-PVCHPYJG.js";
4
4
  import {
5
5
  useAudioSync,
6
6
  useDocPlayback,
7
7
  useMediaSchedule,
8
8
  useViewportOrientation
9
- } from "./chunk-BFZAPNGC.js";
9
+ } from "./chunk-TVYZINUR.js";
10
10
  import {
11
11
  useAutoSurface
12
12
  } from "./chunk-TT6ENR6T.js";
13
13
  import {
14
14
  MarkdownRenderer
15
- } from "./chunk-FLPGMUXM.js";
15
+ } from "./chunk-OWC7DNGJ.js";
16
16
  import {
17
17
  BlockRenderer
18
- } from "./chunk-MPTT6UJ4.js";
18
+ } from "./chunk-GIJRQVYB.js";
19
19
  import {
20
20
  isCaptureDrivenVideo,
21
21
  seekVideoToFrame
22
- } from "./chunk-TOI34QD7.js";
22
+ } from "./chunk-UTRO6ZZS.js";
23
23
  import {
24
24
  useMediaProvider,
25
25
  useMediaUrl,
26
26
  useResourcePolicy
27
- } from "./chunk-P6MT4F3R.js";
27
+ } from "./chunk-OTYJ4MRH.js";
28
28
 
29
29
  // src/hooks/useBuildNavigation.ts
30
30
  import { useCallback, useEffect, useMemo, useState } from "react";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  mermaidRenderErrorMessage,
3
3
  renderMermaidSvg
4
- } from "./chunk-P6MT4F3R.js";
4
+ } from "./chunk-OTYJ4MRH.js";
5
5
 
6
6
  // src/mermaid/MermaidDiagram.tsx
7
7
  import { useEffect, useState } from "react";
@@ -12,7 +12,7 @@ import {
12
12
  getAnchorOffset,
13
13
  getTransitionClass,
14
14
  resolveValue
15
- } from "./chunk-TOI34QD7.js";
15
+ } from "./chunk-UTRO6ZZS.js";
16
16
 
17
17
  // src/BlockRenderer.tsx
18
18
  import { useEffect, useId, useLayoutEffect, useMemo, useRef, useState } from "react";
@@ -151,6 +151,25 @@ function enqueue(run) {
151
151
  );
152
152
  return result;
153
153
  }
154
+ var LABEL_WIDTH_SNAP = 0.5;
155
+ async function withMermaidLabelWrapping(run) {
156
+ const prototype = Element.prototype;
157
+ const measure = prototype.getBoundingClientRect;
158
+ function snapped() {
159
+ const rect = measure.call(this);
160
+ if (!(this instanceof HTMLElement) || this.parentElement?.localName !== "foreignObject") {
161
+ return rect;
162
+ }
163
+ const maxWidth = Number.parseFloat(this.style.maxWidth);
164
+ return Math.abs(rect.width - maxWidth) < LABEL_WIDTH_SNAP ? new DOMRect(rect.x, rect.y, maxWidth, rect.height) : rect;
165
+ }
166
+ prototype.getBoundingClientRect = snapped;
167
+ try {
168
+ return await run();
169
+ } finally {
170
+ if (prototype.getBoundingClientRect === snapped) prototype.getBoundingClientRect = measure;
171
+ }
172
+ }
154
173
  function renderMermaidSvg(id, source, container, theme = DEFAULT_THEME) {
155
174
  return enqueue(async () => {
156
175
  const mermaid = await loadMermaid();
@@ -159,7 +178,9 @@ function renderMermaidSvg(id, source, container, theme = DEFAULT_THEME) {
159
178
  theme: "base",
160
179
  themeVariables: buildMermaidThemeVariables(theme)
161
180
  });
162
- const { svg, diagramType } = await mermaid.render(id, source, container);
181
+ const { svg, diagramType } = await withMermaidLabelWrapping(
182
+ () => mermaid.render(id, source, container)
183
+ );
163
184
  return { svg, diagramType };
164
185
  });
165
186
  }
@@ -193,6 +214,7 @@ export {
193
214
  useResourcePolicy,
194
215
  useMediaProvider,
195
216
  useMediaUrl,
217
+ withMermaidLabelWrapping,
196
218
  renderMermaidSvg,
197
219
  renderMermaidSvgForExport,
198
220
  mermaidRenderErrorMessage
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  MermaidDiagram
3
- } from "./chunk-BXPGK5VO.js";
3
+ } from "./chunk-A65WPCGZ.js";
4
4
  import {
5
5
  svgDataImageSrc,
6
6
  useMediaProvider,
7
7
  useMediaUrl
8
- } from "./chunk-P6MT4F3R.js";
8
+ } from "./chunk-OTYJ4MRH.js";
9
9
 
10
10
  // src/hooks/FenceRendererContext.tsx
11
11
  import { createContext, useContext } from "react";
@@ -5,14 +5,14 @@ import {
5
5
  InlineVideoPlayer,
6
6
  MarkdownRenderer,
7
7
  VideoEmbedFrame
8
- } from "./chunk-FLPGMUXM.js";
8
+ } from "./chunk-OWC7DNGJ.js";
9
9
  import {
10
10
  BlockRenderer
11
- } from "./chunk-MPTT6UJ4.js";
11
+ } from "./chunk-GIJRQVYB.js";
12
12
  import {
13
13
  svgDataImageSrc,
14
14
  useMediaUrl
15
- } from "./chunk-P6MT4F3R.js";
15
+ } from "./chunk-OTYJ4MRH.js";
16
16
 
17
17
  // src/page/PageViewContext.ts
18
18
  import { createContext, useContext } from "react";
@@ -2,7 +2,7 @@ import {
2
2
  renderMermaidSvg,
3
3
  useMediaProvider,
4
4
  useResourcePolicy
5
- } from "./chunk-P6MT4F3R.js";
5
+ } from "./chunk-OTYJ4MRH.js";
6
6
 
7
7
  // src/hooks/useMediaSchedule.ts
8
8
  import { useMemo } from "react";
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  MermaidDiagram
3
- } from "./chunk-BXPGK5VO.js";
3
+ } from "./chunk-A65WPCGZ.js";
4
4
  import {
5
5
  useMediaUrl,
6
6
  useResourcePolicy
7
- } from "./chunk-P6MT4F3R.js";
7
+ } from "./chunk-OTYJ4MRH.js";
8
8
 
9
9
  // src/utils/animationUtils.ts
10
10
  import {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  LinearDocView
3
- } from "./chunk-Z23W4GCL.js";
3
+ } from "./chunk-PVCHPYJG.js";
4
4
 
5
5
  // src/PaginatedDocView.tsx
6
6
  import {
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  BlockRenderer
3
- } from "../chunk-MPTT6UJ4.js";
4
- import "../chunk-TOI34QD7.js";
5
- import "../chunk-BXPGK5VO.js";
3
+ } from "../chunk-GIJRQVYB.js";
4
+ import "../chunk-UTRO6ZZS.js";
5
+ import "../chunk-A65WPCGZ.js";
6
6
  import {
7
7
  renderMermaidSvgForExport
8
- } from "../chunk-P6MT4F3R.js";
8
+ } from "../chunk-OTYJ4MRH.js";
9
9
 
10
10
  // src/export/diagramPictures.ts
11
11
  import { createElement } from "react";
@@ -6,7 +6,7 @@ import {
6
6
  useDocPlayback,
7
7
  useMediaSchedule,
8
8
  useViewportOrientation
9
- } from "../chunk-BFZAPNGC.js";
9
+ } from "../chunk-TVYZINUR.js";
10
10
  import {
11
11
  useAutoSurface
12
12
  } from "../chunk-TT6ENR6T.js";
@@ -16,7 +16,7 @@ import {
16
16
  useMediaProvider,
17
17
  useMediaUrl,
18
18
  useResourcePolicy
19
- } from "../chunk-P6MT4F3R.js";
19
+ } from "../chunk-OTYJ4MRH.js";
20
20
  export {
21
21
  MediaContext,
22
22
  ResourcePolicyContext,
package/dist/index.d.ts CHANGED
@@ -144,6 +144,15 @@ interface SquisqPlayerHandle {
144
144
  unmount(): void;
145
145
  }
146
146
 
147
+ /** Browser-only, lazy official Mermaid renderer shared by page and slide views. */
148
+
149
+ /**
150
+ * Run Mermaid work with HTML label widths snapped to their wrapping width, so
151
+ * long labels wrap at every display scale. Call it inside the shared Mermaid
152
+ * work queue, which keeps two renders from overlapping.
153
+ */
154
+ declare function withMermaidLabelWrapping<T>(run: () => Promise<T>): Promise<T>;
155
+
147
156
  interface DashboardViewProps {
148
157
  doc: Doc;
149
158
  /** Resolved theme; defaults to the doc's own theme resolution. */
@@ -325,4 +334,4 @@ declare function useBuildNavigation(block: Block | null | undefined, enabled: bo
325
334
  showAll: () => void;
326
335
  };
327
336
 
328
- export { AnimatedImageControls, type AnimatedImageControlsProps, type AnimatedImagePlayback, type AnimatedImageStatus, CodeBlockCopyHandler, DashboardView, type DashboardViewProps, type DocPlayerAppearanceOverrides, type MountOptions, PipPosition, PipShape, PipSize, type ResolvedDocPlayerAppearance, type SanitizedSvgImageOptions, type SquisqPlayerHandle, SquisqRenderAPI, SvgIslandImage, type SvgIslandImageProps, VideoPresentation$1 as VideoPresentation, decodeSvgImages, isLocalSvgUrl, resolveDocPlayerAppearance, sanitizedSvgImageUrl, useAnimatedImage, useBuildNavigation, useMediaClipDurations, useSanitizedSvgImage };
337
+ export { AnimatedImageControls, type AnimatedImageControlsProps, type AnimatedImagePlayback, type AnimatedImageStatus, CodeBlockCopyHandler, DashboardView, type DashboardViewProps, type DocPlayerAppearanceOverrides, type MountOptions, PipPosition, PipShape, PipSize, type ResolvedDocPlayerAppearance, type SanitizedSvgImageOptions, type SquisqPlayerHandle, SquisqRenderAPI, SvgIslandImage, type SvgIslandImageProps, VideoPresentation$1 as VideoPresentation, decodeSvgImages, isLocalSvgUrl, resolveDocPlayerAppearance, sanitizedSvgImageUrl, useAnimatedImage, useBuildNavigation, useMediaClipDurations, useSanitizedSvgImage, withMermaidLabelWrapping };
package/dist/index.js CHANGED
@@ -17,17 +17,17 @@ import {
17
17
  resolveDocPlayerAppearance,
18
18
  useBuildNavigation,
19
19
  useMediaClipDurations
20
- } from "./chunk-3Y62AJBT.js";
20
+ } from "./chunk-73MW4RJW.js";
21
21
  import {
22
22
  PaginatedDocView
23
- } from "./chunk-H3HW6MU5.js";
23
+ } from "./chunk-X67VFBAO.js";
24
24
  import {
25
25
  CanvasSection,
26
26
  LinearDocView,
27
27
  PageSectionView,
28
28
  PageViewContext,
29
29
  usePageView
30
- } from "./chunk-Z23W4GCL.js";
30
+ } from "./chunk-PVCHPYJG.js";
31
31
  import {
32
32
  useModalDialog
33
33
  } from "./chunk-JP457U6N.js";
@@ -36,11 +36,11 @@ import {
36
36
  useDocPlayback,
37
37
  useMediaSchedule,
38
38
  useViewportOrientation
39
- } from "./chunk-BFZAPNGC.js";
39
+ } from "./chunk-TVYZINUR.js";
40
40
  import {
41
41
  JsonView,
42
42
  createJsonFormFenceRenderer
43
- } from "./chunk-UQOVF7IL.js";
43
+ } from "./chunk-26J5MZBI.js";
44
44
  import {
45
45
  useAutoSurface
46
46
  } from "./chunk-TT6ENR6T.js";
@@ -54,10 +54,10 @@ import {
54
54
  VideoEmbedFrame,
55
55
  useAnimatedImage,
56
56
  useFenceRenderers
57
- } from "./chunk-FLPGMUXM.js";
57
+ } from "./chunk-OWC7DNGJ.js";
58
58
  import {
59
59
  BlockRenderer
60
- } from "./chunk-MPTT6UJ4.js";
60
+ } from "./chunk-GIJRQVYB.js";
61
61
  import {
62
62
  ImageLayer,
63
63
  MapLayer,
@@ -71,10 +71,10 @@ import {
71
71
  VideoLayer,
72
72
  getAnimationStyle,
73
73
  getTransitionClass
74
- } from "./chunk-TOI34QD7.js";
74
+ } from "./chunk-UTRO6ZZS.js";
75
75
  import {
76
76
  MermaidDiagram
77
- } from "./chunk-BXPGK5VO.js";
77
+ } from "./chunk-A65WPCGZ.js";
78
78
  import {
79
79
  MediaContext,
80
80
  ResourcePolicyContext,
@@ -83,8 +83,9 @@ import {
83
83
  useMediaProvider,
84
84
  useMediaUrl,
85
85
  useResourcePolicy,
86
- useSanitizedSvgImage
87
- } from "./chunk-P6MT4F3R.js";
86
+ useSanitizedSvgImage,
87
+ withMermaidLabelWrapping
88
+ } from "./chunk-OTYJ4MRH.js";
88
89
  export {
89
90
  AnimatedImageControls,
90
91
  BlockRenderer,
@@ -148,5 +149,6 @@ export {
148
149
  usePageView,
149
150
  useResourcePolicy,
150
151
  useSanitizedSvgImage,
151
- useViewportOrientation
152
+ useViewportOrientation,
153
+ withMermaidLabelWrapping
152
154
  };
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  JsonView,
3
3
  createJsonFormFenceRenderer
4
- } from "../chunk-UQOVF7IL.js";
4
+ } from "../chunk-26J5MZBI.js";
5
5
  import "../chunk-TT6ENR6T.js";
6
- import "../chunk-FLPGMUXM.js";
7
- import "../chunk-BXPGK5VO.js";
8
- import "../chunk-P6MT4F3R.js";
6
+ import "../chunk-OWC7DNGJ.js";
7
+ import "../chunk-A65WPCGZ.js";
8
+ import "../chunk-OTYJ4MRH.js";
9
9
  export {
10
10
  JsonView,
11
11
  createJsonFormFenceRenderer
@@ -9,9 +9,9 @@ import {
9
9
  TextLayer,
10
10
  TreeLayer,
11
11
  VideoLayer
12
- } from "../chunk-TOI34QD7.js";
13
- import "../chunk-BXPGK5VO.js";
14
- import "../chunk-P6MT4F3R.js";
12
+ } from "../chunk-UTRO6ZZS.js";
13
+ import "../chunk-A65WPCGZ.js";
14
+ import "../chunk-OTYJ4MRH.js";
15
15
  export {
16
16
  ImageLayer,
17
17
  MapLayer,
@@ -3,11 +3,11 @@ import {
3
3
  MarkdownRenderer,
4
4
  VideoEmbedFrame,
5
5
  useFenceRenderers
6
- } from "../chunk-FLPGMUXM.js";
6
+ } from "../chunk-OWC7DNGJ.js";
7
7
  import {
8
8
  MermaidDiagram
9
- } from "../chunk-BXPGK5VO.js";
10
- import "../chunk-P6MT4F3R.js";
9
+ } from "../chunk-A65WPCGZ.js";
10
+ import "../chunk-OTYJ4MRH.js";
11
11
  export {
12
12
  FenceRendererContext,
13
13
  MarkdownRenderer,
@@ -1,19 +1,19 @@
1
1
  import {
2
2
  PaginatedDocView
3
- } from "../chunk-H3HW6MU5.js";
3
+ } from "../chunk-X67VFBAO.js";
4
4
  import {
5
5
  CanvasSection,
6
6
  LinearDocView,
7
7
  PageSectionView,
8
8
  PageViewContext,
9
9
  usePageView
10
- } from "../chunk-Z23W4GCL.js";
10
+ } from "../chunk-PVCHPYJG.js";
11
11
  import "../chunk-TT6ENR6T.js";
12
- import "../chunk-FLPGMUXM.js";
13
- import "../chunk-MPTT6UJ4.js";
14
- import "../chunk-TOI34QD7.js";
15
- import "../chunk-BXPGK5VO.js";
16
- import "../chunk-P6MT4F3R.js";
12
+ import "../chunk-OWC7DNGJ.js";
13
+ import "../chunk-GIJRQVYB.js";
14
+ import "../chunk-UTRO6ZZS.js";
15
+ import "../chunk-A65WPCGZ.js";
16
+ import "../chunk-OTYJ4MRH.js";
17
17
  export {
18
18
  CanvasSection,
19
19
  LinearDocView,
@@ -12,20 +12,20 @@ import {
12
12
  MediaClipLayer,
13
13
  SocialCaptionOverlay,
14
14
  formatTime
15
- } from "../chunk-3Y62AJBT.js";
16
- import "../chunk-Z23W4GCL.js";
17
- import "../chunk-BFZAPNGC.js";
15
+ } from "../chunk-73MW4RJW.js";
16
+ import "../chunk-PVCHPYJG.js";
17
+ import "../chunk-TVYZINUR.js";
18
18
  import "../chunk-TT6ENR6T.js";
19
19
  import {
20
20
  InlineAudioPlayer,
21
21
  InlineVideoPlayer
22
- } from "../chunk-FLPGMUXM.js";
22
+ } from "../chunk-OWC7DNGJ.js";
23
23
  import {
24
24
  BlockRenderer
25
- } from "../chunk-MPTT6UJ4.js";
26
- import "../chunk-TOI34QD7.js";
27
- import "../chunk-BXPGK5VO.js";
28
- import "../chunk-P6MT4F3R.js";
25
+ } from "../chunk-GIJRQVYB.js";
26
+ import "../chunk-UTRO6ZZS.js";
27
+ import "../chunk-A65WPCGZ.js";
28
+ import "../chunk-OTYJ4MRH.js";
29
29
  export {
30
30
  BlockRenderer,
31
31
  CaptionOverlay,