ochreui 0.0.0-stage → 0.0.2

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.
Files changed (168) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +153 -2
  3. package/cli/ochreui.mjs +601 -0
  4. package/mcp/core.mjs +126 -0
  5. package/mcp/docs.json +906 -0
  6. package/mcp/server.mjs +23 -0
  7. package/package.json +393 -3
  8. package/registry/agent-team.ts +350 -0
  9. package/registry/avatar.ts +300 -0
  10. package/registry/badge.ts +207 -0
  11. package/registry/breadcrumb.ts +435 -0
  12. package/registry/button.ts +238 -0
  13. package/registry/card.ts +221 -0
  14. package/registry/change-summary.ts +200 -0
  15. package/registry/checkbox.ts +204 -0
  16. package/registry/code-block.ts +332 -0
  17. package/registry/color-picker.ts +720 -0
  18. package/registry/comment-thread.ts +503 -0
  19. package/registry/context-menu.ts +281 -0
  20. package/registry/cover-flow.ts +623 -0
  21. package/registry/date-picker.ts +799 -0
  22. package/registry/decision-inbox.ts +340 -0
  23. package/registry/dialog.ts +577 -0
  24. package/registry/dropdown-menu.ts +864 -0
  25. package/registry/email-draft.ts +916 -0
  26. package/registry/empty-calendar.ts +199 -0
  27. package/registry/empty-state.ts +164 -0
  28. package/registry/enrichment-orbit.ts +164 -0
  29. package/registry/filter-menu.ts +541 -0
  30. package/registry/form-field.ts +308 -0
  31. package/registry/frost-cloud.ts +381 -0
  32. package/registry/ghosted-chat.ts +210 -0
  33. package/registry/glow-cloud.ts +402 -0
  34. package/registry/grid-background.ts +164 -0
  35. package/registry/hover-card.ts +401 -0
  36. package/registry/icon-button.ts +133 -0
  37. package/registry/index.json +2124 -0
  38. package/registry/integration-beam.ts +588 -0
  39. package/registry/integration-grid.ts +209 -0
  40. package/registry/kbd.ts +176 -0
  41. package/registry/layer-stack.ts +351 -0
  42. package/registry/lead-sourcing.ts +285 -0
  43. package/registry/logo-cluster.ts +239 -0
  44. package/registry/logo-marquee.ts +505 -0
  45. package/registry/message-actions.ts +833 -0
  46. package/registry/model-orbit.ts +583 -0
  47. package/registry/model-wheel.ts +372 -0
  48. package/registry/notification-stack.ts +301 -0
  49. package/registry/number-input.ts +552 -0
  50. package/registry/number-ticker.ts +261 -0
  51. package/registry/ochre.css +917 -0
  52. package/registry/otp-input.ts +704 -0
  53. package/registry/overlay.ts +312 -0
  54. package/registry/pagination.ts +362 -0
  55. package/registry/popover.ts +296 -0
  56. package/registry/profile-menu.ts +332 -0
  57. package/registry/progress-tracker.ts +291 -0
  58. package/registry/rating.ts +461 -0
  59. package/registry/reaction-bar.ts +322 -0
  60. package/registry/region-map.ts +537 -0
  61. package/registry/resizable.ts +489 -0
  62. package/registry/scroll-area.ts +271 -0
  63. package/registry/segmented-control.ts +433 -0
  64. package/registry/select.ts +769 -0
  65. package/registry/separator.ts +97 -0
  66. package/registry/shimmer-loader.ts +211 -0
  67. package/registry/side-folder.ts +152 -0
  68. package/registry/skeleton.ts +136 -0
  69. package/registry/skill/INSTRUCTIONS.md +11 -0
  70. package/registry/skill/SKILL.md +65 -0
  71. package/registry/skill/checklist.md +45 -0
  72. package/registry/skill/references/agent-team.md +105 -0
  73. package/registry/skill/references/avatar.md +88 -0
  74. package/registry/skill/references/badge.md +92 -0
  75. package/registry/skill/references/breadcrumb.md +99 -0
  76. package/registry/skill/references/button.md +82 -0
  77. package/registry/skill/references/card.md +111 -0
  78. package/registry/skill/references/catalog.md +114 -0
  79. package/registry/skill/references/change-summary.md +103 -0
  80. package/registry/skill/references/checkbox.md +105 -0
  81. package/registry/skill/references/code-block.md +109 -0
  82. package/registry/skill/references/color-picker.md +138 -0
  83. package/registry/skill/references/comment-thread.md +164 -0
  84. package/registry/skill/references/context-menu.md +205 -0
  85. package/registry/skill/references/cover-flow.md +128 -0
  86. package/registry/skill/references/date-picker.md +154 -0
  87. package/registry/skill/references/decision-inbox.md +126 -0
  88. package/registry/skill/references/dialog.md +155 -0
  89. package/registry/skill/references/dropdown-menu.md +144 -0
  90. package/registry/skill/references/email-draft.md +182 -0
  91. package/registry/skill/references/empty-calendar.md +74 -0
  92. package/registry/skill/references/empty-state.md +118 -0
  93. package/registry/skill/references/enrichment-orbit.md +71 -0
  94. package/registry/skill/references/filter-menu.md +143 -0
  95. package/registry/skill/references/form-field.md +118 -0
  96. package/registry/skill/references/frost-cloud.md +80 -0
  97. package/registry/skill/references/ghosted-chat.md +75 -0
  98. package/registry/skill/references/glow-cloud.md +84 -0
  99. package/registry/skill/references/grid-background.md +76 -0
  100. package/registry/skill/references/hover-card.md +125 -0
  101. package/registry/skill/references/icon-button.md +99 -0
  102. package/registry/skill/references/integration-beam.md +107 -0
  103. package/registry/skill/references/integration-grid.md +100 -0
  104. package/registry/skill/references/kbd.md +65 -0
  105. package/registry/skill/references/layer-stack.md +115 -0
  106. package/registry/skill/references/lead-sourcing.md +92 -0
  107. package/registry/skill/references/logo-cluster.md +92 -0
  108. package/registry/skill/references/logo-marquee.md +123 -0
  109. package/registry/skill/references/message-actions.md +146 -0
  110. package/registry/skill/references/model-orbit.md +106 -0
  111. package/registry/skill/references/model-wheel.md +84 -0
  112. package/registry/skill/references/notification-stack.md +138 -0
  113. package/registry/skill/references/number-input.md +117 -0
  114. package/registry/skill/references/number-ticker.md +73 -0
  115. package/registry/skill/references/otp-input.md +142 -0
  116. package/registry/skill/references/pagination.md +112 -0
  117. package/registry/skill/references/popover.md +143 -0
  118. package/registry/skill/references/profile-menu.md +123 -0
  119. package/registry/skill/references/progress-tracker.md +122 -0
  120. package/registry/skill/references/rating.md +111 -0
  121. package/registry/skill/references/reaction-bar.md +128 -0
  122. package/registry/skill/references/region-map.md +109 -0
  123. package/registry/skill/references/resizable.md +127 -0
  124. package/registry/skill/references/scroll-area.md +113 -0
  125. package/registry/skill/references/segmented-control.md +96 -0
  126. package/registry/skill/references/select.md +122 -0
  127. package/registry/skill/references/separator.md +69 -0
  128. package/registry/skill/references/shimmer-loader.md +83 -0
  129. package/registry/skill/references/side-folder.md +75 -0
  130. package/registry/skill/references/skeleton.md +95 -0
  131. package/registry/skill/references/smart-recommendation.md +132 -0
  132. package/registry/skill/references/spinner.md +84 -0
  133. package/registry/skill/references/switch.md +79 -0
  134. package/registry/skill/references/tab-overload.md +70 -0
  135. package/registry/skill/references/tag-input.md +126 -0
  136. package/registry/skill/references/team-invite.md +94 -0
  137. package/registry/skill/references/testimonial-wall.md +110 -0
  138. package/registry/skill/references/text-area.md +115 -0
  139. package/registry/skill/references/text-field.md +126 -0
  140. package/registry/skill/references/text-reveal.md +71 -0
  141. package/registry/skill/references/thinking-loader.md +87 -0
  142. package/registry/skill/references/time-picker.md +122 -0
  143. package/registry/skill/references/tips-panel.md +115 -0
  144. package/registry/skill/references/toggle-group.md +98 -0
  145. package/registry/skill/references/tool-call-card.md +151 -0
  146. package/registry/skill/references/tooltip.md +94 -0
  147. package/registry/skill/references/tree-view.md +172 -0
  148. package/registry/skill/theming.md +57 -0
  149. package/registry/smart-recommendation.ts +415 -0
  150. package/registry/spinner.ts +67 -0
  151. package/registry/switch.ts +146 -0
  152. package/registry/tab-overload.ts +211 -0
  153. package/registry/tag-input.ts +620 -0
  154. package/registry/team-invite.ts +248 -0
  155. package/registry/testimonial-wall.ts +521 -0
  156. package/registry/text-area.ts +432 -0
  157. package/registry/text-field.ts +415 -0
  158. package/registry/text-reveal.ts +175 -0
  159. package/registry/theme.ts +68 -0
  160. package/registry/thinking-loader.ts +302 -0
  161. package/registry/time-picker.ts +828 -0
  162. package/registry/tips-panel.ts +312 -0
  163. package/registry/toggle-group.ts +357 -0
  164. package/registry/tool-call-card.ts +578 -0
  165. package/registry/tooltip.ts +486 -0
  166. package/registry/tree-view.ts +454 -0
  167. package/styles/base.css +500 -0
  168. package/styles/tokens.css +415 -0
