@connextar/house 0.23.1 → 0.24.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 +55 -13
- package/dist/analytics/browser.d.ts +1 -0
- package/dist/analytics/browser.d.ts.map +1 -1
- package/dist/analytics/browser.js +22 -5
- package/dist/analytics/browser.js.map +1 -1
- package/dist/analytics/config.d.ts +5 -0
- package/dist/analytics/config.d.ts.map +1 -1
- package/dist/analytics/config.js +4 -1
- package/dist/analytics/config.js.map +1 -1
- package/dist/analytics/posthog-extensions.d.ts +19 -0
- package/dist/analytics/posthog-extensions.d.ts.map +1 -0
- package/dist/analytics/posthog-extensions.js +19 -0
- package/dist/analytics/posthog-extensions.js.map +1 -0
- package/dist/analytics/react.d.ts.map +1 -1
- package/dist/analytics/react.js +4 -2
- package/dist/analytics/react.js.map +1 -1
- package/dist/analytics/redact.d.ts.map +1 -1
- package/dist/analytics/redact.js +6 -1
- package/dist/analytics/redact.js.map +1 -1
- package/dist/house.css +19 -0
- package/package.json +17 -3
- package/src/account/data-contract.ts +112 -0
- package/src/account/index.ts +11 -0
- package/src/admin/access.ts +267 -0
- package/src/admin/audit.ts +238 -0
- package/src/admin/bootstrap.ts +220 -0
- package/src/admin/client-index.ts +19 -0
- package/src/admin/client.tsx +187 -0
- package/src/admin/index.ts +91 -0
- package/src/admin/proof.ts +155 -0
- package/src/admin/second-factor-index.ts +16 -0
- package/src/admin/second-factor.ts +403 -0
- package/src/admin/testing-index.ts +13 -0
- package/src/admin/testing.ts +299 -0
- package/src/admin/view-as.ts +511 -0
- package/src/ai/config-index.ts +40 -0
- package/src/ai/config.ts +176 -0
- package/src/ai/images.ts +18 -0
- package/src/ai/index.ts +21 -0
- package/src/ai/pricing.ts +107 -0
- package/src/ai/provider.ts +403 -0
- package/src/analytics/browser.ts +400 -0
- package/src/analytics/client-index.ts +12 -0
- package/src/analytics/config.ts +89 -0
- package/src/analytics/index.ts +17 -0
- package/src/analytics/ingest.ts +81 -0
- package/src/analytics/posthog-extensions.ts +19 -0
- package/src/analytics/react-index.ts +16 -0
- package/src/analytics/react.tsx +241 -0
- package/src/analytics/redact.ts +146 -0
- package/src/analytics/server-index.ts +17 -0
- package/src/analytics/server.ts +277 -0
- package/src/auth/index.ts +30 -0
- package/src/auth/second-factor-index.ts +16 -0
- package/src/auth/second-factor-next.ts +136 -0
- package/src/auth/second-factor-routes.ts +40 -0
- package/src/auth/second-factor.ts +226 -0
- package/src/auth/step-up-client-index.ts +13 -0
- package/src/auth/step-up-client.ts +23 -0
- package/src/auth/step-up-index.ts +19 -0
- package/src/auth/step-up-routes.ts +99 -0
- package/src/auth/step-up.ts +432 -0
- package/src/auth/two-factor-policy.ts +112 -0
- package/src/changelog/changelog.tsx +367 -0
- package/src/changelog/index.ts +12 -0
- package/src/editor/block-handle.tsx +312 -0
- package/src/editor/blocks.ts +169 -0
- package/src/editor/bubble-toolbar.tsx +208 -0
- package/src/editor/collapsible.ts +159 -0
- package/src/editor/content-index.ts +1 -0
- package/src/editor/content.tsx +343 -0
- package/src/editor/editor.tsx +333 -0
- package/src/editor/emoji-index.ts +1 -0
- package/src/editor/emoji-picker.tsx +114 -0
- package/src/editor/emoji.ts +436 -0
- package/src/editor/index.ts +6 -0
- package/src/editor/sections.ts +83 -0
- package/src/editor/suggestion-popup.tsx +136 -0
- package/src/editor/suggestions.ts +309 -0
- package/src/editor/ui.tsx +171 -0
- package/src/errors/error-shell.tsx +72 -0
- package/src/errors/global-error-shell.tsx +116 -0
- package/src/errors/index.ts +2 -0
- package/src/grid/columns.ts +48 -0
- package/src/grid/compare.ts +35 -0
- package/src/grid/hidden-columns.ts +95 -0
- package/src/grid/index.ts +27 -0
- package/src/grid/use-grid.ts +282 -0
- package/src/grid/views.ts +70 -0
- package/src/guides/guide-article.tsx +92 -0
- package/src/guides/guide-figure-zoom.tsx +533 -0
- package/src/guides/guide-figure.tsx +68 -0
- package/src/guides/guide-toc.tsx +133 -0
- package/src/guides/guides-landing.tsx +57 -0
- package/src/guides/guides-search.tsx +160 -0
- package/src/guides/guides-shell.tsx +60 -0
- package/src/guides/guides-sidebar.tsx +93 -0
- package/src/guides/index.ts +28 -0
- package/src/guides/library.ts +165 -0
- package/src/health/health.ts +115 -0
- package/src/health/index.ts +11 -0
- package/src/internal/cx.ts +4 -0
- package/src/internal/next-link.ts +23 -0
- package/src/jobs/counts.ts +151 -0
- package/src/jobs/cron-auth.ts +60 -0
- package/src/jobs/health.ts +315 -0
- package/src/jobs/idle.ts +86 -0
- package/src/jobs/index.ts +120 -0
- package/src/jobs/job-health-list.tsx +316 -0
- package/src/jobs/next-index.ts +4 -0
- package/src/jobs/next.ts +65 -0
- package/src/jobs/prisma-index.ts +12 -0
- package/src/jobs/prisma.ts +170 -0
- package/src/jobs/prune.ts +79 -0
- package/src/jobs/react-index.ts +35 -0
- package/src/jobs/registry.ts +189 -0
- package/src/jobs/scheduler.ts +437 -0
- package/src/jobs/store.ts +212 -0
- package/src/jobs/windows.ts +157 -0
- package/src/maintenance/core.ts +270 -0
- package/src/maintenance/gate.ts +171 -0
- package/src/maintenance/index.ts +40 -0
- package/src/maintenance/page.ts +76 -0
- package/src/maintenance/proxy.ts +88 -0
- package/src/maintenance/react-index.ts +7 -0
- package/src/maintenance/react.tsx +190 -0
- package/src/maintenance/route.ts +82 -0
- package/src/maintenance/unavailable.ts +61 -0
- package/src/markdown/figure.tsx +132 -0
- package/src/markdown/figures.ts +237 -0
- package/src/markdown/guide.tsx +536 -0
- package/src/markdown/index.ts +53 -0
- package/src/markdown/table-view.tsx +74 -0
- package/src/markdown/table.ts +90 -0
- package/src/password/common.ts +58 -0
- package/src/password/estimate-index.ts +18 -0
- package/src/password/estimate.ts +715 -0
- package/src/password/index.ts +40 -0
- package/src/password/password-input.tsx +116 -0
- package/src/password/password-strength.tsx +157 -0
- package/src/password/reveal.ts +151 -0
- package/src/rate-limit/better-auth.ts +94 -0
- package/src/rate-limit/index.ts +32 -0
- package/src/rate-limit/keys.ts +110 -0
- package/src/rate-limit/limiter.ts +276 -0
- package/src/rate-limit/prisma-index.ts +12 -0
- package/src/rate-limit/prisma.ts +157 -0
- package/src/rate-limit/store.ts +47 -0
- package/src/release/changelog.ts +364 -0
- package/src/release/index.ts +32 -0
- package/src/release/version.ts +64 -0
- package/src/setup-guide/bits.tsx +420 -0
- package/src/setup-guide/card.tsx +358 -0
- package/src/setup-guide/class-names.ts +144 -0
- package/src/setup-guide/context.tsx +239 -0
- package/src/setup-guide/guide.ts +271 -0
- package/src/setup-guide/index.ts +76 -0
- package/src/setup-guide/launcher.tsx +207 -0
- package/src/setup-guide/strip.tsx +127 -0
- package/src/styles/house.css +403 -0
- package/src/trail/index.ts +12 -0
- package/src/trail/rules.ts +84 -0
- package/src/trail/trail.tsx +367 -0
- package/src/ux/errors.ts +32 -0
- package/src/ux/feedback.tsx +41 -0
- package/src/ux/index.ts +44 -0
- package/src/ux/navigation-index.ts +16 -0
- package/src/ux/navigation-progress.tsx +270 -0
- package/src/ux/optimistic.ts +415 -0
- package/src/ux/use-action.ts +155 -0
- package/src/ux/use-optimistic-list.ts +227 -0
- package/src/ux/use-optimistic-value.ts +136 -0
- package/src/web-search/index.ts +13 -0
- package/src/web-search/providers.ts +177 -0
- package/src/web-search/types.ts +98 -0
- package/src/whats-new/body.tsx +190 -0
- package/src/whats-new/index.ts +43 -0
- package/src/whats-new/seen.ts +40 -0
- package/src/whats-new/select.ts +230 -0
- package/src/whats-new/use-whats-new.ts +109 -0
- package/src/wizard/index.ts +61 -0
- package/src/wizard/invalid.ts +152 -0
- package/src/wizard/react-hook-form-index.ts +11 -0
- package/src/wizard/rhf-adapter.ts +67 -0
- package/src/wizard/rules.ts +137 -0
- package/src/wizard/wizard.tsx +442 -0
|
@@ -0,0 +1,403 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @connextar/house — the styles its components need that utility classes
|
|
3
|
+
* cannot say: rich text, the editor's own chrome, and the trail's tinted pills.
|
|
4
|
+
*
|
|
5
|
+
* Import it once in the app's global stylesheet, after Tailwind:
|
|
6
|
+
*
|
|
7
|
+
* @import "tailwindcss";
|
|
8
|
+
* @import "@connextar/house/house.css";
|
|
9
|
+
* @source "../node_modules/@connextar/house/dist";
|
|
10
|
+
*
|
|
11
|
+
* The @source line is not optional. Tailwind does not scan node_modules, so
|
|
12
|
+
* without it every utility class that appears only inside this package — and
|
|
13
|
+
* the components use many — is silently missing from the build.
|
|
14
|
+
*
|
|
15
|
+
* Colours come from the app's own theme tokens (--primary, --border, …) through
|
|
16
|
+
* a --house-* variable at each use, so a theme that stores tokens as HSL
|
|
17
|
+
* triplets ("222 47% 11%") can map them once without forking this file:
|
|
18
|
+
*
|
|
19
|
+
* :root { --house-primary: hsl(var(--primary)); --house-border: hsl(var(--border)); … }
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
@layer components {
|
|
23
|
+
/* ── Rich text — the editor while writing, and RichTextContent while reading ── */
|
|
24
|
+
|
|
25
|
+
/* Images in a note: the app's own, re-encoded copies; never wider than the text. */
|
|
26
|
+
.house-prose img.house-image,
|
|
27
|
+
.house-rich-text .tiptap img.house-image {
|
|
28
|
+
display: block;
|
|
29
|
+
max-width: 100%;
|
|
30
|
+
height: auto;
|
|
31
|
+
margin: 0.75rem 0;
|
|
32
|
+
border-radius: 0.5rem;
|
|
33
|
+
border: 1px solid var(--house-border, var(--border));
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.house-rich-text .tiptap img.house-image.ProseMirror-selectednode {
|
|
37
|
+
outline: 2px solid var(--house-primary, var(--primary));
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.house-image-blocked {
|
|
41
|
+
color: var(--house-muted-foreground, var(--muted-foreground));
|
|
42
|
+
font-style: italic;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.house-prose {
|
|
46
|
+
color: var(--house-foreground, var(--foreground));
|
|
47
|
+
line-height: 1.65;
|
|
48
|
+
font-size: 0.925rem;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.house-prose h1,
|
|
52
|
+
.house-prose h2,
|
|
53
|
+
.house-prose h3 {
|
|
54
|
+
font-weight: 650;
|
|
55
|
+
color: var(--house-foreground, var(--foreground));
|
|
56
|
+
line-height: 1.25;
|
|
57
|
+
margin: 1.4em 0 0.5em;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.house-prose h1 {
|
|
61
|
+
font-size: 1.5em;
|
|
62
|
+
}
|
|
63
|
+
.house-prose h2 {
|
|
64
|
+
font-size: 1.25em;
|
|
65
|
+
}
|
|
66
|
+
.house-prose h3 {
|
|
67
|
+
font-size: 1.1em;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.house-prose h1:first-child,
|
|
71
|
+
.house-prose h2:first-child,
|
|
72
|
+
.house-prose h3:first-child,
|
|
73
|
+
.house-prose p:first-child {
|
|
74
|
+
margin-top: 0;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.house-prose p {
|
|
78
|
+
margin: 0.45em 0;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.house-prose ul,
|
|
82
|
+
.house-prose ol {
|
|
83
|
+
margin: 0.45em 0;
|
|
84
|
+
padding-left: 1.4em;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.house-prose ul {
|
|
88
|
+
list-style: disc;
|
|
89
|
+
}
|
|
90
|
+
.house-prose ol {
|
|
91
|
+
list-style: decimal;
|
|
92
|
+
}
|
|
93
|
+
.house-prose li {
|
|
94
|
+
margin: 0.2em 0;
|
|
95
|
+
}
|
|
96
|
+
.house-prose li > ul,
|
|
97
|
+
.house-prose li > ol {
|
|
98
|
+
margin: 0.15em 0;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/* Task lists — both the editor's data-type DOM and the renderer's own. */
|
|
102
|
+
.house-prose ul[data-type="taskList"],
|
|
103
|
+
.house-prose ul.house-task-list {
|
|
104
|
+
list-style: none;
|
|
105
|
+
padding-left: 0.2em;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.house-prose ul[data-type="taskList"] li,
|
|
109
|
+
.house-prose ul.house-task-list li {
|
|
110
|
+
display: flex;
|
|
111
|
+
align-items: baseline;
|
|
112
|
+
gap: 0.55em;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.house-prose ul[data-type="taskList"] li > label {
|
|
116
|
+
flex: 0 0 auto;
|
|
117
|
+
user-select: none;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.house-prose ul[data-type="taskList"] li > div {
|
|
121
|
+
flex: 1 1 auto;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.house-prose input[type="checkbox"] {
|
|
125
|
+
accent-color: var(--house-primary, var(--primary));
|
|
126
|
+
width: 0.95em;
|
|
127
|
+
height: 0.95em;
|
|
128
|
+
position: relative;
|
|
129
|
+
top: 0.08em;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.house-prose li[data-checked="true"] > div,
|
|
133
|
+
.house-prose li.house-task-done > span {
|
|
134
|
+
color: var(--house-muted-foreground, var(--muted-foreground));
|
|
135
|
+
text-decoration: line-through;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.house-prose blockquote {
|
|
139
|
+
margin: 0.7em 0;
|
|
140
|
+
border-left: 3px solid color-mix(in oklab, var(--house-primary, var(--primary)) 60%, transparent);
|
|
141
|
+
padding: 0.1em 0 0.1em 0.9em;
|
|
142
|
+
color: var(--house-muted-foreground, var(--muted-foreground));
|
|
143
|
+
font-style: italic;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
.house-prose code {
|
|
147
|
+
background: var(--house-muted, var(--muted));
|
|
148
|
+
border-radius: 0.3em;
|
|
149
|
+
padding: 0.12em 0.35em;
|
|
150
|
+
font-size: 0.86em;
|
|
151
|
+
font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
.house-prose pre {
|
|
155
|
+
background: var(--house-muted, var(--muted));
|
|
156
|
+
border: 1px solid var(--house-border, var(--border));
|
|
157
|
+
border-radius: 0.5rem;
|
|
158
|
+
padding: 0.7em 0.9em;
|
|
159
|
+
margin: 0.7em 0;
|
|
160
|
+
overflow-x: auto;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.house-prose pre code {
|
|
164
|
+
background: transparent;
|
|
165
|
+
padding: 0;
|
|
166
|
+
font-size: 0.85em;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
.house-prose hr {
|
|
170
|
+
border: 0;
|
|
171
|
+
border-top: 1px solid var(--house-border, var(--border));
|
|
172
|
+
margin: 1.2em 0;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
.house-prose a {
|
|
176
|
+
color: var(--house-primary, var(--primary));
|
|
177
|
+
font-weight: 500;
|
|
178
|
+
text-decoration: underline;
|
|
179
|
+
text-decoration-color: color-mix(in oklab, var(--house-primary, var(--primary)) 40%, transparent);
|
|
180
|
+
text-underline-offset: 2px;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/* An inline #hashtag, a quiet chip in read views. */
|
|
184
|
+
.house-prose .house-hashtag {
|
|
185
|
+
color: var(--house-primary, var(--primary));
|
|
186
|
+
background: color-mix(in oklab, var(--house-primary, var(--primary)) 10%, transparent);
|
|
187
|
+
border-radius: 0.35em;
|
|
188
|
+
padding: 0.05em 0.3em;
|
|
189
|
+
font-weight: 500;
|
|
190
|
+
font-size: 0.92em;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/* ── The editor ─────────────────────────────────────────────────────────── */
|
|
194
|
+
|
|
195
|
+
/* The content area (Tiptap adds .tiptap to the contenteditable). */
|
|
196
|
+
.house-rich-text .tiptap {
|
|
197
|
+
outline: none;
|
|
198
|
+
min-height: var(--rich-text-min-height, 7rem);
|
|
199
|
+
padding: 0.65rem 0.85rem;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
/* A page editor: a gutter on the left for each block's `+` and grip, and no
|
|
203
|
+
box — the page is the surface. */
|
|
204
|
+
.house-rich-text--document {
|
|
205
|
+
--rich-text-min-height: 20rem;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/* The left gutter holds the block handle: collapse, add, grip. */
|
|
209
|
+
.house-rich-text--document .tiptap {
|
|
210
|
+
padding: 0.5rem 1rem 6rem 4.75rem;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/* The empty document's prompt, and "Type / for blocks" on an empty block. */
|
|
214
|
+
.house-rich-text .tiptap .is-empty::before {
|
|
215
|
+
content: attr(data-placeholder);
|
|
216
|
+
float: left;
|
|
217
|
+
height: 0;
|
|
218
|
+
pointer-events: none;
|
|
219
|
+
color: var(--house-muted-foreground, var(--muted-foreground));
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
/* The block gutter: `+` and grip beside the hovered block. The extension
|
|
223
|
+
positions it; this only styles it and fades it in. */
|
|
224
|
+
.house-block-handle {
|
|
225
|
+
display: flex;
|
|
226
|
+
align-items: center;
|
|
227
|
+
gap: 1px;
|
|
228
|
+
/* Its positioned parent is narrow: without this the handle shrinks and its buttons spill onto the text. */
|
|
229
|
+
width: max-content;
|
|
230
|
+
margin-right: 0.25rem;
|
|
231
|
+
opacity: 0;
|
|
232
|
+
transition: opacity 120ms ease;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
.house-block-handle[data-show="true"],
|
|
236
|
+
.house-block-handle:hover,
|
|
237
|
+
.house-block-handle:focus-within,
|
|
238
|
+
.house-rich-text--document:hover .house-block-handle {
|
|
239
|
+
opacity: 1;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
/* A block picked up by its grip, or selected whole. */
|
|
243
|
+
.house-rich-text .tiptap .ProseMirror-selectednode,
|
|
244
|
+
.house-rich-text .tiptap [draggable="true"]:active {
|
|
245
|
+
background: color-mix(in oklab, var(--house-primary, var(--primary)) 8%, transparent);
|
|
246
|
+
border-radius: 0.375rem;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
.house-rich-text .tiptap.dragging,
|
|
250
|
+
.house-rich-text .tiptap.dragging * {
|
|
251
|
+
cursor: grabbing;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
/* A collapsed heading's section: folded away, with a pill at the end of the heading that says how much. */
|
|
255
|
+
.house-rich-text .tiptap .house-section-hidden {
|
|
256
|
+
display: none;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
.house-rich-text .house-section-more {
|
|
260
|
+
margin-inline-start: 0.5rem;
|
|
261
|
+
padding: 0.05rem 0.5rem;
|
|
262
|
+
border-radius: 9999px;
|
|
263
|
+
border: 1px solid var(--house-border, var(--border));
|
|
264
|
+
background: var(--house-muted, var(--muted));
|
|
265
|
+
color: var(--house-muted-foreground, var(--muted-foreground));
|
|
266
|
+
font-family: inherit;
|
|
267
|
+
font-size: 0.75rem;
|
|
268
|
+
font-weight: 500;
|
|
269
|
+
line-height: 1.4;
|
|
270
|
+
vertical-align: middle;
|
|
271
|
+
cursor: pointer;
|
|
272
|
+
user-select: none;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
.house-rich-text .house-section-more:hover,
|
|
276
|
+
.house-rich-text .house-section-more:focus-visible {
|
|
277
|
+
color: var(--house-foreground, var(--foreground));
|
|
278
|
+
outline: none;
|
|
279
|
+
box-shadow: 0 0 0 2px var(--house-primary, var(--primary));
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
/* The in-flight text of a lookup, before it resolves. */
|
|
283
|
+
.house-rich-text .house-suggestion {
|
|
284
|
+
color: var(--house-primary, var(--primary));
|
|
285
|
+
background: color-mix(in oklab, var(--house-primary, var(--primary)) 8%, transparent);
|
|
286
|
+
border-radius: 0.25em;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
/* ── The trail ──────────────────────────────────────────────────────────── */
|
|
290
|
+
|
|
291
|
+
/* Each step deeper a shade further from the card, so the rail reads as depth. */
|
|
292
|
+
.house-trail-pill {
|
|
293
|
+
background: color-mix(
|
|
294
|
+
in oklab,
|
|
295
|
+
var(--house-card, var(--card)) calc(100% - var(--house-trail-step, 0) * 6%),
|
|
296
|
+
var(--house-accent, var(--accent))
|
|
297
|
+
);
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
.house-trail-pill[data-current] {
|
|
301
|
+
box-shadow: inset 3px 0 0 var(--house-primary, var(--primary));
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
/* The trail bar shows below the lg breakpoint and adds its height less the page
|
|
306
|
+
padding it overlaps. A screen that fills the viewport subtracts --trail-bar so
|
|
307
|
+
the page doesn't scroll by that much. */
|
|
308
|
+
@media (width < 64rem) {
|
|
309
|
+
:root:has([data-trail-bar]) {
|
|
310
|
+
--trail-bar: 37px;
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
/* ── Busy controls (@connextar/house/ux) ────────────────────────────────
|
|
315
|
+
One rule for "this is working on it", wherever the click landed.
|
|
316
|
+
|
|
317
|
+
`data-busy` is set by two things that never meet: the app's own button, for
|
|
318
|
+
an action whose spinner it cannot render inside (a button that forwards to a
|
|
319
|
+
`Link` has nowhere to put one), and `NavigationProgress`, for whichever link
|
|
320
|
+
or menu item was clicked. Neither knows what the other is, so the agreement
|
|
321
|
+
is an attribute and this stylesheet.
|
|
322
|
+
|
|
323
|
+
The spinner is a pseudo-element on purpose: the navigation watcher marks DOM
|
|
324
|
+
nodes it has never rendered and cannot re-render — a sidebar link, a row in
|
|
325
|
+
a table, a dropdown item from a page this package has never heard of — and
|
|
326
|
+
CSS is the only thing that reaches all of them. It lays out as a flex item
|
|
327
|
+
where the control is a flex container, and inline after the label where it
|
|
328
|
+
is not, so it takes its own space instead of sitting on top of the words.
|
|
329
|
+
|
|
330
|
+
`currentColor` throughout: no theme token, so it lands in any app's palette. */
|
|
331
|
+
|
|
332
|
+
@layer components {
|
|
333
|
+
[data-busy="true"] {
|
|
334
|
+
cursor: progress;
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
[data-busy="true"]::after {
|
|
338
|
+
content: "";
|
|
339
|
+
display: inline-block;
|
|
340
|
+
flex: none;
|
|
341
|
+
width: 0.875rem;
|
|
342
|
+
height: 0.875rem;
|
|
343
|
+
margin-inline-start: 0.4rem;
|
|
344
|
+
vertical-align: -0.1875em;
|
|
345
|
+
border-radius: 9999px;
|
|
346
|
+
border: 2px solid currentColor;
|
|
347
|
+
border-inline-end-color: transparent;
|
|
348
|
+
opacity: 0.65;
|
|
349
|
+
animation: house-spin 0.6s linear infinite;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
/* A flex control already spaces its children with `gap`. */
|
|
353
|
+
[data-busy="true"]:is(.inline-flex, .flex)::after {
|
|
354
|
+
margin-inline-start: 0;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
/* A control that renders its own spinner marks it `.house-spinner`, so it
|
|
358
|
+
does not end up with two. */
|
|
359
|
+
[data-busy="true"]:has(> .house-spinner)::after {
|
|
360
|
+
content: none;
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
/* ── The cookie card (`@connextar/house/analytics/react`) ──
|
|
365
|
+
|
|
366
|
+
The card is in the server HTML, before anyone knows the answer, so CSS keeps
|
|
367
|
+
it off screen where it must not be asked — before first paint, with no flash:
|
|
368
|
+
|
|
369
|
+
- an answer is already stored: `ConsentKnownScript` marks <html> in <head>;
|
|
370
|
+
- the page is never measured (`<NotMeasured />`), or is viewed as someone
|
|
371
|
+
(`ViewingAsBanner`): the address alone says "public", so the card would
|
|
372
|
+
otherwise ask on an administrator's changelog. Found in PharmaLine 0.27.5.
|
|
373
|
+
|
|
374
|
+
"Cookie settings" reopens it anywhere (`data-reopened`). Outside any layer,
|
|
375
|
+
so a card whose own classes set `display` (an app's `renderCard`) is still
|
|
376
|
+
hidden. */
|
|
377
|
+
html[data-consent-known] [data-cookie-card]:not([data-reopened]),
|
|
378
|
+
html:has([data-analytics-private]) [data-cookie-card]:not([data-reopened]),
|
|
379
|
+
html:has([data-viewing-as]) [data-cookie-card]:not([data-reopened]) {
|
|
380
|
+
display: none;
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
/* Keyframes must sit outside @layer. */
|
|
384
|
+
@keyframes house-spin {
|
|
385
|
+
to {
|
|
386
|
+
transform: rotate(360deg);
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
@media (prefers-reduced-motion: reduce) {
|
|
391
|
+
.house-block-handle {
|
|
392
|
+
transition: none;
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
/* Stillness was asked for, but silence is not the alternative: the ring
|
|
396
|
+
stays, it just stops going round. Removing it altogether would take away
|
|
397
|
+
the only thing on screen saying the click was heard. */
|
|
398
|
+
[data-busy="true"]::after {
|
|
399
|
+
animation: none !important;
|
|
400
|
+
border-inline-end-color: currentColor;
|
|
401
|
+
opacity: 0.45;
|
|
402
|
+
}
|
|
403
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The navigation trail: the path someone took to where they are, kept so they
|
|
3
|
+
* can step back to any point of it in one click.
|
|
4
|
+
*
|
|
5
|
+
* Every page that sits in a hierarchy says where it is — its own chain, root
|
|
6
|
+
* first (Home › Amara › Progress). Most of the time that chain *is* the trail.
|
|
7
|
+
* The exception is following a reference: from a note, `@Amara` opens Amara's
|
|
8
|
+
* page, and the way back to the note must survive the jump even though the note
|
|
9
|
+
* is nowhere in Amara's hierarchy. So a reference link "carries" the trail
|
|
10
|
+
* across, and the destination's chain is added to the end of it.
|
|
11
|
+
*
|
|
12
|
+
* Pure, so the rules are tested without a browser; `./trail.tsx` keeps the
|
|
13
|
+
* state and draws it.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
export interface Crumb {
|
|
17
|
+
/** Identity across pages: "note:abc", "learner:xyz", "section:progress". */
|
|
18
|
+
key: string;
|
|
19
|
+
label: string;
|
|
20
|
+
href: string;
|
|
21
|
+
/** A short code for the pill's chip — "NO", "LE" — derived when absent. */
|
|
22
|
+
code?: string;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** The most crumbs kept: past this, the oldest fall off the front. */
|
|
26
|
+
export const TRAIL_LIMIT = 8;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* The next trail, from the one before, the page's own chain, and whether the
|
|
30
|
+
* page was reached by following a reference.
|
|
31
|
+
*
|
|
32
|
+
* - **Carried** (a reference was followed): the page's chain is appended to the
|
|
33
|
+
* trail — minus anything already in it. Following a reference back to
|
|
34
|
+
* something already on the trail returns to that point instead of looping.
|
|
35
|
+
* - **Not carried**: the page's chain *is* the trail — unless the page is
|
|
36
|
+
* already on the trail (a pill was clicked, or Back pressed), in which case
|
|
37
|
+
* the trail is cut back to it.
|
|
38
|
+
*/
|
|
39
|
+
export function nextTrail(previous: readonly Crumb[], chain: readonly Crumb[], carried: boolean): Crumb[] {
|
|
40
|
+
const here = chain.at(-1);
|
|
41
|
+
if (!here) return [];
|
|
42
|
+
const at = previous.findIndex((crumb) => crumb.key === here.key);
|
|
43
|
+
|
|
44
|
+
if (at !== -1) {
|
|
45
|
+
// Back to a point already on the trail: keep what led there, refresh the
|
|
46
|
+
// crumb itself (its label may have changed — a renamed note).
|
|
47
|
+
return [...previous.slice(0, at), here].slice(-TRAIL_LIMIT);
|
|
48
|
+
}
|
|
49
|
+
if (!carried) return chain.slice(-TRAIL_LIMIT);
|
|
50
|
+
|
|
51
|
+
const seen = new Set(previous.map((crumb) => crumb.key));
|
|
52
|
+
return [...previous, ...chain.filter((crumb) => !seen.has(crumb.key))].slice(-TRAIL_LIMIT);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/** "Maths — Schedule" → "MS"; "Notes" → "NO"; always two characters or fewer, upper-case. */
|
|
56
|
+
export function codeFor(crumb: Crumb): string {
|
|
57
|
+
if (crumb.code) return crumb.code.slice(0, 3).toUpperCase();
|
|
58
|
+
const words = crumb.label
|
|
59
|
+
.replace(/[^\p{L}\p{N}\s]/gu, " ")
|
|
60
|
+
.split(/\s+/)
|
|
61
|
+
.filter(Boolean);
|
|
62
|
+
const [first, second] = words;
|
|
63
|
+
if (!first) return "·";
|
|
64
|
+
if (!second) return first.slice(0, 2).toUpperCase();
|
|
65
|
+
return ((first[0] ?? "") + (second[0] ?? "")).toUpperCase();
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Only a same-origin path is a crumb. The trail is kept in `sessionStorage`,
|
|
70
|
+
* which is ours — but it is still input, and a crumb is a link.
|
|
71
|
+
*/
|
|
72
|
+
export function isCrumb(value: unknown): value is Crumb {
|
|
73
|
+
if (typeof value !== "object" || value === null) return false;
|
|
74
|
+
const { key, label, href, code } = value as Record<string, unknown>;
|
|
75
|
+
return (
|
|
76
|
+
typeof key === "string" &&
|
|
77
|
+
typeof label === "string" &&
|
|
78
|
+
typeof href === "string" &&
|
|
79
|
+
href.startsWith("/") &&
|
|
80
|
+
!href.startsWith("//") &&
|
|
81
|
+
!href.startsWith("/\\") &&
|
|
82
|
+
(code === undefined || typeof code === "string")
|
|
83
|
+
);
|
|
84
|
+
}
|