@bendyline/squisq-react 2.10.0 → 2.11.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.
@@ -60,7 +60,7 @@ COMPONENTS
60
60
  - decode-named-character-reference@1.3.0 (MIT); files: license
61
61
  - delaunator@5.1.0 (ISC); files: LICENSE
62
62
  - devlop@1.1.0 (MIT); files: license
63
- - dompurify@3.4.12 ((MPL-2.0 OR Apache-2.0)); files: LICENSE, LICENSE-MPL
63
+ - dompurify@3.4.14 ((MPL-2.0 OR Apache-2.0)); files: LICENSE, LICENSE-MPL
64
64
  - entities@6.0.1 (BSD-2-Clause); files: LICENSE
65
65
  - es-toolkit@1.49.0 (MIT); files: LICENSE
66
66
  - escape-string-regexp@5.0.0 (MIT); files: license
@@ -1400,7 +1400,7 @@ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
1400
1400
  SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1401
1401
 
1402
1402
  ==============================================================================
1403
- dompurify@3.4.12 - LICENSE
1403
+ dompurify@3.4.14 - LICENSE
1404
1404
  ==============================================================================
1405
1405
 
1406
1406
  Apache License
@@ -1606,7 +1606,7 @@ dompurify@3.4.12 - LICENSE
1606
1606
  limitations under the License.
1607
1607
 
1608
1608
  ==============================================================================
1609
- dompurify@3.4.12 - LICENSE-MPL
1609
+ dompurify@3.4.14 - LICENSE-MPL
1610
1610
  ==============================================================================
1611
1611
  Mozilla Public License Version 2.0
1612
1612
  ==================================
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-TT6ENR6T.js";
4
4
  import {
5
5
  MarkdownRenderer
6
- } from "./chunk-7YSKELA5.js";
6
+ } from "./chunk-ZY5N3JPM.js";
7
7
 
8
8
  // src/jsonView/useJsonViewTokens.ts
9
9
  import { useMemo } from "react";
@@ -16,7 +16,7 @@ import {
16
16
  import {
17
17
  InlineVideoPlayer,
18
18
  MarkdownRenderer
19
- } from "./chunk-7YSKELA5.js";
19
+ } from "./chunk-ZY5N3JPM.js";
20
20
  import {
21
21
  useMediaUrl
22
22
  } from "./chunk-LR3AIGDD.js";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  BlockRenderer,
3
3
  LinearDocView
