@bendyline/squisq-react 1.3.1 → 1.3.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.
Files changed (187) hide show
  1. package/dist/index.d.ts +710 -35
  2. package/dist/index.js +4288 -33
  3. package/dist/index.js.map +1 -1
  4. package/dist/squisq-player.global.js +1 -1
  5. package/dist/standalone-source.js +1 -1
  6. package/package.json +2 -2
  7. package/dist/BlockRenderer.d.ts +0 -37
  8. package/dist/BlockRenderer.d.ts.map +0 -1
  9. package/dist/BlockRenderer.js +0 -54
  10. package/dist/BlockRenderer.js.map +0 -1
  11. package/dist/CaptionOverlay.d.ts +0 -33
  12. package/dist/CaptionOverlay.d.ts.map +0 -1
  13. package/dist/CaptionOverlay.js +0 -44
  14. package/dist/CaptionOverlay.js.map +0 -1
  15. package/dist/DocControlsBottom.d.ts +0 -28
  16. package/dist/DocControlsBottom.d.ts.map +0 -1
  17. package/dist/DocControlsBottom.js +0 -27
  18. package/dist/DocControlsBottom.js.map +0 -1
  19. package/dist/DocControlsOverlay.d.ts +0 -28
  20. package/dist/DocControlsOverlay.d.ts.map +0 -1
  21. package/dist/DocControlsOverlay.js +0 -80
  22. package/dist/DocControlsOverlay.js.map +0 -1
  23. package/dist/DocControlsSidebar.d.ts +0 -27
  24. package/dist/DocControlsSidebar.d.ts.map +0 -1
  25. package/dist/DocControlsSidebar.js +0 -10
  26. package/dist/DocControlsSidebar.js.map +0 -1
  27. package/dist/DocControlsSlideshow.d.ts +0 -20
  28. package/dist/DocControlsSlideshow.d.ts.map +0 -1
  29. package/dist/DocControlsSlideshow.js +0 -69
  30. package/dist/DocControlsSlideshow.js.map +0 -1
  31. package/dist/DocPlayer.d.ts +0 -97
  32. package/dist/DocPlayer.d.ts.map +0 -1
  33. package/dist/DocPlayer.js +0 -657
  34. package/dist/DocPlayer.js.map +0 -1
  35. package/dist/DocPlayerWithSidebar.d.ts +0 -41
  36. package/dist/DocPlayerWithSidebar.d.ts.map +0 -1
  37. package/dist/DocPlayerWithSidebar.js +0 -69
  38. package/dist/DocPlayerWithSidebar.js.map +0 -1
  39. package/dist/DocProgressBar.d.ts +0 -31
  40. package/dist/DocProgressBar.d.ts.map +0 -1
  41. package/dist/DocProgressBar.js +0 -122
  42. package/dist/DocProgressBar.js.map +0 -1
  43. package/dist/InlineAudioPlayer.d.ts +0 -15
  44. package/dist/InlineAudioPlayer.d.ts.map +0 -1
  45. package/dist/InlineAudioPlayer.js +0 -22
  46. package/dist/InlineAudioPlayer.js.map +0 -1
  47. package/dist/InlineVideoPlayer.d.ts +0 -21
  48. package/dist/InlineVideoPlayer.d.ts.map +0 -1
  49. package/dist/InlineVideoPlayer.js +0 -29
  50. package/dist/InlineVideoPlayer.js.map +0 -1
  51. package/dist/LinearDocView.d.ts +0 -73
  52. package/dist/LinearDocView.d.ts.map +0 -1
  53. package/dist/LinearDocView.js +0 -451
  54. package/dist/LinearDocView.js.map +0 -1
  55. package/dist/MarkdownRenderer.d.ts +0 -32
  56. package/dist/MarkdownRenderer.d.ts.map +0 -1
  57. package/dist/MarkdownRenderer.js +0 -259
  58. package/dist/MarkdownRenderer.js.map +0 -1
  59. package/dist/SocialCaptionOverlay.d.ts +0 -27
  60. package/dist/SocialCaptionOverlay.d.ts.map +0 -1
  61. package/dist/SocialCaptionOverlay.js +0 -185
  62. package/dist/SocialCaptionOverlay.js.map +0 -1
  63. package/dist/__tests__/BlockRenderer.test.d.ts +0 -2
  64. package/dist/__tests__/BlockRenderer.test.d.ts.map +0 -1
  65. package/dist/__tests__/BlockRenderer.test.js +0 -82
  66. package/dist/__tests__/BlockRenderer.test.js.map +0 -1
  67. package/dist/__tests__/DocControlsSlideshow.test.d.ts +0 -2
  68. package/dist/__tests__/DocControlsSlideshow.test.d.ts.map +0 -1
  69. package/dist/__tests__/DocControlsSlideshow.test.js +0 -89
  70. package/dist/__tests__/DocControlsSlideshow.test.js.map +0 -1
  71. package/dist/__tests__/JsonView.test.d.ts +0 -2
  72. package/dist/__tests__/JsonView.test.d.ts.map +0 -1
  73. package/dist/__tests__/JsonView.test.js +0 -93
  74. package/dist/__tests__/JsonView.test.js.map +0 -1
  75. package/dist/__tests__/LinearDocView.test.d.ts +0 -2
  76. package/dist/__tests__/LinearDocView.test.d.ts.map +0 -1
  77. package/dist/__tests__/LinearDocView.test.js +0 -250
  78. package/dist/__tests__/LinearDocView.test.js.map +0 -1
  79. package/dist/__tests__/MarkdownRenderer.test.d.ts +0 -2
  80. package/dist/__tests__/MarkdownRenderer.test.d.ts.map +0 -1
  81. package/dist/__tests__/MarkdownRenderer.test.js +0 -208
  82. package/dist/__tests__/MarkdownRenderer.test.js.map +0 -1
  83. package/dist/__tests__/TableLayer.test.d.ts +0 -2
  84. package/dist/__tests__/TableLayer.test.d.ts.map +0 -1
  85. package/dist/__tests__/TableLayer.test.js +0 -121
  86. package/dist/__tests__/TableLayer.test.js.map +0 -1
  87. package/dist/__tests__/exports.test.d.ts +0 -2
  88. package/dist/__tests__/exports.test.d.ts.map +0 -1
  89. package/dist/__tests__/exports.test.js +0 -48
  90. package/dist/__tests__/exports.test.js.map +0 -1
  91. package/dist/hooks/AudioProvider.d.ts +0 -71
  92. package/dist/hooks/AudioProvider.d.ts.map +0 -1
  93. package/dist/hooks/AudioProvider.js +0 -52
  94. package/dist/hooks/AudioProvider.js.map +0 -1
  95. package/dist/hooks/MediaContext.d.ts +0 -35
  96. package/dist/hooks/MediaContext.d.ts.map +0 -1
  97. package/dist/hooks/MediaContext.js +0 -72
  98. package/dist/hooks/MediaContext.js.map +0 -1
  99. package/dist/hooks/index.d.ts +0 -6
  100. package/dist/hooks/index.d.ts.map +0 -1
  101. package/dist/hooks/index.js +0 -5
  102. package/dist/hooks/index.js.map +0 -1
  103. package/dist/hooks/useAudioSync.d.ts +0 -18
  104. package/dist/hooks/useAudioSync.d.ts.map +0 -1
  105. package/dist/hooks/useAudioSync.js +0 -340
  106. package/dist/hooks/useAudioSync.js.map +0 -1
  107. package/dist/hooks/useAutoSurface.d.ts +0 -11
  108. package/dist/hooks/useAutoSurface.d.ts.map +0 -1
  109. package/dist/hooks/useAutoSurface.js +0 -24
  110. package/dist/hooks/useAutoSurface.js.map +0 -1
  111. package/dist/hooks/useDocPlayback.d.ts +0 -47
  112. package/dist/hooks/useDocPlayback.d.ts.map +0 -1
  113. package/dist/hooks/useDocPlayback.js +0 -179
  114. package/dist/hooks/useDocPlayback.js.map +0 -1
  115. package/dist/hooks/useViewportOrientation.d.ts +0 -31
  116. package/dist/hooks/useViewportOrientation.d.ts.map +0 -1
  117. package/dist/hooks/useViewportOrientation.js +0 -92
  118. package/dist/hooks/useViewportOrientation.js.map +0 -1
  119. package/dist/index.d.ts.map +0 -1
  120. package/dist/jsonView/JsonView.d.ts +0 -26
  121. package/dist/jsonView/JsonView.d.ts.map +0 -1
  122. package/dist/jsonView/JsonView.js +0 -12
  123. package/dist/jsonView/JsonView.js.map +0 -1
  124. package/dist/jsonView/RenderNode.d.ts +0 -22
  125. package/dist/jsonView/RenderNode.d.ts.map +0 -1
  126. package/dist/jsonView/RenderNode.js +0 -30
  127. package/dist/jsonView/RenderNode.js.map +0 -1
  128. package/dist/jsonView/index.d.ts +0 -3
  129. package/dist/jsonView/index.d.ts.map +0 -1
  130. package/dist/jsonView/index.js +0 -2
  131. package/dist/jsonView/index.js.map +0 -1
  132. package/dist/jsonView/useJsonViewTokens.d.ts +0 -14
  133. package/dist/jsonView/useJsonViewTokens.d.ts.map +0 -1
  134. package/dist/jsonView/useJsonViewTokens.js +0 -34
  135. package/dist/jsonView/useJsonViewTokens.js.map +0 -1
  136. package/dist/jsonView/viewers.d.ts +0 -30
  137. package/dist/jsonView/viewers.d.ts.map +0 -1
  138. package/dist/jsonView/viewers.js +0 -226
  139. package/dist/jsonView/viewers.js.map +0 -1
  140. package/dist/layers/ImageLayer.d.ts +0 -23
  141. package/dist/layers/ImageLayer.d.ts.map +0 -1
  142. package/dist/layers/ImageLayer.js +0 -104
  143. package/dist/layers/ImageLayer.js.map +0 -1
  144. package/dist/layers/MapLayer.d.ts +0 -29
  145. package/dist/layers/MapLayer.d.ts.map +0 -1
  146. package/dist/layers/MapLayer.js +0 -97
  147. package/dist/layers/MapLayer.js.map +0 -1
  148. package/dist/layers/ShapeLayer.d.ts +0 -20
  149. package/dist/layers/ShapeLayer.d.ts.map +0 -1
  150. package/dist/layers/ShapeLayer.js +0 -39
  151. package/dist/layers/ShapeLayer.js.map +0 -1
  152. package/dist/layers/TableLayer.d.ts +0 -23
  153. package/dist/layers/TableLayer.d.ts.map +0 -1
  154. package/dist/layers/TableLayer.js +0 -58
  155. package/dist/layers/TableLayer.js.map +0 -1
  156. package/dist/layers/TextLayer.d.ts +0 -23
  157. package/dist/layers/TextLayer.d.ts.map +0 -1
  158. package/dist/layers/TextLayer.js +0 -126
  159. package/dist/layers/TextLayer.js.map +0 -1
  160. package/dist/layers/VideoLayer.d.ts +0 -40
  161. package/dist/layers/VideoLayer.d.ts.map +0 -1
  162. package/dist/layers/VideoLayer.js +0 -105
  163. package/dist/layers/VideoLayer.js.map +0 -1
  164. package/dist/layers/index.d.ts +0 -6
  165. package/dist/layers/index.d.ts.map +0 -1
  166. package/dist/layers/index.js +0 -6
  167. package/dist/layers/index.js.map +0 -1
  168. package/dist/standalone-entry.d.ts +0 -69
  169. package/dist/standalone-entry.d.ts.map +0 -1
  170. package/dist/standalone-entry.js +0 -185
  171. package/dist/standalone-entry.js.map +0 -1
  172. package/dist/types.d.ts +0 -154
  173. package/dist/types.d.ts.map +0 -1
  174. package/dist/types.js +0 -21
  175. package/dist/types.js.map +0 -1
  176. package/dist/utils/animationUtils.d.ts +0 -8
  177. package/dist/utils/animationUtils.d.ts.map +0 -1
  178. package/dist/utils/animationUtils.js +0 -8
  179. package/dist/utils/animationUtils.js.map +0 -1
  180. package/dist/utils/layerUtils.d.ts +0 -17
  181. package/dist/utils/layerUtils.d.ts.map +0 -1
  182. package/dist/utils/layerUtils.js +0 -37
  183. package/dist/utils/layerUtils.js.map +0 -1
  184. package/dist/utils/mapTileUtils.d.ts +0 -105
  185. package/dist/utils/mapTileUtils.d.ts.map +0 -1
  186. package/dist/utils/mapTileUtils.js +0 -268
  187. package/dist/utils/mapTileUtils.js.map +0 -1
