@happyvertical/smrt-ui 0.57.18 → 0.57.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.
@@ -1 +1 @@
1
- {"version":3,"file":"control-spotlight.d.ts","sourceRoot":"","sources":["../../../src/components/forms/control-spotlight.ts"],"names":[],"mappings":"AAAA,iFAAiF;AACjF,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,WAAW,EACjB,OAAO,EAAE;IAAE,YAAY,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,IAAI,CAAA;CAAE,GACxD,MAAM,IAAI,CA+FZ"}
1
+ {"version":3,"file":"control-spotlight.d.ts","sourceRoot":"","sources":["../../../src/components/forms/control-spotlight.ts"],"names":[],"mappings":"AAAA,iFAAiF;AACjF,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,WAAW,EACjB,OAAO,EAAE;IAAE,YAAY,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,IAAI,CAAA;CAAE,GACxD,MAAM,IAAI,CAiJZ"}
@@ -41,7 +41,26 @@ export function paintControlSpotlight(node, options) {
41
41
  '1px solid currentColor',
42
42
  font: 'inherit',
43
43
  });
44
- root.append(veil, button);
44
+ // An arrow beside the cutout makes a small target easy to find. It sits on
45
+ // the roomier side and bobs gently, unless the visitor reduces motion.
46
+ const arrow = doc.createElement('div');
47
+ arrow.dataset.smrtSpotlightArrow = '';
48
+ arrow.setAttribute('aria-hidden', 'true');
49
+ const ARROW = 40;
50
+ Object.assign(arrow.style, {
51
+ position: 'absolute',
52
+ inlineSize: `${ARROW}px`,
53
+ blockSize: `${ARROW}px`,
54
+ pointerEvents: 'none',
55
+ color: tokens.getPropertyValue('--smrt-color-warning').trim() || '#fbbf24',
56
+ filter: 'drop-shadow(0 2px 4px rgba(0, 0, 0, 0.6))',
57
+ });
58
+ arrow.innerHTML =
59
+ '<svg viewBox="0 0 24 24" width="100%" height="100%" fill="currentColor" stroke="rgba(3, 5, 9, 0.85)" stroke-width="1.5" stroke-linejoin="round"><path d="M12 2 21 12h-5v10H8V12H3z"/></svg>';
60
+ const reduce = view.matchMedia?.('(prefers-reduced-motion: reduce)').matches;
61
+ let bob;
62
+ let direction = '';
63
+ root.append(veil, arrow, button);
45
64
  let disposed = false;
46
65
  let frame = 0;
47
66
  const cleanup = () => {
@@ -49,6 +68,7 @@ export function paintControlSpotlight(node, options) {
49
68
  return;
50
69
  disposed = true;
51
70
  view.cancelAnimationFrame(frame);
71
+ bob?.cancel();
52
72
  root.remove();
53
73
  button.removeEventListener('click', dismiss);
54
74
  };
@@ -84,6 +104,30 @@ export function paintControlSpotlight(node, options) {
84
104
  const x2 = Math.min(view.innerWidth, Math.round(r.right + 8));
85
105
  const y2 = Math.min(view.innerHeight, Math.round(r.bottom + 8));
86
106
  veil.style.clipPath = `polygon(evenodd, 0 0, 100% 0, 100% 100%, 0 100%, 0 0, ${x1}px ${y1}px, ${x1}px ${y2}px, ${x2}px ${y2}px, ${x2}px ${y1}px, ${x1}px ${y1}px)`;
107
+ const next = (r.top + r.bottom) / 2 < view.innerHeight / 2 ? 'up' : 'down';
108
+ const left = Math.min(Math.max(0, Math.round((r.left + r.right) / 2 - ARROW / 2)), Math.max(0, view.innerWidth - ARROW));
109
+ arrow.style.left = `${left}px`;
110
+ arrow.style.top = `${next === 'up' ? y2 + 6 : Math.max(0, y1 - ARROW - 6)}px`;
111
+ if (next !== direction) {
112
+ direction = next;
113
+ arrow.dataset.direction = next;
114
+ arrow.style.transform = next === 'up' ? '' : 'rotate(180deg)';
115
+ bob?.cancel();
116
+ const lift = next === 'up' ? '6px' : '-6px';
117
+ const turn = next === 'up' ? '' : ' rotate(180deg)';
118
+ bob =
119
+ !reduce && typeof arrow.animate === 'function'
120
+ ? arrow.animate([
121
+ { transform: `translateY(0)${turn}` },
122
+ { transform: `translateY(${lift})${turn}` },
123
+ ], {
124
+ duration: 600,
125
+ iterations: Number.POSITIVE_INFINITY,
126
+ direction: 'alternate',
127
+ easing: 'ease-in-out',
128
+ })
129
+ : undefined;
130
+ }
87
131
  // Track movement caused by scrolling, resizing or surrounding layout. No
88
132
  // animation/interpolation is applied, including under reduced motion.
89
133
  frame = view.requestAnimationFrame(update);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@happyvertical/smrt-ui",
3
- "version": "0.57.18",
3
+ "version": "0.57.19",
4
4
  "smrtJsdoc": "strict",
5
5
  "description": "Domain-agnostic Svelte 5 UI runtime for SMRT: primitives, i18n client, theme system, and module UI registry",
6
6
  "type": "module",
@@ -164,7 +164,7 @@
164
164
  "access": "public"
165
165
  },
166
166
  "dependencies": {
167
- "@happyvertical/smrt-types": "0.57.18",
167
+ "@happyvertical/smrt-types": "0.57.19",
168
168
  "esm-env": "^1.2.2"
169
169
  },
170
170
  "peerDependencies": {
@@ -180,7 +180,7 @@
180
180
  }
181
181
  },
182
182
  "devDependencies": {
183
- "@happyvertical/speech": "^0.105.5",
183
+ "@happyvertical/speech": "^0.106.0",
184
184
  "@sveltejs/package": "^2.5.8",
185
185
  "@sveltejs/vite-plugin-svelte": "^7.3.0",
186
186
  "@testing-library/jest-dom": "^7.0.1",