4
- } from "./chunk-L7VQNQGW.js";
4
+ } from "./chunk-R44JIBV3.js";
5
5
  import {
6
6
  useAudioSync,
7
7
  useDocPlayback,
@@ -13,7 +13,7 @@ import {
13
13
  } from "./chunk-TT6ENR6T.js";
14
14
  import {
15
15
  MarkdownRenderer
16
- } from "./chunk-7YSKELA5.js";
16
+ } from "./chunk-ZY5N3JPM.js";
17
17
  import {
18
18
  useMediaProvider,
19
19
  useMediaUrl,
@@ -2904,10 +2904,7 @@ function DocPlayerContent({
2904
2904
  const [isSlideshowPickerOpen, setIsSlideshowPickerOpen] = useState6(false);
2905
2905
  const slideshowCoverInitKeyRef = useRef7("");
2906
2906
  useEffect7(() => {
2907
- slideshowCoverInitKeyRef.current = "";
2908
- }, [doc]);
2909
- useEffect7(() => {
2910
- const initKey = `${isSlideshowMode}:${hasManagedCover}:${renderMode}`;
2907
+ const initKey = `${doc.articleId}:${isSlideshowMode}:${hasManagedCover}:${renderMode}`;
2911
2908
  if (slideshowCoverInitKeyRef.current === initKey) return;
2912
2909
  slideshowCoverInitKeyRef.current = initKey;
2913
2910
  if (isSlideshowMode && hasManagedCover && !renderMode) {
@@ -2916,7 +2913,7 @@ function DocPlayerContent({
2916
2913
  } else {
2917
2914
  setSlideshowCoverVisible(false);
2918
2915
  }
2919
- }, [isSlideshowMode, hasManagedCover, renderMode, pause]);
2916
+ }, [doc.articleId, isSlideshowMode, hasManagedCover, renderMode, pause]);
2920
2917
  const [coverForced, setCoverForced] = useState6(false);
2921
2918
  const [coverGraceActive, setCoverGraceActive] = useState6(false);
2922
2919
  const coverGraceTimer = useRef7();
@@ -2,6 +2,7 @@ import {
2
2
  MermaidDiagram
3
3
  } from "./chunk-WLUZTUNZ.js";
4
4
  import {
5
+ useMediaProvider,
5
6
  useMediaUrl
6
7
  } from "./chunk-LR3AIGDD.js";
7
8
 
@@ -177,6 +178,21 @@ function renderInline(nodes, keyPrefix = "", ctx = DEFAULT_CTX) {
177
178
  case "inlineCode":
178
179
  return /* @__PURE__ */ jsx3("code", { className: "squisq-md-inline-code", children: node.value }, key);
179
180
  case "link": {
181
+ if (ctx.accessoryPaths?.has(node.url)) {
182
+ return /* @__PURE__ */ jsxs(
183
+ "span",
184
+ {
185
+ className: "squisq-md-attachment",
186
+ "data-attachment-path": node.url,
187
+ title: node.title ?? `Attachment: ${node.url}`,
188
+ children: [
189
+ /* @__PURE__ */ jsx3("i", { className: "fa-solid fa-paperclip", "aria-hidden": "true" }),
190
+ /* @__PURE__ */ jsx3("span", { className: "squisq-md-attachment-label", children: renderInline(node.children, key, ctx) })
191
+ ]
192
+ },
193
+ key
194
+ );
195
+ }
180
196
  const href = sanitizeUrl(node.url, "link", { extraLinkSchemes: ctx.linkSchemes });
181
197
  if (!href) {
182
198
  return /* @__PURE__ */ jsx3("span", { className: "squisq-md-link squisq-md-link--blocked", children: renderInline(node.children, key, ctx) }, key);
@@ -497,6 +513,8 @@ function renderHtmlNodes(nodes, keyPrefix, ctx = DEFAULT_CTX) {
497
513
  }
498
514
  });
499
515
  }
516
+ var NO_ACCESSORY_PATHS = /* @__PURE__ */ new Set();
517
+ var clearAccessoryPaths = (prev) => prev.size === 0 ? prev : NO_ACCESSORY_PATHS;
500
518
  function MarkdownRenderer({
501
519
  nodes,
502
520
  className,
@@ -508,6 +526,26 @@ function MarkdownRenderer({
508
526
  fenceRenderers
509
527
  }) {
510
528
  const ambientFenceRenderers = useFenceRenderers();
529
+ const mediaProvider = useMediaProvider();
530
+ const [accessoryPaths, setAccessoryPaths] = useState(NO_ACCESSORY_PATHS);
531
+ useEffect(() => {
532
+ if (!mediaProvider) {
533
+ setAccessoryPaths(clearAccessoryPaths);
534
+ return;
535
+ }
536
+ let cancelled = false;
537
+ mediaProvider.listMedia().then(
538
+ (entries) => {
539
+ if (!cancelled) setAccessoryPaths(new Set(entries.map((entry) => entry.name)));
540
+ },
541
+ () => {
542
+ if (!cancelled) setAccessoryPaths(clearAccessoryPaths);
543
+ }
544
+ );
545
+ return () => {
546
+ cancelled = true;
547
+ };
548
+ }, [mediaProvider]);
511
549
  if (!nodes || nodes.length === 0) return null;
512
550
  return /* @__PURE__ */ jsx3("div", { className: `squisq-md ${className || ""}`, children: renderBlocks(nodes, "", {
513
551
  htmlPolicy,
@@ -515,6 +553,7 @@ function MarkdownRenderer({
515
553
  theme,
516
554
  showCodeCopyButton,
517
555
  onCopyCode,
556
+ accessoryPaths,
518
557
  fenceRenderers: fenceRenderers ?? ambientFenceRenderers ?? void 0
519
558
  }) });
520
559
  }
package/dist/index.d.ts CHANGED
@@ -43,11 +43,14 @@ import '@bendyline/squisq/jsonForm';
43
43
 
44
44
  interface MountOptions {
45
45
  /**
46
- * Rendering mode: 'slideshow' (interactive, default), 'static'
46
+ * Rendering mode: 'slideshow' (interactive, default), 'video' (timed
47
+ * auto-advance playback with scrubber — the movie mode), 'static'
47
48
  * (scrollable page), 'dashboard' (one canvas of arranged blocks), or
48
49
  * 'flashcards' (progressively revealed study deck).
49
50
  */
50
- mode?: 'slideshow' | 'static' | 'dashboard' | 'flashcards';
51
+ mode?: 'slideshow' | 'video' | 'static' | 'dashboard' | 'flashcards';
52
+ /** Loop playback when the timeline ends (video mode only, default: false). */
53
+ loop?: boolean;
51
54
  /** Dashboard-mode options (ignored by the other modes). */
52
55
  dashboard?: {
53
56
  /** Layout id or 'auto'. Overrides doc frontmatter. */
package/dist/index.js CHANGED
@@ -15,7 +15,7 @@ import {
15
15
  formatTime,
16
16
  resolveDocPlayerAppearance,
17
17
  useMediaClipDurations
18
- } from "./chunk-PQRILPE6.js";
18
+ } from "./chunk-VKXOZTYP.js";
19
19
  import {
20
20
  BlockRenderer,
21
21
  CanvasSection,
@@ -23,7 +23,7 @@ import {
23
23
  PageSectionView,
24
24
  PageViewContext,
25
25
  usePageView
26
- } from "./chunk-L7VQNQGW.js";
26
+ } from "./chunk-R44JIBV3.js";
27
27
  import {
28
28
  ImageLayer,
29
29
  MapLayer,
@@ -49,7 +49,7 @@ import {
49
49
  import {
50
50
  JsonView,
51
51
  createJsonFormFenceRenderer
52
- } from "./chunk-3LVEPUZX.js";
52
+ } from "./chunk-ITQ4K5N6.js";
53
53
  import {
54
54
  useAutoSurface
55
55
  } from "./chunk-TT6ENR6T.js";
@@ -59,7 +59,7 @@ import {
59
59
  InlineVideoPlayer,
60
60
  MarkdownRenderer,
61
61
  useFenceRenderers
62
- } from "./chunk-7YSKELA5.js";
62
+ } from "./chunk-ZY5N3JPM.js";
63
63
  import {
64
64
  MermaidDiagram
65
65
  } from "./chunk-WLUZTUNZ.js";
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  JsonView,
3
3
  createJsonFormFenceRenderer
4
- } from "../chunk-3LVEPUZX.js";
4
+ } from "../chunk-ITQ4K5N6.js";
5
5
  import "../chunk-TT6ENR6T.js";
6
- import "../chunk-7YSKELA5.js";
6
+ import "../chunk-ZY5N3JPM.js";
7
7
  import "../chunk-WLUZTUNZ.js";
8
8
  import "../chunk-LR3AIGDD.js";
9
9
  export {
@@ -2,7 +2,7 @@ import {
2
2
  FenceRendererContext,
3
3
  MarkdownRenderer,
4
4
  useFenceRenderers
5
- } from "../chunk-7YSKELA5.js";
5
+ } from "../chunk-ZY5N3JPM.js";
6
6
  import {
7
7
  MermaidDiagram
8
8
  } from "../chunk-WLUZTUNZ.js";
@@ -4,10 +4,10 @@ import {
4
4
  PageSectionView,
5
5
  PageViewContext,
6
6
  usePageView
7
- } from "../chunk-L7VQNQGW.js";
7
+ } from "../chunk-R44JIBV3.js";
8
8
  import "../chunk-G6FVNYNW.js";
9
9
  import "../chunk-TT6ENR6T.js";
10
- import "../chunk-7YSKELA5.js";
10
+ import "../chunk-ZY5N3JPM.js";
11
11
  import "../chunk-WLUZTUNZ.js";
12
12
  import "../chunk-LR3AIGDD.js";
13
13
  export {
@@ -12,17 +12,17 @@ import {
12
12
  MediaClipLayer,
13
13
  SocialCaptionOverlay,
14
14
  formatTime
15
- } from "../chunk-PQRILPE6.js";
15
+ } from "../chunk-VKXOZTYP.js";
16
16
  import {
17
17
  BlockRenderer
18
- } from "../chunk-L7VQNQGW.js";
18
+ } from "../chunk-R44JIBV3.js";
19
19
  import "../chunk-G6FVNYNW.js";
20
20
  import "../chunk-MVJQL2W2.js";
21
21
  import "../chunk-TT6ENR6T.js";
22
22
  import {
23
23
  InlineAudioPlayer,
24
24
  InlineVideoPlayer
25
- } from "../chunk-7YSKELA5.js";
25
+ } from "../chunk-ZY5N3JPM.js";
26
26
  import "../chunk-WLUZTUNZ.js";
27
27
  import "../chunk-LR3AIGDD.js";
28
28
  export {