stillmade-sdk 0.1.45 → 0.1.47

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.
@@ -6,6 +6,20 @@ export function installViewRenderer(document,onError=()=>{},onControlsChanged=()
6
6
  const listeners=new Set();
7
7
  const actions=new WeakMap(),compositionState=new WeakMap(),compositions=new Map(),conflicts=new Map();let disposed=false,revision=0,sequence=0,dispatching=false;const roots=new Set();
8
8
  const notify=()=>{try{onControlsChanged();}catch{}};
9
+ // A button whose whole text is "Preview" shows the StillMade preview icon alone (owner, November 6, 2026), in
10
+ // StillMade.render trees and in a view's own HTML, so every Block's preview control looks the same without a new
11
+ // Block version. The label stays as aria-label for screen readers and Chat. Geometry: design-system/preview-icon.js.
12
+ const PREVIEW_PATHS=['M3 8V5a2 2 0 0 1 2-2h3M16 3h3a2 2 0 0 1 2 2v3M21 16v3a2 2 0 0 1-2 2h-3M8 21H5a2 2 0 0 1-2-2v-3','M6.5 12s2.2-3.8 5.5-3.8 5.5 3.8 5.5 3.8-2.2 3.8-5.5 3.8S6.5 12 6.5 12Z'];
13
+ const isPreviewText=value=>typeof value==='string'&&/^\s*preview\s*$/i.test(value);
14
+ const showPreviewIcon=(node,label)=>{
15
+ const ns='http://www.w3.org/2000/svg',svg=document.createElementNS(ns,'svg');
16
+ for(const [name,value] of [['viewBox','0 0 24 24'],['width','20'],['height','20'],['fill','none'],['stroke','currentColor'],['stroke-width','1.5'],['stroke-linecap','round'],['stroke-linejoin','round'],['aria-hidden','true']])svg.setAttribute(name,value);
17
+ for(const d of PREVIEW_PATHS){const path=document.createElementNS(ns,'path');path.setAttribute('d',d);svg.appendChild(path);}
18
+ const pupil=document.createElementNS(ns,'circle');for(const [name,value] of [['cx','12'],['cy','12'],['r','1.8']])pupil.setAttribute(name,value);svg.appendChild(pupil);
19
+ node.textContent='';node.appendChild(svg);node.setAttribute('data-icon-action','true');node.setAttribute('aria-label',label||'Preview');node.setAttribute('title',label||'Preview');
20
+ };
21
+ const iconStaticPreviews=()=>{if(disposed)return;for(const node of document.querySelectorAll('button'))if(!node.children.length&&isPreviewText(node.textContent))showPreviewIcon(node,node.getAttribute('aria-label'));};
22
+ if(document.readyState==='loading')document.addEventListener('DOMContentLoaded',iconStaticPreviews,{once:true});else iconStaticPreviews();
9
23
  // October 30, 2026: Chat also reads and presses a view's plain HTML controls: a button marked
10
24
  // data-stillmade-action, and a labelled input, select or textarea. Shared fields (data-stillmade-share, reached
11
25
  // as shared fields), device-only controls (data-stillmade-local) and file, password and hidden inputs are never
@@ -75,6 +89,7 @@ export function installViewRenderer(document,onError=()=>{},onControlsChanged=()
75
89
  if(item.className!==undefined)node.className=text(item.className,240);
76
90
  if(item.text!==undefined)node.textContent=text(item.text);
77
91
  if(item.label!==undefined)node.setAttribute('aria-label',text(item.label,240));
92
+ if(item.tag==='button'&&isPreviewText(item.text))showPreviewIcon(node,item.label);
78
93
  if(item.type!==undefined){check(item.tag==='input'&&['text','number','range','checkbox','radio','color'].includes(item.type),'Unsupported dynamic input type');node.type=item.type;}
79
94
  for(const key of ['checked','disabled'])if(item[key]!==undefined){check(typeof item[key]==='boolean','Control flags must be boolean');node[key]=item[key];}
80
95
  for(const key of ['min','max','step'])if(item[key]!==undefined){check(typeof item[key]==='string'||typeof item[key]==='number'&&Number.isFinite(item[key]),'Control values must be text or finite numbers');node[key]=text(String(item[key]),10000);}
@@ -133,7 +148,8 @@ export function installViewRenderer(document,onError=()=>{},onControlsChanged=()
133
148
  }
134
149
  // Preserve Block-owned media src/style properties. Only renderer-owned
135
150
  // attributes and control state are reconciled from the validated tree.
136
- for(const name of ['id','class','aria-label','type','min','max','step','placeholder']){
151
+ const iconed=fresh.hasAttribute('data-icon-action')||node.hasAttribute('data-icon-action');
152
+ for(const name of ['id','class','aria-label','type','min','max','step','placeholder',...(iconed?['data-icon-action','title']:[])]){
137
153
  const value=fresh.getAttribute(name);if(value===null)node.removeAttribute(name);else if(node.getAttribute(name)!==value)node.setAttribute(name,value);
138
154
  }
139
155
  reconcile(node,fresh);
@@ -322,3 +322,20 @@
322
322
  :where(.sm-status[data-state="loading"])::before,:where(.sm-glyph[data-glyph="spinner"])::before{animation:none;border-right-color:currentColor;opacity:.6}
323
323
  :where(.sm-more) > :where(summary)::after{transition:none}
324
324
  }
325
+
326
+ /* Actions on the stage (owner, November 5, 2026). A job's sm-actions and sm-status go inside its sm-stage: status top-left,
327
+ actions top-right, in the cream blocks of StillMade's player, over a band kept above the media so they never cover it.
328
+ The run button is always the rightmost, so making again is pressed in the same place it made the first time, and what
329
+ the result adds (Download) sits to its left. On a narrow stage the actions take a second row under the status. */
330
+ :where(.sm-stage:has(> .sm-actions,> .sm-status)){padding-top:calc(var(--s-3,12px) * 2 + var(--touch-target,44px))}
331
+ :where(.sm-stage) > :where(.sm-actions){position:absolute;top:var(--s-3,12px);right:var(--s-3,12px);z-index:2;flex-wrap:nowrap;justify-content:flex-end;max-width:calc(100% - var(--s-3,12px) * 2)}
332
+ :where(.sm-stage) > :where(.sm-actions) > :where(.sm-primary){flex:0 0 auto}
333
+ :where(.sm-stage) > :where(.sm-actions) > :where([data-stillmade-action="run"]){order:99}
334
+ :where(.sm-stage) > :where(.sm-actions) > :where(.sm-quiet,.sm-icon){border-color:transparent;background:var(--cream-100,#F7F0DB);color:var(--ink-600,#0A0A0A)}
335
+ :where(.sm-stage) > :where(.sm-status){position:absolute;top:var(--s-3,12px);left:var(--s-3,12px);z-index:2;display:inline-flex;align-items:center;gap:var(--s-2,8px);min-height:32px;margin:0;padding:0 var(--s-3,12px);border-radius:var(--r-3,8px);background:var(--cream-100,#F7F0DB);color:var(--ink-600,#0A0A0A);font-size:12px}
336
+ :where(.sm-stage) > :where(.sm-status:empty){display:none}
337
+ @container (max-width:420px){
338
+ :where(.sm-stage:has(> .sm-actions):has(> .sm-status:not(:empty))){padding-top:calc(var(--s-3,12px) * 2 + var(--s-2,8px) + 32px + var(--touch-target,44px))}
339
+ :where(.sm-stage:has(> .sm-status:not(:empty))) > :where(.sm-actions){top:calc(var(--s-3,12px) + var(--s-2,8px) + 32px);left:var(--s-3,12px)}
340
+ :where(.sm-stage) > :where(.sm-actions) > :where(.sm-primary){flex:0 1 auto}
341
+ }
@@ -256,15 +256,16 @@
256
256
  }
257
257
 
258
258
  /* Bare icon controls: visible glyph, generous invisible target, no circular chrome. */
259
- button[data-icon-action="true"] {
259
+ button[data-icon-action="true"],a[data-icon-action="true"] {
260
260
  display:inline-flex !important; align-items:center !important; justify-content:center !important;
261
261
  min-width:36px !important; min-height:36px !important; padding:8px !important;
262
262
  border:0 !important; border-radius:0 !important; background:transparent !important;
263
263
  box-shadow:none !important; color:var(--text-secondary, var(--fg)) !important;
264
- flex-shrink:0; line-height:1; cursor:pointer;
264
+ flex-shrink:0; line-height:1; cursor:pointer; text-decoration:none !important;
265
265
  }
266
- button[data-icon-action="true"]:hover:not(:disabled) {color:var(--text-primary, var(--fg)) !important;}
267
- button[data-icon-action="true"]:focus-visible {outline:2px solid var(--signal) !important;outline-offset:2px;}
268
- button[data-icon-action="true"]:disabled {opacity:.4 !important;cursor:not-allowed;}
269
- button[data-icon-action="true"][aria-pressed="true"] {color:var(--text-primary, var(--fg)) !important;text-decoration:underline;text-underline-offset:5px;}
270
- @media (pointer:coarse) {button[data-icon-action="true"] {min-width:44px !important;min-height:44px !important;}}
266
+ button[data-icon-action="true"]:hover:not(:disabled),a[data-icon-action="true"]:hover:not(:disabled) {color:var(--text-primary, var(--fg)) !important;}
267
+ button[data-icon-action="true"]:focus-visible,a[data-icon-action="true"]:focus-visible {outline:2px solid var(--signal) !important;outline-offset:2px;}
268
+ button[data-icon-action="true"]:disabled,a[data-icon-action="true"]:disabled {opacity:.4 !important;cursor:not-allowed;}
269
+ button[data-icon-action="true"][aria-pressed="true"],a[data-icon-action="true"][aria-pressed="true"] {color:var(--text-primary, var(--fg)) !important;text-decoration:underline;text-underline-offset:5px;}
270
+ a[data-icon-action="true"] {flex:0 0 auto !important;align-self:center;} /* an icon link never stretches into a bar */
271
+ @media (pointer:coarse) {button[data-icon-action="true"],a[data-icon-action="true"] {min-width:44px !important;min-height:44px !important;}}