@@ -0,0 +1,351 @@
1
+ // Ochre (https://ochreui.dev), MIT License, Copyright (c) 2026 Ochre. Keep this notice in copies of this file.
2
+ /**
3
+ * Layer Stack, from Ochre (https://ochreui.dev).
4
+ * Needs ochre.css (the --ui-* tokens), which `npx ochreui init` adds once.
5
+ *
6
+ * <ui-layer-stack [items]="layers" [(index)]="layer" (picked)="track($event)" />
7
+ * An isometric stack of up to five plates beside a list; the chosen entry lifts its plate in the accent color.
8
+ * It steps through entries by itself, pausing on hover, focus and off-screen, and stops once someone picks one.
9
+ *
10
+ * Public styling hooks (set them on the element or any ancestor):
11
+ * --ui-layer-stack-accent chosen plate, icon, glow and title (default: the accent)
12
+ * --ui-layer-stack-face unchosen plate faces (default: 60% surface light, 4% ink dark)
13
+ * --ui-layer-stack-edge unchosen plate edges (default: a faint ink wash, half opaque in dark mode)
14
+ * --ui-layer-stack-tray list tray (default: a step off the page)
15
+ * --ui-layer-stack-card card behind the chosen entry (default: the surface)
16
+ */
17
+ import {
18
+ Component,
19
+ DOCUMENT,
20
+ DestroyRef,
21
+ ElementRef,
22
+ PLATFORM_ID,
23
+ afterNextRender,
24
+ computed,
25
+ effect,
26
+ inject,
27
+ input,
28
+ isDevMode,
29
+ model,
30
+ numberAttribute,
31
+ output,
32
+ signal,
33
+ untracked,
34
+ } from '@angular/core';
35
+ import { isPlatformBrowser } from '@angular/common';
36
+
37
+ export type LayerStackIcon = 'bolt' | 'database' | 'plug' | 'spark' | 'pulse';
38
+
39
+ export interface LayerStackItem {
40
+ /** The entry's title; it wraps to a second line when it needs to. */
41
+ title: string;
42
+ /** A short word at the end of the row. */
43
+ hint?: string;
44
+ /** The line glyph drawn on the plate when the entry is chosen. */
45
+ icon?: LayerStackIcon;
46
+ }
47
+
48
+ export interface LayerStackLabels {
49
+ /** The list's accessible name, used when `label` is left out. */
50
+ list: string;
51
+ /** Each entry's accessible name. */
52
+ tab: (title: string, hint: string | undefined) => string;
53
+ }
54
+
55
+ const LABELS: LayerStackLabels = {
56
+ list: 'Layers',
57
+ tab: (title, hint) => (hint ? `${title}, ${hint}` : title),
58
+ };
59
+
60
+ export const LAYER_STACK_ITEMS: readonly LayerStackItem[] = [
61
+ { title: 'Fired by any signal', hint: 'Triggers', icon: 'bolt' },
62
+ { title: 'Fed by your own files', hint: 'Sources', icon: 'database' },
63
+ { title: 'Linked to your toolset', hint: 'SDKs', icon: 'plug' },
64
+ { title: 'Runs on every engine', hint: 'Gateway', icon: 'spark' },
65
+ { title: 'Audited at each turn', hint: 'Feed', icon: 'pulse' },
66
+ ];
67
+
68
+ const ICONS: Record<LayerStackIcon, string> = {
69
+ bolt: 'M13.4 2.6 5 13.2h6.4l-1 8.2 8.6-10.6h-6.4z',
70
+ database: 'M5 6c0 1.6 3.1 2.8 7 2.8s7-1.2 7-2.8-3.1-2.8-7-2.8S5 4.4 5 6v12c0 1.6 3.1 2.8 7 2.8s7-1.2 7-2.8V6M5 12c0 1.6 3.1 2.8 7 2.8s7-1.2 7-2.8',
71
+ plug: 'M9 2.8v4.4M15 2.8v4.4M6.4 7.2h11.2v3.4a5.6 5.6 0 0 1-11.2 0zM12 16.2v5',
72
+ spark:
73
+ 'M10.5 3c.7 4.3 2.4 6 6.7 6.7-4.3.7-6 2.4-6.7 6.7-.7-4.3-2.4-6-6.7-6.7C8.1 9 9.8 7.3 10.5 3zM18 15.4c.3 1.5.9 2.1 2.4 2.4-1.5.3-2.1.9-2.4 2.4-.3-1.5-.9-2.1-2.4-2.4 1.5-.3 2.1-.9 2.4-2.4z',
74
+ pulse: 'M2.8 12.4h4.3l2.4-5.6 4.8 11 2.6-5.4h4.3',
75
+ };
76
+
77
+ const MAX = 5;
78
+ let uid = 0;
79
+
80
+ @Component({
81
+ selector: 'ui-layer-stack',
82
+ host: {
83
+ '(pointerenter)': 'hover($event, true)',
84
+ '(pointerleave)': 'hover($event, false)',
85
+ '(pointercancel)': 'hover($event, false)',
86
+ },
87
+ template: `
88
+ <div style="position: absolute; inset: 0; container-type: inline-size">
89
+ <svg viewBox="0 0 600 400" aria-hidden="true" focusable="false"
90
+ style="position: absolute; inset: 0; inline-size: 100%; block-size: 100%; overflow: visible">
91
+ <filter [id]="id" x="-60%" y="-100%" width="220%" height="300%"><feGaussianBlur stdDeviation="16" /></filter>
92
+ @for (p of plates(); track p.i) {
93
+ <g class="p" [attr.data-on]="p.on || null" [style.--y]="p.y">
94
+ <ellipse class="g" cx="0" cy="79" rx="70" ry="24" [attr.filter]="'url(#' + id + ')'" />
95
+ <g transform="translate(0 9) matrix(1 .5 -1 .5 0 0)">
96
+ <rect class="e" width="104" height="104" rx="9" />
97
+ <rect class="a ae" width="104" height="104" rx="9" />
98
+ </g>
99
+ <g transform="matrix(1 .5 -1 .5 0 0)">
100
+ <rect class="f" width="104" height="104" rx="9" />
101
+ <rect class="a af" width="104" height="104" rx="9" />
102
+ @if (p.d) {
103
+ <path class="i" transform="translate(34 34) scale(1.5)" [attr.d]="p.d" />
104
+ }
105
+ </g>
106
+ </g>
107
+ }
108
+ </svg>
109
+ <div class="l" role="tablist" aria-orientation="vertical" [attr.aria-label]="name() || null"
110
+ style="position: absolute; top: 50%; left: 54.333cqi; translate: 0 -50%; display: grid; grid-template-columns: minmax(0, 1fr); inline-size: 41.333cqi; box-sizing: border-box; padding: 1.333cqi; border-radius: 3cqi"
111
+ [style.--i]="active()" (keydown)="key($event)" (focusin)="focused.set(true)" (focusout)="blur($event)">
112
+ <span class="c" aria-hidden="true"></span>
113
+ @for (it of list(); track $index; let i = $index) {
114
+ <button type="button" role="tab" class="r" [attr.aria-selected]="i === active()" [tabIndex]="i === active() ? 0 : -1"
115
+ [attr.aria-label]="t().tab(it.title, it.hint)" (click)="pick(i)">
116
+ <span class="t">{{ it.title }}</span>
117
+ @if (it.hint) {
118
+ <span class="h">{{ it.hint }}</span>
119
+ }
120
+ </button>
121
+ }
122
+ </div>
123
+ </div>
124
+ `,
125
+ styles: `
126
+ @layer ui {
127
+ :host { display: block; position: relative; inline-size: min(560px, 100%); aspect-ratio: 3 / 2; }
128
+ }
129
+ :host {
130
+ --_m: var(--ui-motion-scale, 1);
131
+ --_a: var(--ui-layer-stack-accent, var(--ui-accent));
132
+ --_io: cubic-bezier(0.65, 0, 0.25, 1);
133
+ box-sizing: border-box;
134
+ color: var(--ui-text);
135
+ font-family: var(--ui-font-sans);
136
+ }
137
+ :host::before { content: 'x x x x x x x x' / ''; display: block; block-size: 0; overflow: hidden; font-size: 0; word-spacing: 80px; }
138
+ .p { transform: translate(168px, calc(var(--y) * 1px)); transition: transform calc(560ms * var(--_m)) var(--_io); }
139
+ .g {
140
+ opacity: 0;
141
+ fill: light-dark(color-mix(in srgb, var(--_a) 28%, transparent), color-mix(in srgb, var(--_a) 30%, transparent));
142
+ transition: opacity calc(180ms * var(--_m)) ease;
143
+ }
144
+ .e, .f { stroke: var(--ui-hairline); stroke-width: 1; }
145
+ .e { fill: var(--ui-layer-stack-edge, light-dark(color-mix(in srgb, var(--ui-text) 9%, transparent), color-mix(in srgb, var(--ui-bg-canvas) 50%, var(--ui-text) 5%))); }
146
+ .f {
147
+ fill: var(--ui-layer-stack-face, light-dark(color-mix(in srgb, var(--ui-bg-surface) 60%, transparent), color-mix(in srgb, var(--ui-text) 4%, transparent)));
148
+ }
149
+ .a { opacity: 0; transition: opacity calc(180ms * var(--_m)) ease; }
150
+ .ae { fill: light-dark(color-mix(in srgb, var(--_a) 88%, var(--ui-text)), color-mix(in oklab, var(--_a) 76%, var(--ui-bg-canvas))); }
151
+ .af {
152
+ fill: light-dark(color-mix(in srgb, var(--_a) 9%, var(--ui-bg-canvas)), color-mix(in srgb, var(--_a) 20%, var(--ui-bg-canvas)));
153
+ stroke: var(--_a);
154
+ stroke-width: 1.6;
155
+ }
156
+ .i {
157
+ opacity: 0;
158
+ fill: none;
159
+ stroke: var(--_a);
160
+ stroke-width: 1.5;
161
+ stroke-linecap: round;
162
+ stroke-linejoin: round;
163
+ transition: opacity calc(160ms * var(--_m)) ease;
164
+ }
165
+ [data-on] :is(.g, .a, .i) { opacity: 1; transition-duration: calc(240ms * var(--_m)); transition-delay: calc(180ms * var(--_m)); }
166
+ [data-on] .i { transition-delay: calc(260ms * var(--_m)); }
167
+ .l { background: var(--ui-layer-stack-tray, light-dark(var(--ui-bg-subtle), color-mix(in srgb, var(--ui-bg-canvas) 65%, var(--ui-gray-1050)))); }
168
+ .c {
169
+ position: absolute;
170
+ top: 1.333cqi;
171
+ left: 1.333cqi;
172
+ right: 1.333cqi;
173
+ block-size: 8.667cqi;
174
+ border-radius: 2cqi;
175
+ background: var(--ui-layer-stack-card, var(--ui-bg-surface));
176
+ box-shadow: var(--ui-shadow-sm);
177
+ translate: 0 calc(var(--i) * 8.667cqi);
178
+ transition: translate calc(460ms * var(--_m)) var(--_io);
179
+ }
180
+ .r {
181
+ position: relative;
182
+ display: flex;
183
+ align-items: center;
184
+ justify-content: space-between;
185
+ gap: 1.667cqi;
186
+ box-sizing: border-box;
187
+ inline-size: 100%;
188
+ block-size: 8.667cqi;
189
+ margin: 0;
190
+ padding: 0 2.333cqi;
191
+ border: 0;
192
+ border-radius: 2cqi;
193
+ background: none;
194
+ color: inherit;
195
+ font: inherit;
196
+ line-height: 1.3;
197
+ text-align: start;
198
+ cursor: pointer;
199
+ -webkit-tap-highlight-color: transparent;
200
+ }
201
+ .r:focus { outline: 0; }
202
+ .l .r:focus-visible { outline: var(--ui-focus-width, 2px) solid var(--ui-focus-ring); outline-offset: -2px; }
203
+ .t {
204
+ min-inline-size: 0;
205
+ display: -webkit-box;
206
+ -webkit-box-orient: vertical;
207
+ -webkit-line-clamp: 2;
208
+ overflow: clip;
209
+ overflow-clip-margin: 2px;
210
+ text-wrap: balance;
211
+ font-size: 2.333cqi;
212
+ line-height: 1.2;
213
+ font-weight: var(--ui-weight-medium, 500);
214
+ letter-spacing: -0.01em;
215
+ transition: color calc(160ms * var(--_m)) ease;
216
+ }
217
+ [aria-selected='true'] .t { color: var(--_a); transition-delay: calc(160ms * var(--_m)); }
218
+ .h { flex: none; font-size: 2cqi; color: var(--ui-text-muted); }
219
+ @media (forced-colors: active) {
220
+ .c { outline: 1px solid CanvasText; }
221
+ .l { outline: 1px solid transparent; }
222
+ }
223
+ `,
224
+ })
225
+ export class UiLayerStack {
226
+ /** Up to five entries, top layer first; any more are left out. */
227
+ readonly items = input<readonly LayerStackItem[]>(LAYER_STACK_ITEMS);
228
+ /** The chosen entry. Bind it two-way to follow the autoplay steps and the user's picks. */
229
+ readonly index = model(0);
230
+ /** Time on each entry while it steps by itself, in ms. */
231
+ readonly interval = input(2600, { transform: numberAttribute });
232
+ /** The list's accessible name. Defaults to `labels.list`. */
233
+ readonly label = input<string>();
234
+ /** The list name and the way each entry's name is built, for translation. */
235
+ readonly labels = input<Partial<LayerStackLabels>>({});
236
+ /** Emits the index when the user picks an entry with a click, a tap or a key; never on autoplay steps. */
237
+ readonly picked = output<number>();
238
+
239
+ protected readonly id = `ui-layer-stack-${++uid}`;
240
+ protected readonly list = computed(() => this.items().slice(0, MAX));
241
+ protected readonly t = computed(() => ({ ...LABELS, ...this.labels() }));
242
+ protected readonly name = computed(() => this.label() ?? this.t().list);
243
+ protected readonly active = computed(() => {
244
+ const n = this.list().length;
245
+ const i = Math.trunc(Number(this.index()) || 0);
246
+ return n ? Math.min(Math.max(i, 0), n - 1) : 0;
247
+ });
248
+ protected readonly plates = computed(() => {
249
+ const items = this.list();
250
+ const n = items.length;
251
+ const a = this.active();
252
+ const shift = 13 * (MAX - n);
253
+ return items
254
+ .map((it, i) => ({
255
+ i,
256
+ on: i === a,
257
+ d: it.icon ? ICONS[it.icon] : '',
258
+ y: 109 + 26 * i + shift - (i < a ? 58 : i === a && i < n - 1 ? 34 : 0),
259
+ }))
260
+ .reverse();
261
+ });
262
+
263
+ private readonly doc = inject(DOCUMENT);
264
+ private readonly win = this.doc.defaultView;
265
+ private readonly host = inject<ElementRef<HTMLElement>>(ElementRef).nativeElement;
266
+ private readonly browser = isPlatformBrowser(inject(PLATFORM_ID));
267
+ private readonly reduce = this.browser ? this.win?.matchMedia?.('(prefers-reduced-motion: reduce)') : undefined;
268
+
269
+ private readonly still = signal(true);
270
+ private readonly seen = signal(false);
271
+ private readonly visible = signal(true);
272
+ private readonly hovered = signal(false);
273
+ protected readonly focused = signal(false);
274
+ private readonly stopped = signal(false);
275
+ private readonly live = computed(
276
+ () => !this.still() && this.seen() && this.visible() && !this.hovered() && !this.focused() && !this.stopped() && this.list().length > 1,
277
+ );
278
+
279
+ constructor() {
280
+ effect((onCleanup) => {
281
+ if (!this.live()) return;
282
+ const at = this.active();
283
+ const timer = setTimeout(() => {
284
+ if (this.isStill()) this.still.set(true);
285
+ else this.index.set((at + 1) % untracked(this.list).length);
286
+ }, Math.max(this.interval(), 200));
287
+ onCleanup(() => clearTimeout(timer));
288
+ });
289
+
290
+ let io: IntersectionObserver | undefined;
291
+ const onMotion = () => this.still.set(this.isStill());
292
+ const onVisibility = () => {
293
+ onMotion();
294
+ this.visible.set(this.doc.visibilityState !== 'hidden');
295
+ };
296
+ afterNextRender(() => {
297
+ onMotion();
298
+ onVisibility();
299
+ this.reduce?.addEventListener('change', onMotion);
300
+ this.doc.addEventListener('visibilitychange', onVisibility);
301
+ if (this.win?.IntersectionObserver) {
302
+ io = new this.win.IntersectionObserver((entries) => {
303
+ onMotion();
304
+ this.seen.set(entries[entries.length - 1].isIntersecting);
305
+ });
306
+ io.observe(this.host);
307
+ } else this.seen.set(true);
308
+ if (isDevMode() && !this.name().trim() && !this.host.hasAttribute('aria-labelledby')) {
309
+ console.warn('ui-layer-stack: the list has no accessible name. Set label or labels.list.', this.host);
310
+ }
311
+ });
312
+
313
+ inject(DestroyRef).onDestroy(() => {
314
+ io?.disconnect();
315
+ this.reduce?.removeEventListener('change', onMotion);
316
+ this.doc.removeEventListener('visibilitychange', onVisibility);
317
+ });
318
+ }
319
+
320
+ protected pick(i: number): void {
321
+ this.stopped.set(true);
322
+ if (i === this.active()) return;
323
+ this.index.set(i);
324
+ this.picked.emit(i);
325
+ }
326
+
327
+ protected key(e: KeyboardEvent): void {
328
+ const n = this.list().length;
329
+ const a = this.active();
330
+ const to =
331
+ e.key === 'ArrowDown' ? (a + 1) % n : e.key === 'ArrowUp' ? (a - 1 + n) % n : e.key === 'Home' ? 0 : e.key === 'End' ? n - 1 : -1;
332
+ if (to < 0 || !n) return;
333
+ e.preventDefault();
334
+ this.pick(to);
335
+ (e.currentTarget as HTMLElement).querySelectorAll<HTMLElement>('[role=tab]')[to]?.focus();
336
+ }
337
+
338
+ protected hover(e: PointerEvent, on: boolean): void {
339
+ if (e.pointerType !== 'touch') this.hovered.set(on);
340
+ }
341
+
342
+ protected blur(e: FocusEvent): void {
343
+ const to = e.relatedTarget as Node | null;
344
+ if (!to || !(e.currentTarget as HTMLElement).contains(to)) this.focused.set(false);
345
+ }
346
+
347
+ private isStill(): boolean {
348
+ const scale = this.win?.getComputedStyle(this.host).getPropertyValue('--ui-motion-scale').trim();
349
+ return !!this.reduce?.matches || (!!scale && parseFloat(scale) === 0);
350
+ }
351
+ }
@@ -0,0 +1,285 @@
1
+ // Ochre (https://ochreui.dev), MIT License, Copyright (c) 2026 Ochre. Keep this notice in copies of this file.
2
+ /**
3
+ * Lead Sourcing, from Ochre (https://ochreui.dev).
4
+ * Needs ochre.css (the --ui-* tokens), which `npx ochreui init` adds once.
5
+ *
6
+ * <ui-lead-sourcing />
7
+ * <ui-lead-sourcing [logos]="[inbox, assistant, finder]" />
8
+ * A card illustration: an assistant tile linked by a thin line to a source app on each side, with a coloured
9
+ * shine running along the line every 3.6s. Still and grey under reduced motion.
10
+ *
11
+ * Public styling hooks (set them on the element or any ancestor):
12
+ * --ui-lead-sourcing-tile tile face (default: the surface colour)
13
+ * --ui-lead-sourcing-edge tile outline (default: a hairline of the text colour)
14
+ * --ui-lead-sourcing-lip the deeper band along each tile's bottom edge
15
+ * --ui-lead-sourcing-line the resting line
16
+ * --ui-lead-sourcing-ink logos without a colour (default: the text colour)
17
+ * --ui-lead-sourcing-glow-a / -glow-b glow and centre rim, left to right
18
+ * --ui-lead-sourcing-shine-tail / -mid / -head the shine, back to front
19
+ */
20
+ import { Component, DOCUMENT, DestroyRef, ElementRef, afterNextRender, computed, inject, input, signal } from '@angular/core';
21
+
22
+ /** One logo: a filled path drawn in a 24 × 24 box. Without `color` it follows the ink colour. */
23
+ export interface LeadSourcingLogo {
24
+ name: string;
25
+ path: string;
26
+ color?: string;
27
+ darkColor?: string;
28
+ }
29
+
30
+ /** Every string the scene speaks. `{left}`, `{center}` and `{right}` are filled with the logo names. */
31
+ export interface LeadSourcingLabels {
32
+ scene: string;
33
+ left: string;
34
+ center: string;
35
+ right: string;
36
+ }
37
+
38
+ const LABELS: LeadSourcingLabels = {
39
+ scene: '{center} linked to {left} and {right}, among empty tiles',
40
+ left: 'a mail app',
41
+ center: 'An assistant',
42
+ right: 'a search app',
43
+ };
44
+
45
+ const fill = (s: string, v: Record<string, string>) => s.replace(/\{(\w+)\}/g, (m, k) => v[k] ?? m);
46
+
47
+ interface Tile {
48
+ x: number;
49
+ y: number;
50
+ s: number;
51
+ r: number;
52
+ cx?: number;
53
+ cy?: number;
54
+ }
55
+
56
+ const SIDES: Tile[] = [
57
+ { x: 45, y: 95, s: 50, r: 10 },
58
+ { x: 225, y: 95, s: 50, r: 10 },
59
+ ];
60
+ const CORNERS: Tile[] = [
61
+ { x: 67, y: 27, s: 50, r: 10, cx: 117, cy: 77 },
62
+ { x: 203, y: 27, s: 50, r: 10, cx: 203, cy: 77 },
63
+ { x: 67, y: 163, s: 50, r: 10, cx: 117, cy: 163 },
64
+ { x: 203, y: 163, s: 50, r: 10, cx: 203, cy: 163 },
65
+ ];
66
+ const CENTRE: Tile = { x: 128, y: 88, s: 64, r: 14 };
67
+ /** Glyph boxes, left / centre / right, as x, y, size. */
68
+ const BOX = [
69
+ [58, 108, 24],
70
+ [146, 106, 28],
71
+ [237, 107, 26],
72
+ ] as const;
73
+
74
+ let nextId = 0;
75
+
76
+ @Component({
77
+ selector: 'ui-lead-sourcing',
78
+ host: {
79
+ '[attr.role]': "name() ? 'img' : null",
80
+ '[attr.aria-label]': 'name() || null',
81
+ '[attr.aria-hidden]': "name() ? null : 'true'",
82
+ '[attr.data-run]': "running() ? '' : null",
83
+ },
84
+ template: `
85
+ <svg viewBox="0 0 320 240" aria-hidden="true" focusable="false">
86
+ <defs>
87
+ <filter [id]="id + 'd'" x="-15%" y="-12%" width="130%" height="140%">
88
+ <feDropShadow class="ds" dx="0" dy="3" stdDeviation="2" />
89
+ </filter>
90
+ <filter [id]="id + 'b'" filterUnits="userSpaceOnUse" x="80" y="100" width="160" height="104">
91
+ <feGaussianBlur stdDeviation="11" />
92
+ </filter>
93
+ <linearGradient [id]="id + 'g'" gradientUnits="userSpaceOnUse" x1="136" x2="184">
94
+ <stop class="ga" offset="0" /><stop class="gb" offset="1" />
95
+ </linearGradient>
96
+ <linearGradient [id]="id + 'r'" gradientUnits="userSpaceOnUse" x1="130" x2="190">
97
+ <stop class="ra" offset=".1" /><stop class="rb" offset=".9" />
98
+ </linearGradient>
99
+ <linearGradient [id]="id + 'f'" gradientUnits="userSpaceOnUse" x1="25" x2="295">
100
+ <stop offset="0" stop-color="#fff" stop-opacity="0" />
101
+ <stop offset=".16" stop-color="#fff" />
102
+ <stop offset=".84" stop-color="#fff" />
103
+ <stop offset="1" stop-color="#fff" stop-opacity="0" />
104
+ </linearGradient>
105
+ <linearGradient [id]="id + 'c'">
106
+ <stop class="s1" offset="0" stop-opacity="0" />
107
+ <stop class="s1" offset=".22" />
108
+ <stop class="s2" offset=".5" />
109
+ <stop class="s3" offset=".78" />
110
+ <stop class="s3" offset="1" stop-opacity="0" />
111
+ </linearGradient>
112
+ <mask [id]="id + 'l'" maskUnits="userSpaceOnUse" x="0" y="110" width="320" height="20">
113
+ <rect x="25" y="119.25" width="270" height="1.5" [attr.fill]="url('f')" />
114
+ </mask>
115
+ @for (t of corners; track $index) {
116
+ <radialGradient [id]="id + 'q' + $index" gradientUnits="userSpaceOnUse" [attr.cx]="t.cx" [attr.cy]="t.cy" r="80">
117
+ <stop offset=".36" stop-color="#fff" />
118
+ <stop offset="1" stop-color="#fff" stop-opacity="0" />
119
+ </radialGradient>
120
+ <mask [id]="id + 'm' + $index" maskUnits="userSpaceOnUse" [attr.x]="t.x - 10" [attr.y]="t.y - 10" width="70" height="74">
121
+ <rect [attr.x]="t.x - 10" [attr.y]="t.y - 10" width="70" height="74" [attr.fill]="url('q' + $index)" />
122
+ </mask>
123
+ }
124
+ <linearGradient [id]="id + 'e'" gradientUnits="userSpaceOnUse" x1="0" x2="24">
125
+ <stop offset="0" style="stop-color: var(--ui-hue-pink)" />
126
+ <stop offset=".3" style="stop-color: var(--ui-hue-orange)" />
127
+ <stop offset=".55" style="stop-color: var(--ui-hue-amber)" />
128
+ <stop offset=".78" style="stop-color: var(--ui-hue-green)" />
129
+ <stop offset="1" style="stop-color: var(--ui-hue-blue)" />
130
+ </linearGradient>
131
+ </defs>
132
+
133
+ <ellipse class="gw" cx="160" cy="152" rx="22" ry="8" [attr.fill]="url('g')" [attr.filter]="url('b')" />
134
+ <rect class="ln" x="25" y="119.25" width="270" height="1.5" [attr.mask]="url('l')" />
135
+ <g [attr.mask]="url('l')"><rect class="sh" x="-30" y="119.25" width="60" height="1.5" [attr.fill]="url('c')" /></g>
136
+
137
+ @for (t of tiles; track $index) {
138
+ <g [attr.mask]="t.cx ? url('m' + $index) : null" [attr.filter]="url('d')">
139
+ <rect class="lp" [attr.x]="t.x" [attr.y]="t.y" [attr.width]="t.s" [attr.height]="t.s" [attr.rx]="t.r" />
140
+ <rect class="fc" [attr.x]="t.x" [attr.y]="t.y" [attr.width]="t.s" [attr.height]="t.s - 4" [attr.rx]="t.r" />
141
+ <rect class="ed" [attr.x]="t.x" [attr.y]="t.y" [attr.width]="t.s" [attr.height]="t.s" [attr.rx]="t.r" />
142
+ </g>
143
+ }
144
+ <path class="rim" d="M128 138a14 14 0 0 0 14 14h36a14 14 0 0 0 14-14" [attr.stroke]="url('r')" />
145
+
146
+ @for (b of box; track $index) {
147
+ @let logo = slots()[$index];
148
+ @if (logo) {
149
+ <svg class="lg" viewBox="0 0 24 24" [attr.x]="b[0]" [attr.y]="b[1]" [attr.width]="b[2]" [attr.height]="b[2]"
150
+ [style.--c]="logo.color" [style.--cd]="logo.darkColor"><path [attr.d]="logo.path" /></svg>
151
+ } @else if ($index === 0) {
152
+ <svg x="58" y="110.45" width="24" height="19.1" viewBox="0 0 24 19.1" fill="none" [attr.stroke]="url('e')" stroke-width="3" stroke-linecap="round" stroke-linejoin="round">
153
+ <rect x="1.5" y="1.5" width="21" height="16.1" rx="3.6" /><path d="M6 6.4l6 4.3 6-4.3" />
154
+ </svg>
155
+ } @else if ($index === 1) {
156
+ <svg class="ink" x="146" y="106" width="28" height="28" viewBox="0 0 24 24">
157
+ <g fill="none" stroke="currentColor" stroke-width="1.8">
158
+ <circle cx="12" cy="7.5" r="5.9" /><circle cx="7.9" cy="14.6" r="5.9" /><circle cx="16.1" cy="14.6" r="5.9" />
159
+ </g>
160
+ </svg>
161
+ } @else {
162
+ <svg class="ink" x="237" y="107" width="26" height="26" viewBox="0 0 24 24">
163
+ <path fill="currentColor" fill-rule="evenodd" d="M10.2 2a8.2 8.2 0 0 1 6.6 13.1l4.7 4.7a1.6 1.6 0 0 1-2.3 2.3l-4.7-4.7A8.2 8.2 0 1 1 10.2 2Zm0 3.1a5.1 5.1 0 1 0 0 10.2 5.1 5.1 0 0 0 0-10.2Z" />
164
+ <path fill="currentColor" d="M10.2 6.9c.3 1.5 1.2 2.4 2.7 2.7-1.5.3-2.4 1.2-2.7 2.7-.3-1.5-1.2-2.4-2.7-2.7 1.5-.3 2.4-1.2 2.7-2.7Z" />
165
+ </svg>
166
+ }
167
+ }
168
+
169
+ </svg>
170
+ `,
171
+ styles: `
172
+ @layer ui {
173
+ :host { display: block; overflow: hidden; inline-size: min(560px, 100%); aspect-ratio: 3 / 2; }
174
+ }
175
+ :host {
176
+ --_f: var(--ui-lead-sourcing-tile, var(--ui-bg-surface));
177
+ --_e: var(--ui-lead-sourcing-edge, light-dark(color-mix(in srgb, var(--ui-text) 11%, transparent), color-mix(in srgb, var(--ui-text) 15%, transparent)));
178
+ --_p: var(--ui-lead-sourcing-lip, light-dark(color-mix(in srgb, var(--ui-text) 7%, var(--_f)), color-mix(in srgb, var(--ui-gray-1000) 65%, var(--_f))));
179
+ --_ink: var(--ui-lead-sourcing-ink, var(--ui-text));
180
+ --_ga: var(--ui-lead-sourcing-glow-a, color-mix(in srgb, var(--ui-hue-pink) 50%, var(--ui-hue-orange)));
181
+ --_gb: var(--ui-lead-sourcing-glow-b, color-mix(in srgb, var(--ui-hue-purple) 55%, var(--ui-hue-blue)));
182
+ box-sizing: border-box;
183
+ }
184
+ :host::before { content: 'x x x x x x x x' / ''; display: block; block-size: 0; overflow: hidden; font-size: 0; word-spacing: 80px; }
185
+ svg { display: block; inline-size: 100%; block-size: 100%; }
186
+ .ds { flood-color: light-dark(color-mix(in srgb, var(--ui-gray-1000) 7%, transparent), color-mix(in srgb, var(--ui-gray-1000) 45%, transparent)); }
187
+ .ga { stop-color: light-dark(color-mix(in srgb, var(--_ga) 20%, transparent), var(--_ga)); }
188
+ .gb { stop-color: light-dark(color-mix(in srgb, var(--_gb) 20%, transparent), var(--_gb)); }
189
+ .ra { stop-color: light-dark(color-mix(in srgb, var(--_ga) 60%, var(--_f)), color-mix(in srgb, var(--_ga) 30%, var(--ui-gray-0))); }
190
+ .rb { stop-color: light-dark(color-mix(in srgb, var(--_gb) 60%, var(--_f)), color-mix(in srgb, var(--_gb) 30%, var(--ui-gray-0))); }
191
+ .rim { fill: none; stroke-width: 0.8; }
192
+ .ln { fill: var(--ui-lead-sourcing-line, light-dark(color-mix(in srgb, var(--ui-text) 11%, transparent), color-mix(in srgb, var(--ui-text) 16%, transparent))); }
193
+ .s1 { stop-color: var(--ui-lead-sourcing-shine-tail, light-dark(color-mix(in srgb, var(--ui-hue-red) 75%, var(--ui-gray-0)), color-mix(in srgb, var(--ui-hue-red) 70%, var(--ui-gray-0)))); }
194
+ .s2 { stop-color: var(--ui-lead-sourcing-shine-mid, light-dark(color-mix(in srgb, var(--ui-hue-pink) 45%, var(--ui-gray-0)), color-mix(in srgb, var(--ui-hue-pink) 35%, var(--ui-gray-0)))); }
195
+ .s3 { stop-color: var(--ui-lead-sourcing-shine-head, light-dark(color-mix(in srgb, var(--_gb) 80%, var(--ui-gray-0)), color-mix(in srgb, var(--_gb) 50%, var(--ui-gray-0)))); }
196
+ .sh { visibility: hidden; }
197
+ :host([data-run]) .sh { visibility: visible; animation: ui-ls-shine calc(3600ms * var(--ui-motion-scale, 1)) linear infinite; }
198
+ @keyframes ui-ls-shine {
199
+ from { transform: translateX(0); }
200
+ 30.6%, to { transform: translateX(330px); }
201
+ }
202
+ .lp { fill: var(--_p); }
203
+ .fc { fill: var(--_f); stroke: light-dark(transparent, var(--_e)); stroke-width: 0.5; }
204
+ .ed { fill: none; stroke: var(--_e); stroke-width: 0.5; }
205
+ .ink { color: var(--_ink); }
206
+ .lg { overflow: visible; fill: light-dark(var(--c, var(--_ink)), var(--cd, var(--c, var(--_ink)))); }
207
+ @media (prefers-reduced-motion: reduce) { .sh { display: none; } }
208
+ @container style(--ui-motion-scale: 0) { .sh { display: none; } }
209
+ @media (forced-colors: active) {
210
+ :host { --_ink: CanvasText; }
211
+ .fc, .lp { fill: Canvas; }
212
+ .ed { stroke: CanvasText; stroke-width: 1px; vector-effect: non-scaling-stroke; }
213
+ .ln { fill: GrayText; }
214
+ .sh, .gw, .rim { display: none; }
215
+ .ds { flood-opacity: 0; }
216
+ }
217
+ `,
218
+ })
219
+ export class UiLeadSourcing {
220
+ /** Your own logos, left / centre / right. Leave a slot out (or `null`) to keep the built-in glyph there. */
221
+ readonly logos = input<readonly (LeadSourcingLogo | null | undefined)[]>([]);
222
+ /** What screen readers hear. Left out, it is built from `labels` and the logo names. An empty string hides the scene as decoration. */
223
+ readonly label = input<string>();
224
+ /** Words for the generated label, for other languages or your own names for the built-in glyphs. */
225
+ readonly labels = input<Partial<LeadSourcingLabels>>({});
226
+
227
+ protected readonly id = `ui-ls-${nextId++}-`;
228
+ protected readonly corners = CORNERS;
229
+ protected readonly tiles = [...CORNERS, ...SIDES, CENTRE];
230
+ protected readonly box = BOX;
231
+
232
+ protected readonly slots = computed(() => [0, 1, 2].map((i) => this.logos()[i] ?? null));
233
+ protected readonly name = computed(() => {
234
+ const label = this.label();
235
+ if (label !== undefined) return label;
236
+ const l = { ...LABELS, ...this.labels() };
237
+ const [a, b, c] = this.slots();
238
+ return fill(l.scene, { left: a?.name ?? l.left, center: b?.name ?? l.center, right: c?.name ?? l.right });
239
+ });
240
+
241
+ private readonly doc = inject(DOCUMENT);
242
+ private readonly win = this.doc.defaultView;
243
+ private readonly host = inject<ElementRef<HTMLElement>>(ElementRef).nativeElement;
244
+ private readonly ready = signal(false);
245
+ private readonly seen = signal(false);
246
+ private readonly shown = signal(true);
247
+ private readonly still = signal(false);
248
+ protected readonly running = computed(() => this.ready() && this.seen() && this.shown() && !this.still());
249
+
250
+ constructor() {
251
+ let io: IntersectionObserver | undefined;
252
+ let mq: MediaQueryList | undefined;
253
+ const onVisibility = () => this.shown.set(this.doc.visibilityState !== 'hidden');
254
+ const onMotion = () => {
255
+ const scale = this.win?.getComputedStyle?.(this.host).getPropertyValue('--ui-motion-scale') ?? '';
256
+ this.still.set(!!mq?.matches || parseFloat(scale) === 0);
257
+ };
258
+
259
+ afterNextRender(() => {
260
+ mq = this.win?.matchMedia?.('(prefers-reduced-motion: reduce)');
261
+ mq?.addEventListener?.('change', onMotion);
262
+ onVisibility();
263
+ onMotion();
264
+ this.doc.addEventListener('visibilitychange', onVisibility);
265
+ const Observer = this.win?.IntersectionObserver;
266
+ if (Observer) {
267
+ io = new Observer((entries) => this.seen.set(entries[entries.length - 1].isIntersecting), { threshold: [0] });
268
+ io.observe(this.host);
269
+ } else {
270
+ this.seen.set(true);
271
+ }
272
+ this.ready.set(true);
273
+ });
274
+
275
+ inject(DestroyRef).onDestroy(() => {
276
+ io?.disconnect();
277
+ mq?.removeEventListener?.('change', onMotion);
278
+ this.doc.removeEventListener('visibilitychange', onVisibility);
279
+ });
280
+ }
281
+
282
+ protected url(key: string) {
283
+ return `url(#${this.id}${key})`;
284
+ }
285
+ }