@terpjs/react-core 0.32.0 → 0.33.0
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/README.md +6 -5
- package/package.json +5 -5
- package/src/Breadcrumbs.test.tsx +78 -0
- package/src/Breadcrumbs.tsx +38 -5
- package/src/Page.tsx +16 -3
- package/src/WorkspacePage.test.tsx +69 -0
- package/src/WorkspacePage.tsx +103 -0
- package/src/admin/GroupDetail.tsx +1 -1
- package/src/admin/UserDetail.tsx +1 -1
- package/src/admin/admin.test.tsx +52 -0
- package/src/charts/TrendChart.tsx +24 -18
- package/src/charts/charts.test.tsx +11 -0
- package/src/index.ts +2 -0
- package/src/layoutContract.test.tsx +62 -1
- package/src/layoutContract.ts +12 -0
- package/src/markers.test.ts +4 -0
- package/src/router.test.tsx +1 -1
- package/src/router.tsx +19 -1
- package/src/styles.test.ts +175 -2
- package/src/styles.ts +142 -25
- package/src/trailMemory.ts +56 -0
package/src/styles.ts
CHANGED
|
@@ -302,7 +302,6 @@ html {
|
|
|
302
302
|
[data-terp="button"][data-variant="primary"] {
|
|
303
303
|
background: var(--color-brand-primary);
|
|
304
304
|
color: var(--color-brand-primary-contrast);
|
|
305
|
-
box-shadow: var(--shadow-sm);
|
|
306
305
|
}
|
|
307
306
|
[data-terp="button"][data-variant="secondary"] {
|
|
308
307
|
background: var(--color-neutral-0);
|
|
@@ -1284,7 +1283,16 @@ textarea[data-terp="input"] {
|
|
|
1284
1283
|
step down from the page, in light; the dark themes invert both, which is the direction a
|
|
1285
1284
|
recess wants in each. --color-bg-inset cannot do that job — in three themes it is
|
|
1286
1285
|
declared AS the canvas value, so an inset named from it would be the one thing that
|
|
1287
|
-
disappears.
|
|
1286
|
+
disappears.
|
|
1287
|
+
|
|
1288
|
+
Flat at rest (ADR 0172). The blocks are told apart by their fill and their hairline, never
|
|
1289
|
+
by a shadow: a card, a hub card, a figure, a chart and the table frame all sit on the page
|
|
1290
|
+
at one height. A shadow means a LAYER — something over the page that the page goes on
|
|
1291
|
+
under: a tooltip, a toast, a popover, a dropdown list, a dialog, the phone's nav drawer.
|
|
1292
|
+
It used to mean importance as well — the table frame raised to --shadow-md, the headline
|
|
1293
|
+
figure too, everything else at --shadow-sm and the chrome at none — and three meanings on
|
|
1294
|
+
one scale read as no system at all. Importance is the fill's job (the headline's brand
|
|
1295
|
+
fill, the table's surface), and the chrome's edges were hairlines already. */
|
|
1288
1296
|
[data-terp="card"] {
|
|
1289
1297
|
display: flex;
|
|
1290
1298
|
flex-direction: column;
|
|
@@ -1292,7 +1300,6 @@ textarea[data-terp="input"] {
|
|
|
1292
1300
|
background: var(--color-bg-subtle);
|
|
1293
1301
|
border: 1px solid var(--color-neutral-200);
|
|
1294
1302
|
border-radius: var(--radius-lg);
|
|
1295
|
-
box-shadow: var(--shadow-sm);
|
|
1296
1303
|
padding: var(--space-4);
|
|
1297
1304
|
min-width: 0;
|
|
1298
1305
|
}
|
|
@@ -1347,7 +1354,6 @@ textarea[data-terp="input"] {
|
|
|
1347
1354
|
[data-terp="card"][data-variant="plain"] {
|
|
1348
1355
|
background: none;
|
|
1349
1356
|
border-color: transparent;
|
|
1350
|
-
box-shadow: none;
|
|
1351
1357
|
padding: 0;
|
|
1352
1358
|
}
|
|
1353
1359
|
|
|
@@ -1690,6 +1696,19 @@ textarea[data-terp="input"] {
|
|
|
1690
1696
|
[data-terp="breadcrumbs"] li > [data-terp="breadcrumbs-separator"] {
|
|
1691
1697
|
flex: 0 0 auto;
|
|
1692
1698
|
}
|
|
1699
|
+
/* A crumb whose label is not known yet and never was at this path (ADR 0173): a quiet bar of
|
|
1700
|
+
one width where its words will be, in em so it scales with the crumb or the heading it sits
|
|
1701
|
+
in. Not a stand-in word: the parent's name in the leaf was a wrong title for as long as the
|
|
1702
|
+
record loaded. The words are its visually hidden "Loading", read where the bar is shown. */
|
|
1703
|
+
[data-terp="breadcrumbs-pending"] {
|
|
1704
|
+
display: inline-block;
|
|
1705
|
+
inline-size: 8em;
|
|
1706
|
+
max-inline-size: 100%;
|
|
1707
|
+
block-size: 0.9em;
|
|
1708
|
+
vertical-align: middle;
|
|
1709
|
+
border-radius: var(--radius-sm);
|
|
1710
|
+
background: var(--color-neutral-100);
|
|
1711
|
+
}
|
|
1693
1712
|
/* Keyed on our own marker, not on [aria-current="page"]. The trail's ancestor
|
|
1694
1713
|
crumbs are the app router's links, and TanStack stamps aria-current="page" on
|
|
1695
1714
|
every link whose path is a PREFIX of the current one — which every ancestor
|
|
@@ -1977,7 +1996,13 @@ textarea[data-terp="input"] {
|
|
|
1977
1996
|
and the nav labels in the icon rail, which were a style-object TERNARY before this —
|
|
1978
1997
|
the component picked between two objects per render, and the collapsed branch was
|
|
1979
1998
|
painted by nothing, because the rail state was internal and no specimen could reach it.
|
|
1980
|
-
That is what defaultCollapsed is for.
|
|
1999
|
+
That is what defaultCollapsed is for.
|
|
2000
|
+
|
|
2001
|
+
Every element named here is a block or an inline box, never a table: a table's width and
|
|
2002
|
+
height are minimums, so this rule cannot shrink one. A chart's data table is hidden through
|
|
2003
|
+
its wrapper for that reason. Marked on the table itself, it kept its full size, hung below the
|
|
2004
|
+
chart, stretched the document, and a page whose content fitted could scroll, carrying the
|
|
2005
|
+
shell's sticky sidebar away with it. */
|
|
1981
2006
|
[data-terp="appshell-skip-link"],
|
|
1982
2007
|
[data-terp="drawer-focus-start"],
|
|
1983
2008
|
[data-terp="drawer-focus-end"],
|
|
@@ -1985,6 +2010,7 @@ textarea[data-terp="input"] {
|
|
|
1985
2010
|
[data-terp="stat-trend-data"],
|
|
1986
2011
|
[data-terp="chart-table"],
|
|
1987
2012
|
[data-terp="status-history-data"],
|
|
2013
|
+
[data-terp="breadcrumbs-pending-text"],
|
|
1988
2014
|
[data-terp="appshell-sidebar"][data-collapsed="true"] [data-terp="appshell-brand-title"],
|
|
1989
2015
|
[data-terp="appshell-sidebar"][data-collapsed="true"] [data-terp="appshell-nav-label"],
|
|
1990
2016
|
[data-terp="appshell-sidebar"][data-collapsed="true"] [data-terp="appshell-nav-group-label"] {
|
|
@@ -2232,11 +2258,18 @@ textarea[data-terp="input"] {
|
|
|
2232
2258
|
content — the loading and error frames, where the body is one small block. With
|
|
2233
2259
|
the default the two rows would spread to fill the height. It needs something to
|
|
2234
2260
|
stretch the article before it is observable at all, which is why page-loading and
|
|
2235
|
-
page-error render inside a grid box rather than a plain tall div.
|
|
2261
|
+
page-error render inside a grid box rather than a plain tall div.
|
|
2262
|
+
|
|
2263
|
+
The gap is the room between SECTIONS (ADR 0174), and it is a step wider than the gap inside
|
|
2264
|
+
one: --space-6 against the --space-4 a grid and a hub's cards keep between the blocks of a
|
|
2265
|
+
section. At one shared --space-4, a row of cards was as far from
|
|
2266
|
+
the table under it as the cards were from each other, so nothing said where a section
|
|
2267
|
+
ended. Two rules below cancel or repeat this value and name the same token: the summary
|
|
2268
|
+
band's flush margin and the sequence bar's room above it. */
|
|
2236
2269
|
[data-terp="page"] {
|
|
2237
2270
|
display: grid;
|
|
2238
2271
|
grid-template-columns: minmax(0, 1fr);
|
|
2239
|
-
gap: var(--space-
|
|
2272
|
+
gap: var(--space-6);
|
|
2240
2273
|
align-content: start;
|
|
2241
2274
|
min-width: 0;
|
|
2242
2275
|
}
|
|
@@ -2581,7 +2614,7 @@ textarea[data-terp="input"] {
|
|
|
2581
2614
|
[data-terp="appshell-main"]
|
|
2582
2615
|
> [data-terp="page"]:not([data-measure="narrow"])
|
|
2583
2616
|
> [data-terp="page-summary"] {
|
|
2584
|
-
margin: calc(-1 * var(--space-
|
|
2617
|
+
margin: calc(-1 * var(--space-6)) calc(-1 * var(--shell-gutter)) 0;
|
|
2585
2618
|
padding-inline: var(--shell-gutter);
|
|
2586
2619
|
border-radius: 0;
|
|
2587
2620
|
border-block-end: 1px solid var(--color-neutral-200);
|
|
@@ -2638,9 +2671,14 @@ textarea[data-terp="input"] {
|
|
|
2638
2671
|
As a width it composes instead of competing, because CSS resolves max-width AFTER width:
|
|
2639
2672
|
min(100%, measure) caps a child that has no measure of its own, and a child that has one
|
|
2640
2673
|
still wins with it. min() rather than a bare token so a track narrower than the measure is
|
|
2641
|
-
untouched rather than overflowing.
|
|
2674
|
+
untouched rather than overflowing.
|
|
2675
|
+
|
|
2676
|
+
A workspace's canvas host is exempt as the bands are (ADR 0179): the measure exists for
|
|
2677
|
+
reading, and a canvas is not read along a line. Capped, it stopped at the measure and sat
|
|
2678
|
+
against the start of a wider track, with the band above running past it. Adding it to the
|
|
2679
|
+
one :not() leaves the weight where it was, for the reason the summary band's entry does. */
|
|
2642
2680
|
[data-terp="appshell"][data-content-width="measured"]
|
|
2643
|
-
[data-terp="page"] > *:not([data-terp="page-header"], [data-terp="page-summary"]) {
|
|
2681
|
+
[data-terp="page"] > *:not([data-terp="page-header"], [data-terp="page-summary"], [data-terp="canvas-host"]) {
|
|
2644
2682
|
width: min(100%, var(--shell-content-max-width));
|
|
2645
2683
|
}
|
|
2646
2684
|
/* The reach-through, for the one body child that generates no box of its own. Markdown is
|
|
@@ -2687,7 +2725,9 @@ textarea[data-terp="input"] {
|
|
|
2687
2725
|
grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
|
|
2688
2726
|
align-items: center;
|
|
2689
2727
|
gap: var(--space-3);
|
|
2690
|
-
|
|
2728
|
+
/* The page's own section gap, so the body ends as far above the bar as it starts below the
|
|
2729
|
+
band. */
|
|
2730
|
+
margin-block-start: var(--space-6);
|
|
2691
2731
|
padding-block: var(--space-2) max(var(--space-2), env(safe-area-inset-bottom));
|
|
2692
2732
|
border-block-start: 1px solid var(--color-neutral-200);
|
|
2693
2733
|
background: var(--color-bg-subtle);
|
|
@@ -2801,6 +2841,81 @@ html:has([data-terp="page-sequence"]) {
|
|
|
2801
2841
|
min-width: 0;
|
|
2802
2842
|
}
|
|
2803
2843
|
|
|
2844
|
+
/* The workspace (ADR 0179) ------------------------------------------------ */
|
|
2845
|
+
/* One canvas that fills the screen. Every other page lays its body out as blocks that take
|
|
2846
|
+
the height of their content; a canvas has none of its own and takes the box it is given, so
|
|
2847
|
+
the box has to come from here or from an inline style app code may not write.
|
|
2848
|
+
|
|
2849
|
+
The same scoping the page-sequence bar uses: the shell's main area becomes a flex column
|
|
2850
|
+
only when it holds a workspace, the page grows into it, and inside the page the host grows
|
|
2851
|
+
into what the band and the summary leave. No other page changes. The page keeps its own gap,
|
|
2852
|
+
because a flex column honours gap exactly as the grid did. */
|
|
2853
|
+
[data-terp="appshell-main"]:has(> [data-terp="page"][data-fill="workspace"]) {
|
|
2854
|
+
display: flex;
|
|
2855
|
+
flex-direction: column;
|
|
2856
|
+
}
|
|
2857
|
+
[data-terp="appshell-main"] > [data-terp="page"][data-fill="workspace"] {
|
|
2858
|
+
flex-grow: 1;
|
|
2859
|
+
}
|
|
2860
|
+
[data-terp="page"][data-fill="workspace"] {
|
|
2861
|
+
display: flex;
|
|
2862
|
+
flex-direction: column;
|
|
2863
|
+
}
|
|
2864
|
+
[data-terp="page"][data-fill="workspace"] > [data-terp="canvas-host"] {
|
|
2865
|
+
flex: 1 1 auto;
|
|
2866
|
+
}
|
|
2867
|
+
/* A state in the canvas's place takes the canvas's box: it grows as the host does, keeps the
|
|
2868
|
+
host's floor, and centres its message in it. Otherwise the frame is a short block while the
|
|
2869
|
+
canvas loads and jumps to the full height when it arrives. Only these three: an alert above
|
|
2870
|
+
the canvas is a line of the page, and the canvas takes what it leaves. */
|
|
2871
|
+
[data-terp="page"][data-fill="workspace"] > [data-terp="loading-state"],
|
|
2872
|
+
[data-terp="page"][data-fill="workspace"] > [data-terp="error-state"],
|
|
2873
|
+
[data-terp="page"][data-fill="workspace"] > [data-terp="empty-state"] {
|
|
2874
|
+
flex: 1 1 auto;
|
|
2875
|
+
min-height: 24rem;
|
|
2876
|
+
align-content: center;
|
|
2877
|
+
}
|
|
2878
|
+
/* The host is a block of the page, painted as one: the surface fill, and the hairline and
|
|
2879
|
+
radius a card uses. It clips, so a canvas panned past its edge never paints over the band.
|
|
2880
|
+
clip rather than hidden: hidden makes the host a scroll container, so focusing something on
|
|
2881
|
+
the canvas near its edge could scroll the drawing inside its frame, and clip cannot. The
|
|
2882
|
+
floor keeps a canvas a canvas where nothing gives it height: standalone, and on a viewport
|
|
2883
|
+
shorter than the band plus the floor. */
|
|
2884
|
+
[data-terp="canvas-host"] {
|
|
2885
|
+
position: relative;
|
|
2886
|
+
min-height: 24rem;
|
|
2887
|
+
min-width: 0;
|
|
2888
|
+
overflow: clip;
|
|
2889
|
+
background: var(--color-bg-surface);
|
|
2890
|
+
border: 1px solid var(--color-neutral-200);
|
|
2891
|
+
border-radius: var(--radius-lg);
|
|
2892
|
+
}
|
|
2893
|
+
/* The layer the canvas is drawn in, laid over the whole host, and the framework's own element.
|
|
2894
|
+
The host's height comes from flex growth inside a column that is only min-height tall, so a
|
|
2895
|
+
percentage height resolved against the HOST is not definite. Positioning the canvas itself
|
|
2896
|
+
absolutely would sidestep that, but a canvas library's root is not ours to position: its
|
|
2897
|
+
own sheet sizes it (commonly position: relative and a 100% size), and an unlayered sheet beats
|
|
2898
|
+
every layered rule here. No library styles this layer, and an absolutely positioned box at
|
|
2899
|
+
inset 0 has a definite size, so its child takes 100% of it in both directions and that
|
|
2900
|
+
resolves: an svg fills it and scales its drawing by its viewBox, and a library root that
|
|
2901
|
+
sizes itself to its container gets all of it.
|
|
2902
|
+
|
|
2903
|
+
The explicit 100% is there because an svg is a replaced element: given only a box to sit in,
|
|
2904
|
+
it takes its width from the box and its height from its viewBox's ratio, so a wide diagram sat
|
|
2905
|
+
at the top of a tall canvas instead of in its middle. The first recording of the workspace
|
|
2906
|
+
baseline showed exactly that. Every child takes the whole layer, which is why the host takes
|
|
2907
|
+
one: a second lands below the first and is clipped. A dialog is the exception, at its own
|
|
2908
|
+
size, because an open modal one is in the top layer and a 100% height would stretch it over
|
|
2909
|
+
the whole viewport. */
|
|
2910
|
+
[data-terp="canvas-host-layer"] {
|
|
2911
|
+
position: absolute;
|
|
2912
|
+
inset: 0;
|
|
2913
|
+
}
|
|
2914
|
+
[data-terp="canvas-host-layer"] > :not([data-terp="dialog"]) {
|
|
2915
|
+
width: 100%;
|
|
2916
|
+
height: 100%;
|
|
2917
|
+
}
|
|
2918
|
+
|
|
2804
2919
|
/* The sign-in screen ------------------------------------------------------- */
|
|
2805
2920
|
/* The one screen an unauthenticated user sees, and the only full-viewport page in
|
|
2806
2921
|
the package: a 100vh grid centring one card. The reset layer's box-sizing note
|
|
@@ -2848,7 +2963,6 @@ html:has([data-terp="page-sequence"]) {
|
|
|
2848
2963
|
background: var(--color-neutral-0);
|
|
2849
2964
|
border: 1px solid var(--color-neutral-200);
|
|
2850
2965
|
border-radius: var(--radius-lg);
|
|
2851
|
-
box-shadow: var(--shadow-md);
|
|
2852
2966
|
}
|
|
2853
2967
|
[data-terp="login-brand"] {
|
|
2854
2968
|
display: flex;
|
|
@@ -3058,7 +3172,6 @@ html:has([data-terp="page-sequence"]) {
|
|
|
3058
3172
|
background: var(--color-bg-subtle);
|
|
3059
3173
|
border: 1px solid var(--color-neutral-200);
|
|
3060
3174
|
border-radius: var(--radius-lg);
|
|
3061
|
-
box-shadow: var(--shadow-sm);
|
|
3062
3175
|
color: var(--color-neutral-900);
|
|
3063
3176
|
box-sizing: border-box;
|
|
3064
3177
|
transition: border-color var(--motion-duration-fast) var(--motion-easing-standard);
|
|
@@ -3184,11 +3297,11 @@ html:has([data-terp="page-sequence"]) {
|
|
|
3184
3297
|
leaves the toolbar inside a surface, and leaves two nested frames whenever the view
|
|
3185
3298
|
is empty (the empty state's dashed frame inside the card's solid one).
|
|
3186
3299
|
|
|
3187
|
-
What the slot carries is the surface itself — a fill, a border and a radius
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3300
|
+
What the slot carries is the surface itself — a fill, a border and a radius. The
|
|
3301
|
+
collection is where data is read, so under ADR 0169's surface ladder it keeps
|
|
3302
|
+
--color-bg-surface while the containers around it step back to --color-bg-subtle: the
|
|
3303
|
+
table is the brightest object on the page by rule. It was raised by --shadow-md as well,
|
|
3304
|
+
and no longer is: a block at rest is flat (ADR 0172), and the fill already says it. None of that moves the ownership settled above: the frame is the
|
|
3192
3305
|
table's, not the view's.
|
|
3193
3306
|
|
|
3194
3307
|
Keyed on [data-variant="full"] rather than the bare marker for the reason the
|
|
@@ -3201,7 +3314,6 @@ html:has([data-terp="page-sequence"]) {
|
|
|
3201
3314
|
background: var(--color-bg-surface);
|
|
3202
3315
|
border: 1px solid var(--color-neutral-200);
|
|
3203
3316
|
border-radius: var(--radius-lg);
|
|
3204
|
-
box-shadow: var(--shadow-md);
|
|
3205
3317
|
}
|
|
3206
3318
|
/* The horizontal scroll container the reset's scrollbar comment already names. A
|
|
3207
3319
|
marker rather than [data-terp="dataview"] > div, which also matches the toolbar.
|
|
@@ -3704,7 +3816,6 @@ th[data-terp="dataview-actions-cell"] > span {
|
|
|
3704
3816
|
background: var(--color-bg-surface);
|
|
3705
3817
|
border: 1px solid var(--color-neutral-200);
|
|
3706
3818
|
border-radius: var(--radius-lg);
|
|
3707
|
-
box-shadow: var(--shadow-sm);
|
|
3708
3819
|
}
|
|
3709
3820
|
[data-terp="dataview-card"][data-clickable="true"] {
|
|
3710
3821
|
cursor: pointer;
|
|
@@ -4667,7 +4778,6 @@ button[data-terp="input"][data-placeholder="true"] {
|
|
|
4667
4778
|
border: 1px solid var(--color-neutral-200);
|
|
4668
4779
|
border-radius: var(--radius-lg);
|
|
4669
4780
|
background: var(--color-bg-surface);
|
|
4670
|
-
box-shadow: var(--shadow-sm);
|
|
4671
4781
|
color: var(--color-fg-default);
|
|
4672
4782
|
}
|
|
4673
4783
|
[data-terp="chart-caption"] {
|
|
@@ -5070,7 +5180,6 @@ button[data-terp="input"][data-placeholder="true"] {
|
|
|
5070
5180
|
border: 1px solid var(--color-neutral-200);
|
|
5071
5181
|
border-radius: var(--radius-lg);
|
|
5072
5182
|
background: var(--color-bg-surface);
|
|
5073
|
-
box-shadow: var(--shadow-sm);
|
|
5074
5183
|
color: var(--color-fg-default);
|
|
5075
5184
|
}
|
|
5076
5185
|
[data-terp="stat-label"] {
|
|
@@ -5191,7 +5300,6 @@ button[data-terp="input"][data-placeholder="true"] {
|
|
|
5191
5300
|
[data-terp="stat"][data-headline] {
|
|
5192
5301
|
border-color: var(--color-brand-primary);
|
|
5193
5302
|
background: var(--color-brand-primary);
|
|
5194
|
-
box-shadow: var(--shadow-md);
|
|
5195
5303
|
color: var(--color-brand-primary-contrast);
|
|
5196
5304
|
}
|
|
5197
5305
|
[data-terp="stat"][data-headline] [data-terp="stat-label"],
|
|
@@ -5273,7 +5381,6 @@ button[data-terp="input"][data-placeholder="true"] {
|
|
|
5273
5381
|
border: 0;
|
|
5274
5382
|
border-radius: 0;
|
|
5275
5383
|
background: none;
|
|
5276
|
-
box-shadow: none;
|
|
5277
5384
|
}
|
|
5278
5385
|
/* In a hub card's stat row the card is the frame, so an ordinary figure has none of its own
|
|
5279
5386
|
there. The headline keeps its fill wherever it is. */
|
|
@@ -5282,7 +5389,6 @@ button[data-terp="input"][data-placeholder="true"] {
|
|
|
5282
5389
|
border: 0;
|
|
5283
5390
|
border-radius: 0;
|
|
5284
5391
|
background: none;
|
|
5285
|
-
box-shadow: none;
|
|
5286
5392
|
}
|
|
5287
5393
|
|
|
5288
5394
|
/* Tooltips ----------------------------------------------------------------- */
|
|
@@ -6266,6 +6372,17 @@ button[data-terp="input"][data-placeholder="true"] {
|
|
|
6266
6372
|
box-shadow: 0 0 0 3px var(--color-focus-ring);
|
|
6267
6373
|
}
|
|
6268
6374
|
|
|
6375
|
+
/* The canvas's ring, drawn on its host (ADR 0179). A canvas that answers keys takes focus, and
|
|
6376
|
+
it fills the host's layer edge to edge, so any ring drawn around it lies outside the host's
|
|
6377
|
+
padding box and the host's clip cuts all of it away: a keyboard user on the canvas saw no
|
|
6378
|
+
indicator at all. The host's own outline and shadow sit outside the box it clips, so the ring
|
|
6379
|
+
moves there, the shared ring's declarations unchanged, while the canvas has keyboard focus. */
|
|
6380
|
+
[data-terp="canvas-host"]:has(> [data-terp="canvas-host-layer"] > :focus-visible) {
|
|
6381
|
+
outline: 2px solid var(--color-fg-accent);
|
|
6382
|
+
outline-offset: 1px;
|
|
6383
|
+
box-shadow: 0 0 0 3px var(--color-focus-ring);
|
|
6384
|
+
}
|
|
6385
|
+
|
|
6269
6386
|
/* The pager's disabled ink, scoped rather than added to the shared iconbutton
|
|
6270
6387
|
rule above: of the seventeen sites wearing that marker only six can be disabled at
|
|
6271
6388
|
all — these four and the view-options panel's two reorder arrows, which carry
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { createContext, useContext } from "react";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* What the breadcrumb trail has already said about each place, for as long as the app runs
|
|
5
|
+
* (ADR 0173).
|
|
6
|
+
*
|
|
7
|
+
* Every routed view mounts its own page, so the trail is built again on every navigation, and
|
|
8
|
+
* a label that comes from data (a record's name) is not known again until that data is: the
|
|
9
|
+
* trail used to print a stand-in and then the name, on every visit, on every tab of a detail,
|
|
10
|
+
* and on the parent crumb one level down. The trail is the same place it was a moment ago, so
|
|
11
|
+
* it can say so. A crumb whose label is not known yet shows the last label it had at that
|
|
12
|
+
* path, and only a place never seen before shows a placeholder.
|
|
13
|
+
*
|
|
14
|
+
* The router's shell holds the labels, one map for the app's lifetime ({@link TrailLabelsContext}),
|
|
15
|
+
* and each routed view binds them to the path ITS OWN match is at. Not the router's current
|
|
16
|
+
* location: during a navigation the old page is still rendered while the location is already
|
|
17
|
+
* the new one, so a leaf keyed by the location remembered the page being left under the name of
|
|
18
|
+
* the page being opened, and the detail then recalled its parent's title. A trail outside a Terp
|
|
19
|
+
* router has no memory: a pending crumb is a placeholder there, and nothing else changes.
|
|
20
|
+
*/
|
|
21
|
+
export interface TrailMemory {
|
|
22
|
+
/** The path this routed view's own match is at: the key for its leaf, which has no `to`. */
|
|
23
|
+
readonly pathname: string;
|
|
24
|
+
/** The last label shown at *path*, if any. */
|
|
25
|
+
recall(path: string): string | undefined;
|
|
26
|
+
/** Remember *label* as what *path* is called. */
|
|
27
|
+
remember(path: string, label: string): void;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** One spelling per place: no query, no fragment, no trailing slash past the root. */
|
|
31
|
+
export function trailPath(path: string): string {
|
|
32
|
+
const bare = path.split(/[?#]/, 1)[0]!;
|
|
33
|
+
return bare.length > 1 ? bare.replace(/\/+$/, "") : bare;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** A memory over *labels*, at *pathname*. The map outlives the value, which a navigation replaces. */
|
|
37
|
+
export function trailMemory(labels: Map<string, string>, pathname: string): TrailMemory {
|
|
38
|
+
return {
|
|
39
|
+
pathname,
|
|
40
|
+
recall: (path) => labels.get(trailPath(path)),
|
|
41
|
+
remember: (path, label) => {
|
|
42
|
+
labels.set(trailPath(path), label);
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/** The labels themselves, held by the router's shell across every navigation. */
|
|
48
|
+
export const TrailLabelsContext = createContext<Map<string, string> | null>(null);
|
|
49
|
+
|
|
50
|
+
/** The memory bound to the routed view's own path. */
|
|
51
|
+
export const TrailMemoryContext = createContext<TrailMemory | null>(null);
|
|
52
|
+
|
|
53
|
+
/** The surrounding router's trail memory, or `null` outside one. */
|
|
54
|
+
export function useTrailMemory(): TrailMemory | null {
|
|
55
|
+
return useContext(TrailMemoryContext);
|
|
56
|
+
}
|