@iasiv5/dsh-skills 1.3.6 → 1.3.7

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.
@@ -30,6 +30,14 @@
30
30
  window.__IMPECCABLE_LIVE_INIT__ = false; // reset so the real load can init
31
31
  return;
32
32
  }
33
+ // The user just exited this helper's session: a reload in the next minute,
34
+ // before the agent removes the script tag (a carbonize edit reloads the
35
+ // page), must not bring Live back.
36
+ const EXITED_KEY = 'impeccable-live-exited';
37
+ try {
38
+ const [t, at] = (sessionStorage.getItem(EXITED_KEY) || '').split(' ');
39
+ if (t === TOKEN && Date.now() - Number(at) < 60_000) return;
40
+ } catch { /* storage blocked */ }
33
41
 
34
42
  //
35
43
  // Design tokens
@@ -2709,7 +2717,7 @@
2709
2717
  return el('div', { display: 'none' });
2710
2718
  }
2711
2719
  const row = el('div', {
2712
- display: 'flex', alignItems: 'center', gap: '6px',
2720
+ display: 'flex', alignItems: 'center', gap: touchPrimary() ? '2px' : '6px',
2713
2721
  padding: '1px 2px',
2714
2722
  });
2715
2723
 
@@ -2824,6 +2832,7 @@
2824
2832
  cursor: 'pointer', transition: 'filter 0.12s ease, transform 0.1s ease',
2825
2833
  whiteSpace: 'nowrap',
2826
2834
  });
2835
+ touchTarget(accept);
2827
2836
  accept.textContent = '\u2713 Accept';
2828
2837
  accept.addEventListener('mouseenter', () => accept.style.filter = 'brightness(1.08)');
2829
2838
  accept.addEventListener('mouseleave', () => accept.style.filter = 'none');
@@ -2844,6 +2853,7 @@
2844
2853
  fontFamily: FONT, fontSize: '11px', color: BP.textDim,
2845
2854
  cursor: 'pointer', transition: 'color 0.12s ease, border-color 0.12s ease',
2846
2855
  });
2856
+ touchTarget(discard);
2847
2857
  discard.textContent = '\u2715';
2848
2858
  discard.title = 'Discard all variants';
2849
2859
  discard.addEventListener('mouseenter', () => { discard.style.color = BP.text; discard.style.borderColor = BP.text; });
@@ -2944,6 +2954,12 @@
2944
2954
  return container;
2945
2955
  }
2946
2956
 
