@bendyline/squisq-react 2.11.15 → 2.11.17

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": "@bendyline/squisq-react",
3
- "version": "2.11.15",
3
+ "version": "2.11.17",
4
4
  "description": "React component library for doc playback, block rendering, and media layers",
5
5
  "license": "MIT",
6
6
  "author": "Bendyline",
@@ -64,6 +64,10 @@
64
64
  "types": "./dist/json-view/index.d.ts",
65
65
  "import": "./dist/json-view/index.js"
66
66
  },
67
+ "./diagram-pictures": {
68
+ "types": "./dist/diagram-pictures/index.d.ts",
69
+ "import": "./dist/diagram-pictures/index.js"
70
+ },
67
71
  "./styles": {
68
72
  "types": "./dist/styles/index.d.ts",
69
73
  "default": "./dist/styles/index.css"
@@ -77,6 +81,10 @@
77
81
  "./standalone-source": {
78
82
  "types": "./dist/standalone-source.d.ts",
79
83
  "import": "./dist/standalone-source.js"
84
+ },
85
+ "./standalone-source/full": {
86
+ "types": "./dist/standalone-player-full.d.ts",
87
+ "import": "./dist/standalone-player-full.js"
80
88
  }
81
89
  },
82
90
  "scripts": {
@@ -91,7 +99,7 @@
91
99
  "react-dom": "^18.0.0 || ^19.0.0"
92
100
  },
93
101
  "dependencies": {
94
- "@bendyline/squisq": "2.11.13",
102
+ "@bendyline/squisq": "2.11.15",
95
103
  "@fortawesome/fontawesome-free": "7.2.0",
96
104
  "mermaid": "11.16.1"
97
105
  },
@@ -1,58 +0,0 @@
1
- // src/hooks/MediaContext.tsx
2
- import { createContext, useContext, useState, useEffect, useMemo } from "react";
3
- import {
4
- DEFAULT_INTERACTIVE_RESOURCE_POLICY,
5
- isResourceUrlAllowed
6
- } from "@bendyline/squisq/markdown";
7
- var MediaContext = createContext(null);
8
- var ResourcePolicyContext = createContext(
9
- DEFAULT_INTERACTIVE_RESOURCE_POLICY
10
- );
11
- function useResourcePolicy() {
12
- return useContext(ResourcePolicyContext);
13
- }
14
- function useMediaProvider() {
15
- return useContext(MediaContext);
16
- }
17
- function useMediaUrl(relativePath, basePath) {
18
- const provider = useMediaProvider();
19
- const resourcePolicy = useResourcePolicy();
20
- const safePath = typeof relativePath === "string" ? relativePath : "";
21
- const isAbsolute = !safePath || /^(?:[a-z][a-z0-9+.-]*:|\/\/|\/)/i.test(safePath);
22
- const fallback = useMemo(() => {
23
- const candidate = isAbsolute ? safePath : `${basePath.replace(/\/$/, "")}/${safePath}`;
24
- return isResourceUrlAllowed(candidate, resourcePolicy) ? candidate : "";
25
- }, [isAbsolute, safePath, basePath, resourcePolicy]);
26
- const needsProvider = !isAbsolute && !!provider;
27
- const [url, setUrl] = useState(fallback);
28
- useEffect(() => {
29
- if (!needsProvider) {
30
- setUrl(fallback);
31
- return;
32
- }
33
- let cancelled = false;
34
- setUrl(fallback);
35
- provider.resolveUrl(safePath).then(
36
- (resolved) => {
37
- if (!cancelled) {
38
- setUrl(isResourceUrlAllowed(resolved, resourcePolicy) ? resolved : "");
39
- }
40
- },
41
- () => {
42
- if (!cancelled) setUrl(fallback);
43
- }
44
- );
45
- return () => {
46
- cancelled = true;
47
- };
48
- }, [needsProvider, provider, safePath, fallback, resourcePolicy]);
49
- return needsProvider ? url : fallback;
50
- }
51
-
52
- export {
53
- MediaContext,
54
- ResourcePolicyContext,
55
- useResourcePolicy,
56
- useMediaProvider,
57
- useMediaUrl
58
- };