|
24 | 24 | }: { |
25 | 25 | focal: string; |
26 | 26 | models: ColModel[]; |
27 | | - colEdges: [string, string, Lens][]; |
| 27 | + colEdges: [string, string, Lens, string?][]; |
28 | 28 | /** per-model SQL: modelId -> SQL text */ |
29 | 29 | modelSql?: Record<string, string>; |
30 | 30 | /** per-model column expressions: modelId -> { colName -> defining substring } */ |
|
70 | 70 | const kindOf = (id: string) => models.find((m) => m.id === id)?.kind ?? 'table'; |
71 | 71 | const statusOf = (id: string) => models.find((m) => m.id === id)?.status ?? 'ok'; |
72 | 72 | const incomingLens = $derived(new Map<string, Lens>(colEdges.map(([, t, lens]) => [t, lens]))); |
| 73 | + // What a column's incoming edge does: the published transform, such as Cast, or the lens's name. |
| 74 | + const incomingLabel = $derived(new Map<string, string>(colEdges.map(([, t, lens, label]) => [t, label ?? lensLabel[lens]]))); |
| 75 | + const labelOf = (cid: string) => incomingLabel.get(cid) ?? lensLabel.raw; |
73 | 76 |
|
74 | 77 | const focalModel = $derived(models.find((m) => m.id === focal)); |
75 | 78 | let colQuery = $state(''); |
|
223 | 226 | kind: kindOf(modelOf(cid)), |
224 | 227 | status: statusOf(modelOf(cid)), |
225 | 228 | lens: incomingLens.get(cid), |
226 | | - lensLabel, |
| 229 | + label: incomingLens.has(cid) ? labelOf(cid) : undefined, |
227 | 230 | focal: cid === selectedCol, |
228 | 231 | active: cid === activeStep |
229 | 232 | } |
|
284 | 287 | onclick={() => (selectedCol = cid)} |
285 | 288 | > |
286 | 289 | {#if selectedCol === cid}<span class="bg-primary absolute left-0 h-5 w-[2px]"></span>{/if} |
287 | | - <span class="truncate" style:color={selectedCol === cid ? 'var(--foreground)' : 'var(--muted-foreground)'}>{c.name}</span> |
288 | | - <span class="ml-auto shrink-0 text-[11.5px]" class:text-foreground={lens === 'transform'} class:text-muted-foreground={lens !== 'transform'}>{lens ? lensLabel[lens] : ''}</span> |
289 | | - <span class="text-[var(--sb-text-faint)] w-[52px] shrink-0 text-right font-mono text-[11px]">{c.type.toLowerCase()}</span> |
| 290 | + <span class="col-name" style:color={selectedCol === cid ? 'var(--foreground)' : 'var(--muted-foreground)'}>{c.name}</span> |
| 291 | + <span class="ml-auto shrink-0 text-[11.5px]" class:text-foreground={lens === 'transform'} class:text-muted-foreground={lens !== 'transform'}>{lens ? labelOf(cid) : ''}</span> |
| 292 | + {#if c.type}<span class="text-[var(--sb-text-faint)] shrink-0 whitespace-nowrap text-right font-mono text-[11px]">{c.type.toLowerCase()}</span>{/if} |
290 | 293 | </button> |
291 | 294 | {:else} |
292 | 295 | <div class="text-[var(--sb-text-faint)] px-3 py-4 text-center text-[11.5px]">No columns match.</div> |
|
369 | 372 | <li class:focal={st.depth === 0} class:active={activeStep === st.cid}> |
370 | 373 | <button onmouseenter={() => (hoverNode = st.cid)} onmouseleave={() => (hoverNode = null)} onclick={() => (pinnedNode = pinnedNode === st.cid ? null : st.cid)}> |
371 | 374 | <i></i> |
372 | | - <span class="dv-name"><span class="m">{st.model}.</span>{st.col}</span> |
373 | | - <span class="dv-lens" class:strong={st.lens === 'transform'}>{lensLabel[st.lens]}</span> |
| 375 | + <span class="dv-name" title="{st.model}.{st.col}"><span class="m">{st.model}.</span>{st.col}</span> |
| 376 | + <span class="dv-lens" class:strong={st.lens === 'transform'}>{labelOf(st.cid)}</span> |
374 | 377 | {#if st.expr && st.lens !== 'raw'}<code>{@html highlightSqlbuild(st.expr)}</code>{/if} |
375 | 378 | </button> |
376 | 379 | </li> |
|
383 | 386 | <li class:active={activeStep === st.cid}> |
384 | 387 | <button onmouseenter={() => (hoverNode = st.cid)} onmouseleave={() => (hoverNode = null)} onclick={() => (pinnedNode = pinnedNode === st.cid ? null : st.cid)}> |
385 | 388 | <i></i> |
386 | | - <span class="dv-name"><span class="m">{st.model}.</span>{st.col}</span> |
387 | | - <span class="dv-lens" class:strong={st.lens === 'transform'}>{lensLabel[st.lens]}</span> |
| 389 | + <span class="dv-name" title="{st.model}.{st.col}"><span class="m">{st.model}.</span>{st.col}</span> |
| 390 | + <span class="dv-lens" class:strong={st.lens === 'transform'}>{labelOf(st.cid)}</span> |
388 | 391 | {#if st.expr}<code>{@html highlightSqlbuild(st.expr)}</code>{/if} |
389 | 392 | </button> |
390 | 393 | </li> |
|
498 | 501 | border-color: var(--primary); |
499 | 502 | background: var(--primary); |
500 | 503 | } |
| 504 | + /* The identifier being traced wraps rather than truncates. */ |
501 | 505 | .dv-name { |
502 | | - overflow: hidden; |
503 | 506 | font: 12.5px var(--font-mono); |
504 | | - text-overflow: ellipsis; |
505 | | - white-space: nowrap; |
| 507 | + overflow-wrap: anywhere; |
| 508 | + } |
| 509 | + .col-name { |
| 510 | + min-width: 0; |
| 511 | + overflow-wrap: anywhere; |
506 | 512 | } |
507 | 513 | .dv-name .m { |
508 | 514 | color: var(--muted-foreground); |
|
0 commit comments