2957
+ /** A finger needs 44px; a mouse keeps the compact bar. */
2958
+ function touchTarget(b) {
2959
+ if (touchPrimary()) Object.assign(b.style, { minWidth: '44px', minHeight: '44px' });
2960
+ return b;
2961
+ }
2962
+
2947
2963
  function navBtn(text) {
2948
2964
  const b = el('button', {
2949
2965
  width: '26px', height: '26px', borderRadius: '5px',
@@ -2956,7 +2972,7 @@
2956
2972
  b.textContent = text;
2957
2973
  b.addEventListener('mouseenter', () => { b.style.borderColor = BP.text; });
2958
2974
  b.addEventListener('mouseleave', () => { b.style.borderColor = BP.hairline; });
2959
- return b;
2975
+ return touchTarget(b);
2960
2976
  }
2961
2977
 
2962
2978
  function actionLabel() {
@@ -7843,7 +7859,7 @@
7843
7859
  saveInteractionPrefs();
7844
7860
  updateGlobalBarState();
7845
7861
  showToast('Click anything on the page to restyle it.', 8000);
7846
- } else if (!hasProjectContext && !liveBarHiddenByHelper) showToast(`No PRODUCT.md found. Variants will be brand-agnostic. Run ${IMPECCABLE_COMMAND} init to generate one.`, 7000);
7862
+ } else if (!hasProjectContext && !liveBarHiddenByHelper && takeContextNotice()) showToast(`No PRODUCT.md found. Variants will be brand-agnostic. Run ${IMPECCABLE_COMMAND} init to generate one.`, 7000);
7847
7863
  console.log('[impeccable] Live mode connected.');
7848
7864
  syncAgentPollingUi(!!msg.agentPolling);
7849
7865
  startAgentStatusPoll();
@@ -10574,6 +10590,20 @@ void main() {
10574
10590
  return { pickActive: false, insertActive: false, firstRun: true };
10575
10591
  }
10576
10592
 
10593
+ // The missing-PRODUCT.md notice shows once per browser: a reconnect, a
10594
+ // reload or the variants arriving would otherwise bring it back each time.
10595
+ const CONTEXT_NOTICE_KEY = 'impeccable-live-context-notice';
10596
+ let contextNoticeShown = false;
10597
+ function takeContextNotice() {
10598
+ if (contextNoticeShown) return false;
10599
+ contextNoticeShown = true;
10600
+ try {
10601
+ if (localStorage.getItem(CONTEXT_NOTICE_KEY)) return false;
10602
+ localStorage.setItem(CONTEXT_NOTICE_KEY, '1');
10603
+ } catch { /* ignore */ }
10604
+ return true;
10605
+ }
10606
+
10577
10607
  function saveInteractionPrefs() {
10578
10608
  try {
10579
10609
  localStorage.setItem(INTERACTION_PREFS_KEY, JSON.stringify({ pickActive, insertActive }));
@@ -10755,13 +10785,11 @@ void main() {
10755
10785
  });
10756
10786
  }
10757
10787
 
10758
- function syncGlobalBarExpandedLabels(expanded = globalBarEl?.matches(':hover')) {
10759
- const expandInactive = !!(expanded && !pageChatExpanded);
10760
- applyGlobalBarLabelState(expandInactive, pageChatExpanded);
10761
-
10762
- if (expandInactive && globalBarEl && globalBarEl.scrollWidth > window.innerWidth - 16) {
10763
- applyGlobalBarLabelState(false);
10764
- }
10788
+ // Only active modes show their label. Hover never widens the bar: it sits
10789
+ // centred, so growing labels slid the icons out from under the pointer and a
10790
+ // click meant for Pick landed on Insert. The title tooltip names the rest.
10791
+ function syncGlobalBarExpandedLabels() {
10792
+ applyGlobalBarLabelState(false, pageChatExpanded);
10765
10793
  }
10766
10794
 
10767
10795
  function pageChatCollapsedWidthPx() {
@@ -11167,7 +11195,7 @@ void main() {
11167
11195
  if (!pageChatEl || !pageChatInput) return false;
11168
11196
  pageChatExpanded = true;
11169
11197
  pageChatEl.dataset.expanded = 'true';
11170
- syncGlobalBarExpandedLabels(false);
11198
+ syncGlobalBarExpandedLabels();
11171
11199
  pageChatEl.style.width = pageChatExpandedWidth();
11172
11200
  pageChatEl.style.cursor = steerLocked ? 'default' : 'text';
11173
11201
  pageChatInput.placeholder = PAGE_CHAT_PLACEHOLDER_EXPANDED;
@@ -11310,6 +11338,7 @@ void main() {
11310
11338
  }
11311
11339
  steerPendingMessage = keepExpanded ? restoreMessage : '';
11312
11340
  steerInputWasFocused = false;
11341
+ syncGlobalBarExpandedLabels();
11313
11342
  syncPageChatChrome();
11314
11343
  syncPageChatFocusRing();
11315
11344
  if (opts?.error) showToast(String(opts.error), 5000);
@@ -11602,7 +11631,7 @@ void main() {
11602
11631
  pageChatEl.dataset.expanded = 'false';
11603
11632
  pageChatEl.style.width = PAGE_CHAT_COLLAPSED_W;
11604
11633
  pageChatEl.style.cursor = 'pointer';
11605
- syncGlobalBarExpandedLabels(globalBarEl?.matches(':hover'));
11634
+ syncGlobalBarExpandedLabels();
11606
11635
  if (blur) {
11607
11636
  pageChatInput.blur();
11608
11637
  pageChatInput.style.pointerEvents = 'none';
@@ -12048,7 +12077,7 @@ void main() {
12048
12077
  inner.id = PREFIX + '-global-bar-inner';
12049
12078
  globalBarEl.appendChild(inner);
12050
12079
 
12051
- // Button factory: icon-only at rest, label slides in on hover/active.
12080
+ // Button factory: icon-only at rest, label slides in while active.
12052
12081
  function makeIconBtn({ id, svg, label, ariaLabel, labelFont, onClick }) {
12053
12082
  const b = el('button', {
12054
12083
  position: 'relative',
@@ -12078,10 +12107,8 @@ void main() {
12078
12107
  if (!labelEl || (!force && b.dataset.active === 'true')) return;
12079
12108
  labelEl.style.maxWidth = '0'; labelEl.style.opacity = '0'; labelEl.style.marginLeft = '0'; labelEl.style.transform = 'translateX(-4px)';
12080
12109
  };
12081
- // Per-button hover only changes color (no layout). The label expand/
12082
- // collapse is driven by the bar-level mouseenter/mouseleave so moving
12083
- // the mouse between adjacent buttons doesn't trigger per-button width
12084
- // thrashing - the whole bar grows once and shrinks once.
12110
+ // Hover only changes color, never layout: the label shows while the
12111
+ // mode is active (see syncGlobalBarExpandedLabels).
12085
12112
  b.addEventListener('mouseenter', () => { if (b.dataset.active !== 'true') b.style.color = P.text; });
12086
12113
  b.addEventListener('mouseleave', () => { if (b.dataset.active !== 'true') b.style.color = P.textDim; });
12087
12114
  b.addEventListener('click', onClick);
@@ -12348,27 +12375,20 @@ void main() {
12348
12375
  color: P.textDim, fontFamily: FONT, fontSize: '0', lineHeight: '0',
12349
12376
  cursor: 'pointer', transition: 'color 0.12s ease, background 0.12s ease',
12350
12377
  });
12378
+ touchTarget(exitBtn);
12351
12379
  exitBtn.id = PREFIX + '-exit';
12352
12380
  exitBtn.innerHTML = '<svg width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"><line x1="3" y1="3" x2="11" y2="11"/><line x1="11" y1="3" x2="3" y2="11"/></svg>';
12353
12381
  exitBtn.title = 'Exit live mode';
12354
12382
  exitBtn.addEventListener('mouseenter', () => { exitBtn.style.color = 'oklch(58% 0.15 35)'; exitBtn.style.background = P.exitHover; });
12355
12383
  exitBtn.addEventListener('mouseleave', () => { exitBtn.style.color = P.textDim; exitBtn.style.background = 'transparent'; });
12356
- exitBtn.addEventListener('click', () => { sendEvent({ type: 'exit' }); teardown(); });
12384
+ // source: 'user' keeps a reconnect (the reload a carbonize edit triggers) from cancelling it.
12385
+ exitBtn.addEventListener('click', () => {
12386
+ try { sessionStorage.setItem(EXITED_KEY, TOKEN + ' ' + Date.now()); } catch { /* storage blocked */ }
12387
+ sendEvent({ type: 'exit', source: 'user' });
12388
+ teardown();
12389
+ });
12357
12390
  inner.appendChild(exitBtn);
12358
12391
 
12359
- // Bar-level hover: expand mode labels unless Steer is using the space.
12360
- // Buttons with dataset.active="true" ignore collapse (their label stays).
12361
- globalBarEl.addEventListener('mouseenter', () => {
12362
- syncGlobalBarExpandedLabels(true);
12363
- syncPageChatExpandedWidth();
12364
- schedulePendingDockPosition();
12365
- setTimeout(schedulePendingDockPosition, 260);
12366
- });
12367
- globalBarEl.addEventListener('mouseleave', () => {
12368
- syncGlobalBarExpandedLabels(false);
12369
- schedulePendingDockPosition();
12370
- setTimeout(schedulePendingDockPosition, 260);
12371
- });
12372
12392
  globalBarEl.addEventListener('pointerdown', () => {
12373
12393
  try { window.focus(); } catch { /* in-app preview may block */ }
12374
12394
  }, true);
@@ -12433,7 +12453,7 @@ void main() {
12433
12453
  // If the bar is currently under the cursor, keep all labels expanded -
12434
12454
  // otherwise clicking a toggle that deactivates (e.g. closing DESIGN.md)
12435
12455
  // would collapse its label while the user's mouse is still on the bar.
12436
- syncGlobalBarExpandedLabels(globalBarEl && globalBarEl.matches(':hover'));
12456
+ syncGlobalBarExpandedLabels();
12437
12457
 
12438
12458
  if (detectBadge) {
12439
12459
  detectBadge.style.display = (detectActive && detectCount > 0) ? 'inline' : 'none';