@lalalic/markcut 3.2.27 → 3.2.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lalalic/markcut",
3
- "version": "3.2.27",
3
+ "version": "3.2.29",
4
4
  "description": "Markdown-to-video engine. Describe scenes in markdown, get a rendered video.",
5
5
  "bin": {
6
6
  "markcut": "bin/markcut"
@@ -26,14 +26,35 @@ function clearComments(){
26
26
  comments.length=0;selectedId=null;currentScene={sceneId:null,sceneName:null,sceneStart:0,timeSeconds:0};feedback.value='';mode.value='spot';redrawComments();
27
27
  }
28
28
  window.addEventListener('markcut:scene-change',event=>{currentScene={...(event.detail||{})};});
29
+ function autoSaveBeforeSwitch(){
30
+ const value=feedback.value.trim();
31
+ if(!value)return true; // Empty text never implicitly deletes a saved comment; use −.
32
+ const existing=comments.find(x=>x.id===selectedId);
33
+ if(existing){
34
+ existing.text=value;
35
+ if(existing.scope!=='overall'){
36
+ existing.scope=mode.value;
37
+ if(existing.scope==='scene')existing.context.timeSeconds=Number(existing.context.sceneStart)||0;
38
+ }
39
+ return true;
40
+ }
41
+ const scope=selectedId===0?'overall':mode.value;
42
+ const live=window.__markcutPlaybackContext||currentScene;
43
+ if(scope!=='overall'&&!live.sceneId&&!live.sceneName){status.textContent='Choose a scene first.';return false;}
44
+ comments.push({id:++nextCommentId,scope,text:value,context:scope==='overall'?{sceneId:null,sceneName:null,timeSeconds:0}:
45
+ {...live,timeSeconds:scope==='scene'?(Number(live.sceneStart)||0):(Number(live.timeSeconds)||0)}});
46
+ return true;
47
+ }
29
48
  window.addEventListener('markcut:spot-select',event=>{
30
49
  const id=event.detail?.id;
31
- const note=comments.find(x=>x.id===id);
32
- if(!note&&id!==0)return;
33
- if(selectedId===id){
50
+ if(!comments.some(x=>x.id===id)&&id!==0)return;
51
+ if(!autoSaveBeforeSwitch())return;
52
+ const targetId=id===0?(comments.find(x=>x.scope==='overall')?.id??0):id;
53
+ const note=comments.find(x=>x.id===targetId);
54
+ if(selectedId===targetId){
34
55
  selectedId=null;feedback.value='';redrawComments();return;
35
56
  }
36
- selectedId=id;feedback.value=note?.text||'';if(note&&note.scope!=='overall')mode.value=note.scope;
57
+ selectedId=targetId;feedback.value=note?.text||'';if(note&&note.scope!=='overall')mode.value=note.scope;
37
58
  if(note&&note.scope!=='overall')window.dispatchEvent(new CustomEvent('markcut:comment-select',{detail:note.context}));
38
59
  redrawComments();
39
60
  });
@@ -8,7 +8,7 @@ import { buildPreviewBridgeScript } from "./bridge.mjs";
8
8
  import { externalizePreviewMedia, publicOrigin, resolveMountedFile, resolvePreviewPath, publishPlayerBundle, publishCompiledCache, prunePublishedCache, EXPORT_ROOT } from "./remote-assets.mjs";
9
9
 
10
10
  export const TOOL_NAME = "markcut.preview";
11
- export const RESOURCE_URI = "ui://markcut/video-preview-v33.html";
11
+ export const RESOURCE_URI = "ui://markcut/video-preview-v35.html";
12
12
  // Legacy entrypoints remain registered, but serve the current implementation.
13
13
  export const LEGACY_RESOURCE_URIS = [
14
14
  "ui://markcut/video-preview-v3.html",
@@ -41,6 +41,8 @@ export const LEGACY_RESOURCE_URIS = [
41
41
  "ui://markcut/video-preview-v30.html",
42
42
  "ui://markcut/video-preview-v31.html",
43
43
  "ui://markcut/video-preview-v32.html",
44
+ "ui://markcut/video-preview-v33.html",
45
+ "ui://markcut/video-preview-v34.html",
44
46
  ];
45
47
  export const RESOURCE_MIME_TYPE = "text/html;profile=mcp-app";
46
48
  // Google Maps JS loads libraries, tiles and Routes RPCs from these HTTPS origins.
@@ -288,9 +290,9 @@ export function buildPreviewHtml() {
288
290
  return `<!doctype html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
289
291
  <title>Markcut</title>
290
292
  <style>body{font:14px system-ui;margin:0;background:#fff;color:#17202a}main{padding:12px;max-width:960px;margin:auto}h1{font-size:17px}.path{font-size:12px;overflow-wrap:anywhere}.transport{display:flex;align-items:center;gap:10px;padding:12px 0}.transport input{flex:1;min-width:50px}button{cursor:pointer;padding:8px;border-radius:6px;border:1px solid #a8a8a8}#approve{background:#198038;color:white}#changes{background:#c72b29;color:white}#comment-entry{display:flex;align-items:center;gap:6px;margin:5px 0}#feedback{flex:1;min-width:0;box-sizing:border-box;height:34px;padding:6px 9px;border:1px solid #b5bdc8;border-radius:6px}#comment-mode{max-width:102px;height:34px;border:1px solid #b5bdc8;border-radius:6px;background:white}#save-spot,#remove-spot{width:34px;height:34px;padding:0;font-size:19px}#comment-count{white-space:nowrap}#comment-entry button:disabled{opacity:.4;cursor:default}.review-actions{display:flex;justify-content:space-between;align-items:center;width:100%;gap:16px}.review-actions button{min-width:110px}#remotion-canvas{background:#090b12}#status{padding:8px 0}#status:empty{display:none}#scene-thumbnails{display:flex;gap:7px;overflow-x:auto;padding:12px 2px;scrollbar-width:thin} .scene-pill{flex-shrink:0;padding:7px 11px;border:1px solid #d4dbe4;border-radius:9px;cursor:pointer;background:#f5f7fa;color:#475569;font-size:12px;white-space:nowrap} .scene-pill.active{background:#e7f0ff;color:#125ea2;border-color:#408bd7} .scene-pill.commented{border-color:#cc8b12;background:#fff4d6;color:#764900;font-weight:650} .scene-pill.commented::after{content:' •';color:#ad5b00} #comment-list{display:grid;gap:4px;margin:8px 0} #comment-list>div{display:flex;gap:8px} #comment-list button:first-child{flex:1;text-align:left;overflow:hidden;text-overflow:ellipsis} #comment-target,#comment-count{font-size:12px;color:#526071;margin:8px 0}</style></head>
291
- <style>.comment-marker{position:absolute;top:50%;transform:translate(-50%,-50%);width:20px;height:20px;min-width:20px;padding:0;border:0;border-radius:50%;background:transparent;z-index:10;cursor:pointer;touch-action:none}.comment-marker::after{content:'';display:block;width:14px;height:14px;border-radius:50%;margin:auto;background:#f59e0b;border:2px solid white;box-sizing:border-box}.comment-marker.scope-scene::after{background:#3b82f6}.comment-marker.scope-overall{left:-12px!important}.comment-marker.scope-overall::after{background:#8b5cf6}.comment-marker.scope-overall.placeholder::after{background:transparent;border-color:#8b5cf6}.comment-marker.selected::after,.comment-marker:focus-visible::after{outline:2px solid #2563eb;outline-offset:2px}.comment-marker:hover::after{transform:scale(1.2)}</style>
293
+ <style>.comment-marker{position:absolute;top:50%;transform:translate(-50%,-50%);width:20px;height:20px;min-width:20px;padding:0;border:0;border-radius:50%;background:transparent;z-index:10;cursor:pointer;touch-action:none}.comment-marker::after{content:'';display:block;width:14px;height:14px;border-radius:50%;margin:auto;background:#f59e0b;border:2px solid white;box-sizing:border-box}.comment-marker.scope-scene::after{background:#3b82f6}.comment-marker.scope-overall{left:-28px!important}.comment-marker.scope-overall::after{background:#8b5cf6}.comment-marker.scope-overall.placeholder::after{background:transparent;border-color:#8b5cf6}.comment-marker.selected::after,.comment-marker:focus-visible::after{outline:2px solid #2563eb;outline-offset:2px}.comment-marker:hover::after{transform:scale(1.2)}</style>
292
294
  <style>#comment-entry{position:relative;display:block}#feedback{display:block;width:100%;height:auto;min-height:76px;max-height:240px;field-sizing:content;resize:none;padding:9px 112px 32px 9px;font:inherit}#comment-tools{position:absolute;bottom:6px;right:8px;display:flex;align-items:center;gap:2px;background:white}#comment-tools>*{width:30px;height:28px;padding:0;border:0;background:transparent;color:#526071;font:inherit;text-align:center}#comment-tools button{font-size:20px}#comment-tools>*:focus-visible{outline:2px solid #408bd7;outline-offset:-2px}#comment-mode{width:70px;max-width:none;font-size:12px;font-weight:650;text-align:center;text-align-last:center;line-height:28px}#comment-mode:has(option[value=spot]:checked){color:#b45309}#comment-mode:has(option[value=scene]:checked){color:#2563eb}#overall-mode{width:70px;height:28px;line-height:28px;text-align:center;font-size:12px;font-weight:650;color:#7c3aed}</style>
293
- <body><main><header style="display:flex;justify-content:space-between;align-items:center"><h1>Markcut · <span id="video-md-version">video</span></h1><div style="display:flex;align-items:center;gap:14px;margin-left:auto"><span id="header-tts"></span><span id="player-version" style="font-size:12px;color:#667">v33</span></div></header><div class="path" id="path-label" hidden></div><div id="interactive-ui" hidden><div id="remotion-root"></div>
295
+ <body><main><header style="display:flex;justify-content:space-between;align-items:center"><h1>Markcut · <span id="video-md-version">video</span></h1><div style="display:flex;align-items:center;gap:14px;margin-left:auto"><span id="header-tts"></span><span id="player-version" style="font-size:12px;color:#667">v35</span></div></header><div class="path" id="path-label" hidden></div><div id="interactive-ui" hidden><div id="remotion-root"></div>
294
296
  <div id="comment-entry"><textarea id="feedback" rows="3" aria-label="Feedback" placeholder="Add a comment…"></textarea><div id="comment-tools"><select id="comment-mode" aria-label="Comment scope" title="Comment scope"><option value="spot" style="color:#b45309">Spot</option><option value="scene" style="color:#2563eb">Scene</option></select><span id="overall-mode" hidden>Overall</span><button id="save-spot" type="button" title="Add or update comment" aria-label="Add or update comment">+</button><button id="remove-spot" type="button" title="Remove selected comment" aria-label="Remove selected comment" disabled>−</button></div></div>
295
297
  <div style="display:flex;justify-content:flex-end"><span id="comment-count" aria-live="polite">0 comments</span></div>
296
298
  <div id="status" role="status">Starting preview…</div>