@spark-apps/quickpeek 1.0.0 → 1.1.1
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/LICENSE +21 -0
- package/README.md +200 -0
- package/dist/assets/qp.wm +0 -0
- package/dist/highlight.css +15 -0
- package/dist/qp.js +6143 -0
- package/package.json +64 -45
- package/dist/api-client.d.ts +0 -61
- package/dist/api-client.d.ts.map +0 -1
- package/dist/api-client.js +0 -180
- package/dist/api-client.js.map +0 -1
- package/dist/config.d.ts +0 -69
- package/dist/config.d.ts.map +0 -1
- package/dist/config.js +0 -43
- package/dist/config.js.map +0 -1
- package/dist/crawl.d.ts +0 -18
- package/dist/crawl.d.ts.map +0 -1
- package/dist/crawl.js +0 -175
- package/dist/crawl.js.map +0 -1
- package/dist/cursor.d.ts +0 -6
- package/dist/cursor.d.ts.map +0 -1
- package/dist/cursor.js +0 -6
- package/dist/cursor.js.map +0 -1
- package/dist/ffmpeg.d.ts +0 -50
- package/dist/ffmpeg.d.ts.map +0 -1
- package/dist/ffmpeg.js +0 -224
- package/dist/ffmpeg.js.map +0 -1
- package/dist/index.d.ts +0 -15
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -26
- package/dist/index.js.map +0 -1
- package/dist/prompts.d.ts +0 -13
- package/dist/prompts.d.ts.map +0 -1
- package/dist/prompts.js +0 -91
- package/dist/prompts.js.map +0 -1
- package/dist/styles.d.ts +0 -16
- package/dist/styles.d.ts.map +0 -1
- package/dist/styles.js +0 -66
- package/dist/styles.js.map +0 -1
- package/dist/tts.d.ts +0 -64
- package/dist/tts.d.ts.map +0 -1
- package/dist/tts.js +0 -236
- package/dist/tts.js.map +0 -1
- package/dist/utils.d.ts +0 -25
- package/dist/utils.d.ts.map +0 -1
- package/dist/utils.js +0 -106
- package/dist/utils.js.map +0 -1
- package/dist/voices.d.ts +0 -2
- package/dist/voices.d.ts.map +0 -1
- package/dist/voices.js +0 -73
- package/dist/voices.js.map +0 -1
- package/dist/watermark.d.ts +0 -27
- package/dist/watermark.d.ts.map +0 -1
- package/dist/watermark.js +0 -57
- package/dist/watermark.js.map +0 -1
package/dist/prompts.js
DELETED
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* AI prompts for demo plan generation
|
|
3
|
-
*/
|
|
4
|
-
import { getLanguageName } from './utils.js';
|
|
5
|
-
export { getLanguageName };
|
|
6
|
-
export function buildSystemPrompt(maxSteps) {
|
|
7
|
-
// Tier-based scope guidance
|
|
8
|
-
let scope;
|
|
9
|
-
if (maxSteps <= 5) {
|
|
10
|
-
scope = `SCOPE: Minimal demo (${maxSteps} steps max) - ONE complete user journey only`;
|
|
11
|
-
}
|
|
12
|
-
else if (maxSteps <= 8) {
|
|
13
|
-
scope = `SCOPE: Standard demo (${maxSteps} steps max) - One journey with 1-2 options`;
|
|
14
|
-
}
|
|
15
|
-
else {
|
|
16
|
-
scope = `SCOPE: Extended demo (${maxSteps} steps max) - Journey plus key settings`;
|
|
17
|
-
}
|
|
18
|
-
return `You create demo video scripts for web apps.
|
|
19
|
-
|
|
20
|
-
${scope}
|
|
21
|
-
|
|
22
|
-
CORE FLOW (always follow this structure):
|
|
23
|
-
1. wait - Intro (what does this app do?)
|
|
24
|
-
2. Actions - Complete ONE user journey (upload→process→result)
|
|
25
|
-
3. wait - Outro (what was accomplished?)
|
|
26
|
-
|
|
27
|
-
SELECTOR RULES:
|
|
28
|
-
• Visible buttons: use exact text from AVAILABLE ELEMENTS
|
|
29
|
-
• Hidden buttons (appear after actions): use *Keyword - TRY THESE IN ORDER:
|
|
30
|
-
- Processing: *Extract (preferred), *Generate, *Create, *Convert, *Submit
|
|
31
|
-
- Results: *Download (preferred), *Save, *Export
|
|
32
|
-
• ONLY target real buttons/links - never labels, images, sliders, or files
|
|
33
|
-
|
|
34
|
-
SKIP THESE ELEMENTS (never include in demo):
|
|
35
|
-
• Navigation links: Home, About, Contact, Help, Support, FAQ
|
|
36
|
-
• Account links: Login, Sign In, Sign Up, Register, My Account
|
|
37
|
-
• Business links: Pricing, Plans, Subscribe, Buy, Upgrade
|
|
38
|
-
• Footer links: Privacy, Terms, Blog, Careers, Social media
|
|
39
|
-
• Any header/footer navigation - focus ONLY on the main app functionality
|
|
40
|
-
|
|
41
|
-
FORBIDDEN:
|
|
42
|
-
• Repeating actions (one upload, one process, one download)
|
|
43
|
-
• Clicking downloaded files or results
|
|
44
|
-
• Vague targets like "slider", "animation", "options"
|
|
45
|
-
• More steps than maxSteps allows
|
|
46
|
-
|
|
47
|
-
ACTION FORMATS (use CSS selectors, not descriptions):
|
|
48
|
-
• click: { "action": "click", "target": "button text or CSS selector" }
|
|
49
|
-
• type: { "action": "type", "target": "input[name=...] or #id", "value": "text" }
|
|
50
|
-
• upload: { "action": "upload", "target": "input[type=\\"file\\"]", "value": "[file]" }
|
|
51
|
-
• wait: { "action": "wait" } - no target needed
|
|
52
|
-
• scroll:
|
|
53
|
-
- Page: { "action": "scroll", "value": "up|down" }
|
|
54
|
-
- Zoom: { "action": "scroll", "value": "10|-10" } - positive=in, negative=out (or "in|out")
|
|
55
|
-
• drag:
|
|
56
|
-
- Sliders: { "action": "drag", "target": "input[type=\\"range\\"]", "value": "10" }
|
|
57
|
-
- Rotation: { "action": "drag", "value": "around" } - auto-targets canvas
|
|
58
|
-
• select: { "action": "select", "target": "select#id or select[name=...]", "value": "option" }
|
|
59
|
-
• check: { "action": "check", "target": "input[type=\\"checkbox\\"]" }
|
|
60
|
-
|
|
61
|
-
SELECTOR PRIORITY: CSS selectors > exact button text > *Keyword wildcard`;
|
|
62
|
-
}
|
|
63
|
-
export function buildUserPrompt(url, title, elements, langName, description, maxSteps) {
|
|
64
|
-
const lang = langName ? `\nLanguage: Write ALL captions in ${langName}.` : '';
|
|
65
|
-
const purpose = description ? `\nPurpose: ${description}` : '';
|
|
66
|
-
const minSteps = Math.max(3, Math.floor(maxSteps * 0.6));
|
|
67
|
-
return `URL: ${url}
|
|
68
|
-
Title: ${title}${purpose}
|
|
69
|
-
|
|
70
|
-
AVAILABLE ELEMENTS:
|
|
71
|
-
${JSON.stringify(elements, null, 2)}
|
|
72
|
-
|
|
73
|
-
REQUIREMENTS:
|
|
74
|
-
• ${minSteps}-${maxSteps} steps total (start with wait intro, end with wait outro)
|
|
75
|
-
• Complete ONE user journey: input → process → output
|
|
76
|
-
• Use *Keyword for buttons that appear after actions
|
|
77
|
-
• Final action should be download/save/submit - never click results${lang}
|
|
78
|
-
|
|
79
|
-
Return JSON:
|
|
80
|
-
{
|
|
81
|
-
"url": "${url}",
|
|
82
|
-
"title": "Short demo title",
|
|
83
|
-
"description": "What this app does",
|
|
84
|
-
"steps": [
|
|
85
|
-
{ "id": 1, "action": "wait", "caption": "Intro..." },
|
|
86
|
-
{ "id": 2, "action": "click|upload|type", "target": "selector", "caption": "..." },
|
|
87
|
-
{ "id": N, "action": "wait", "caption": "Outro..." }
|
|
88
|
-
]
|
|
89
|
-
}`;
|
|
90
|
-
}
|
|
91
|
-
//# sourceMappingURL=prompts.js.map
|
package/dist/prompts.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"prompts.js","sourceRoot":"","sources":["../src/prompts.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAQ7C,OAAO,EAAE,eAAe,EAAE,CAAC;AAE3B,MAAM,UAAU,iBAAiB,CAAC,QAAgB;IAChD,4BAA4B;IAC5B,IAAI,KAAa,CAAC;IAClB,IAAI,QAAQ,IAAI,CAAC,EAAE,CAAC;QAClB,KAAK,GAAG,wBAAwB,QAAQ,8CAA8C,CAAC;IACzF,CAAC;SAAM,IAAI,QAAQ,IAAI,CAAC,EAAE,CAAC;QACzB,KAAK,GAAG,yBAAyB,QAAQ,4CAA4C,CAAC;IACxF,CAAC;SAAM,CAAC;QACN,KAAK,GAAG,yBAAyB,QAAQ,yCAAyC,CAAC;IACrF,CAAC;IAED,OAAO;;EAEP,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yEAyCkE,CAAC;AAC1E,CAAC;AAED,MAAM,UAAU,eAAe,CAC7B,GAAW,EACX,KAAa,EACb,QAAuB,EACvB,QAAuB,EACvB,WAA+B,EAC/B,QAAgB;IAEhB,MAAM,IAAI,GAAG,QAAQ,CAAC,CAAC,CAAC,qCAAqC,QAAQ,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;IAC9E,MAAM,OAAO,GAAG,WAAW,CAAC,CAAC,CAAC,cAAc,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAC/D,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,GAAG,GAAG,CAAC,CAAC,CAAC;IAEzD,OAAO,QAAQ,GAAG;SACX,KAAK,GAAG,OAAO;;;EAGtB,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;;;IAG/B,QAAQ,IAAI,QAAQ;;;qEAG6C,IAAI;;;;YAI7D,GAAG;;;;;;;;EAQb,CAAC;AACH,CAAC"}
|
package/dist/styles.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* CSS and ASS styling for QuickPeek
|
|
3
|
-
*/
|
|
4
|
-
/**
|
|
5
|
-
* CSS for the custom cursor overlay
|
|
6
|
-
*/
|
|
7
|
-
export declare const CURSOR_CSS = "\n #qp-cursor {\n position: fixed;\n width: 48px;\n height: 56px;\n background: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAAEsBAMAAAB01OGNAAAAIGNIUk0AAHomAACAhAAA+gAAAIDoAAB1MAAA6mAAADqYAAAXcJy6UTwAAAAtUExURUdwTAAAAAAAAAAAAAAAAAAAAAAAAB0dHVZWVtvb2/X19f///6mpqXV1df////vm1ewAAAAGdFJOUwAltTfpcLO208EAAAABYktHRA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GnsE/R7F2UZ6tI0dwt5Dpo3dJ8LfbDlWGivm3dpuKY0V875z6RLMGtw76J3pDO69ANc6Y3WPCBn+wkUaq48JY3giJg3ukU8+ysgnH2ek5SvUGCYfaaTJhxr95GONbvLRxm7y4cb2iTjeWN08gLFaaYz/AWAIeJtzdhugAAAAAElFTkSuQmCC\") no-repeat;\n background-size: contain;\n pointer-events: none;\n z-index: 2147483647;\n transform: translate(-4px, -4px);\n transition: transform 0.08s ease-out;\n filter: drop-shadow(2px 2px 2px rgba(0,0,0,0.3));\n }\n #qp-cursor.clicking {\n transform: translate(-4px, -4px) scale(0.9);\n }\n";
|
|
8
|
-
/**
|
|
9
|
-
* JavaScript to inject for cursor tracking
|
|
10
|
-
*/
|
|
11
|
-
export declare const CURSOR_SCRIPT = "\n (function() {\n if (document.getElementById('qp-cursor')) return;\n const cursor = document.createElement('div');\n cursor.id = 'qp-cursor';\n document.body.appendChild(cursor);\n\n document.addEventListener('mousemove', (e) => {\n cursor.style.left = e.clientX + 'px';\n cursor.style.top = e.clientY + 'px';\n });\n\n document.addEventListener('mousedown', () => cursor.classList.add('clicking'));\n document.addEventListener('mouseup', () => cursor.classList.remove('clicking'));\n\n // Start at center\n cursor.style.left = window.innerWidth / 2 + 'px';\n cursor.style.top = window.innerHeight / 2 + 'px';\n })();\n";
|
|
12
|
-
/**
|
|
13
|
-
* Generate ASS subtitle file header
|
|
14
|
-
*/
|
|
15
|
-
export declare function generateASSHeader(width: number, height: number, font: string, size: number, primaryColor: string, secondaryColor: string, outlineColor: string, backColor: string, bold: boolean, outlineWidth: number, shadow: number, marginBottom: number): string;
|
|
16
|
-
//# sourceMappingURL=styles.d.ts.map
|
package/dist/styles.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../src/styles.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH;;GAEG;AACH,eAAO,MAAM,UAAU,o7FAgBtB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,aAAa,+pBAmBzB,CAAC;AAEF;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,YAAY,EAAE,MAAM,EACpB,cAAc,EAAE,MAAM,EACtB,YAAY,EAAE,MAAM,EACpB,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,OAAO,EACb,YAAY,EAAE,MAAM,EACpB,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,MAAM,GACnB,MAAM,CAcR"}
|
package/dist/styles.js
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* CSS and ASS styling for QuickPeek
|
|
3
|
-
*/
|
|
4
|
-
import { CURSOR_PNG } from './cursor.js';
|
|
5
|
-
/**
|
|
6
|
-
* CSS for the custom cursor overlay
|
|
7
|
-
*/
|
|
8
|
-
export const CURSOR_CSS = `
|
|
9
|
-
#qp-cursor {
|
|
10
|
-
position: fixed;
|
|
11
|
-
width: 48px;
|
|
12
|
-
height: 56px;
|
|
13
|
-
background: url("${CURSOR_PNG}") no-repeat;
|
|
14
|
-
background-size: contain;
|
|
15
|
-
pointer-events: none;
|
|
16
|
-
z-index: 2147483647;
|
|
17
|
-
transform: translate(-4px, -4px);
|
|
18
|
-
transition: transform 0.08s ease-out;
|
|
19
|
-
filter: drop-shadow(2px 2px 2px rgba(0,0,0,0.3));
|
|
20
|
-
}
|
|
21
|
-
#qp-cursor.clicking {
|
|
22
|
-
transform: translate(-4px, -4px) scale(0.9);
|
|
23
|
-
}
|
|
24
|
-
`;
|
|
25
|
-
/**
|
|
26
|
-
* JavaScript to inject for cursor tracking
|
|
27
|
-
*/
|
|
28
|
-
export const CURSOR_SCRIPT = `
|
|
29
|
-
(function() {
|
|
30
|
-
if (document.getElementById('qp-cursor')) return;
|
|
31
|
-
const cursor = document.createElement('div');
|
|
32
|
-
cursor.id = 'qp-cursor';
|
|
33
|
-
document.body.appendChild(cursor);
|
|
34
|
-
|
|
35
|
-
document.addEventListener('mousemove', (e) => {
|
|
36
|
-
cursor.style.left = e.clientX + 'px';
|
|
37
|
-
cursor.style.top = e.clientY + 'px';
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
document.addEventListener('mousedown', () => cursor.classList.add('clicking'));
|
|
41
|
-
document.addEventListener('mouseup', () => cursor.classList.remove('clicking'));
|
|
42
|
-
|
|
43
|
-
// Start at center
|
|
44
|
-
cursor.style.left = window.innerWidth / 2 + 'px';
|
|
45
|
-
cursor.style.top = window.innerHeight / 2 + 'px';
|
|
46
|
-
})();
|
|
47
|
-
`;
|
|
48
|
-
/**
|
|
49
|
-
* Generate ASS subtitle file header
|
|
50
|
-
*/
|
|
51
|
-
export function generateASSHeader(width, height, font, size, primaryColor, secondaryColor, outlineColor, backColor, bold, outlineWidth, shadow, marginBottom) {
|
|
52
|
-
return `[Script Info]
|
|
53
|
-
Title: QuickPeek Demo
|
|
54
|
-
ScriptType: v4.00+
|
|
55
|
-
PlayResX: ${width}
|
|
56
|
-
PlayResY: ${height}
|
|
57
|
-
|
|
58
|
-
[V4+ Styles]
|
|
59
|
-
Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding
|
|
60
|
-
Style: Karaoke,${font},${size},${primaryColor},${secondaryColor},${outlineColor},${backColor},${bold ? 1 : 0},0,0,0,100,100,0,0,1,${outlineWidth},${shadow},2,40,40,${marginBottom},1
|
|
61
|
-
|
|
62
|
-
[Events]
|
|
63
|
-
Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
|
|
64
|
-
`;
|
|
65
|
-
}
|
|
66
|
-
//# sourceMappingURL=styles.js.map
|
package/dist/styles.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../src/styles.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG;;;;;uBAKH,UAAU;;;;;;;;;;;CAWhC,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG;;;;;;;;;;;;;;;;;;;CAmB5B,CAAC;AAEF;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAC/B,KAAa,EACb,MAAc,EACd,IAAY,EACZ,IAAY,EACZ,YAAoB,EACpB,cAAsB,EACtB,YAAoB,EACpB,SAAiB,EACjB,IAAa,EACb,YAAoB,EACpB,MAAc,EACd,YAAoB;IAEpB,OAAO;;;YAGG,KAAK;YACL,MAAM;;;;iBAID,IAAI,IAAI,IAAI,IAAI,YAAY,IAAI,cAAc,IAAI,YAAY,IAAI,SAAS,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,wBAAwB,YAAY,IAAI,MAAM,YAAY,YAAY;;;;CAIjL,CAAC;AACF,CAAC"}
|
package/dist/tts.d.ts
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Text-to-Speech via Microsoft Edge TTS (free, no API key)
|
|
3
|
-
*/
|
|
4
|
-
import type { Config } from './config.js';
|
|
5
|
-
export interface WordTiming {
|
|
6
|
-
word: string;
|
|
7
|
-
start: number;
|
|
8
|
-
end: number;
|
|
9
|
-
}
|
|
10
|
-
export interface StepAudio {
|
|
11
|
-
duration: number;
|
|
12
|
-
words: WordTiming[];
|
|
13
|
-
}
|
|
14
|
-
export interface AudioResult {
|
|
15
|
-
voiceoverPath: string;
|
|
16
|
-
stepAudio: Map<number, StepAudio>;
|
|
17
|
-
}
|
|
18
|
-
interface Step {
|
|
19
|
-
caption: string;
|
|
20
|
-
action?: string;
|
|
21
|
-
value?: string;
|
|
22
|
-
duration?: number;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Synthesize speech with retry on connection failure
|
|
26
|
-
*/
|
|
27
|
-
export declare function synthesizeSpeech(text: string, outputPath: string, voice: string): Promise<void>;
|
|
28
|
-
export declare function estimateDurationFromText(text: string, wordsPerMinute?: number): number;
|
|
29
|
-
export declare function estimateWordTimings(caption: string, duration: number): WordTiming[];
|
|
30
|
-
export declare function resolveVoice(config: Config): string | null;
|
|
31
|
-
/**
|
|
32
|
-
* Calculate a hash of captions for change detection
|
|
33
|
-
*/
|
|
34
|
-
export declare function getCaptionsHash(steps: Step[]): string;
|
|
35
|
-
/**
|
|
36
|
-
* Metadata stored alongside voiceover for reuse detection
|
|
37
|
-
*/
|
|
38
|
-
export interface VoiceoverMeta {
|
|
39
|
-
captionsHash: string;
|
|
40
|
-
totalCaptionLength: number;
|
|
41
|
-
stepCount: number;
|
|
42
|
-
voice: string;
|
|
43
|
-
stepDurations: Record<number, number>;
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Load existing voiceover metadata if available
|
|
47
|
-
*/
|
|
48
|
-
export declare function loadVoiceoverMeta(outputDir: string): Promise<VoiceoverMeta | null>;
|
|
49
|
-
/**
|
|
50
|
-
* Check if existing voiceover can be reused
|
|
51
|
-
*/
|
|
52
|
-
export declare function canReuseVoiceover(steps: Step[], voice: string, existingMeta: VoiceoverMeta | null): {
|
|
53
|
-
canReuse: boolean;
|
|
54
|
-
reason?: string;
|
|
55
|
-
};
|
|
56
|
-
/**
|
|
57
|
-
* Load existing voiceover and reconstruct stepAudio from metadata
|
|
58
|
-
*/
|
|
59
|
-
export declare function loadExistingVoiceover(steps: Step[], outputDir: string, meta: VoiceoverMeta, config: Config): Promise<AudioResult>;
|
|
60
|
-
export declare function generateVoiceover(steps: Step[], config: Config, workDir: string, outputDir: string, logError: (context: string, error: unknown) => Promise<void>, task: (text: string) => {
|
|
61
|
-
succeed: (text?: string) => void;
|
|
62
|
-
}, info: (text: string) => void): Promise<AudioResult>;
|
|
63
|
-
export {};
|
|
64
|
-
//# sourceMappingURL=tts.d.ts.map
|
package/dist/tts.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tts.d.ts","sourceRoot":"","sources":["../src/tts.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAI1C,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,SAAS;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,UAAU,EAAE,CAAC;CACrB;AAED,MAAM,WAAW,WAAW;IAC1B,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;CACnC;AAED,UAAU,IAAI;IACZ,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AA+BD;;GAEG;AACH,wBAAsB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAkBrG;AAED,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,cAAc,SAAM,GAAG,MAAM,CAGnF;AAED,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,UAAU,EAAE,CAQnF;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAI1D;AAYD;;GAEG;AACH,wBAAgB,eAAe,CAAC,KAA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|
|
|
1
|
-
/**
|
|
2
|
-
* Text-to-Speech via Microsoft Edge TTS (free, no API key)
|
|
3
|
-
*/
|
|
4
|
-
import { mkdir, writeFile } from 'node:fs/promises';
|
|
5
|
-
import { join, resolve } from 'node:path';
|
|
6
|
-
import { concatMedia, generateSilence, getMediaDuration } from './ffmpeg.js';
|
|
7
|
-
import { LANGUAGE_VOICES } from './voices.js';
|
|
8
|
-
/**
|
|
9
|
-
* Estimate duration for steps without captions based on action type
|
|
10
|
-
*/
|
|
11
|
-
function estimateActionDuration(step) {
|
|
12
|
-
if (step.action === 'drag' && step.value === 'around') {
|
|
13
|
-
return 3000; // Drag around takes ~3 seconds
|
|
14
|
-
}
|
|
15
|
-
if (step.action === 'drag') {
|
|
16
|
-
return 2000; // Other drags take ~2 seconds
|
|
17
|
-
}
|
|
18
|
-
if (step.action === 'scroll') {
|
|
19
|
-
return 1500;
|
|
20
|
-
}
|
|
21
|
-
return 1000; // Default 1 second for other actions
|
|
22
|
-
}
|
|
23
|
-
let ttsInstance = null;
|
|
24
|
-
let currentVoice = null;
|
|
25
|
-
/**
|
|
26
|
-
* Create fresh TTS instance
|
|
27
|
-
*/
|
|
28
|
-
async function createTTS(voice) {
|
|
29
|
-
const { MsEdgeTTS, OUTPUT_FORMAT } = await import('msedge-tts');
|
|
30
|
-
const tts = new MsEdgeTTS();
|
|
31
|
-
await tts.setMetadata(voice, OUTPUT_FORMAT.AUDIO_24KHZ_96KBITRATE_MONO_MP3);
|
|
32
|
-
return tts;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Synthesize speech with retry on connection failure
|
|
36
|
-
*/
|
|
37
|
-
export async function synthesizeSpeech(text, outputPath, voice) {
|
|
38
|
-
const maxRetries = 2;
|
|
39
|
-
for (let attempt = 0; attempt <= maxRetries; attempt++) {
|
|
40
|
-
try {
|
|
41
|
-
// Create new instance on first call or after failure
|
|
42
|
-
if (!ttsInstance || currentVoice !== voice || attempt > 0) {
|
|
43
|
-
ttsInstance = await createTTS(voice);
|
|
44
|
-
currentVoice = voice;
|
|
45
|
-
}
|
|
46
|
-
await ttsInstance.toFile(outputPath, text);
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
49
|
-
catch (err) {
|
|
50
|
-
ttsInstance = null; // Reset on failure
|
|
51
|
-
if (attempt === maxRetries)
|
|
52
|
-
throw err;
|
|
53
|
-
await new Promise((r) => setTimeout(r, 500)); // Wait before retry
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
export function estimateDurationFromText(text, wordsPerMinute = 150) {
|
|
58
|
-
const words = text.split(/\s+/).filter((w) => w.length > 0).length;
|
|
59
|
-
return Math.max(Math.round((words / wordsPerMinute) * 60 * 1000), 1500);
|
|
60
|
-
}
|
|
61
|
-
export function estimateWordTimings(caption, duration) {
|
|
62
|
-
const words = caption.split(/\s+/).filter((w) => w.length > 0);
|
|
63
|
-
const wordDuration = duration / words.length;
|
|
64
|
-
return words.map((word, i) => ({
|
|
65
|
-
word,
|
|
66
|
-
start: Math.round(i * wordDuration),
|
|
67
|
-
end: Math.round((i + 1) * wordDuration),
|
|
68
|
-
}));
|
|
69
|
-
}
|
|
70
|
-
export function resolveVoice(config) {
|
|
71
|
-
if (config.audio?.voice)
|
|
72
|
-
return config.audio.voice;
|
|
73
|
-
if (config.lang)
|
|
74
|
-
return LANGUAGE_VOICES[config.lang] || null;
|
|
75
|
-
return null;
|
|
76
|
-
}
|
|
77
|
-
async function concatenateAudio(inputs, output, workDir) {
|
|
78
|
-
const listContent = inputs.map((f) => `file '${resolve(f)}'`).join('\n');
|
|
79
|
-
const listPath = join(workDir, 'concat.txt');
|
|
80
|
-
await writeFile(listPath, listContent);
|
|
81
|
-
await concatMedia(listPath, output);
|
|
82
|
-
// Clean up temp file
|
|
83
|
-
const { unlink } = await import('node:fs/promises');
|
|
84
|
-
await unlink(listPath).catch(() => { });
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* Calculate a hash of captions for change detection
|
|
88
|
-
*/
|
|
89
|
-
export function getCaptionsHash(steps) {
|
|
90
|
-
const captions = steps.map((s) => s.caption || '').join('|');
|
|
91
|
-
// Simple hash - sum of char codes
|
|
92
|
-
let hash = 0;
|
|
93
|
-
for (let i = 0; i < captions.length; i++) {
|
|
94
|
-
hash = ((hash << 5) - hash + captions.charCodeAt(i)) | 0;
|
|
95
|
-
}
|
|
96
|
-
return hash.toString(16);
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* Load existing voiceover metadata if available
|
|
100
|
-
*/
|
|
101
|
-
export async function loadVoiceoverMeta(outputDir) {
|
|
102
|
-
const metaPath = join(outputDir, 'voiceover.json');
|
|
103
|
-
try {
|
|
104
|
-
const { existsSync } = await import('node:fs');
|
|
105
|
-
if (!existsSync(metaPath))
|
|
106
|
-
return null;
|
|
107
|
-
const { readFile } = await import('node:fs/promises');
|
|
108
|
-
const content = await readFile(metaPath, 'utf-8');
|
|
109
|
-
return JSON.parse(content);
|
|
110
|
-
}
|
|
111
|
-
catch {
|
|
112
|
-
return null;
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
/**
|
|
116
|
-
* Save voiceover metadata for future reuse detection
|
|
117
|
-
*/
|
|
118
|
-
async function saveVoiceoverMeta(outputDir, meta) {
|
|
119
|
-
const metaPath = join(outputDir, 'voiceover.json');
|
|
120
|
-
const { writeFile } = await import('node:fs/promises');
|
|
121
|
-
await writeFile(metaPath, JSON.stringify(meta, null, 2));
|
|
122
|
-
}
|
|
123
|
-
/**
|
|
124
|
-
* Check if existing voiceover can be reused
|
|
125
|
-
*/
|
|
126
|
-
export function canReuseVoiceover(steps, voice, existingMeta) {
|
|
127
|
-
if (!existingMeta) {
|
|
128
|
-
return { canReuse: false, reason: 'No existing voiceover found' };
|
|
129
|
-
}
|
|
130
|
-
// Check voice match
|
|
131
|
-
if (existingMeta.voice !== voice) {
|
|
132
|
-
return { canReuse: false, reason: `Voice changed (${existingMeta.voice} → ${voice})` };
|
|
133
|
-
}
|
|
134
|
-
// Check step count
|
|
135
|
-
if (existingMeta.stepCount !== steps.length) {
|
|
136
|
-
return { canReuse: false, reason: `Step count changed (${existingMeta.stepCount} → ${steps.length})` };
|
|
137
|
-
}
|
|
138
|
-
// Check captions hash for exact match
|
|
139
|
-
const currentHash = getCaptionsHash(steps);
|
|
140
|
-
if (existingMeta.captionsHash === currentHash) {
|
|
141
|
-
return { canReuse: true };
|
|
142
|
-
}
|
|
143
|
-
// Check total caption length - allow 10% variance
|
|
144
|
-
const currentLength = steps.reduce((sum, s) => sum + (s.caption?.length || 0), 0);
|
|
145
|
-
const lengthDiff = Math.abs(currentLength - existingMeta.totalCaptionLength);
|
|
146
|
-
const threshold = existingMeta.totalCaptionLength * 0.1;
|
|
147
|
-
if (lengthDiff <= threshold) {
|
|
148
|
-
return { canReuse: true, reason: 'Captions similar enough' };
|
|
149
|
-
}
|
|
150
|
-
return { canReuse: false, reason: 'Captions changed significantly' };
|
|
151
|
-
}
|
|
152
|
-
/**
|
|
153
|
-
* Load existing voiceover and reconstruct stepAudio from metadata
|
|
154
|
-
*/
|
|
155
|
-
export async function loadExistingVoiceover(steps, outputDir, meta, config) {
|
|
156
|
-
const voiceoverPath = join(outputDir, 'voiceover.wav');
|
|
157
|
-
const stepAudio = new Map();
|
|
158
|
-
for (let i = 0; i < steps.length; i++) {
|
|
159
|
-
const step = steps[i];
|
|
160
|
-
const stepNum = i + 1;
|
|
161
|
-
const duration = meta.stepDurations[stepNum] || config.timing.minStepDuration;
|
|
162
|
-
stepAudio.set(stepNum, {
|
|
163
|
-
duration,
|
|
164
|
-
words: estimateWordTimings(step.caption || '', duration),
|
|
165
|
-
});
|
|
166
|
-
}
|
|
167
|
-
return { voiceoverPath, stepAudio };
|
|
168
|
-
}
|
|
169
|
-
export async function generateVoiceover(steps, config, workDir, outputDir, logError, task, info) {
|
|
170
|
-
const voice = resolveVoice(config);
|
|
171
|
-
if (!voice) {
|
|
172
|
-
const stepAudio = new Map();
|
|
173
|
-
for (let i = 0; i < steps.length; i++) {
|
|
174
|
-
const step = steps[i];
|
|
175
|
-
const duration = step.caption ? estimateDurationFromText(step.caption) : estimateActionDuration(step);
|
|
176
|
-
stepAudio.set(i + 1, { duration, words: step.caption ? estimateWordTimings(step.caption, duration) : [] });
|
|
177
|
-
}
|
|
178
|
-
info('No voice configured');
|
|
179
|
-
return { voiceoverPath: '', stepAudio };
|
|
180
|
-
}
|
|
181
|
-
const audioDir = join(workDir, 'audio');
|
|
182
|
-
await mkdir(audioDir, { recursive: true });
|
|
183
|
-
const segments = [];
|
|
184
|
-
const stepAudio = new Map();
|
|
185
|
-
const ttsTask = task('Generating voiceover');
|
|
186
|
-
for (let idx = 0; idx < steps.length; idx++) {
|
|
187
|
-
const step = steps[idx];
|
|
188
|
-
const stepNum = idx + 1;
|
|
189
|
-
// Empty caption = generate silence to keep audio/video in sync
|
|
190
|
-
if (!step.caption) {
|
|
191
|
-
const silenceDuration = estimateActionDuration(step);
|
|
192
|
-
const silencePath = join(audioDir, `step-${stepNum}-silence.mp3`);
|
|
193
|
-
await generateSilence(silencePath, silenceDuration);
|
|
194
|
-
segments.push(silencePath);
|
|
195
|
-
stepAudio.set(stepNum, { duration: silenceDuration, words: [] });
|
|
196
|
-
continue;
|
|
197
|
-
}
|
|
198
|
-
const audioPath = join(audioDir, `step-${stepNum}.mp3`);
|
|
199
|
-
if (segments.length > 0)
|
|
200
|
-
await new Promise((r) => setTimeout(r, 200));
|
|
201
|
-
try {
|
|
202
|
-
await synthesizeSpeech(step.caption, audioPath, voice);
|
|
203
|
-
segments.push(audioPath);
|
|
204
|
-
const audioDuration = await getMediaDuration(audioPath);
|
|
205
|
-
// Use raw audio duration - audio drives timing, no artificial padding
|
|
206
|
-
const stepDuration = Math.max(audioDuration, config.timing.minStepDuration);
|
|
207
|
-
stepAudio.set(stepNum, { duration: stepDuration, words: estimateWordTimings(step.caption, audioDuration) });
|
|
208
|
-
}
|
|
209
|
-
catch (err) {
|
|
210
|
-
await logError(`TTS Step ${stepNum}`, err);
|
|
211
|
-
stepAudio.set(stepNum, { duration: config.timing.minStepDuration, words: [] });
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
const stepsWithCaptions = steps.filter((s) => s.caption).length;
|
|
215
|
-
ttsTask.succeed(`${segments.length}/${stepsWithCaptions} clips`);
|
|
216
|
-
if (segments.length === 0) {
|
|
217
|
-
return { voiceoverPath: '', stepAudio };
|
|
218
|
-
}
|
|
219
|
-
const concatTask = task('Combining audio');
|
|
220
|
-
// Save voiceover to output directory for reuse
|
|
221
|
-
await mkdir(outputDir, { recursive: true });
|
|
222
|
-
const voiceoverPath = join(outputDir, 'voiceover.wav');
|
|
223
|
-
await concatenateAudio(segments, voiceoverPath, workDir);
|
|
224
|
-
concatTask.succeed('Done');
|
|
225
|
-
// Save metadata for future reuse detection
|
|
226
|
-
const meta = {
|
|
227
|
-
captionsHash: getCaptionsHash(steps),
|
|
228
|
-
totalCaptionLength: steps.reduce((sum, s) => sum + (s.caption?.length || 0), 0),
|
|
229
|
-
stepCount: steps.length,
|
|
230
|
-
voice,
|
|
231
|
-
stepDurations: Object.fromEntries(Array.from(stepAudio.entries()).map(([k, v]) => [k, v.duration])),
|
|
232
|
-
};
|
|
233
|
-
await saveVoiceoverMeta(outputDir, meta);
|
|
234
|
-
return { voiceoverPath, stepAudio };
|
|
235
|
-
}
|
|
236
|
-
//# sourceMappingURL=tts.js.map
|
package/dist/tts.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tts.js","sourceRoot":"","sources":["../src/tts.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAE1C,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC7E,OAAO,EAA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,EAAE,IAAI,CAAC,CAAC;IAEzC,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,CAAC;AACtC,CAAC"}
|
package/dist/utils.d.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Utility functions for QuickPeek
|
|
3
|
-
*/
|
|
4
|
-
/**
|
|
5
|
-
* Language code to full name mapping
|
|
6
|
-
*/
|
|
7
|
-
export declare const LANGUAGE_NAMES: Record<string, string>;
|
|
8
|
-
/**
|
|
9
|
-
* Get full language name from ISO code
|
|
10
|
-
*/
|
|
11
|
-
export declare function getLanguageName(lang?: string): string | null;
|
|
12
|
-
/**
|
|
13
|
-
* Convert hex color (#RRGGBB) to ASS subtitle format (&HAABBGGRR)
|
|
14
|
-
*/
|
|
15
|
-
export declare function hexToASS(hex: string, alpha?: number): string;
|
|
16
|
-
/**
|
|
17
|
-
* Convert rgba() or rgb() color string to hex
|
|
18
|
-
*/
|
|
19
|
-
export declare function rgbaToHex(color: string): string;
|
|
20
|
-
/**
|
|
21
|
-
* Convert text to Title Case, keeping prepositions/articles lowercase
|
|
22
|
-
* First word is always capitalized
|
|
23
|
-
*/
|
|
24
|
-
export declare function toTitleCase(text: string): string;
|
|
25
|
-
//# sourceMappingURL=utils.d.ts.map
|
package/dist/utils.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAajD,CAAC;AAEF;;GAEG;AACH,wBAAgB,eAAe,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAG5D;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,SAAI,GAAG,MAAM,CAOvD;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAQ/C;AAsCD;;;GAGG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAYhD"}
|
package/dist/utils.js
DELETED
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Utility functions for QuickPeek
|
|
3
|
-
*/
|
|
4
|
-
/**
|
|
5
|
-
* Language code to full name mapping
|
|
6
|
-
*/
|
|
7
|
-
export const LANGUAGE_NAMES = {
|
|
8
|
-
ar: 'Arabic',
|
|
9
|
-
es: 'Spanish',
|
|
10
|
-
fr: 'French',
|
|
11
|
-
de: 'German',
|
|
12
|
-
zh: 'Chinese',
|
|
13
|
-
ja: 'Japanese',
|
|
14
|
-
ko: 'Korean',
|
|
15
|
-
pt: 'Portuguese',
|
|
16
|
-
ru: 'Russian',
|
|
17
|
-
hi: 'Hindi',
|
|
18
|
-
tr: 'Turkish',
|
|
19
|
-
it: 'Italian',
|
|
20
|
-
};
|
|
21
|
-
/**
|
|
22
|
-
* Get full language name from ISO code
|
|
23
|
-
*/
|
|
24
|
-
export function getLanguageName(lang) {
|
|
25
|
-
if (!lang || lang === 'en')
|
|
26
|
-
return null;
|
|
27
|
-
return LANGUAGE_NAMES[lang] || lang.toUpperCase();
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Convert hex color (#RRGGBB) to ASS subtitle format (&HAABBGGRR)
|
|
31
|
-
*/
|
|
32
|
-
export function hexToASS(hex, alpha = 0) {
|
|
33
|
-
const clean = hex.replace('#', '');
|
|
34
|
-
const r = clean.slice(0, 2);
|
|
35
|
-
const g = clean.slice(2, 4);
|
|
36
|
-
const b = clean.slice(4, 6);
|
|
37
|
-
const a = alpha.toString(16).padStart(2, '0').toUpperCase();
|
|
38
|
-
return `&H${a}${b}${g}${r}`.toUpperCase();
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Convert rgba() or rgb() color string to hex
|
|
42
|
-
*/
|
|
43
|
-
export function rgbaToHex(color) {
|
|
44
|
-
if (color.startsWith('#'))
|
|
45
|
-
return color;
|
|
46
|
-
const match = color.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)/);
|
|
47
|
-
if (!match)
|
|
48
|
-
return '#000000';
|
|
49
|
-
const r = parseInt(match[1], 10).toString(16).padStart(2, '0');
|
|
50
|
-
const g = parseInt(match[2], 10).toString(16).padStart(2, '0');
|
|
51
|
-
const b = parseInt(match[3], 10).toString(16).padStart(2, '0');
|
|
52
|
-
return `#${r}${g}${b}`.toUpperCase();
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Words to keep lowercase in title case (prepositions, articles, conjunctions)
|
|
56
|
-
*/
|
|
57
|
-
const LOWERCASE_WORDS = new Set([
|
|
58
|
-
'a',
|
|
59
|
-
'an',
|
|
60
|
-
'the',
|
|
61
|
-
'and',
|
|
62
|
-
'but',
|
|
63
|
-
'or',
|
|
64
|
-
'nor',
|
|
65
|
-
'for',
|
|
66
|
-
'yet',
|
|
67
|
-
'so',
|
|
68
|
-
'at',
|
|
69
|
-
'by',
|
|
70
|
-
'in',
|
|
71
|
-
'of',
|
|
72
|
-
'on',
|
|
73
|
-
'to',
|
|
74
|
-
'up',
|
|
75
|
-
'as',
|
|
76
|
-
'if',
|
|
77
|
-
'off',
|
|
78
|
-
'per',
|
|
79
|
-
'via',
|
|
80
|
-
'from',
|
|
81
|
-
'into',
|
|
82
|
-
'onto',
|
|
83
|
-
'upon',
|
|
84
|
-
'with',
|
|
85
|
-
'over',
|
|
86
|
-
'under',
|
|
87
|
-
'than',
|
|
88
|
-
]);
|
|
89
|
-
/**
|
|
90
|
-
* Convert text to Title Case, keeping prepositions/articles lowercase
|
|
91
|
-
* First word is always capitalized
|
|
92
|
-
*/
|
|
93
|
-
export function toTitleCase(text) {
|
|
94
|
-
return text.replace(/\w+/g, (word, index) => {
|
|
95
|
-
// Always capitalize first word
|
|
96
|
-
if (index === 0) {
|
|
97
|
-
return word.charAt(0).toUpperCase() + word.slice(1).toLowerCase();
|
|
98
|
-
}
|
|
99
|
-
// Keep prepositions/articles lowercase
|
|
100
|
-
if (LOWERCASE_WORDS.has(word.toLowerCase())) {
|
|
101
|
-
return word.toLowerCase();
|
|
102
|
-
}
|
|
103
|
-
return word.charAt(0).toUpperCase() + word.slice(1).toLowerCase();
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
//# sourceMappingURL=utils.js.map
|
package/dist/utils.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAA2B;IACpD,EAAE,EAAE,QAAQ;IACZ,EAAE,EAAE,SAAS;IACb,EAAE,EAAE,QAAQ;IACZ,EAAE,EAAE,QAAQ;IACZ,EAAE,EAAE,SAAS;IACb,EAAE,EAAE,UAAU;IACd,EAAE,EAAE,QAAQ;IACZ,EAAE,EAAE,YAAY;IAChB,EAAE,EAAE,SAAS;IACb,EAAE,EAAE,OAAO;IACX,EAAE,EAAE,SAAS;IACb,EAAE,EAAE,SAAS;CACd,CAAC;AAEF;;GAEG;AACH,MAAM,UAAU,eAAe,CAAC,IAAa;IAC3C,IAAI,CAAC,IAAI,IAAI,IAAI,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IACxC,OAAO,cAAc,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;AACpD,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,QAAQ,CAAC,GAAW,EAAE,KAAK,GAAG,CAAC;IAC7C,MAAM,KAAK,GAAG,GAAG,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;IACnC,MAAM,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAC5B,MAAM,CAAC,GAAG,KAAK,CAAC,KA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