@bendyline/squisq-editor-react 2.11.17 → 2.11.19

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 (30) hide show
  1. package/dist/{chunk-US5DALTZ.js → chunk-5EB3BGPE.js} +2419 -2025
  2. package/dist/{chunk-QZWFSSDE.js → chunk-DJS5I5NO.js} +1 -1
  3. package/dist/chunk-DNEVUOBZ.js +14 -0
  4. package/dist/chunk-DNJ6HOES.js +93 -0
  5. package/dist/{chunk-DPAMJV6A.js → chunk-HSWWEWT4.js} +31 -2
  6. package/dist/{chunk-EJKGXWNK.js → chunk-LR6Q2MK4.js} +1 -1
  7. package/dist/chunk-LRZJD5YD.js +107 -0
  8. package/dist/{chunk-2XXBDECJ.js → chunk-OCQEWWHI.js} +1 -1
  9. package/dist/{chunk-HTO5MTTJ.js → chunk-TZX7RKZV.js} +1107 -130
  10. package/dist/{chunk-C6QVA6TO.js → chunk-UFK47ZAI.js} +58 -133
  11. package/dist/{chunk-UBFNLWCN.js → chunk-V2OLZOYJ.js} +2 -2
  12. package/dist/{chunk-XZVMKR5Q.js → chunk-ZS6G2P57.js} +41 -96
  13. package/dist/dictationSession-PN3OT5LJ.js +521 -0
  14. package/dist/index.d.ts +30 -11
  15. package/dist/index.js +53 -21
  16. package/dist/json-editor/index.js +3 -3
  17. package/dist/recorder/index.d.ts +2 -2
  18. package/dist/recorder/index.js +17 -13
  19. package/dist/{recorder-CRsw0eC7.d.ts → recorder-DKN3vZPi.d.ts} +1 -1
  20. package/dist/review/index.js +3 -2
  21. package/dist/shell/index.d.ts +2 -1
  22. package/dist/shell/index.js +10 -7
  23. package/dist/{shell-X0EoQbbN.d.ts → shell-Cje1A3zN.d.ts} +176 -5
  24. package/dist/speech/index.d.ts +126 -0
  25. package/dist/speech/index.js +10 -0
  26. package/dist/styles/index.css +142 -3
  27. package/dist/teleprompter/index.d.ts +13 -5
  28. package/dist/teleprompter/index.js +3 -2
  29. package/dist/{useNarrationStage-vKtk6H-V.d.ts → useNarrationStage-CB8dynUg.d.ts} +15 -1
  30. package/package.json +10 -6
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  NarrationStage,
3
3
  useNarrationStage
4
- } from "./chunk-XZVMKR5Q.js";
4
+ } from "./chunk-ZS6G2P57.js";
5
5
 
6
6
  // src/teleprompter/TeleprompterView.tsx
7
7
  import { jsx } from "react/jsx-runtime";
