@1agh/maude 2.2.0 → 2.2.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/apps/studio/canvas-pages-view.tsx +3 -2
- package/apps/studio/canvas-theme-pill.tsx +125 -72
- package/apps/studio/client/v2/left-panel/left-panel.css +8 -0
- package/apps/studio/dist/client.bundle.js +1 -1
- package/apps/studio/dist/styles.css +1 -1
- package/apps/studio/ds/board/board.css +4 -78
- package/apps/studio/ds/board/ds-bar.tsx +15 -9
- package/apps/studio/whats-new.json +9 -0
- package/package.json +8 -8
|
@@ -362,10 +362,11 @@ const SEG_TITLE = {
|
|
|
362
362
|
pages: 'One artboard at a time',
|
|
363
363
|
} as const;
|
|
364
364
|
|
|
365
|
-
/** The two homes of the switch: the canvas pill (canvas-theme-pill.tsx) and the Design system bar (ds-bar.tsx)
|
|
365
|
+
/** The two homes of the switch: the canvas pill (canvas-theme-pill.tsx) and the Design system bar (ds-bar.tsx) —
|
|
366
|
+
* one island since #225, so one set of classes. */
|
|
366
367
|
const SEG_CLASS = {
|
|
367
368
|
pill: { seg: 'dc-theme-pill-seg', b: 'dc-theme-pill-b' },
|
|
368
|
-
ds: { seg: '
|
|
369
|
+
ds: { seg: 'dc-theme-pill-seg', b: 'dc-theme-pill-b' },
|
|
369
370
|
} as const;
|
|
370
371
|
|
|
371
372
|
/**
|
|
@@ -15,6 +15,9 @@
|
|
|
15
15
|
// (smaller, grey), centred in the free band the shell reports with its `occluded-insets` (`topBand`, the stretch
|
|
16
16
|
// between the project pill and the Share cluster) and never wider than it. Short of room the path line goes first,
|
|
17
17
|
// then the name truncates. An older shell sends no band: the pill centres on the frame, as before.
|
|
18
|
+
//
|
|
19
|
+
// #225 — the Design system canvas's bar is the same island (`CanvasTopIsland`, its own controls on the row): it kept a
|
|
20
|
+
// copy of this chrome in ds/board/board.css and missed #217, so on that screen the bar sat elsewhere.
|
|
18
21
|
|
|
19
22
|
import {
|
|
20
23
|
type ReactNode,
|
|
@@ -30,7 +33,7 @@ import { DsIcon } from './canvas-ds-icons.tsx';
|
|
|
30
33
|
import { getCanvasThemeSystemName, setCanvasTheme, useCanvasTheme } from './canvas-theme.ts';
|
|
31
34
|
import { THEME_WORD, ThemeIcon } from './canvas-theme-icons.tsx';
|
|
32
35
|
|
|
33
|
-
/** The
|
|
36
|
+
/** The island's chrome — the canvas pill's AND the Design system bar's (#225: one copy, `CanvasTopIsland`). */
|
|
34
37
|
const PILL_CSS = `
|
|
35
38
|
.dc-theme-pill{position:fixed;left:50%;top:16px;translate:-50% 0;z-index:2147483000;box-sizing:border-box;display:flex;flex-direction:column;align-items:center;gap:5px;min-width:0;min-height:44px;padding:4px 8px 5px;overflow:hidden;border-radius:var(--maude-hud-radius-lg,14px);background:var(--maude-hud-island-bg);color:var(--maude-chrome-fg-0);-webkit-backdrop-filter:saturate(1.4) blur(18px);backdrop-filter:saturate(1.4) blur(18px);box-shadow:var(--maude-hud-island-shadow),inset 0 0 0 .5px var(--maude-hud-island-edge);font:400 var(--maude-hud-type-sm,12px)/1 var(--maude-chrome-font-body);white-space:nowrap}
|
|
36
39
|
.dc-theme-pill-row{display:flex;align-items:center;gap:8px;min-width:0;max-width:100%;padding-left:4px}
|
|
@@ -152,33 +155,26 @@ function canvasFilePath(): string | null {
|
|
|
152
155
|
}
|
|
153
156
|
|
|
154
157
|
/**
|
|
155
|
-
*
|
|
156
|
-
*
|
|
158
|
+
* #225 — the one top-centre island every canvas draws: the canvas pill below, and the Design system canvas's bar
|
|
159
|
+
* (ds/board/ds-bar.tsx), which used to keep its own copy of the chrome — still centred on the frame in the old one-row
|
|
160
|
+
* form after #217, so on that screen the bar sat elsewhere. Placed in the shell's free top band (`pillPlacement`), a
|
|
161
|
+
* column with the canvas's path on its own line above `children` (the host's controls row). Maude's chrome, so tagged
|
|
162
|
+
* `data-dc-overlay` (an export never carries it) and stepping aside while a people pill holds the spot.
|
|
157
163
|
*/
|
|
158
|
-
export function
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
164
|
+
export function CanvasTopIsland({
|
|
165
|
+
testid,
|
|
166
|
+
ariaLabel,
|
|
167
|
+
rowTestid,
|
|
168
|
+
pathTestid,
|
|
169
|
+
children,
|
|
162
170
|
}: {
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
171
|
+
testid: string;
|
|
172
|
+
ariaLabel: string;
|
|
173
|
+
rowTestid: string;
|
|
174
|
+
pathTestid: string;
|
|
175
|
+
/** the controls row, under the path line */
|
|
176
|
+
children: ReactNode;
|
|
168
177
|
}) {
|
|
169
|
-
const mode = useCanvasTheme();
|
|
170
|
-
const [, tick] = useState(0);
|
|
171
|
-
useEffect(() => {
|
|
172
|
-
if (typeof window === 'undefined') return;
|
|
173
|
-
const again = () => tick((n) => n + 1);
|
|
174
|
-
if (document.readyState === 'complete') again();
|
|
175
|
-
else window.addEventListener('load', again, { once: true });
|
|
176
|
-
const off = onProbeStale?.(again);
|
|
177
|
-
return () => {
|
|
178
|
-
window.removeEventListener('load', again);
|
|
179
|
-
off?.();
|
|
180
|
-
};
|
|
181
|
-
}, [onProbeStale]);
|
|
182
178
|
// r5-8 — the canvas's path on the pill; a click copies it whole and the pill says so for a moment
|
|
183
179
|
const [copied, setCopied] = useState<'no' | 'ok' | 'failed'>('no');
|
|
184
180
|
useEffect(() => {
|
|
@@ -198,20 +194,16 @@ export function CanvasThemePill({
|
|
|
198
194
|
setCopied('failed');
|
|
199
195
|
}
|
|
200
196
|
};
|
|
201
|
-
const both = bothThemes();
|
|
202
|
-
const name = getCanvasThemeSystemName();
|
|
203
197
|
// #217 — placed in the shell's free top band; the path line goes first when the band is short
|
|
204
198
|
const band = useTopBand();
|
|
205
199
|
const vw = useViewportWidth();
|
|
206
200
|
const place = pillPlacement(band, vw);
|
|
207
201
|
const pillRef = useRef<HTMLDivElement>(null);
|
|
208
|
-
const textRef = useRef<HTMLSpanElement>(null);
|
|
209
|
-
const titleRef = useRef<HTMLElement>(null);
|
|
210
202
|
const pathRef = useRef<HTMLButtonElement>(null);
|
|
211
203
|
const [pathShown, setPathShown] = useState(true);
|
|
212
204
|
// how many characters of the path fit: it loses its leading folders first, never its file name
|
|
213
205
|
const [pathChars, setPathChars] = useState(PATH_MAX);
|
|
214
|
-
//
|
|
206
|
+
// file and copied change the path line's natural width; the row's own changes reach `fit` through the ResizeObserver
|
|
215
207
|
useLayoutEffect(() => {
|
|
216
208
|
const pill = pillRef.current;
|
|
217
209
|
if (!pill) return undefined;
|
|
@@ -241,7 +233,7 @@ export function CanvasThemePill({
|
|
|
241
233
|
const ro = new ResizeObserver(fit); // Light | Dark and Canvas | Pages may change width after first paint
|
|
242
234
|
ro.observe(pill);
|
|
243
235
|
return () => ro.disconnect();
|
|
244
|
-
}, [place.maxWidth,
|
|
236
|
+
}, [place.maxWidth, file, copied]);
|
|
245
237
|
return (
|
|
246
238
|
<>
|
|
247
239
|
<style data-dc-theme-pill-css="">{PILL_CSS}</style>
|
|
@@ -249,19 +241,19 @@ export function CanvasThemePill({
|
|
|
249
241
|
ref={pillRef}
|
|
250
242
|
className="dc-theme-pill"
|
|
251
243
|
data-dc-overlay=""
|
|
252
|
-
data-testid=
|
|
244
|
+
data-testid={testid}
|
|
253
245
|
data-band={place.banded ? 'band' : 'frame'}
|
|
254
246
|
data-path={file ? (pathShown ? 'shown' : 'hidden') : undefined}
|
|
255
247
|
style={{ left: `${place.left}px`, maxWidth: `${place.maxWidth}px` }}
|
|
256
248
|
role="toolbar"
|
|
257
|
-
aria-label=
|
|
249
|
+
aria-label={ariaLabel}
|
|
258
250
|
>
|
|
259
251
|
{file ? (
|
|
260
252
|
<button
|
|
261
253
|
ref={pathRef}
|
|
262
254
|
type="button"
|
|
263
255
|
className="dc-theme-pill-path"
|
|
264
|
-
data-testid=
|
|
256
|
+
data-testid={pathTestid}
|
|
265
257
|
title={`Copy relative path — ${file}`}
|
|
266
258
|
aria-label={`Copy relative path ${file}`}
|
|
267
259
|
aria-live="polite"
|
|
@@ -274,46 +266,107 @@ export function CanvasThemePill({
|
|
|
274
266
|
: shortenCanvasPath(file, pathChars)}
|
|
275
267
|
</button>
|
|
276
268
|
) : null}
|
|
277
|
-
<div className="dc-theme-pill-row" data-testid=
|
|
278
|
-
{
|
|
279
|
-
<span className="dc-theme-pill-ic" aria-hidden="true">
|
|
280
|
-
<DsIcon name="system" size={14} />
|
|
281
|
-
</span>
|
|
282
|
-
) : null}
|
|
283
|
-
{name ? (
|
|
284
|
-
<span ref={textRef} className="dc-theme-pill-text" data-testid="canvas-theme-text">
|
|
285
|
-
<b ref={titleRef} className="dc-theme-pill-title" data-testid="canvas-theme-title">
|
|
286
|
-
{name}
|
|
287
|
-
</b>
|
|
288
|
-
</span>
|
|
289
|
-
) : null}
|
|
290
|
-
<fieldset className="dc-theme-pill-seg" aria-label="Show every artboard in">
|
|
291
|
-
{(['light', 'dark'] as const).map((m) => (
|
|
292
|
-
<button
|
|
293
|
-
key={m}
|
|
294
|
-
type="button"
|
|
295
|
-
className="dc-theme-pill-b dc-theme-pill-b--ic"
|
|
296
|
-
data-testid={`canvas-theme-mode-${m}`}
|
|
297
|
-
aria-pressed={mode === m}
|
|
298
|
-
aria-label={THEME_WORD[m]}
|
|
299
|
-
disabled={!both && mode !== m}
|
|
300
|
-
// 2.0.7 — icons only (Michal): the name is the tooltip; a theme the canvas lacks says so there
|
|
301
|
-
title={!both && mode !== m ? `This canvas has no ${THEME_WORD[m]}` : THEME_WORD[m]}
|
|
302
|
-
onClick={() => setCanvasTheme(m)}
|
|
303
|
-
>
|
|
304
|
-
<ThemeIcon mode={m} />
|
|
305
|
-
</button>
|
|
306
|
-
))}
|
|
307
|
-
</fieldset>
|
|
308
|
-
{!both ? (
|
|
309
|
-
// read by a screen reader only; the greyed button's tooltip says the same to everyone else
|
|
310
|
-
<span className="dc-theme-pill-sr" data-testid="canvas-theme-note">
|
|
311
|
-
{`This canvas has no ${mode === 'light' ? 'Dark' : 'Light'}`}
|
|
312
|
-
</span>
|
|
313
|
-
) : null}
|
|
314
|
-
{extra}
|
|
269
|
+
<div className="dc-theme-pill-row" data-testid={rowTestid}>
|
|
270
|
+
{children}
|
|
315
271
|
</div>
|
|
316
272
|
</div>
|
|
317
273
|
</>
|
|
318
274
|
);
|
|
319
275
|
}
|
|
276
|
+
|
|
277
|
+
/** The design system's glyph tile and name, as both islands draw them (the name truncates first, never a control). */
|
|
278
|
+
export function TopIslandTitle({
|
|
279
|
+
name,
|
|
280
|
+
textTestid,
|
|
281
|
+
titleTestid,
|
|
282
|
+
}: {
|
|
283
|
+
name: string;
|
|
284
|
+
textTestid?: string;
|
|
285
|
+
titleTestid?: string;
|
|
286
|
+
}) {
|
|
287
|
+
return (
|
|
288
|
+
<>
|
|
289
|
+
<span className="dc-theme-pill-ic" aria-hidden="true">
|
|
290
|
+
<DsIcon name="system" size={14} />
|
|
291
|
+
</span>
|
|
292
|
+
<span className="dc-theme-pill-text" data-testid={textTestid}>
|
|
293
|
+
<b className="dc-theme-pill-title" data-testid={titleTestid}>
|
|
294
|
+
{name}
|
|
295
|
+
</b>
|
|
296
|
+
</span>
|
|
297
|
+
</>
|
|
298
|
+
);
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
/**
|
|
302
|
+
* @param bothThemes does the canvas's design system define Light AND Dark? Asked on every render (the answer can
|
|
303
|
+
* arrive after first paint, once the system's stylesheet has parsed — the pill re-asks on load).
|
|
304
|
+
*/
|
|
305
|
+
export function CanvasThemePill({
|
|
306
|
+
bothThemes,
|
|
307
|
+
onProbeStale,
|
|
308
|
+
extra,
|
|
309
|
+
}: {
|
|
310
|
+
bothThemes: () => boolean;
|
|
311
|
+
/** subscribe to "the answer may have changed" (a stylesheet or the first artboard wrapper arrived) */
|
|
312
|
+
onProbeStale?: (f: () => void) => () => void;
|
|
313
|
+
/** 2.0.7 B2 — drawn after Light | Dark: the canvas's Canvas | Pages (canvas-pages-view.tsx) */
|
|
314
|
+
extra?: ReactNode;
|
|
315
|
+
}) {
|
|
316
|
+
const mode = useCanvasTheme();
|
|
317
|
+
const [, tick] = useState(0);
|
|
318
|
+
useEffect(() => {
|
|
319
|
+
if (typeof window === 'undefined') return;
|
|
320
|
+
const again = () => tick((n) => n + 1);
|
|
321
|
+
if (document.readyState === 'complete') again();
|
|
322
|
+
else window.addEventListener('load', again, { once: true });
|
|
323
|
+
const off = onProbeStale?.(again);
|
|
324
|
+
return () => {
|
|
325
|
+
window.removeEventListener('load', again);
|
|
326
|
+
off?.();
|
|
327
|
+
};
|
|
328
|
+
}, [onProbeStale]);
|
|
329
|
+
const both = bothThemes();
|
|
330
|
+
const name = getCanvasThemeSystemName();
|
|
331
|
+
return (
|
|
332
|
+
<CanvasTopIsland
|
|
333
|
+
testid="canvas-theme-pill"
|
|
334
|
+
ariaLabel="Canvas theme"
|
|
335
|
+
rowTestid="canvas-theme-row"
|
|
336
|
+
pathTestid="canvas-theme-path"
|
|
337
|
+
>
|
|
338
|
+
{name ? (
|
|
339
|
+
<TopIslandTitle
|
|
340
|
+
name={name}
|
|
341
|
+
textTestid="canvas-theme-text"
|
|
342
|
+
titleTestid="canvas-theme-title"
|
|
343
|
+
/>
|
|
344
|
+
) : null}
|
|
345
|
+
<fieldset className="dc-theme-pill-seg" aria-label="Show every artboard in">
|
|
346
|
+
{(['light', 'dark'] as const).map((m) => (
|
|
347
|
+
<button
|
|
348
|
+
key={m}
|
|
349
|
+
type="button"
|
|
350
|
+
className="dc-theme-pill-b dc-theme-pill-b--ic"
|
|
351
|
+
data-testid={`canvas-theme-mode-${m}`}
|
|
352
|
+
aria-pressed={mode === m}
|
|
353
|
+
aria-label={THEME_WORD[m]}
|
|
354
|
+
disabled={!both && mode !== m}
|
|
355
|
+
// 2.0.7 — icons only (Michal): the name is the tooltip; a theme the canvas lacks says so there
|
|
356
|
+
title={!both && mode !== m ? `This canvas has no ${THEME_WORD[m]}` : THEME_WORD[m]}
|
|
357
|
+
onClick={() => setCanvasTheme(m)}
|
|
358
|
+
>
|
|
359
|
+
<ThemeIcon mode={m} />
|
|
360
|
+
</button>
|
|
361
|
+
))}
|
|
362
|
+
</fieldset>
|
|
363
|
+
{!both ? (
|
|
364
|
+
// read by a screen reader only; the greyed button's tooltip says the same to everyone else
|
|
365
|
+
<span className="dc-theme-pill-sr" data-testid="canvas-theme-note">
|
|
366
|
+
{`This canvas has no ${mode === 'light' ? 'Dark' : 'Light'}`}
|
|
367
|
+
</span>
|
|
368
|
+
) : null}
|
|
369
|
+
{extra}
|
|
370
|
+
</CanvasTopIsland>
|
|
371
|
+
);
|
|
372
|
+
}
|
|
@@ -330,8 +330,16 @@
|
|
|
330
330
|
color: var(--fg-2);
|
|
331
331
|
font-variant-numeric: tabular-nums;
|
|
332
332
|
}
|
|
333
|
+
/* #224: the strip scrolls itself within a cap. A system row opened into its artboards (65 for a big system)
|
|
334
|
+
used to grow it past the panel: `.sh-sidebar` clips (F35), so the canvas list below — the panel's only
|
|
335
|
+
scroller — was squeezed to nothing and no wheel scrolled anything. Still `flex: none`: a shrinkable strip
|
|
336
|
+
gave way to the canvas list and cut the system row itself (26 of its 61 px). */
|
|
333
337
|
.lp-pinned {
|
|
334
338
|
flex: none;
|
|
339
|
+
max-height: 40%;
|
|
340
|
+
overflow-x: hidden;
|
|
341
|
+
overflow-y: auto;
|
|
342
|
+
overscroll-behavior: contain;
|
|
335
343
|
margin: 0 var(--space-2) var(--space-1);
|
|
336
344
|
padding-bottom: var(--space-1);
|
|
337
345
|
box-shadow: inset 0 -0.5px 0 var(--border-default);
|