@@ -1,185 +0,0 @@
1
- /**
2
- * Standalone Entry Point — IIFE bundle for self-contained HTML rendering.
3
- *
4
- * This file is the entry point for the standalone `squisq-player.iife.js` bundle.
5
- * It bundles Preact (via preact/compat), squisq core, and all rendering components
6
- * into a single self-contained script that can be loaded in any HTML page.
7
- *
8
- * The bundle exposes a global `SquisqPlayer` object with methods to mount
9
- * interactive or static document views into any DOM element.
10
- *
11
- * Usage (in HTML):
12
- * <script src="squisq-player.iife.js"></script>
13
- * <div id="root"></div>
14
- * <script>
15
- * SquisqPlayer.mount(document.getElementById('root'), docJson, {
16
- * mode: 'slideshow',
17
- * images: { 'hero.jpg': 'data:image/jpeg;base64,...' }
18
- * });
19
- * </script>
20
- */
21
- import { createElement } from 'react';
22
- import { createRoot } from 'react-dom/client';
23
- import { DocPlayer } from './DocPlayer';
24
- import { LinearDocView } from './LinearDocView';
25
- import { MediaContext } from './hooks/MediaContext';
26
- // CSS is loaded as text via esbuild's text loader (configured in tsup.standalone.config.ts)
27
- // @ts-expect-error — .css import returns a string when esbuild uses 'text' loader (standalone build only)
28
- import animationCss from './styles/doc-animations.css';
29
- // ── CSS Injection ──────────────────────────────────────────────────
30
- let cssInjected = false;
31
- function injectCss() {
32
- if (cssInjected || typeof document === 'undefined')
33
- return;
34
- const style = document.createElement('style');
35
- style.setAttribute('data-squisq-player', 'animations');
36
- style.textContent = animationCss;
37
- document.head.appendChild(style);
38
- cssInjected = true;
39
- }
40
- // ── Inline Media Provider ──────────────────────────────────────────
41
- /**
42
- * Creates a MediaProvider that resolves URLs from an inline image map.
43
- * Falls back to basePath-based resolution for unknown paths.
44
- */
45
- function createInlineMediaProvider(images, basePath) {
46
- // Doc image references may not exactly match image map keys
47
- // (e.g., "images/hero.jpg" vs "hero.jpg"). Build a filename-keyed
48
- // lookup so resolution can fall back to basename matching.
49
- const byFilename = {};
50
- for (const key of Object.keys(images)) {
51
- const filename = key.split('/').pop();
52
- byFilename[filename] = images[key];
53
- }
54
- return {
55
- async resolveUrl(relativePath) {
56
- if (relativePath in images)
57
- return images[relativePath];
58
- const stripped = relativePath.replace(/^\.\//, '');
59
- if (stripped !== relativePath && stripped in images)
60
- return images[stripped];
61
- const filename = relativePath.split('/').pop();
62
- if (filename in byFilename)
63
- return byFilename[filename];
64
- if (relativePath.startsWith('http') ||
65
- relativePath.startsWith('data:') ||
66
- relativePath.startsWith('blob:')) {
67
- return relativePath;
68
- }
69
- return `${basePath}/${relativePath}`;
70
- },
71
- async listMedia() {
72
- return Object.keys(images).map((name) => ({
73
- name,
74
- mimeType: inferMimeType(name),
75
- size: 0,
76
- }));
77
- },
78
- async addMedia() {
79
- throw new Error('Standalone player is read-only');
80
- },
81
- async removeMedia() {
82
- throw new Error('Standalone player is read-only');
83
- },
84
- dispose() {
85
- // no-op
86
- },
87
- };
88
- }
89
- function inferMimeType(filename) {
90
- const ext = filename.split('.').pop()?.toLowerCase() ?? '';
91
- const map = {
92
- jpg: 'image/jpeg',
93
- jpeg: 'image/jpeg',
94
- png: 'image/png',
95
- gif: 'image/gif',
96
- webp: 'image/webp',
97
- svg: 'image/svg+xml',
98
- mp3: 'audio/mpeg',
99
- mp4: 'video/mp4',
100
- webm: 'video/webm',
101
- };
102
- return map[ext] ?? 'application/octet-stream';
103
- }
104
- // ── Audio Rewriting ────────────────────────────────────────────────
105
- /**
106
- * Rewrite audio segment URLs in a Doc if an audio map is provided.
107
- * Returns a shallow-modified copy — does not mutate the original.
108
- */
109
- function rewriteAudioUrls(doc, audioMap) {
110
- if (!doc.audio?.segments?.length)
111
- return doc;
112
- const segments = doc.audio.segments.map((seg) => {
113
- const resolved = audioMap[seg.name] ?? audioMap[seg.src] ?? seg.src;
114
- return { ...seg, src: resolved };
115
- });
116
- return { ...doc, audio: { ...doc.audio, segments } };
117
- }
118
- // ── Root Tracking ──────────────────────────────────────────────────
119
- const roots = new WeakMap();
120
- // ── Public API ─────────────────────────────────────────────────────
121
- /**
122
- * Mount a SquisqPlayer into a DOM element.
123
- *
124
- * @param element - The DOM element to render into
125
- * @param doc - A Doc object (parsed JSON)
126
- * @param options - Rendering options
127
- */
128
- export function mount(element, doc, options = {}) {
129
- injectCss();
130
- const { mode = 'slideshow', basePath = '.', images, audio, autoPlay = false, theme, renderMode = false, captionStyle, } = options;
131
- // Rewrite audio URLs if map provided
132
- const finalDoc = audio ? rewriteAudioUrls(doc, audio) : doc;
133
- // Build the media provider if images are provided
134
- const mediaProvider = images ? createInlineMediaProvider(images, basePath) : null;
135
- let content;
136
- if (mode === 'static') {
137
- content = createElement(LinearDocView, {
138
- doc: finalDoc,
139
- basePath,
140
- theme,
141
- });
142
- }
143
- else {
144
- content = createElement(DocPlayer, {
145
- script: finalDoc,
146
- basePath,
147
- displayMode: 'slideshow',
148
- autoPlay: renderMode ? false : autoPlay,
149
- showControls: !renderMode,
150
- renderMode,
151
- theme,
152
- captionsEnabled: !!captionStyle,
153
- captionStyle: captionStyle ?? 'standard',
154
- });
155
- }
156
- // Wrap in MediaContext if provider is available
157
- if (mediaProvider) {
158
- content = createElement(MediaContext.Provider, { value: mediaProvider }, content);
159
- }
160
- // Create or reuse React root
161
- let root = roots.get(element);
162
- if (!root) {
163
- root = createRoot(element);
164
- roots.set(element, root);
165
- }
166
- root.render(content);
167
- }
168
- /**
169
- * Mount a static scrollable document view (alias for mount with mode='static').
170
- */
171
- export function mountStatic(element, doc, options = {}) {
172
- mount(element, doc, { ...options, mode: 'static' });
173
- }
174
- /**
175
- * Unmount a previously mounted SquisqPlayer from an element.
176
- */
177
- export function unmount(element) {
178
- const root = roots.get(element);
179
- if (root) {
180
- root.unmount();
181
- roots.delete(element);
182
- }
183
- }
184
- export const version = typeof __SQUISQ_VERSION__ !== 'undefined' ? __SQUISQ_VERSION__ : '0.0.0';
185
- //# sourceMappingURL=standalone-entry.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"standalone-entry.js","sourceRoot":"","sources":["../src/standalone-entry.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,UAAU,EAAa,MAAM,kBAAkB,CAAC;AAGzD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEpD,4FAA4F;AAC5F,0GAA0G;AAC1G,OAAO,YAAY,MAAM,6BAA6B,CAAC;AAkCvD,sEAAsE;AAEtE,IAAI,WAAW,GAAG,KAAK,CAAC;AAExB,SAAS,SAAS;IAChB,IAAI,WAAW,IAAI,OAAO,QAAQ,KAAK,WAAW;QAAE,OAAO;IAC3D,MAAM,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;IAC9C,KAAK,CAAC,YAAY,CAAC,oBAAoB,EAAE,YAAY,CAAC,CAAC;IACvD,KAAK,CAAC,WAAW,GAAG,YAAY,CAAC;IACjC,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;IACjC,WAAW,GAAG,IAAI,CAAC;AACrB,CAAC;AAED,sEAAsE;AAEtE;;;GAGG;AACH,SAAS,yBAAyB,CAChC,MAA8B,EAC9B,QAAgB;IAEhB,4DAA4D;IAC5D,kEAAkE;IAClE,2DAA2D;IAC3D,MAAM,UAAU,GAA2B,EAAE,CAAC;IAC9C,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;QACtC,MAAM,QAAQ,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAG,CAAC;QACvC,UAAU,CAAC,QA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GAAG,CAAC,OAAO,CAAC,CAAC;IAC9B,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,IAAI,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC;QAC3B,KAAK,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IAC3B,CAAC;IACD,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;AACvB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,WAAW,CACzB,OAAgB,EAChB,GAAQ,EACR,UAAsC,EAAE;IAExC,KAAK,CAAC,OAAO,EAAE,GAAG,EAAE,EAAE,GAAG,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC;AACtD,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,OAAO,CAAC,OAAgB;IACtC,MAAM,IAAI,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IAChC,IAAI,IAAI,EAAE,CAAC;QACT,IAAI,CAAC,OAAO,EAAE,CAAC;QACf,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACxB,CAAC;AACH,CAAC;AAID,MAAM,CAAC,MAAM,OAAO,GAClB,OAAO,kBAAkB,KAAK,WAAW,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,OAAO,CAAC"}
package/dist/types.d.ts DELETED
@@ -1,154 +0,0 @@
1
- /**
2
- * Doc Player Control Types
3
- *
4
- * Shared type definitions for doc player controls across different
5
- * layout modes (overlay, sidebar, bottom). These interfaces allow
6
- * control components to be decoupled from the core DocPlayer.
7
- *
8
- * Related Files:
9
- * - DocPlayer.tsx — Core player component
10
- * - DocProgressBar.tsx — Extracted progress bar
11
- * - DocControlsOverlay.tsx — Overlay controls (default)
12
- * - DocControlsSidebar.tsx — Vertical sidebar controls
13
- * - DocControlsBottom.tsx — Horizontal bottom strip controls
14
- */
15
- import type { Block } from '@bendyline/squisq/schemas';
16
- /** Layout mode for doc player controls */
17
- export type ControlsLayout = 'overlay' | 'sidebar' | 'bottom';
18
- /**
19
- * Display mode for DocPlayer.
20
- *
21
- * - `'video'` — Traditional video-style playback with play/pause, scrub bar,
22
- * and time-based auto-advance. Default mode.
23
- * - `'slideshow'` — PowerPoint-style presentation with prev/next navigation.
24
- * Blocks are treated as static slides that only change on user click.
25
- * No auto-advance, no scrub bar.
26
- * - `'linear'` — Long-scrolling document view. Renders the full markdown as
27
- * readable HTML with template-annotated sections shown as inline SVG cards.
28
- * No audio, no timeline, no controls — just a scrollable page.
29
- * - `'page'` — Plain semantic HTML preview matching what the
30
- * `markdownDocToPlainHtml` export produces. No SquisqPlayer, no SVG
31
- * cards — just `<h1>`/`<p>`/`<ul>` etc. inside a sandboxed iframe.
32
- * Use when you want a WYSIWYG view of the simple HTML export.
33
- */
34
- export type DisplayMode = 'video' | 'slideshow' | 'linear' | 'page';
35
- /**
36
- * Caption display style.
37
- *
38
- * - `'standard'` — Traditional broadcast-style captions: small white text
39
- * on a semi-transparent black badge at the top of the player.
40
- * - `'social'` — Social media-style (Instagram/TikTok): large centered words
41
- * showing 3-5 words at a time with the active word highlighted in the
42
- * theme's primary color. Font and colors pulled from the active theme.
43
- */
44
- export type CaptionStyle = 'standard' | 'social';
45
- /**
46
- * Caption display mode — combines enable/disable with style selection.
47
- * The CC button cycles through: off → standard → social → off.
48
- */
49
- export type CaptionMode = 'off' | 'standard' | 'social';
50
- /** Slide navigation actions for slideshow display mode */
51
- export interface SlideNavActions {
52
- /** Navigate to the next slide */
53
- nextSlide: () => void;
54
- /** Navigate to the previous slide */
55
- prevSlide: () => void;
56
- /** Navigate to a specific slide by index (0-based) */
57
- goToSlide: (index: number) => void;
58
- }
59
- /** Playback state exposed to external control components */
60
- export interface PlaybackState {
61
- isPlaying: boolean;
62
- currentTime: number;
63
- totalDuration: number;
64
- currentBlockIndex: number;
65
- totalBlocks: number;
66
- docProgress: number;
67
- hasCaptions: boolean;
68
- captionsEnabled: boolean;
69
- /** Current caption display mode (off, standard, social). */
70
- captionMode: CaptionMode;
71
- isFullscreen?: boolean;
72
- /** Current audio segment index (0-based) */
73
- currentSegmentIndex: number;
74
- /** Current audio segment name (e.g., 'intro', 'history') */
75
- currentSegmentName: string | null;
76
- /** Current block data (for extracting image info, etc.) */
77
- currentBlock: Block | null;
78
- }
79
- /** Playback actions exposed to external control components */
80
- export interface PlaybackActions {
81
- toggle: () => void;
82
- restart: () => void;
83
- seekTo: (time: number) => void;
84
- setCaptionsEnabled: (enabled: boolean) => void;
85
- /** Cycle caption mode: off → standard → social → off */
86
- cycleCaptionMode: () => void;
87
- toggleFullscreen?: () => void;
88
- }
89
- /** Block marker data for the progress bar */
90
- export interface BlockMarker {
91
- block: Block;
92
- index: number;
93
- position: number;
94
- title: string;
95
- /** True if this block is the first in a new audio segment (section boundary) */
96
- isSectionStart: boolean;
97
- }
98
- /** Block metadata returned by SquisqRenderAPI.getBlocks() */
99
- export interface RenderBlockInfo {
100
- id: string;
101
- template: string;
102
- startTime: number;
103
- duration: number;
104
- }
105
- /** Audio segment info returned by SquisqRenderAPI.getAudioSegments() */
106
- export interface RenderAudioSegmentInfo {
107
- src: string;
108
- name: string;
109
- duration: number;
110
- startTime: number;
111
- }
112
- /** Caption phrase info returned by SquisqRenderAPI.getCaptions() */
113
- export interface RenderCaptionInfo {
114
- text: string;
115
- startTime: number;
116
- endTime: number;
117
- }
118
- /** Chapter marker returned by SquisqRenderAPI.getChapters() */
119
- export interface RenderChapterInfo {
120
- title: string;
121
- startTime: number;
122
- duration: number;
123
- }
124
- /**
125
- * API surface exposed on `window` in render mode and debug mode.
126
- * Used by Playwright for video export and by ?debug=true for testing.
127
- *
128
- * @example
129
- * ```ts
130
- * // In Playwright:
131
- * const w = window as unknown as SquisqWindow;
132
- * await w.seekTo!(5.0);
133
- * const blocks = w.getBlocks!();
134
- * ```
135
- */
136
- export interface SquisqRenderAPI {
137
- seekTo: (time: number) => Promise<void>;
138
- getDuration: () => number;
139
- getBlocks: () => RenderBlockInfo[];
140
- getAudioSegments: () => RenderAudioSegmentInfo[];
141
- getCaptions: () => RenderCaptionInfo[];
142
- getChapters: () => RenderChapterInfo[];
143
- showCover: () => Promise<void>;
144
- hideCover: () => Promise<void>;
145
- hasCoverBlock: () => boolean;
146
- }
147
- /**
148
- * Window augmented with optional SquisqRenderAPI properties.
149
- * Each property is optional because they're only present in render/debug mode.
150
- */
151
- export type SquisqWindow = Window & typeof globalThis & Partial<SquisqRenderAPI>;
152
- /** Format time in seconds to MM:SS string */
153
- export declare function formatTime(seconds: number): string;
154
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAEvD,0CAA0C;AAC1C,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAC;AAE9D;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,WAAW,GAAG,OAAO,GAAG,WAAW,GAAG,QAAQ,GAAG,MAAM,CAAC;AAEpE;;;;;;;;GAQG;AACH,MAAM,MAAM,YAAY,GAAG,UAAU,GAAG,QAAQ,CAAC;AAEjD;;;GAGG;AACH,MAAM,MAAM,WAAW,GAAG,KAAK,GAAG,UAAU,GAAG,QAAQ,CAAC;AAExD,0DAA0D;AAC1D,MAAM,WAAW,eAAe;IAC9B,iCAAiC;IACjC,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,qCAAqC;IACrC,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,sDAAsD;IACtD,SAAS,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACpC;AAED,4DAA4D;AAC5D,MAAM,WAAW,aAAa;IAC5B,SAAS,EAAE,OAAO,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,iBAAiB,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,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,oEAAoE;AACpE,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,+DAA+D;AAC/D,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACxC,WAAW,EAAE,MAAM,MAAM,CAAC;IAC1B,SAAS,EAAE,MAAM,eAAe,EAAE,CAAC;IACnC,gBAAgB,EAAE,MAAM,sBAAsB,EAAE,CAAC;IACjD,WAAW,EAAE,MAAM,iBAAiB,EAAE,CAAC;IACvC,WAAW,EAAE,MAAM,iBAAiB,EAAE,CAAC;IACvC,SAAS,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/B,SAAS,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/B,aAAa,EAAE,MAAM,OAAO,CAAC;CAC9B;AAED;;;GAGG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,OAAO,UAAU,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;AAEjF,6CAA6C;AAC7C,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAIlD"}
package/dist/types.js DELETED
@@ -1,21 +0,0 @@
1
- /**
2
- * Doc Player Control Types
3
- *
4
- * Shared type definitions for doc player controls across different
5
- * layout modes (overlay, sidebar, bottom). These interfaces allow
6
- * control components to be decoupled from the core DocPlayer.
7
- *
8
- * Related Files:
9
- * - DocPlayer.tsx — Core player component
10
- * - DocProgressBar.tsx — Extracted progress bar
11
- * - DocControlsOverlay.tsx — Overlay controls (default)
12
- * - DocControlsSidebar.tsx — Vertical sidebar controls
13
- * - DocControlsBottom.tsx — Horizontal bottom strip controls
14
- */
15
- /** Format time in seconds to MM:SS string */
16
- export function formatTime(seconds) {
17
- const mins = Math.floor(seconds / 60);
18
- const secs = Math.floor(seconds % 60);
19
- return `${mins}:${secs.toString().padStart(2, '0')}`;
20
- }
21
- //# sourceMappingURL=types.js.map
package/dist/types.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AA8JH,6CAA6C;AAC7C,MAAM,UAAU,UAAU,CAAC,OAAe;IACxC,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,EAAE,CAAC,CAAC;IACtC,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,EAAE,CAAC,CAAC;IACtC,OAAO,GAAG,IAAI,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC;AACvD,CAAC"}
@@ -1,8 +0,0 @@
1
- /**
2
- * Animation Utilities (React)
3
- *
4
- * Re-exports the shared animation utilities for use in the React package.
5
- * All animation logic is in shared/doc/utils.
6
- */
7
- export { getAnimationStyle, getDefaultAnimationDuration, getTransitionClass, getAnimationProgress, } from '@bendyline/squisq/doc';
8
- //# sourceMappingURL=animationUtils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"animationUtils.d.ts","sourceRoot":"","sources":["../../src/utils/animationUtils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,iBAAiB,EACjB,2BAA2B,EAC3B,kBAAkB,EAClB,oBAAoB,GACrB,MAAM,uBAAuB,CAAC"}
@@ -1,8 +0,0 @@
1
- /**
2
- * Animation Utilities (React)
3
- *
4
- * Re-exports the shared animation utilities for use in the React package.
5
- * All animation logic is in shared/doc/utils.
6
- */
7
- export { getAnimationStyle, getDefaultAnimationDuration, getTransitionClass, getAnimationProgress, } from '@bendyline/squisq/doc';
8
- //# sourceMappingURL=animationUtils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"animationUtils.js","sourceRoot":"","sources":["../../src/utils/animationUtils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,iBAAiB,EACjB,2BAA2B,EAC3B,kBAAkB,EAClB,oBAAoB,GACrB,MAAM,uBAAuB,CAAC"}
@@ -1,17 +0,0 @@
1
- /**
2
- * Shared utilities for layer components.
3
- *
4
- * Resolves position values and anchor offsets used by all layer types.
5
- */
6
- /**
7
- * Resolve a position value (number or percentage string) to pixels.
8
- */
9
- export declare function resolveValue(value: number | string, dimension: number): number;
10
- /**
11
- * Get offset based on anchor point.
12
- */
13
- export declare function getAnchorOffset(anchor: string | undefined, width: number, height: number): {
14
- x: number;
15
- y: number;
16
- };
17
- //# sourceMappingURL=layerUtils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"layerUtils.d.ts","sourceRoot":"","sources":["../../src/utils/layerUtils.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAS9E;AAED;;GAEG;AACH,wBAAgB,eAAe,CAC7B,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,GACb;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,CAc1B"}
@@ -1,37 +0,0 @@
1
- /**
2
- * Shared utilities for layer components.
3
- *
4
- * Resolves position values and anchor offsets used by all layer types.
5
- */
6
- /**
7
- * Resolve a position value (number or percentage string) to pixels.
8
- */
9
- export function resolveValue(value, dimension) {
10
- if (typeof value === 'number') {
11
- return value;
12
- }
13
- if (value.endsWith('%')) {
14
- const percent = parseFloat(value);
15
- return (percent / 100) * dimension;
16
- }
17
- return parseFloat(value);
18
- }
19
- /**
20
- * Get offset based on anchor point.
21
- */
22
- export function getAnchorOffset(anchor, width, height) {
23
- switch (anchor) {
24
- case 'center':
25
- return { x: -width / 2, y: -height / 2 };
26
- case 'top-right':
27
- return { x: -width, y: 0 };
28
- case 'bottom-left':
29
- return { x: 0, y: -height };
30
- case 'bottom-right':
31
- return { x: -width, y: -height };
32
- case 'top-left':
33
- default:
34
- return { x: 0, y: 0 };
35
- }
36
- }
37
- //# sourceMappingURL=layerUtils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"layerUtils.js","sourceRoot":"","sources":["../../src/utils/layerUtils.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,MAAM,UAAU,YAAY,CAAC,KAAsB,EAAE,SAAiB;IACpE,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,OAAO,KAAK,CAAC;IACf,CAAC;IACD,IAAI,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QACxB,MAAM,OAAO,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC;QAClC,OAAO,CAAC,OAAO,GAAG,GAAG,CAAC,GAAG,SAAS,CAAC;IACrC,CAAC;IACD,OAAO,UAAU,CAAC,KAAK,CAAC,CAAC;AAC3B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,eAAe,CAC7B,MAA0B,EAC1B,KAAa,EACb,MAAc;IAEd,QAAQ,MAAM,EAAE,CAAC;QACf,KAAK,QAAQ;YACX,OAAO,EAAE,CAAC,EAAE,CAAC,KAAK,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC3C,KAAK,WAAW;YACd,OAAO,EAAE,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;QAC7B,KAAK,aAAa;YAChB,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC;QAC9B,KAAK,cAAc;YACjB,OAAO,EAAE,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC;QACnC,KAAK,UAAU,CAAC;QAChB;YACE,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;IAC1B,CAAC;AACH,CAAC"}
@@ -1,105 +0,0 @@
1
- /**
2
- * Map Tile Utilities
3
- *
4
- * Functions for fetching and composing map tiles from free/open-source providers.
5
- * Converts lat/lng to tile coordinates and composites multiple tiles into a
6
- * single image for SVG embedding.
7
- *
8
- * Supported Providers (all free with attribution):
9
- * - terrain: OpenTopoMap (CC-BY-SA)
10
- * - road: OpenStreetMap (ODbL)
11
- * - satellite: ESRI World Imagery (free with attribution)
12
- * - toner: Stadia/Stamen Toner (free tier)
13
- * - watercolor: Stadia/Stamen Watercolor (free tier)
14
- *
15
- * See docs/MAP_TILES.md for full provider details and terms.
16
- */
17
- import type { MapTileStyle, MapMarker } from '@bendyline/squisq/schemas';
18
- /**
19
- * Tile provider configuration.
20
- */
21
- export interface TileProvider {
22
- /** URL template with {z}, {x}, {y} placeholders */
23
- url: string;
24
- /** Attribution text (required for display) */
25
- attribution: string;
26
- /** Maximum zoom level */
27
- maxZoom: number;
28
- /** Tile size in pixels (default: 256) */
29
- tileSize?: number;
30
- }
31
- /**
32
- * Free tile providers for each map style.
33
- * All require attribution to be displayed.
34
- */
35
- export declare const TILE_PROVIDERS: Record<MapTileStyle, TileProvider>;
36
- /**
37
- * Convert latitude/longitude to tile coordinates at a given zoom level.
38
- * Uses Web Mercator projection (EPSG:3857).
39
- */
40
- export declare function latLngToTile(lat: number, lng: number, zoom: number): {
41
- x: number;
42
- y: number;
43
- };
44
- /**
45
- * Convert tile coordinates back to lat/lng (top-left corner of tile).
46
- */
47
- export declare function tileToLatLng(x: number, y: number, zoom: number): {
48
- lat: number;
49
- lng: number;
50
- };
51
- /**
52
- * Get the pixel offset within a tile for a given lat/lng.
53
- */
54
- export declare function getPixelOffset(lat: number, lng: number, zoom: number, tileSize?: number): {
55
- x: number;
56
- y: number;
57
- };
58
- /**
59
- * Calculate which tiles are needed to cover a viewport centered on lat/lng.
60
- */
61
- export declare function getTilesForViewport(centerLat: number, centerLng: number, zoom: number, viewportWidth: number, viewportHeight: number, tileSize?: number): Array<{
62
- x: number;
63
- y: number;
64
- screenX: number;
65
- screenY: number;
66
- }>;
67
- /**
68
- * Build a tile URL from the provider template.
69
- */
70
- export declare function buildTileUrl(provider: TileProvider, x: number, y: number, z: number): string;
71
- /**
72
- * Options for composing a map image.
73
- */
74
- export interface ComposeMapOptions {
75
- /** Center coordinates */
76
- center: {
77
- lat: number;
78
- lng: number;
79
- };
80
- /** Zoom level */
81
- zoom: number;
82
- /** Map tile style */
83
- style: MapTileStyle;
84
- /** Output width in pixels */
85
- width: number;
86
- /** Output height in pixels */
87
- height: number;
88
- /** Optional markers to render */
89
- markers?: MapMarker[];
90
- /** Show attribution (default: true) */
91
- showAttribution?: boolean;
92
- }
93
- /**
94
- * Compose map tiles into a single data URL image.
95
- *
96
- * This is the main function for generating map images for blocks.
97
- * It fetches all needed tiles, composites them on a canvas, and
98
- * returns a data URL that can be used in an SVG <image> element.
99
- */
100
- export declare function composeMapImage(options: ComposeMapOptions): Promise<string>;
101
- /**
102
- * Get attribution text for a map style.
103
- */
104
- export declare function getAttribution(style: MapTileStyle): string;
105
- //# sourceMappingURL=mapTileUtils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mapTileUtils.d.ts","sourceRoot":"","sources":["../../src/utils/mapTileUtils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAEzE;;GAEG;AACH,MAAM,WA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