@@ -0,0 +1,14 @@
1
+ // src/speech/types.ts
2
+ var SPEECH_INPUT_SAMPLE_RATE = 16e3;
3
+ function resolveSpeechInputProvider(capability) {
4
+ return typeof capability === "function" ? capability() : capability;
5
+ }
6
+ function isSpeechInputProviderFactory(capability) {
7
+ return typeof capability === "function";
8
+ }
9
+
10
+ export {
11
+ SPEECH_INPUT_SAMPLE_RATE,
12
+ resolveSpeechInputProvider,
13
+ isSpeechInputProviderFactory
14
+ };
@@ -0,0 +1,93 @@
1
+ // src/recorder/formats.ts
2
+ var AUDIO_CANDIDATES = [
3
+ "audio/webm;codecs=opus",
4
+ "audio/webm",
5
+ "audio/mp4;codecs=mp4a.40.2",
6
+ "audio/mp4",
7
+ "audio/ogg;codecs=opus"
8
+ ];
9
+ var VIDEO_CANDIDATES = [
10
+ "video/webm;codecs=vp9,opus",
11
+ "video/webm;codecs=vp8,opus",
12
+ "video/webm",
13
+ "video/mp4;codecs=avc1.42E01E,mp4a.40.2",
14
+ "video/mp4"
15
+ ];
16
+ function extensionForMime(mimeType) {
17
+ const m = mimeType.toLowerCase();
18
+ if (m.startsWith("audio/webm")) return ".webm";
19
+ if (m.startsWith("audio/ogg")) return ".ogg";
20
+ if (m.startsWith("audio/mp4")) return ".m4a";
21
+ if (m.startsWith("audio/mpeg")) return ".mp3";
22
+ if (m.startsWith("audio/wav")) return ".wav";
23
+ if (m.startsWith("video/webm")) return ".webm";
24
+ if (m.startsWith("video/mp4")) return ".mp4";
25
+ return ".bin";
26
+ }
27
+ function probeMimeType(candidates) {
28
+ if (typeof MediaRecorder === "undefined") return null;
29
+ for (const candidate of candidates) {
30
+ try {
31
+ if (MediaRecorder.isTypeSupported(candidate)) return candidate;
32
+ } catch {
33
+ }
34
+ }
35
+ return null;
36
+ }
37
+ function resolveFormat(kind, preferred) {
38
+ const candidates = kind === "audio" ? AUDIO_CANDIDATES : VIDEO_CANDIDATES;
39
+ const probed = (preferred && probeMimeType([preferred])) ?? probeMimeType(candidates) ?? "";
40
+ const directory = kind === "audio" ? "audio" : "video";
41
+ const extension = probed ? extensionForMime(probed) : ".webm";
42
+ return { mimeType: probed, extension, directory };
43
+ }
44
+ function supportsMediaRecorder() {
45
+ return typeof MediaRecorder !== "undefined";
46
+ }
47
+ function supportsUserMedia() {
48
+ return typeof navigator !== "undefined" && typeof navigator.mediaDevices !== "undefined" && typeof navigator.mediaDevices.getUserMedia === "function";
49
+ }
50
+ function supportsDisplayMedia() {
51
+ return typeof navigator !== "undefined" && typeof navigator.mediaDevices !== "undefined" && typeof navigator.mediaDevices.getDisplayMedia === "function";
52
+ }
53
+ function supportsSystemAudioCapture() {
54
+ if (!supportsDisplayMedia()) return false;
55
+ const nav = navigator;
56
+ const uaData = nav.userAgentData;
57
+ if (uaData?.mobile === true) return false;
58
+ if (uaData?.brands?.length) {
59
+ return uaData.brands.some(({ brand }) => /chromium/i.test(brand));
60
+ }
61
+ const userAgent = nav.userAgent ?? "";
62
+ if (/Android|Mobile|iPhone|iPad|iPod/i.test(userAgent)) return false;
63
+ return /(?:Chrome|Chromium|Edg|OPR)\//.test(userAgent);
64
+ }
65
+ function buildFilename(kind, extension, basename, seed) {
66
+ const safe = basename ? basename.trim().replace(/[\\/:*?"<>|]+/g, "-").replace(/\s+/g, "-") : "";
67
+ if (safe) return `${safe}${extension}`;
68
+ const now = /* @__PURE__ */ new Date();
69
+ const stamp = now.getFullYear().toString().padStart(4, "0") + (now.getMonth() + 1).toString().padStart(2, "0") + now.getDate().toString().padStart(2, "0") + "-" + now.getHours().toString().padStart(2, "0") + now.getMinutes().toString().padStart(2, "0") + now.getSeconds().toString().padStart(2, "0");
70
+ const prefix = seed ?? (kind === "audio" ? "narration" : "recording");
71
+ return `${prefix}-${stamp}${extension}`;
72
+ }
73
+
74
+ // src/recorder/sources/micStream.ts
75
+ async function requestMicStream(constraints) {
76
+ if (!supportsUserMedia()) {
77
+ throw new Error("navigator.mediaDevices.getUserMedia is not available in this environment.");
78
+ }
79
+ return navigator.mediaDevices.getUserMedia({
80
+ audio: constraints ?? true,
81
+ video: false
82
+ });
83
+ }
84
+
85
+ export {
86
+ resolveFormat,
87
+ supportsMediaRecorder,
88
+ supportsUserMedia,
89
+ supportsDisplayMedia,
90
+ supportsSystemAudioCapture,
91
+ buildFilename,
92
+ requestMicStream
93
+ };
@@ -70,6 +70,35 @@ var RE_ITALIC_UNDER = /(?<![\p{L}\p{N}_])_(?![\s_])(.+?)(?<![\s_])_(?![\p{L}\p{N
70
70
  var RE_STRIKETHROUGH = /~~(.+?)~~/g;
71
71
  var RE_LEGACY_BOLD_STAR = /\*\*(?![\s*])((?:(?!\*\*).)+?)(?<![\s*])([ \t]+)\*\*(?=$|[^\s*])/g;
72
72
  var RE_LEGACY_ITALIC_STAR = /(?<!\*)\*(?![\s*])([^*]+?)(?<![\s*])([ \t]+)\*(?=$|[^\s*])/g;
73
+ var RE_BOLD_DELIMITER = /\*\*/g;
74
+ var RE_ITALIC_DELIMITER = /\*/g;
75
+ function countEmphasisDelimiters(text, end, delimiter) {
76
+ let count = 0;
77
+ delimiter.lastIndex = 0;
78
+ for (let match = delimiter.exec(text); match && match.index < end; match = delimiter.exec(text)) {
79
+ const before = text[match.index - 1];
80
+ const after = text[match.index + match[0].length];
81
+ if ((before === void 0 || /\s/.test(before)) && (after === void 0 || /\s/.test(after))) {
82
+ continue;
83
+ }
84
+ count++;
85
+ }
86
+ return count;
87
+ }
88
+ function recoverLegacyEmphasis(text, pattern, delimiter, delimiterLength, tag) {
89
+ let output = "";
90
+ let copied = 0;
91
+ pattern.lastIndex = 0;
92
+ for (let match = pattern.exec(text); match; match = pattern.exec(text)) {
93
+ if (countEmphasisDelimiters(text, match.index, delimiter) % 2 === 1) {
94
+ pattern.lastIndex = match.index + delimiterLength;
95
+ continue;
96
+ }
97
+ output += `${text.slice(copied, match.index)}<${tag}>${match[1]}</${tag}>${match[2]}`;
98
+ copied = match.index + match[0].length;
99
+ }
100
+ return output + text.slice(copied);
101
+ }
73
102
  var ESCAPABLE_MD_CHARS = ["*", "_", "~", "\\"];
74
103
  var RE_MD_ESCAPE = /\\([*_~\\])/g;
75
104
  var RE_BACKSLASH_PAIR = /\\([\s\S])/g;
@@ -972,10 +1001,10 @@ function inlineToHtml(text) {
972
1001
  RE_MD_ESCAPE,
973
1002
  (_m, ch) => `\0ESC${ESCAPABLE_MD_CHARS.indexOf(ch)}\0`
974
1003
  );
975
- result = result.replace(RE_LEGACY_BOLD_STAR, "<strong>$1</strong>$2");
1004
+ result = recoverLegacyEmphasis(result, RE_LEGACY_BOLD_STAR, RE_BOLD_DELIMITER, 2, "strong");
976
1005
  result = result.replace(RE_BOLD_STAR, "<strong>$1</strong>");
977
1006
  result = result.replace(RE_BOLD_UNDER, "<strong>$1</strong>");
978
- result = result.replace(RE_LEGACY_ITALIC_STAR, "<em>$1</em>$2");
1007
+ result = recoverLegacyEmphasis(result, RE_LEGACY_ITALIC_STAR, RE_ITALIC_DELIMITER, 1, "em");
979
1008
  result = result.replace(RE_ITALIC_STAR, "<em>$1</em>");
980
1009
  result = result.replace(RE_ITALIC_UNDER, "<em>$1</em>");
981
1010
  result = result.replace(RE_STRIKETHROUGH, "<s>$1</s>");
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  RecorderModal
3
- } from "./chunk-C6QVA6TO.js";
3
+ } from "./chunk-UFK47ZAI.js";
4
4
 
5
5
  // src/recorder/RecorderButton.tsx
6
6
  import { useCallback, useState } from "react";
@@ -0,0 +1,107 @@
1
+ // src/recorder/deviceSettings.ts
2
+ var DEFAULT_RECORDER_DEVICE_SETTINGS = {
3
+ constraintMode: "ideal",
4
+ audio: { deviceId: "" },
5
+ camera: { deviceId: "" },
6
+ screen: {},
7
+ screenAudio: {},
8
+ encoding: {
9
+ audioMimeType: "",
10
+ videoMimeType: ""
11
+ }
12
+ };
13
+ function preferredNumber(value, mode) {
14
+ if (value === void 0 || !Number.isFinite(value) || value <= 0) return void 0;
15
+ return { [mode]: value };
16
+ }
17
+ function preferredInteger(value, mode) {
18
+ if (value === void 0 || !Number.isFinite(value) || value <= 0) return void 0;
19
+ return { [mode]: Math.round(value) };
20
+ }
21
+ function preferredString(value, mode) {
22
+ const trimmed = value?.trim();
23
+ return trimmed ? { [mode]: trimmed } : void 0;
24
+ }
25
+ function buildRecorderAudioConstraints(settings) {
26
+ const { audio, constraintMode } = settings;
27
+ const result = {};
28
+ if (audio.deviceId) result.deviceId = { exact: audio.deviceId };
29
+ const groupId = preferredString(audio.groupId, constraintMode);
30
+ if (groupId) result.groupId = groupId;
31
+ if (audio.autoGainControl !== void 0) result.autoGainControl = audio.autoGainControl;
32
+ if (audio.echoCancellation !== void 0) result.echoCancellation = audio.echoCancellation;
33
+ if (audio.noiseSuppression !== void 0) result.noiseSuppression = audio.noiseSuppression;
34
+ const channelCount = preferredInteger(audio.channelCount, constraintMode);
35
+ const latency = preferredNumber(audio.latency, constraintMode);
36
+ const sampleRate = preferredInteger(audio.sampleRate, constraintMode);
37
+ const sampleSize = preferredInteger(audio.sampleSize, constraintMode);
38
+ if (channelCount) result.channelCount = channelCount;
39
+ if (latency) result.latency = latency;
40
+ if (sampleRate) result.sampleRate = sampleRate;
41
+ if (sampleSize) result.sampleSize = sampleSize;
42
+ return result;
43
+ }
44
+ function buildRecorderCameraConstraints(settings) {
45
+ const { camera, constraintMode } = settings;
46
+ const result = {};
47
+ if (camera.deviceId) result.deviceId = { exact: camera.deviceId };
48
+ const groupId = preferredString(camera.groupId, constraintMode);
49
+ if (groupId) result.groupId = groupId;
50
+ if (camera.backgroundBlur !== void 0) result.backgroundBlur = camera.backgroundBlur;
51
+ const aspectRatio = preferredNumber(camera.aspectRatio, constraintMode);
52
+ const facingMode = preferredString(camera.facingMode, constraintMode);
53
+ const frameRate = preferredNumber(camera.frameRate, constraintMode);
54
+ const height = preferredInteger(camera.height, constraintMode);
55
+ const resizeMode = preferredString(camera.resizeMode, constraintMode);
56
+ const width = preferredInteger(camera.width, constraintMode);
57
+ if (aspectRatio) result.aspectRatio = aspectRatio;
58
+ if (facingMode) result.facingMode = facingMode;
59
+ if (frameRate) result.frameRate = frameRate;
60
+ if (height) result.height = height;
61
+ if (resizeMode) result.resizeMode = resizeMode;
62
+ if (width) result.width = width;
63
+ return result;
64
+ }
65
+ function buildRecorderScreenConstraints(settings) {
66
+ const { screen } = settings;
67
+ const result = {};
68
+ const aspectRatio = preferredNumber(screen.aspectRatio, "ideal");
69
+ const cursor = preferredString(screen.cursor, "ideal");
70
+ const displaySurface = preferredString(screen.displaySurface, "ideal");
71
+ const frameRate = preferredNumber(screen.frameRate, "ideal");
72
+ const height = preferredInteger(screen.height, "ideal");
73
+ const resizeMode = preferredString(screen.resizeMode, "ideal");
74
+ const width = preferredInteger(screen.width, "ideal");
75
+ if (screen.logicalSurface !== void 0) result.logicalSurface = screen.logicalSurface;
76
+ if (aspectRatio) result.aspectRatio = aspectRatio;
77
+ if (cursor) result.cursor = cursor;
78
+ if (displaySurface) result.displaySurface = displaySurface;
79
+ if (frameRate) result.frameRate = frameRate;
80
+ if (height) result.height = height;
81
+ if (resizeMode) result.resizeMode = resizeMode;
82
+ if (width) result.width = width;
83
+ return result;
84
+ }
85
+ function buildRecorderScreenAudioConstraints(settings) {
86
+ const result = {};
87
+ if (settings.screenAudio.restrictOwnAudio !== void 0) {
88
+ result.restrictOwnAudio = settings.screenAudio.restrictOwnAudio;
89
+ }
90
+ if (settings.screenAudio.suppressLocalAudioPlayback !== void 0) {
91
+ result.suppressLocalAudioPlayback = settings.screenAudio.suppressLocalAudioPlayback;
92
+ }
93
+ return result;
94
+ }
95
+ function recorderBitsPerSecond(value) {
96
+ if (value === void 0 || !Number.isFinite(value) || value <= 0) return void 0;
97
+ return Math.round(value * 1e3);
98
+ }
99
+
100
+ export {
101
+ DEFAULT_RECORDER_DEVICE_SETTINGS,
102
+ buildRecorderAudioConstraints,
103
+ buildRecorderCameraConstraints,
104
+ buildRecorderScreenConstraints,
105
+ buildRecorderScreenAudioConstraints,
106
+ recorderBitsPerSecond
107
+ };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  MARKDOWN_ESCAPE_ATTR
3
- } from "./chunk-DPAMJV6A.js";
3
+ } from "./chunk-HSWWEWT4.js";
4
4
 
5
5
  // src/MarkdownEscape.ts
6
6
  import { Mark, mergeAttributes } from "@tiptap/core";