@bendyline/squisq-react 2.4.4 → 2.4.6
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/NOTICE.md +7 -6
- package/README.md +9 -6
- package/dist/{chunk-AKPXDG4E.js → chunk-7CDO336T.js} +13 -5
- package/dist/{chunk-NANF7REM.js → chunk-DJRYQQXB.js} +1 -1
- package/dist/{chunk-EJMUO6VX.js → chunk-ICM7AWQT.js} +1 -1
- package/dist/{chunk-D7KN4CRG.js → chunk-VMPQEUJH.js} +10 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.js +4 -4
- package/dist/json-view/index.js +2 -2
- package/dist/markdown/index.js +1 -1
- package/dist/page/index.js +2 -2
- package/dist/player/index.js +3 -3
- package/dist/squisq-player.full.global.js +319 -318
- package/dist/squisq-player.global.js +55 -54
- package/dist/standalone-icon-styles.d.ts +1 -0
- package/dist/standalone-icon-styles.js +2 -0
- package/dist/standalone-source.js +3 -1
- package/dist/styles/fa-brands-400-AHOAZHCU.woff2 +0 -0
- package/dist/styles/fa-regular-400-VRZYIBIZ.woff2 +0 -0
- package/dist/styles/fa-solid-900-MDEYK55F.woff2 +0 -0
- package/dist/styles/index.css +6962 -0
- package/package.json +7 -2
package/NOTICE.md
CHANGED
|
@@ -6,12 +6,13 @@ Third-party components remain under their respective license terms.
|
|
|
6
6
|
|
|
7
7
|
## Runtime, peer, and bundled dependencies
|
|
8
8
|
|
|
9
|
-
| Package
|
|
10
|
-
|
|
|
11
|
-
|
|
|
12
|
-
|
|
|
13
|
-
|
|
|
14
|
-
| react
|
|
9
|
+
| Package | Version | License | Repository |
|
|
10
|
+
| ----------------------------- | -------------------- | ----------------------------- | ------------------------------------------- |
|
|
11
|
+
| @fortawesome/fontawesome-free | 7.2.0 | CC-BY-4.0 AND OFL-1.1 AND MIT | https://github.com/FortAwesome/Font-Awesome |
|
|
12
|
+
| mermaid | 11.16.0 | MIT | https://github.com/mermaid-js/mermaid |
|
|
13
|
+
| preact _(bundled)_ | 10.29.0 | MIT | https://github.com/preactjs/preact |
|
|
14
|
+
| react _(peer)_ | ^18.0.0 \|\| ^19.0.0 | MIT | https://github.com/facebook/react |
|
|
15
|
+
| react-dom _(peer)_ | ^18.0.0 \|\| ^19.0.0 | MIT | https://github.com/facebook/react |
|
|
15
16
|
|
|
16
17
|
Mermaid is Copyright (c) 2014-2022 Knut Sveidqvist and is distributed under
|
|
17
18
|
the MIT License. Preact is used by the standalone browser bundles. Exact
|
package/README.md
CHANGED
|
@@ -91,9 +91,10 @@ useDocPlayback(doc, currentTime, { viewport, theme, onSeek });
|
|
|
91
91
|
|
|
92
92
|
## Standalone Player
|
|
93
93
|
|
|
94
|
-
A
|
|
95
|
-
|
|
96
|
-
`
|
|
94
|
+
A global build is available for non-React environments. It exposes a
|
|
95
|
+
`SquisqPlayer` global with `mount`, `getHandle`, `unmount`, and `version`.
|
|
96
|
+
`mount` returns an instance handle. Load the package stylesheet alongside the
|
|
97
|
+
raw global build so authored Font Awesome icons can use the shared webfonts.
|
|
97
98
|
|
|
98
99
|
The default build is the light player and omits Mermaid's multi-megabyte parser
|
|
99
100
|
and layout engines. Documents that contain Mermaid fences should use the full
|
|
@@ -108,6 +109,7 @@ top-level `window.seekTo` / `window.getDuration` properties.
|
|
|
108
109
|
Interactive mount:
|
|
109
110
|
|
|
110
111
|
```html
|
|
112
|
+
<link rel="stylesheet" href="https://unpkg.com/@bendyline/squisq-react/dist/styles/index.css" />
|
|
111
113
|
<script src="https://unpkg.com/@bendyline/squisq-react/dist/squisq-player.global.js"></script>
|
|
112
114
|
<div id="player"></div>
|
|
113
115
|
<script>
|
|
@@ -138,12 +140,13 @@ content. Embedded video, timed media, captions, audio, and document timing stay
|
|
|
138
140
|
active; this makes the option suitable for compact MP4 and animated-GIF export.
|
|
139
141
|
|
|
140
142
|
For build-time embedding, `@bendyline/squisq-react/standalone-source` exports
|
|
141
|
-
the
|
|
142
|
-
|
|
143
|
+
the player as a self-contained string constant (`PLAYER_BUNDLE`) with the
|
|
144
|
+
shared icon styles composed once. It is used by `@bendyline/squisq-formats`
|
|
145
|
+
and the CLI to produce single-file HTML and rendered video exports.
|
|
143
146
|
|
|
144
147
|
## Styles
|
|
145
148
|
|
|
146
|
-
Import the
|
|
149
|
+
Import the package CSS for block transitions and Font Awesome inline icons:
|
|
147
150
|
|
|
148
151
|
```ts
|
|
149
152
|
import '@bendyline/squisq-react/styles';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
BlockRenderer,
|
|
3
3
|
LinearDocView
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-ICM7AWQT.js";
|
|
5
5
|
import {
|
|
6
6
|
useAudioSync,
|
|
7
7
|
useDocPlayback,
|
|
@@ -1545,6 +1545,14 @@ var VIDEO_TIME_TOLERANCE_SECONDS = 0.01;
|
|
|
1545
1545
|
function formatMediaTime(time) {
|
|
1546
1546
|
return Number.isFinite(time) ? `${time.toFixed(3)}s` : String(time);
|
|
1547
1547
|
}
|
|
1548
|
+
function reachableMediaTime(video, targetTime) {
|
|
1549
|
+
const duration = video.duration;
|
|
1550
|
+
if (!Number.isFinite(duration)) return targetTime;
|
|
1551
|
+
return Math.max(0, Math.min(targetTime, duration));
|
|
1552
|
+
}
|
|
1553
|
+
function isAtReachableMediaTime(video, targetTime) {
|
|
1554
|
+
return Math.abs(video.currentTime - reachableMediaTime(video, targetTime)) <= VIDEO_TIME_TOLERANCE_SECONDS;
|
|
1555
|
+
}
|
|
1548
1556
|
function isVisiblyPresented(video) {
|
|
1549
1557
|
if (!video.isConnected) return false;
|
|
1550
1558
|
const view = video.ownerDocument.defaultView;
|
|
@@ -1559,7 +1567,7 @@ function isVisiblyPresented(video) {
|
|
|
1559
1567
|
}
|
|
1560
1568
|
function seekVideoToFrame(video, targetTime, timeoutMs = DEFAULT_VIDEO_FRAME_TIMEOUT_MS) {
|
|
1561
1569
|
video.pause();
|
|
1562
|
-
const alreadyReady = !video.seeking && video.readyState >= HTMLMediaElement.HAVE_CURRENT_DATA &&
|
|
1570
|
+
const alreadyReady = !video.seeking && video.readyState >= HTMLMediaElement.HAVE_CURRENT_DATA && isAtReachableMediaTime(video, targetTime);
|
|
1563
1571
|
if (alreadyReady) return Promise.resolve();
|
|
1564
1572
|
return new Promise((resolve, reject) => {
|
|
1565
1573
|
let settled = false;
|
|
@@ -1586,12 +1594,12 @@ function seekVideoToFrame(video, targetTime, timeoutMs = DEFAULT_VIDEO_FRAME_TIM
|
|
|
1586
1594
|
cleanup();
|
|
1587
1595
|
reject(
|
|
1588
1596
|
new Error(
|
|
1589
|
-
`Video frame did not become ready at ${formatMediaTime(targetTime)} within ${timeoutMs}ms (currentTime=${formatMediaTime(video.currentTime)}, readyState=${video.readyState}, seeking=${String(video.seeking)}, visible=${String(isVisiblyPresented(video))}).`
|
|
1597
|
+
`Video frame did not become ready at ${formatMediaTime(targetTime)} within ${timeoutMs}ms (currentTime=${formatMediaTime(video.currentTime)}, reachableTime=${formatMediaTime(reachableMediaTime(video, targetTime))}, duration=${formatMediaTime(video.duration)}, readyState=${video.readyState}, seeking=${String(video.seeking)}, visible=${String(isVisiblyPresented(video))}).`
|
|
1590
1598
|
)
|
|
1591
1599
|
);
|
|
1592
1600
|
};
|
|
1593
1601
|
const requestPresentedFrame = () => {
|
|
1594
|
-
if (settled || video.seeking || video.readyState < HTMLMediaElement.HAVE_CURRENT_DATA ||
|
|
1602
|
+
if (settled || video.seeking || video.readyState < HTMLMediaElement.HAVE_CURRENT_DATA || !isAtReachableMediaTime(video, targetTime)) {
|
|
1595
1603
|
return;
|
|
1596
1604
|
}
|
|
1597
1605
|
if (typeof video.requestVideoFrameCallback !== "function" || !isVisiblyPresented(video)) {
|
|
@@ -1613,7 +1621,7 @@ function seekVideoToFrame(video, targetTime, timeoutMs = DEFAULT_VIDEO_FRAME_TIM
|
|
|
1613
1621
|
video.addEventListener("loadeddata", handleMediaReady);
|
|
1614
1622
|
video.addEventListener("canplay", handleMediaReady);
|
|
1615
1623
|
try {
|
|
1616
|
-
video.currentTime = targetTime;
|
|
1624
|
+
video.currentTime = reachableMediaTime(video, targetTime);
|
|
1617
1625
|
queueMicrotask(requestPresentedFrame);
|
|
1618
1626
|
} catch (error) {
|
|
1619
1627
|
settled = true;
|
|
@@ -103,6 +103,16 @@ function renderInline(nodes, keyPrefix = "", ctx = DEFAULT_CTX) {
|
|
|
103
103
|
return /* @__PURE__ */ jsx3("br", {}, key);
|
|
104
104
|
case "inlineMath":
|
|
105
105
|
return /* @__PURE__ */ jsx3("code", { className: "squisq-md-inline-math", children: node.value }, key);
|
|
106
|
+
case "inlineIcon":
|
|
107
|
+
return /* @__PURE__ */ jsx3(
|
|
108
|
+
"i",
|
|
109
|
+
{
|
|
110
|
+
className: `fa-${node.family} fa-${node.name}`,
|
|
111
|
+
"data-icon": node.token,
|
|
112
|
+
"aria-hidden": "true"
|
|
113
|
+
},
|
|
114
|
+
key
|
|
115
|
+
);
|
|
106
116
|
case "htmlInline":
|
|
107
117
|
if (ctx.htmlPolicy === "strip") return null;
|
|
108
118
|
return /* @__PURE__ */ jsx3("span", { className: "squisq-md-html-inline", children: renderHtmlNodes(resolveHtmlNodes(node.htmlChildren, ctx.htmlPolicy), `${key}h`, ctx) }, key);
|
package/dist/index.d.ts
CHANGED
|
@@ -17,8 +17,9 @@ import '@bendyline/squisq/jsonForm';
|
|
|
17
17
|
* Standalone Entry Point — IIFE bundle for self-contained HTML rendering.
|
|
18
18
|
*
|
|
19
19
|
* This file is the entry point for the standalone `squisq-player.iife.js` bundle.
|
|
20
|
-
* It bundles Preact (via preact/compat), squisq core,
|
|
21
|
-
*
|
|
20
|
+
* It bundles Preact (via preact/compat), squisq core, rendering components, and
|
|
21
|
+
* animation CSS. Raw-script consumers load the package stylesheet for shared
|
|
22
|
+
* icon webfonts; standalone-source and the CLI compose those styles once.
|
|
22
23
|
*
|
|
23
24
|
* The bundle exposes a global `SquisqPlayer` object with methods to mount
|
|
24
25
|
* interactive or static document views into any DOM element.
|
package/dist/index.js
CHANGED
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
formatTime,
|
|
13
13
|
resolveDocPlayerAppearance,
|
|
14
14
|
useMediaClipDurations
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-7CDO336T.js";
|
|
16
16
|
import {
|
|
17
17
|
BlockRenderer,
|
|
18
18
|
CanvasSection,
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
PageSectionView,
|
|
21
21
|
PageViewContext,
|
|
22
22
|
usePageView
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-ICM7AWQT.js";
|
|
24
24
|
import {
|
|
25
25
|
ImageLayer,
|
|
26
26
|
MapLayer,
|
|
@@ -45,7 +45,7 @@ import {
|
|
|
45
45
|
} from "./chunk-BOZJ655L.js";
|
|
46
46
|
import {
|
|
47
47
|
JsonView
|
|
48
|
-
} from "./chunk-
|
|
48
|
+
} from "./chunk-DJRYQQXB.js";
|
|
49
49
|
import {
|
|
50
50
|
useAutoSurface
|
|
51
51
|
} from "./chunk-TT6ENR6T.js";
|
|
@@ -53,7 +53,7 @@ import {
|
|
|
53
53
|
InlineAudioPlayer,
|
|
54
54
|
InlineVideoPlayer,
|
|
55
55
|
MarkdownRenderer
|
|
56
|
-
} from "./chunk-
|
|
56
|
+
} from "./chunk-VMPQEUJH.js";
|
|
57
57
|
import {
|
|
58
58
|
MermaidDiagram
|
|
59
59
|
} from "./chunk-WLUZTUNZ.js";
|
package/dist/json-view/index.js
CHANGED
package/dist/markdown/index.js
CHANGED
package/dist/page/index.js
CHANGED
|
@@ -4,10 +4,10 @@ import {
|
|
|
4
4
|
PageSectionView,
|
|
5
5
|
PageViewContext,
|
|
6
6
|
usePageView
|
|
7
|
-
} from "../chunk-
|
|
7
|
+
} from "../chunk-ICM7AWQT.js";
|
|
8
8
|
import "../chunk-TI5X7SBC.js";
|
|
9
9
|
import "../chunk-TT6ENR6T.js";
|
|
10
|
-
import "../chunk-
|
|
10
|
+
import "../chunk-VMPQEUJH.js";
|
|
11
11
|
import "../chunk-WLUZTUNZ.js";
|
|
12
12
|
import "../chunk-LR3AIGDD.js";
|
|
13
13
|
export {
|
package/dist/player/index.js
CHANGED
|
@@ -10,17 +10,17 @@ import {
|
|
|
10
10
|
MediaClipLayer,
|
|
11
11
|
SocialCaptionOverlay,
|
|
12
12
|
formatTime
|
|
13
|
-
} from "../chunk-
|
|
13
|
+
} from "../chunk-7CDO336T.js";
|
|
14
14
|
import {
|
|
15
15
|
BlockRenderer
|
|
16
|
-
} from "../chunk-
|
|
16
|
+
} from "../chunk-ICM7AWQT.js";
|
|
17
17
|
import "../chunk-TI5X7SBC.js";
|
|
18
18
|
import "../chunk-BOZJ655L.js";
|
|
19
19
|
import "../chunk-TT6ENR6T.js";
|
|
20
20
|
import {
|
|
21
21
|
InlineAudioPlayer,
|
|
22
22
|
InlineVideoPlayer
|
|
23
|
-
} from "../chunk-
|
|
23
|
+
} from "../chunk-VMPQEUJH.js";
|
|
24
24
|
import "../chunk-WLUZTUNZ.js";
|
|
25
25
|
import "../chunk-LR3AIGDD.js";
|
|
26
26
|
export {
|