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.
- package/LICENSE +21 -0
- package/README.md +153 -2
- package/cli/ochreui.mjs +601 -0
- package/mcp/core.mjs +126 -0
- package/mcp/docs.json +906 -0
- package/mcp/server.mjs +23 -0
- package/package.json +393 -3
- package/registry/agent-team.ts +350 -0
- package/registry/avatar.ts +300 -0
- package/registry/badge.ts +207 -0
- package/registry/breadcrumb.ts +435 -0
- package/registry/button.ts +238 -0
- package/registry/card.ts +221 -0
- package/registry/change-summary.ts +200 -0
- package/registry/checkbox.ts +204 -0
- package/registry/code-block.ts +332 -0
- package/registry/color-picker.ts +720 -0
- package/registry/comment-thread.ts +503 -0
- package/registry/context-menu.ts +281 -0
- package/registry/cover-flow.ts +623 -0
- package/registry/date-picker.ts +799 -0
- package/registry/decision-inbox.ts +340 -0
- package/registry/dialog.ts +577 -0
- package/registry/dropdown-menu.ts +864 -0
- package/registry/email-draft.ts +916 -0
- package/registry/empty-calendar.ts +199 -0
- package/registry/empty-state.ts +164 -0
- package/registry/enrichment-orbit.ts +164 -0
- package/registry/filter-menu.ts +541 -0
- package/registry/form-field.ts +308 -0
- package/registry/frost-cloud.ts +381 -0
- package/registry/ghosted-chat.ts +210 -0
- package/registry/glow-cloud.ts +402 -0
- package/registry/grid-background.ts +164 -0
- package/registry/hover-card.ts +401 -0
- package/registry/icon-button.ts +133 -0
- package/registry/index.json +2124 -0
- package/registry/integration-beam.ts +588 -0
- package/registry/integration-grid.ts +209 -0
- package/registry/kbd.ts +176 -0
- package/registry/layer-stack.ts +351 -0
- package/registry/lead-sourcing.ts +285 -0
- package/registry/logo-cluster.ts +239 -0
- package/registry/logo-marquee.ts +505 -0
- package/registry/message-actions.ts +833 -0
- package/registry/model-orbit.ts +583 -0
- package/registry/model-wheel.ts +372 -0
- package/registry/notification-stack.ts +301 -0
- package/registry/number-input.ts +552 -0
- package/registry/number-ticker.ts +261 -0
- package/registry/ochre.css +917 -0
- package/registry/otp-input.ts +704 -0
- package/registry/overlay.ts +312 -0
- package/registry/pagination.ts +362 -0
- package/registry/popover.ts +296 -0
- package/registry/profile-menu.ts +332 -0
- package/registry/progress-tracker.ts +291 -0
- package/registry/rating.ts +461 -0
- package/registry/reaction-bar.ts +322 -0
- package/registry/region-map.ts +537 -0
- package/registry/resizable.ts +489 -0
- package/registry/scroll-area.ts +271 -0
- package/registry/segmented-control.ts +433 -0
- package/registry/select.ts +769 -0
- package/registry/separator.ts +97 -0
- package/registry/shimmer-loader.ts +211 -0
- package/registry/side-folder.ts +152 -0
- package/registry/skeleton.ts +136 -0
- package/registry/skill/INSTRUCTIONS.md +11 -0
- package/registry/skill/SKILL.md +65 -0
- package/registry/skill/checklist.md +45 -0
- package/registry/skill/references/agent-team.md +105 -0
- package/registry/skill/references/avatar.md +88 -0
- package/registry/skill/references/badge.md +92 -0
- package/registry/skill/references/breadcrumb.md +99 -0
- package/registry/skill/references/button.md +82 -0
- package/registry/skill/references/card.md +111 -0
- package/registry/skill/references/catalog.md +114 -0
- package/registry/skill/references/change-summary.md +103 -0
- package/registry/skill/references/checkbox.md +105 -0
- package/registry/skill/references/code-block.md +109 -0
- package/registry/skill/references/color-picker.md +138 -0
- package/registry/skill/references/comment-thread.md +164 -0
- package/registry/skill/references/context-menu.md +205 -0
- package/registry/skill/references/cover-flow.md +128 -0
- package/registry/skill/references/date-picker.md +154 -0
- package/registry/skill/references/decision-inbox.md +126 -0
- package/registry/skill/references/dialog.md +155 -0
- package/registry/skill/references/dropdown-menu.md +144 -0
- package/registry/skill/references/email-draft.md +182 -0
- package/registry/skill/references/empty-calendar.md +74 -0
- package/registry/skill/references/empty-state.md +118 -0
- package/registry/skill/references/enrichment-orbit.md +71 -0
- package/registry/skill/references/filter-menu.md +143 -0
- package/registry/skill/references/form-field.md +118 -0
- package/registry/skill/references/frost-cloud.md +80 -0
- package/registry/skill/references/ghosted-chat.md +75 -0
- package/registry/skill/references/glow-cloud.md +84 -0
- package/registry/skill/references/grid-background.md +76 -0
- package/registry/skill/references/hover-card.md +125 -0
- package/registry/skill/references/icon-button.md +99 -0
- package/registry/skill/references/integration-beam.md +107 -0
- package/registry/skill/references/integration-grid.md +100 -0
- package/registry/skill/references/kbd.md +65 -0
- package/registry/skill/references/layer-stack.md +115 -0
- package/registry/skill/references/lead-sourcing.md +92 -0
- package/registry/skill/references/logo-cluster.md +92 -0
- package/registry/skill/references/logo-marquee.md +123 -0
- package/registry/skill/references/message-actions.md +146 -0
- package/registry/skill/references/model-orbit.md +106 -0
- package/registry/skill/references/model-wheel.md +84 -0
- package/registry/skill/references/notification-stack.md +138 -0
- package/registry/skill/references/number-input.md +117 -0
- package/registry/skill/references/number-ticker.md +73 -0
- package/registry/skill/references/otp-input.md +142 -0
- package/registry/skill/references/pagination.md +112 -0
- package/registry/skill/references/popover.md +143 -0
- package/registry/skill/references/profile-menu.md +123 -0
- package/registry/skill/references/progress-tracker.md +122 -0
- package/registry/skill/references/rating.md +111 -0
- package/registry/skill/references/reaction-bar.md +128 -0
- package/registry/skill/references/region-map.md +109 -0
- package/registry/skill/references/resizable.md +127 -0
- package/registry/skill/references/scroll-area.md +113 -0
- package/registry/skill/references/segmented-control.md +96 -0
- package/registry/skill/references/select.md +122 -0
- package/registry/skill/references/separator.md +69 -0
- package/registry/skill/references/shimmer-loader.md +83 -0
- package/registry/skill/references/side-folder.md +75 -0
- package/registry/skill/references/skeleton.md +95 -0
- package/registry/skill/references/smart-recommendation.md +132 -0
- package/registry/skill/references/spinner.md +84 -0
- package/registry/skill/references/switch.md +79 -0
- package/registry/skill/references/tab-overload.md +70 -0
- package/registry/skill/references/tag-input.md +126 -0
- package/registry/skill/references/team-invite.md +94 -0
- package/registry/skill/references/testimonial-wall.md +110 -0
- package/registry/skill/references/text-area.md +115 -0
- package/registry/skill/references/text-field.md +126 -0
- package/registry/skill/references/text-reveal.md +71 -0
- package/registry/skill/references/thinking-loader.md +87 -0
- package/registry/skill/references/time-picker.md +122 -0
- package/registry/skill/references/tips-panel.md +115 -0
- package/registry/skill/references/toggle-group.md +98 -0
- package/registry/skill/references/tool-call-card.md +151 -0
- package/registry/skill/references/tooltip.md +94 -0
- package/registry/skill/references/tree-view.md +172 -0
- package/registry/skill/theming.md +57 -0
- package/registry/smart-recommendation.ts +415 -0
- package/registry/spinner.ts +67 -0
- package/registry/switch.ts +146 -0
- package/registry/tab-overload.ts +211 -0
- package/registry/tag-input.ts +620 -0
- package/registry/team-invite.ts +248 -0
- package/registry/testimonial-wall.ts +521 -0
- package/registry/text-area.ts +432 -0
- package/registry/text-field.ts +415 -0
- package/registry/text-reveal.ts +175 -0
- package/registry/theme.ts +68 -0
- package/registry/thinking-loader.ts +302 -0
- package/registry/time-picker.ts +828 -0
- package/registry/tips-panel.ts +312 -0
- package/registry/toggle-group.ts +357 -0
- package/registry/tool-call-card.ts +578 -0
- package/registry/tooltip.ts +486 -0
- package/registry/tree-view.ts +454 -0
- package/styles/base.css +500 -0
- package/styles/tokens.css +415 -0
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
// Ochre (https://ochreui.dev), MIT License, Copyright (c) 2026 Ochre. Keep this notice in copies of this file.
|
|
2
|
+
/**
|
|
3
|
+
* Separator, from Ochre (https://ochreui.dev).
|
|
4
|
+
* Needs ochre.css (`npx ochreui init`).
|
|
5
|
+
*
|
|
6
|
+
* Public styling hooks (set them on the element or any ancestor):
|
|
7
|
+
* --ui-separator-color line color (default --ui-hairline; --ui-border with data-ui-look="tray")
|
|
8
|
+
* --ui-separator-width line thickness (default 0.5px; 1px with data-ui-look="tray")
|
|
9
|
+
* --ui-separator-length upright height (default one line of small text: 16px; 18px with data-ui-look="tray")
|
|
10
|
+
*/
|
|
11
|
+
import { Component, ElementRef, afterRenderEffect, booleanAttribute, computed, input, signal, viewChild } from '@angular/core';
|
|
12
|
+
|
|
13
|
+
export type SeparatorOrientation = 'horizontal' | 'vertical';
|
|
14
|
+
|
|
15
|
+
let nextId = 0;
|
|
16
|
+
|
|
17
|
+
@Component({
|
|
18
|
+
selector: 'ui-separator',
|
|
19
|
+
host: {
|
|
20
|
+
class: 'ui-separator',
|
|
21
|
+
'[attr.role]': "decorative() ? 'none' : 'separator'",
|
|
22
|
+
'[attr.aria-orientation]': "!decorative() && vertical() ? 'vertical' : null",
|
|
23
|
+
'[attr.aria-labelledby]': '!decorative() && !vertical() && (label() || projected()) ? labelId : null',
|
|
24
|
+
'[attr.aria-label]': '!decorative() && vertical() && label() ? label() : null',
|
|
25
|
+
'[attr.data-orientation]': 'orientation()',
|
|
26
|
+
},
|
|
27
|
+
template: `
|
|
28
|
+
@if (!vertical()) {
|
|
29
|
+
<span class="line" aria-hidden="true"></span>
|
|
30
|
+
@if (label()) {
|
|
31
|
+
<span class="label" [id]="labelId">{{ label() }}</span>
|
|
32
|
+
} @else {
|
|
33
|
+
<span #slot class="label" [id]="labelId"><ng-content /></span>
|
|
34
|
+
}
|
|
35
|
+
<span class="line" aria-hidden="true"></span>
|
|
36
|
+
}
|
|
37
|
+
`,
|
|
38
|
+
styles: `
|
|
39
|
+
:host {
|
|
40
|
+
--_t: var(--ui-look-tray, 0);
|
|
41
|
+
--_w: var(--ui-separator-width, calc(0.5px + 0.5px * var(--_t)));
|
|
42
|
+
--_c: var(--ui-separator-color, color-mix(in srgb, var(--ui-border) calc(var(--_t) * 100%), var(--ui-hairline)));
|
|
43
|
+
--_lh: calc(var(--ui-leading-xs) + (var(--ui-leading-sm) - var(--ui-leading-xs)) * var(--_t));
|
|
44
|
+
--_len: var(--ui-separator-length, var(--_lh));
|
|
45
|
+
display: flex;
|
|
46
|
+
align-items: center;
|
|
47
|
+
gap: calc(var(--ui-space-2-5) + var(--ui-space-0-5) * var(--_t));
|
|
48
|
+
color: var(--ui-text-muted);
|
|
49
|
+
font-size: var(--ui-text-sm);
|
|
50
|
+
line-height: var(--_lh);
|
|
51
|
+
}
|
|
52
|
+
.line {
|
|
53
|
+
flex: 1 1 0;
|
|
54
|
+
min-inline-size: var(--ui-space-3);
|
|
55
|
+
border-block-start: var(--_w) solid var(--_c);
|
|
56
|
+
}
|
|
57
|
+
.label:empty,
|
|
58
|
+
.label:empty + .line { display: none; }
|
|
59
|
+
.label {
|
|
60
|
+
flex: 0 1 auto;
|
|
61
|
+
min-inline-size: 0;
|
|
62
|
+
text-align: center;
|
|
63
|
+
overflow-wrap: anywhere;
|
|
64
|
+
}
|
|
65
|
+
:host([data-orientation='vertical']) {
|
|
66
|
+
display: block;
|
|
67
|
+
flex: none;
|
|
68
|
+
align-self: center;
|
|
69
|
+
inline-size: 0;
|
|
70
|
+
block-size: var(--_len);
|
|
71
|
+
border-inline-start: var(--_w) solid var(--_c);
|
|
72
|
+
}
|
|
73
|
+
@media (forced-colors: active) {
|
|
74
|
+
:host,
|
|
75
|
+
.line {
|
|
76
|
+
--_c: CanvasText;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
`,
|
|
80
|
+
})
|
|
81
|
+
export class UiSeparator {
|
|
82
|
+
/** A line across its container, or a short upright line between items in a row. */
|
|
83
|
+
readonly orientation = input<SeparatorOrientation>('horizontal');
|
|
84
|
+
/** A word or two in the middle of a horizontal line; text put inside the element works too. On a vertical one it is only the accessible name. */
|
|
85
|
+
readonly label = input<string>();
|
|
86
|
+
/** Visual only and hidden from screen readers. Set false to expose a real separator, named by its label. */
|
|
87
|
+
readonly decorative = input(true, { transform: booleanAttribute });
|
|
88
|
+
|
|
89
|
+
protected readonly vertical = computed(() => this.orientation() === 'vertical');
|
|
90
|
+
protected readonly labelId = `ui-separator-${nextId++}`;
|
|
91
|
+
protected readonly projected = signal(false);
|
|
92
|
+
private readonly slot = viewChild<ElementRef<HTMLElement>>('slot');
|
|
93
|
+
|
|
94
|
+
constructor() {
|
|
95
|
+
afterRenderEffect(() => this.projected.set(!!this.slot()?.nativeElement.textContent?.trim()));
|
|
96
|
+
}
|
|
97
|
+
}
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
// Ochre (https://ochreui.dev), MIT License, Copyright (c) 2026 Ochre. Keep this notice in copies of this file.
|
|
2
|
+
/**
|
|
3
|
+
* Shimmer Loader, from Ochre (https://ochreui.dev).
|
|
4
|
+
* Needs ochre.css (`npx ochreui init`).
|
|
5
|
+
*
|
|
6
|
+
* <div aria-busy="true"><span uiShimmerBlock circle [width]="36"></span><span uiShimmerBlock [width]="120" [height]="10"></span></div>
|
|
7
|
+
* <p uiShimmerText>Generating summary…</p>
|
|
8
|
+
* Blocks are gray placeholders on your own elements, swept by one band of light across the page.
|
|
9
|
+
* Shimmer text keeps your real text and runs a band through it. Still with reduced motion.
|
|
10
|
+
*
|
|
11
|
+
* Public styling hooks (set them on the element or any ancestor):
|
|
12
|
+
* --ui-shimmer-loader-bg block fill (default: a step from the surface, about 1.18:1)
|
|
13
|
+
* --ui-shimmer-loader-sheen passing light (default: almost the surface in light, a lighter grey in dark)
|
|
14
|
+
* --ui-shimmer-loader-speed one block sweep (default 2200ms)
|
|
15
|
+
* --ui-shimmer-loader-radius block corners (default 6px)
|
|
16
|
+
* --ui-shimmer-loader-text text at rest (default --ui-text-muted)
|
|
17
|
+
* --ui-shimmer-loader-glint band in the text (default: toward the surface in light, toward the text in dark)
|
|
18
|
+
*/
|
|
19
|
+
import {
|
|
20
|
+
Component,
|
|
21
|
+
DOCUMENT,
|
|
22
|
+
DestroyRef,
|
|
23
|
+
ElementRef,
|
|
24
|
+
afterNextRender,
|
|
25
|
+
booleanAttribute,
|
|
26
|
+
computed,
|
|
27
|
+
inject,
|
|
28
|
+
input,
|
|
29
|
+
isDevMode,
|
|
30
|
+
numberAttribute,
|
|
31
|
+
} from '@angular/core';
|
|
32
|
+
|
|
33
|
+
export type ShimmerLength = number | string;
|
|
34
|
+
|
|
35
|
+
const toLength = (v: ShimmerLength | null | undefined): string | null => {
|
|
36
|
+
if (v === null || v === undefined) return null;
|
|
37
|
+
const s = String(v).trim();
|
|
38
|
+
const n = s === '' ? NaN : Number(s);
|
|
39
|
+
if (typeof v === 'string' && Number.isNaN(n) && s !== '' && s !== 'NaN') return s;
|
|
40
|
+
return Number.isFinite(n) && n > 0 ? `${n}px` : null;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
interface Watched {
|
|
44
|
+
run: (on: boolean) => void;
|
|
45
|
+
seen: boolean;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
interface Hub {
|
|
49
|
+
io?: IntersectionObserver;
|
|
50
|
+
all: Map<Element, Watched>;
|
|
51
|
+
wake: () => void;
|
|
52
|
+
motion?: MediaQueryList;
|
|
53
|
+
calm: () => void;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const hubs = new WeakMap<Document, Hub>();
|
|
57
|
+
|
|
58
|
+
/** Reduced motion or --ui-motion-scale: 0 marks the element `data-still`, which drops the band. */
|
|
59
|
+
function still(el: Element, motion?: MediaQueryList): void {
|
|
60
|
+
const scale = parseFloat(el.ownerDocument.defaultView?.getComputedStyle(el).getPropertyValue('--ui-motion-scale') ?? '');
|
|
61
|
+
el.toggleAttribute('data-still', !!motion?.matches || scale === 0);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/** One IntersectionObserver, one visibilitychange and one reduced-motion listener per document, shared by every instance. */
|
|
65
|
+
function watch(doc: Document, el: Element, run: (on: boolean) => void): () => void {
|
|
66
|
+
let hub = hubs.get(doc);
|
|
67
|
+
if (!hub) {
|
|
68
|
+
const all = new Map<Element, Watched>();
|
|
69
|
+
const shown = () => doc.visibilityState !== 'hidden';
|
|
70
|
+
const Io = doc.defaultView?.IntersectionObserver;
|
|
71
|
+
const io = Io && new Io((entries) => {
|
|
72
|
+
for (const e of entries) {
|
|
73
|
+
const w = all.get(e.target);
|
|
74
|
+
if (w) w.run((w.seen = e.isIntersecting) && shown());
|
|
75
|
+
}
|
|
76
|
+
}, { rootMargin: '64px' });
|
|
77
|
+
const wake = () => all.forEach((w) => w.run(w.seen && shown()));
|
|
78
|
+
const motion = doc.defaultView?.matchMedia?.('(prefers-reduced-motion: reduce)');
|
|
79
|
+
const calm = () => all.forEach((_, e) => still(e, motion));
|
|
80
|
+
doc.addEventListener('visibilitychange', wake);
|
|
81
|
+
motion?.addEventListener?.('change', calm);
|
|
82
|
+
hubs.set(doc, (hub = { io, all, wake, motion, calm }));
|
|
83
|
+
}
|
|
84
|
+
const h = hub;
|
|
85
|
+
h.all.set(el, { run, seen: true });
|
|
86
|
+
h.io?.observe(el);
|
|
87
|
+
still(el, h.motion);
|
|
88
|
+
return () => {
|
|
89
|
+
h.all.delete(el);
|
|
90
|
+
h.io?.unobserve(el);
|
|
91
|
+
if (h.all.size) return;
|
|
92
|
+
h.io?.disconnect();
|
|
93
|
+
doc.removeEventListener('visibilitychange', h.wake);
|
|
94
|
+
h.motion?.removeEventListener?.('change', h.calm);
|
|
95
|
+
hubs.delete(doc);
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
let warnedBusy = false;
|
|
100
|
+
|
|
101
|
+
/** A gray placeholder on your own empty element: `<span uiShimmerBlock>`. Hidden from screen readers. */
|
|
102
|
+
@Component({
|
|
103
|
+
selector: '[uiShimmerBlock]',
|
|
104
|
+
host: {
|
|
105
|
+
'aria-hidden': 'true',
|
|
106
|
+
'[attr.data-circle]': 'circle() ? "" : null',
|
|
107
|
+
'[style.--_w]': 'width()',
|
|
108
|
+
'[style.--_h]': 'height()',
|
|
109
|
+
'[style.--_r]': 'radius()',
|
|
110
|
+
},
|
|
111
|
+
template: ``,
|
|
112
|
+
styles: `
|
|
113
|
+
:host {
|
|
114
|
+
--_g: var(--ui-shimmer-loader-bg, light-dark(color-mix(in srgb, var(--ui-text) 8%, var(--ui-bg-surface)), color-mix(in srgb, var(--ui-text) 7%, var(--ui-bg-surface))));
|
|
115
|
+
--_s: var(--ui-shimmer-loader-sheen, light-dark(color-mix(in srgb, var(--ui-text) 1%, var(--ui-bg-surface)), color-mix(in srgb, var(--ui-text) 15%, var(--ui-bg-surface))));
|
|
116
|
+
display: block;
|
|
117
|
+
box-sizing: border-box;
|
|
118
|
+
inline-size: min(var(--_w, 100%), 100%);
|
|
119
|
+
block-size: var(--_h, var(--ui-space-3));
|
|
120
|
+
border-radius: var(--_r, var(--ui-shimmer-loader-radius, 6px));
|
|
121
|
+
background: linear-gradient(96deg, var(--_g) 27.5%, var(--_s) 50%, var(--_g) 72.5%) 0 0 / 150vw 100vh fixed var(--_g);
|
|
122
|
+
animation: s var(--ui-shimmer-loader-speed, 2200ms) linear infinite;
|
|
123
|
+
}
|
|
124
|
+
:host([data-circle]) { flex-shrink: 0; block-size: auto; aspect-ratio: 1; border-radius: 50%; }
|
|
125
|
+
:host([data-idle]) { animation: none; }
|
|
126
|
+
:host([data-still]) { animation: none; background: var(--_g); }
|
|
127
|
+
@container style(--ui-motion-scale: 0) { :host { animation: none; background: var(--_g); } }
|
|
128
|
+
@keyframes s { from { background-position-x: -64vw; } to { background-position-x: 86vw; } }
|
|
129
|
+
@media (prefers-reduced-motion: reduce) { :host { animation: none; background: var(--_g); } }
|
|
130
|
+
@media (forced-colors: active) { :host, :host([data-still]) { border: 1px solid GrayText; background: Canvas; animation: none; } }
|
|
131
|
+
`,
|
|
132
|
+
})
|
|
133
|
+
export class UiShimmerBlock {
|
|
134
|
+
/** Width: a number is px, a string any CSS length. Never wider than its parent. Left out, it fills the row. */
|
|
135
|
+
readonly width = input<string | null, ShimmerLength | null | undefined>(null, { transform: toLength });
|
|
136
|
+
/** Height. Default 12px. Ignored by `circle`. */
|
|
137
|
+
readonly height = input<string | null, ShimmerLength | null | undefined>(null, { transform: toLength });
|
|
138
|
+
/** Corner radius. Default 6px. */
|
|
139
|
+
readonly radius = input<string | null, ShimmerLength | null | undefined>(null, { transform: toLength });
|
|
140
|
+
/** A round shape as tall as it is wide, for avatars. */
|
|
141
|
+
readonly circle = input(false, { transform: booleanAttribute });
|
|
142
|
+
|
|
143
|
+
constructor() {
|
|
144
|
+
const el = inject<ElementRef<HTMLElement>>(ElementRef).nativeElement;
|
|
145
|
+
const doc = inject(DOCUMENT);
|
|
146
|
+
/** Every block runs on the document clock, so blocks added at any time, or resumed together, show one band. */
|
|
147
|
+
const sync = () => el.getAnimations?.().forEach((a) => (a.startTime = 0));
|
|
148
|
+
let on = true;
|
|
149
|
+
let stop = () => {};
|
|
150
|
+
afterNextRender(() => {
|
|
151
|
+
sync();
|
|
152
|
+
stop = watch(doc, el, (next) => {
|
|
153
|
+
if (next === on) return;
|
|
154
|
+
on = next;
|
|
155
|
+
el.toggleAttribute('data-idle', !on);
|
|
156
|
+
if (on) sync();
|
|
157
|
+
});
|
|
158
|
+
if (isDevMode() && !warnedBusy && !el.closest('[aria-busy], [role=status]')) {
|
|
159
|
+
warnedBusy = true;
|
|
160
|
+
console.warn('uiShimmerBlock: blocks are hidden from screen readers. Put aria-busy="true" on the container that is loading.', el);
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
inject(DestroyRef).onDestroy(() => stop());
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/** Runs a band of light through your own text: `<p uiShimmerText>Generating summary…</p>`. Screen readers read the text as is. */
|
|
168
|
+
@Component({
|
|
169
|
+
selector: '[uiShimmerText]',
|
|
170
|
+
host: {
|
|
171
|
+
'[style.--_d]': 'seconds()',
|
|
172
|
+
},
|
|
173
|
+
template: `<ng-content />`,
|
|
174
|
+
styles: `
|
|
175
|
+
:host {
|
|
176
|
+
--_b: var(--ui-shimmer-loader-text, var(--ui-text-muted));
|
|
177
|
+
--_s: var(--ui-shimmer-loader-glint, light-dark(color-mix(in srgb, var(--_b) 9%, var(--ui-bg-surface)), var(--ui-text)));
|
|
178
|
+
background: linear-gradient(90deg, var(--_b) 40.5%, var(--_s) 48.3%, var(--_b) 56.2%) 100% 0 / 300% 100%;
|
|
179
|
+
-webkit-background-clip: text;
|
|
180
|
+
background-clip: text;
|
|
181
|
+
color: transparent;
|
|
182
|
+
animation: s var(--_d, 2s) linear infinite var(--_p, running);
|
|
183
|
+
}
|
|
184
|
+
:host([data-still]) { animation: none; background: none; color: var(--_b); }
|
|
185
|
+
@container style(--ui-motion-scale: 0) { :host { animation: none; background: none; color: var(--_b); } }
|
|
186
|
+
@keyframes s { to { background-position: 0 0; } }
|
|
187
|
+
@media (prefers-reduced-motion: reduce) { :host { animation: none; background: none; color: var(--_b); } }
|
|
188
|
+
@media (forced-colors: active) { :host, :host([data-still]) { animation: none; background: none; color: CanvasText; } }
|
|
189
|
+
`,
|
|
190
|
+
})
|
|
191
|
+
export class UiShimmerText {
|
|
192
|
+
/** Seconds for one pass of the band. Default 2. */
|
|
193
|
+
readonly duration = input(2, { transform: numberAttribute });
|
|
194
|
+
|
|
195
|
+
protected readonly seconds = computed(() => {
|
|
196
|
+
const d = this.duration();
|
|
197
|
+
return `${Number.isFinite(d) && d > 0 ? d : 2}s`;
|
|
198
|
+
});
|
|
199
|
+
constructor() {
|
|
200
|
+
const el = inject<ElementRef<HTMLElement>>(ElementRef).nativeElement;
|
|
201
|
+
/** `auto` unless the element has a `dir`, so a trailing "…" stays at the end in right-to-left text. A `[dir]` binding overrides it. */
|
|
202
|
+
if (!el.hasAttribute('dir')) el.setAttribute('dir', 'auto');
|
|
203
|
+
const doc = inject(DOCUMENT);
|
|
204
|
+
let stop = () => {};
|
|
205
|
+
afterNextRender(() => {
|
|
206
|
+
stop = watch(doc, el, (on) => el.style.setProperty('--_p', on ? null : 'paused'));
|
|
207
|
+
if (isDevMode() && !el.textContent?.trim()) console.warn('uiShimmerText: the element has no text, so screen readers hear nothing.', el);
|
|
208
|
+
});
|
|
209
|
+
inject(DestroyRef).onDestroy(() => stop());
|
|
210
|
+
}
|
|
211
|
+
}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
// Ochre (https://ochreui.dev), MIT License, Copyright (c) 2026 Ochre. Keep this notice in copies of this file.
|
|
2
|
+
/**
|
|
3
|
+
* Side Folder, from Ochre (https://ochreui.dev).
|
|
4
|
+
* Needs ochre.css (the --ui-* tokens), which `npx ochreui init` adds once.
|
|
5
|
+
*
|
|
6
|
+
* <ui-side-folder />
|
|
7
|
+
* A glassy folder on its side with three pages peeking out; on hover the pocket swings open and the pages slide out.
|
|
8
|
+
* Pure CSS, 3 : 2 and up to 560px wide. Screen readers hear one image named by `label`.
|
|
9
|
+
*
|
|
10
|
+
* Public styling hooks (set them on the element or any ancestor):
|
|
11
|
+
* --ui-side-folder-back back cover (default: sky blue)
|
|
12
|
+
* --ui-side-folder-back-sheen soft light across the back cover
|
|
13
|
+
* --ui-side-folder-glass-1 pocket glass at the top (translucent)
|
|
14
|
+
* --ui-side-folder-glass-2 pocket glass at the bottom (translucent, deeper)
|
|
15
|
+
* --ui-side-folder-rim pocket rim
|
|
16
|
+
* --ui-side-folder-paper-1 paper at the top
|
|
17
|
+
* --ui-side-folder-paper-2 paper at the bottom
|
|
18
|
+
* --ui-side-folder-paper-edge paper outline
|
|
19
|
+
* --ui-side-folder-line placeholder lines
|
|
20
|
+
* --ui-side-folder-shadow shadow under the folder
|
|
21
|
+
*/
|
|
22
|
+
import { Component, computed, input } from '@angular/core';
|
|
23
|
+
|
|
24
|
+
const POCKET =
|
|
25
|
+
'M0 32Q0 0 32 0H296Q328 0 328 32V310C328 330 334 339 346 348L362 360C374 369 380 378 380 394V488Q380 520 348 520H32Q0 520 0 488Z';
|
|
26
|
+
|
|
27
|
+
let nextId = 0;
|
|
28
|
+
|
|
29
|
+
@Component({
|
|
30
|
+
selector: 'ui-side-folder',
|
|
31
|
+
host: {
|
|
32
|
+
'[attr.role]': "name() ? 'img' : null",
|
|
33
|
+
'[attr.aria-label]': 'name() || null',
|
|
34
|
+
'[attr.aria-hidden]': "name() ? null : 'true'",
|
|
35
|
+
},
|
|
36
|
+
template: `
|
|
37
|
+
<div class="q">
|
|
38
|
+
<div class="s" aria-hidden="true">
|
|
39
|
+
<svg viewBox="0 0 440 520" focusable="false">
|
|
40
|
+
<defs>
|
|
41
|
+
<linearGradient [id]="id + 'h'" x2="0.6" y2="1">
|
|
42
|
+
<stop class="h1" /><stop class="h2" offset="0.45" /><stop class="h3" offset="1" />
|
|
43
|
+
</linearGradient>
|
|
44
|
+
</defs>
|
|
45
|
+
<rect class="bk" y="18" width="440" height="486" rx="36" />
|
|
46
|
+
<rect y="18" width="440" height="486" rx="36" [attr.fill]="url('h')" />
|
|
47
|
+
</svg>
|
|
48
|
+
<svg viewBox="0 0 440 520" focusable="false">
|
|
49
|
+
<defs>
|
|
50
|
+
<linearGradient [id]="id + 'p'" x2="0" y2="1"><stop class="p1" /><stop class="p2" offset="1" /></linearGradient>
|
|
51
|
+
<filter [id]="id + 'f'" x="-10%" y="-10%" width="120%" height="125%">
|
|
52
|
+
<feDropShadow dy="3" stdDeviation="2" />
|
|
53
|
+
</filter>
|
|
54
|
+
</defs>
|
|
55
|
+
<g transform="scale(1.15)">
|
|
56
|
+
@for (d of docs; track d) {
|
|
57
|
+
<g class="pg" [class]="d">
|
|
58
|
+
<rect class="pp" x="0.6" y="0.6" width="278.8" height="348.8" rx="19.4" stroke-width="1.2" [attr.fill]="url('p')" [attr.filter]="url('f')" />
|
|
59
|
+
@for (w of lines; track $index) {
|
|
60
|
+
<rect class="ln" x="30" [attr.y]="87 + 28 * $index" [attr.width]="w" height="9" rx="4.5" />
|
|
61
|
+
}
|
|
62
|
+
</g>
|
|
63
|
+
}
|
|
64
|
+
</g>
|
|
65
|
+
</svg>
|
|
66
|
+
<div class="p" [style.mask-image]="mask">
|
|
67
|
+
<svg viewBox="0 0 380 520" preserveAspectRatio="none" focusable="false">
|
|
68
|
+
<defs>
|
|
69
|
+
<linearGradient [id]="id + 'g'" x2="0" y2="1">
|
|
70
|
+
<stop class="g1" /><stop class="g1" offset="0.72" /><stop class="g2" offset="1" />
|
|
71
|
+
</linearGradient>
|
|
72
|
+
</defs>
|
|
73
|
+
<path class="fb" [attr.d]="pocket" />
|
|
74
|
+
<path [attr.d]="pocket" [attr.fill]="url('g')" class="rm" stroke-width="5" />
|
|
75
|
+
</svg>
|
|
76
|
+
</div>
|
|
77
|
+
</div>
|
|
78
|
+
</div>
|
|
79
|
+
`,
|
|
80
|
+
styles: `
|
|
81
|
+
@layer ui {
|
|
82
|
+
:host { display: block; position: relative; overflow: hidden; inline-size: min(560px, 100%); aspect-ratio: 3 / 2; }
|
|
83
|
+
}
|
|
84
|
+
:host {
|
|
85
|
+
--_e: cubic-bezier(0.22, 1, 0.36, 1);
|
|
86
|
+
--_t: calc(600ms * var(--ui-motion-scale, 1));
|
|
87
|
+
--_sh: var(--ui-side-folder-shadow, rgb(36 118 186 / 0.2));
|
|
88
|
+
box-sizing: border-box;
|
|
89
|
+
}
|
|
90
|
+
:host::before { content: 'x x x x x x x x' / ''; display: block; block-size: 0; overflow: hidden; font-size: 0; word-spacing: 80px; }
|
|
91
|
+
.q { position: absolute; inset: 0; container-type: inline-size; }
|
|
92
|
+
.s {
|
|
93
|
+
position: absolute; inset-inline-start: 50%; top: 50%; box-sizing: border-box;
|
|
94
|
+
inline-size: 37cqw; aspect-ratio: 440 / 520; translate: -50% -50%;
|
|
95
|
+
perspective: 260cqw; direction: ltr; forced-color-adjust: none;
|
|
96
|
+
transition: scale var(--_t) var(--_e);
|
|
97
|
+
}
|
|
98
|
+
svg { position: absolute; inset: 0; display: block; inline-size: 100%; block-size: 100%; overflow: visible; }
|
|
99
|
+
.s > svg:first-child {
|
|
100
|
+
filter: drop-shadow(0 2cqw 2.37cqw var(--_sh)) drop-shadow(0 0.67cqw 1cqw var(--_sh)) drop-shadow(0 0.17cqw 0.33cqw var(--_sh));
|
|
101
|
+
}
|
|
102
|
+
.bk { fill: var(--ui-side-folder-back, #56b5eb); }
|
|
103
|
+
.h1 { stop-color: var(--ui-side-folder-back-sheen, rgb(255 255 255 / 0.2)); }
|
|
104
|
+
.h2 { stop-color: rgb(255 255 255 / 0); }
|
|
105
|
+
.h3 { stop-color: rgb(16 72 128 / 0.04); }
|
|
106
|
+
.p1 { stop-color: var(--ui-side-folder-paper-1, #fff); }
|
|
107
|
+
.p2 { stop-color: var(--ui-side-folder-paper-2, #ebf2f9); }
|
|
108
|
+
.pp { stroke: var(--ui-side-folder-paper-edge, #d6dce3); }
|
|
109
|
+
feDropShadow { flood-color: rgb(24 56 92 / 0.13); }
|
|
110
|
+
.ln { fill: var(--ui-side-folder-line, #dfe2e6); }
|
|
111
|
+
.pg {
|
|
112
|
+
transform-box: fill-box; transform-origin: center;
|
|
113
|
+
transition: transform calc(550ms * var(--ui-motion-scale, 1)) var(--_e);
|
|
114
|
+
}
|
|
115
|
+
.a { transform: translate(83px, 43px) rotate(3deg); }
|
|
116
|
+
.b { transform: translate(78px, 68px) rotate(4deg); }
|
|
117
|
+
.c { transform: translate(73px, 56px) rotate(-2deg); }
|
|
118
|
+
.p {
|
|
119
|
+
position: absolute; inset-block: 0; inset-inline-start: 0; inline-size: 86.36%; box-sizing: border-box;
|
|
120
|
+
transform-origin: left center; transition: transform var(--_t) var(--_e);
|
|
121
|
+
backdrop-filter: blur(1.665cqw);
|
|
122
|
+
mask-size: 100% 100%; mask-repeat: no-repeat;
|
|
123
|
+
}
|
|
124
|
+
.g1 { stop-color: var(--ui-side-folder-glass-1, rgb(104 196 246 / 0.5)); }
|
|
125
|
+
.g2 { stop-color: var(--ui-side-folder-glass-2, rgb(52 118 166 / 0.72)); }
|
|
126
|
+
.rm { stroke: var(--ui-side-folder-rim, rgb(255 255 255 / 0.32)); }
|
|
127
|
+
.fb { display: none; fill: rgb(214 236 248 / 0.85); }
|
|
128
|
+
@supports not (backdrop-filter: blur(1px)) { .fb { display: inline; } }
|
|
129
|
+
@media (hover: hover) {
|
|
130
|
+
.s:hover { scale: 1.03; }
|
|
131
|
+
.s:hover .p { transform: translateZ(1.11cqw) rotateY(-12deg); }
|
|
132
|
+
.s:hover .a { transform: translate(100px, 35px) rotate(6deg); }
|
|
133
|
+
.s:hover .b { transform: translate(93px, 75px) rotate(7deg); }
|
|
134
|
+
.s:hover .c { transform: translate(95px, 54px) rotate(0deg); }
|
|
135
|
+
}
|
|
136
|
+
`,
|
|
137
|
+
})
|
|
138
|
+
export class UiSideFolder {
|
|
139
|
+
/** What screen readers hear. Set it to "" when the text around already says it all. */
|
|
140
|
+
readonly label = input('Blue folder lying on its side, three pages tucked behind its frosted front flap');
|
|
141
|
+
|
|
142
|
+
protected readonly name = computed(() => this.label().trim());
|
|
143
|
+
protected readonly id = `ui-sf${nextId++}-`;
|
|
144
|
+
protected readonly docs = ['a', 'b', 'c'] as const;
|
|
145
|
+
protected readonly lines = [78, 180, 140, 175, 126, 168, 110];
|
|
146
|
+
protected readonly pocket = POCKET;
|
|
147
|
+
protected readonly mask = `url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 380 520' preserveAspectRatio='none'%3E%3Cpath d='${POCKET}'/%3E%3C/svg%3E")`;
|
|
148
|
+
|
|
149
|
+
protected url(key: string) {
|
|
150
|
+
return `url(#${this.id}${key})`;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
// Ochre (https://ochreui.dev), MIT License, Copyright (c) 2026 Ochre. Keep this notice in copies of this file.
|
|
2
|
+
/**
|
|
3
|
+
* Skeleton, from Ochre (https://ochreui.dev).
|
|
4
|
+
* Needs ochre.css (the --ui-* tokens and the ui-sheen and ui-fade-in keyframes), which `npx ochreui init` adds once.
|
|
5
|
+
*
|
|
6
|
+
* <ui-skeleton> is one gray shape sized like the content it stands in for.
|
|
7
|
+
* <ui-loading> wraps the skeletons of one area: one busy status for screen readers, shown only after a short delay.
|
|
8
|
+
*
|
|
9
|
+
* Public styling hooks (set them on the element or any ancestor):
|
|
10
|
+
* --ui-skeleton-bg shape fill (default --ui-bg-placeholder)
|
|
11
|
+
* --ui-skeleton-sheen passing highlight (default --ui-bg-placeholder-sheen)
|
|
12
|
+
* --ui-skeleton-speed one sheen cycle (default 1600ms; no sheen with reduced motion)
|
|
13
|
+
* --ui-skeleton-delay wait before <ui-loading> shows (default 150ms; kept with reduced motion)
|
|
14
|
+
*/
|
|
15
|
+
import { Component, computed, input } from '@angular/core';
|
|
16
|
+
|
|
17
|
+
export type SkeletonLength = number | string;
|
|
18
|
+
|
|
19
|
+
const toLength = (v: SkeletonLength | boolean | null | undefined): string | null => {
|
|
20
|
+
if (typeof v === 'boolean' || v === null || v === undefined) return null;
|
|
21
|
+
const s = String(v).trim();
|
|
22
|
+
const n = s === '' ? NaN : Number(s);
|
|
23
|
+
if (typeof v === 'string' && Number.isNaN(n) && s !== '' && s !== 'NaN') return s;
|
|
24
|
+
return Number.isFinite(n) && n >= 0 ? `${n}px` : null;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const toLine = (v: SkeletonLength | boolean | null | undefined): string | null =>
|
|
28
|
+
v === '' || v === true || v === 'true' ? '1lh' : v === 'false' || v === 0 || v === '0' ? null : toLength(v);
|
|
29
|
+
|
|
30
|
+
@Component({
|
|
31
|
+
selector: 'ui-skeleton',
|
|
32
|
+
host: {
|
|
33
|
+
class: 'ui-skeleton',
|
|
34
|
+
'aria-hidden': 'true',
|
|
35
|
+
'[attr.data-line]': 'line() ? "" : null',
|
|
36
|
+
'[attr.data-fill]': 'width() ? null : ""',
|
|
37
|
+
'[style.--_w]': 'width()',
|
|
38
|
+
'[style.--_h]': 'height()',
|
|
39
|
+
'[style.--_r]': 'radius()',
|
|
40
|
+
'[style.--_lh]': 'line()',
|
|
41
|
+
},
|
|
42
|
+
template: `
|
|
43
|
+
@if (line()) {
|
|
44
|
+
<span class="shape"></span>
|
|
45
|
+
}
|
|
46
|
+
`,
|
|
47
|
+
styles: `
|
|
48
|
+
@layer ui {
|
|
49
|
+
:host(:not([data-line])),
|
|
50
|
+
.shape {
|
|
51
|
+
position: relative;
|
|
52
|
+
display: block;
|
|
53
|
+
flex-shrink: 0;
|
|
54
|
+
box-sizing: border-box;
|
|
55
|
+
inline-size: var(--_w, 100%);
|
|
56
|
+
max-inline-size: 100%;
|
|
57
|
+
block-size: var(--_h, var(--ui-space-3));
|
|
58
|
+
border-radius: var(--_r, var(--ui-radius-sm));
|
|
59
|
+
overflow: hidden;
|
|
60
|
+
}
|
|
61
|
+
:host([data-line]) {
|
|
62
|
+
display: flex;
|
|
63
|
+
align-items: center;
|
|
64
|
+
block-size: var(--_lh);
|
|
65
|
+
max-inline-size: 100%;
|
|
66
|
+
}
|
|
67
|
+
:host([data-fill]) {
|
|
68
|
+
flex: 1 1 0;
|
|
69
|
+
min-inline-size: 0;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
:host(:not([data-line])),
|
|
73
|
+
.shape {
|
|
74
|
+
background: var(--ui-skeleton-bg, var(--ui-bg-placeholder));
|
|
75
|
+
}
|
|
76
|
+
:host(:not([data-line]))::after,
|
|
77
|
+
.shape::after {
|
|
78
|
+
content: '';
|
|
79
|
+
position: absolute;
|
|
80
|
+
inset: 0;
|
|
81
|
+
background: linear-gradient(90deg, transparent, var(--ui-skeleton-sheen, var(--ui-bg-placeholder-sheen)), transparent);
|
|
82
|
+
transform: translateX(-100%);
|
|
83
|
+
animation: ui-sheen var(--ui-skeleton-speed, 1600ms) ease-in-out infinite;
|
|
84
|
+
}
|
|
85
|
+
:host(:dir(rtl))::after,
|
|
86
|
+
:host(:dir(rtl)) .shape::after { scale: -1 1; }
|
|
87
|
+
@media (prefers-reduced-motion: reduce) {
|
|
88
|
+
:host(:not([data-line]))::after,
|
|
89
|
+
.shape::after { display: none; }
|
|
90
|
+
}
|
|
91
|
+
@container style(--ui-motion-scale: 0) {
|
|
92
|
+
:host(:not([data-line]))::after,
|
|
93
|
+
.shape::after { display: none; }
|
|
94
|
+
}
|
|
95
|
+
@media (forced-colors: active) {
|
|
96
|
+
:host(:not([data-line])),
|
|
97
|
+
.shape { border: 1px solid GrayText; background: Canvas; }
|
|
98
|
+
:host(:not([data-line]))::after,
|
|
99
|
+
.shape::after { display: none; }
|
|
100
|
+
}
|
|
101
|
+
`,
|
|
102
|
+
})
|
|
103
|
+
export class UiSkeleton {
|
|
104
|
+
/** Width: a number is px, a string any CSS length. Default: fills the space, never wider than its parent. */
|
|
105
|
+
readonly width = input<string | null, SkeletonLength | null | undefined>(null, { transform: toLength });
|
|
106
|
+
/** Height of the shape. Default 12px. */
|
|
107
|
+
readonly height = input<string | null, SkeletonLength | null | undefined>(null, { transform: toLength });
|
|
108
|
+
/** Corner radius. Default --ui-radius-sm; "50%" makes a circle. */
|
|
109
|
+
readonly radius = input<string | null, SkeletonLength | null | undefined>(null, { transform: toLength });
|
|
110
|
+
/** Centers the shape in a box as tall as a text line; bare for the current line height, or a length (number is px; 0 turns it off). */
|
|
111
|
+
readonly line = input<string | null, SkeletonLength | boolean | null | undefined>(null, { transform: toLine });
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
@Component({
|
|
115
|
+
selector: 'ui-loading',
|
|
116
|
+
host: {
|
|
117
|
+
class: 'ui-loading',
|
|
118
|
+
role: 'status',
|
|
119
|
+
'aria-busy': 'true',
|
|
120
|
+
'[attr.aria-label]': 'name()',
|
|
121
|
+
},
|
|
122
|
+
template: `<ng-content />`,
|
|
123
|
+
styles: `
|
|
124
|
+
@layer ui {
|
|
125
|
+
:host { display: block; }
|
|
126
|
+
}
|
|
127
|
+
:host {
|
|
128
|
+
animation: ui-fade-in var(--ui-duration-4) var(--ui-ease-out) var(--ui-skeleton-delay, 150ms) both;
|
|
129
|
+
}
|
|
130
|
+
`,
|
|
131
|
+
})
|
|
132
|
+
export class UiLoading {
|
|
133
|
+
/** What is loading, for screen readers: "Loading runs". */
|
|
134
|
+
readonly label = input('Loading');
|
|
135
|
+
protected readonly name = computed(() => this.label() || 'Loading');
|
|
136
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Ochre rules
|
|
2
|
+
|
|
3
|
+
Paste this into AGENTS.md or CLAUDE.md, or save it as `.cursor/rules/ochre.mdc`, for agents that don't load skills.
|
|
4
|
+
|
|
5
|
+
- Add components with `npx ochreui@latest add <name>`. It copies one file to `src/app/ui/<name>.ts`; import from `./ui/<name>` and add the class to the standalone component's `imports`. Selectors start with `ui-`.
|
|
6
|
+
- Read the component's API before using it (https://ochreui.dev/components/<name>, or `/ai/<name>.json` on the same site). Never guess an input.
|
|
7
|
+
- Inputs are signals: `[input]="value"`, `[(value)]` for models. Components never change your data: handle outputs and set new arrays and objects.
|
|
8
|
+
- Style only with `--ui-*` tokens and each component's `--ui-<component>-*` variables. No hard-coded colors, no `::ng-deep`.
|
|
9
|
+
- Dark mode is `data-ui-theme` on `<html>`, or `UiTheme` (`npx ochreui@latest add theme`). No per-theme component styles.
|
|
10
|
+
- Translate through the `labels` input. Give icon-only controls an `aria-label`.
|
|
11
|
+
- Prefer inputs and variables over editing the copied files, so `npx ochreui@latest update` keeps them current.
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ochre
|
|
3
|
+
description: Build Angular UI with Ochre, a library of standalone Angular components that are copied into the app as files you own. Use when adding, wiring, theming or reviewing Ochre components (selectors start with ui-, files live in src/app/ui/, tokens are --ui-* CSS variables), when the user mentions Ochre or ochreui, when building an AI product or SaaS screen in Angular that needs agent, chat, data or form UI, or for the commands "ochre scan", "ochre check" and "ochre theme".
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Ochre
|
|
7
|
+
|
|
8
|
+
Ochre is a set of Angular components for AI products and everyday app UI. Each component is one standalone `.ts` file with its template and styles inside. The Ochre CLI copies it into the app, so the app owns the code. Components read only `--ui-*` CSS variables, and light and dark mode, keyboard support and reduced motion are built in. Angular 22 or later; zone.js, zoneless and SSR all work. No other dependencies.
|
|
9
|
+
|
|
10
|
+
**Read a component's reference file before writing code for it. Never guess an input, output or type.**
|
|
11
|
+
|
|
12
|
+
## Workflow
|
|
13
|
+
|
|
14
|
+
```
|
|
15
|
+
Ochre task:
|
|
16
|
+
- [ ] 1. Find: pick a component for each part of the screen (references/catalog.md)
|
|
17
|
+
- [ ] 2. Read: references/<name>.md for usage, inputs, outputs, keyboard and when not to use it
|
|
18
|
+
- [ ] 3. Add: npx ochreui@latest add <name> (copies src/app/ui/<name>.ts, and ochre.css the first time)
|
|
19
|
+
- [ ] 4. Wire: real data through signals; handle outputs by producing new arrays and objects
|
|
20
|
+
- [ ] 5. Brand: the app has its own colors, font or radius? Set them once (theming.md)
|
|
21
|
+
- [ ] 6. Check: go through checklist.md, fix, and go through it again until every line passes
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Files
|
|
25
|
+
|
|
26
|
+
Read only what the task needs.
|
|
27
|
+
|
|
28
|
+
| File | Read it when |
|
|
29
|
+
| --- | --- |
|
|
30
|
+
| [references/catalog.md](references/catalog.md) | Choosing a component: every one, with what it is for |
|
|
31
|
+
| `references/<name>.md` | Before writing code for a component: usage, inputs, outputs, types, keyboard, accessibility |
|
|
32
|
+
| [theming.md](theming.md) | Matching a brand, scoping a theme to part of a page, or dark mode |
|
|
33
|
+
| [checklist.md](checklist.md) | Before you say the work is done |
|
|
34
|
+
| [INSTRUCTIONS.md](INSTRUCTIONS.md) | The short rules, for agents that only read AGENTS.md, CLAUDE.md or Cursor rules |
|
|
35
|
+
|
|
36
|
+
## Setup
|
|
37
|
+
|
|
38
|
+
- `npx ochreui@latest add <name...>` (or `pnpm dlx`, `yarn dlx`, `bunx`). The first run also copies `src/styles/ochre.css`, lists it first in the `styles` of `angular.json`, and writes `ochre.json`.
|
|
39
|
+
- Import from the copied file: `import { UiSomething } from './ui/<name>';`, and add it to the standalone component's `imports`.
|
|
40
|
+
- `npx ochreui@latest list` shows what can be added. `diff <name>` shows upstream changes. `update` refreshes files nobody edited and keeps edited ones unless `--force`.
|
|
41
|
+
- If `angular.json` has comments, the CLI leaves it alone and prints the one line to add by hand.
|
|
42
|
+
|
|
43
|
+
## Wiring
|
|
44
|
+
|
|
45
|
+
- Inputs are signals. Bind them with `[input]="value"`. Model inputs take `[(value)]`.
|
|
46
|
+
- Components never change your data. They emit an output; you update your own signal with a new array or object.
|
|
47
|
+
- Visible and spoken text goes through the `labels` input when a component has one. Translate there, not by editing the file.
|
|
48
|
+
- Templates for custom content are directives on `<ng-template>` (for example `uiSomethingIcon let-item`); their context is typed.
|
|
49
|
+
- Keep the copied files as they are where you can. Change behaviour through inputs and `--ui-<component>-*` variables, so `ochreui update` keeps working. When an edit is really needed, edit the file: it is yours.
|
|
50
|
+
|
|
51
|
+
## Design rules
|
|
52
|
+
|
|
53
|
+
- Color, size, radius, shadow and motion come from `--ui-*` tokens. Never put a hex value, a pixel font size or a shadow next to Ochre components.
|
|
54
|
+
- One accent color. Status colors (`--ui-success`, `--ui-warning`, `--ui-danger`, `--ui-info`) only where they carry a state, always with text or an icon, never color alone.
|
|
55
|
+
- Spacing on the 4px grid (`--ui-space-*`). Control heights from `--ui-control-h-*`.
|
|
56
|
+
- Dark mode is `data-ui-theme` on `<html>` (or `UiTheme` from `npx ochreui@latest add theme`). Never write separate dark styles for a component.
|
|
57
|
+
- Never use `::ng-deep` or override a component's internal classes.
|
|
58
|
+
|
|
59
|
+
## Commands
|
|
60
|
+
|
|
61
|
+
The user may type these. Each one is read-only until the user agrees to a change.
|
|
62
|
+
|
|
63
|
+
- **ochre scan**: look through the project and list the places where an Ochre component would replace hand-built UI (spinners, raw JSON, home-made tables, dialogs, tabs, date pickers). One line per place: file, what is there now, which component, why. Change nothing.
|
|
64
|
+
- **ochre check**: run [checklist.md](checklist.md) against the Ochre code in the project and report every line that fails, worst first, with the fix.
|
|
65
|
+
- **ochre theme**: ask for the brand (colors, font, radius, or a website or logo to take them from), then write the overrides as described in [theming.md](theming.md), check contrast, and show both themes.
|