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,209 @@
|
|
|
1
|
+
// Ochre (https://ochreui.dev), MIT License, Copyright (c) 2026 Ochre. Keep this notice in copies of this file.
|
|
2
|
+
/**
|
|
3
|
+
* Integration Grid, from Ochre (https://ochreui.dev).
|
|
4
|
+
* Needs ochre.css (the --ui-* tokens), which `npx ochreui init` adds once.
|
|
5
|
+
*
|
|
6
|
+
* <ui-integration-grid [logos]="logos" [columns]="7" label="Works with the tools your team uses">
|
|
7
|
+
* <img uiIntegrationGridMark src="/mark.svg" alt="" width="40" height="40" />
|
|
8
|
+
* </ui-integration-grid>
|
|
9
|
+
* A still wall of app tiles in three rows (7 / 9 / 7 by default) around a larger center tile with your mark.
|
|
10
|
+
* Screen readers hear one image named after the integrations it shows.
|
|
11
|
+
*
|
|
12
|
+
* Public styling hooks (set them on the element or any ancestor):
|
|
13
|
+
* --ui-integration-grid-face tile face (default: the surface color, fading toward the sides)
|
|
14
|
+
* --ui-integration-grid-line tile outline (default: a hairline of the text color)
|
|
15
|
+
* --ui-integration-grid-centre-face center tile face (default: the raised surface)
|
|
16
|
+
* --ui-integration-grid-centre-line center tile outline
|
|
17
|
+
* --ui-integration-grid-ink logos without a color, and the default center mark (default: the text color)
|
|
18
|
+
*/
|
|
19
|
+
import { Component, Directive, computed, input } from '@angular/core';
|
|
20
|
+
|
|
21
|
+
/** One logo: a filled path drawn in a 24 × 24 box. Without `color` it follows the ink color. */
|
|
22
|
+
export interface IntegrationGridLogo {
|
|
23
|
+
name: string;
|
|
24
|
+
path: string;
|
|
25
|
+
color?: string;
|
|
26
|
+
darkColor?: string;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export type IntegrationGridColumns = 5 | 7 | 9;
|
|
30
|
+
|
|
31
|
+
export interface IntegrationGridLabels {
|
|
32
|
+
/** Starts the generated label, followed by the logo names. */
|
|
33
|
+
integratesWith: string;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const LABELS: IntegrationGridLabels = { integratesWith: 'Integrates with' };
|
|
37
|
+
|
|
38
|
+
const ring = (r: number, cw: boolean) => {
|
|
39
|
+
const s = cw ? 1 : 0;
|
|
40
|
+
return `M12 ${12 - r}a${r} ${r} 0 1 ${s} 0 ${2 * r}a${r} ${r} 0 1 ${s} 0-${2 * r}Z`;
|
|
41
|
+
};
|
|
42
|
+
const tile = 'M5.5 1h13A4.5 4.5 0 0 1 23 5.5v13a4.5 4.5 0 0 1-4.5 4.5h-13A4.5 4.5 0 0 1 1 18.5v-13A4.5 4.5 0 0 1 5.5 1Z';
|
|
43
|
+
const dot = (x: number, y: number, r: number) => `M${x} ${y - r}a${r} ${r} 0 1 1 0 ${2 * r}a${r} ${r} 0 1 1 0-${2 * r}Z`;
|
|
44
|
+
|
|
45
|
+
export const INTEGRATION_GRID_LOGOS: readonly IntegrationGridLogo[] = [
|
|
46
|
+
{ name: 'Kestro', path: 'M12 1.82 23.25 21.64h-22.5Z' },
|
|
47
|
+
{ name: 'Orbitra', path: ring(11.25, true) + ring(7.5, false) + ring(3.4, true), color: 'var(--ui-hue-purple)' },
|
|
48
|
+
{ name: 'Hexon', path: 'M12 0.75 22.18 6.38v11.25L12 23.25 1.82 17.63V6.38ZM12 5.25 5.89 8.63v6.75L12 18.75l6.11-3.38v-6.75Z', color: 'var(--ui-hue-orange)' },
|
|
49
|
+
{ name: 'Tidel', path: 'M3 3h18a2.25 2.25 0 0 1 0 4.5H3a2.25 2.25 0 0 1 0-4.5ZM6.38 9.75h14.63a2.25 2.25 0 0 1 0 4.5H6.38a2.25 2.25 0 0 1 0-4.5ZM9.75 16.5h11.25a2.25 2.25 0 0 1 0 4.5H9.75a2.25 2.25 0 0 1 0-4.5Z', color: 'var(--ui-accent)' },
|
|
50
|
+
{ name: 'Lumora', path: 'M14.81 1.09a11.25 11.25 0 1 0 8.1 13.72A9 9 0 0 1 14.81 1.09Z', color: 'var(--ui-hue-amber)' },
|
|
51
|
+
{ name: 'Brightloop', path: 'M7 5.5h10a6.5 6.5 0 0 1 0 13H7a6.5 6.5 0 0 1 0-13ZM7 9.75a2.25 2.25 0 0 0 0 4.5h10a2.25 2.25 0 0 0 0-4.5Z', color: 'var(--ui-hue-blue)' },
|
|
52
|
+
{ name: 'Tallyhub', path: 'M0.75 13.78h5.92v9.47h-5.92ZM9.04 7.86h5.92v15.39h-5.92ZM17.33 0.75h5.92v22.5h-5.92Z', color: 'var(--ui-hue-blue)' },
|
|
53
|
+
{ name: 'Fennick', path: 'M22.95 1.05C10.27 0.48 1.63 7.39 2.32 20.41L0.48 22.25 1.75 23.52l1.84-1.84C16.61 22.37 23.52 13.73 22.95 1.05Z', color: 'var(--ui-hue-green)' },
|
|
54
|
+
{ name: 'Corvel', path: tile + ring(5, false) + ring(2.2, true), color: 'var(--ui-hue-orange)' },
|
|
55
|
+
{ name: 'Mirelo', path: 'M12 0.64 22.23 5.75 12 10.86 1.77 5.75ZM1.2 7.8 10.86 12.68v10.45l-9.66-4.89ZM22.8 7.8v10.45L13.14 23.14v-10.45Z', color: 'var(--ui-hue-cyan)' },
|
|
56
|
+
{ name: 'Dottra', path: [4, 12, 20].flatMap((y) => [4, 12, 20].map((x) => dot(x, y, 2.75))).join(''), color: 'var(--ui-hue-purple)' },
|
|
57
|
+
{ name: 'Ostrel', path: ring(11.25, true) + 'M12 6.1 6.9 15.7h10.2Z' },
|
|
58
|
+
{ name: 'Vantly', path: 'M0.75 3h6.19L12 13.69 17.06 3H23.25L12 22.13Z', color: 'var(--ui-hue-blue)' },
|
|
59
|
+
{ name: 'Solvane', path: 'M10.88 0.75a10.13 10.13 0 0 0-10.13 10.13h10.13ZM13.13 0.75a10.13 10.13 0 0 1 10.13 10.13h-10.13ZM10.88 23.25a10.13 10.13 0 0 1-10.13-10.13h10.13ZM13.13 23.25a10.13 10.13 0 0 0 10.13-10.13h-10.13Z', color: 'var(--ui-hue-red)' },
|
|
60
|
+
{ name: 'Arcwell', path: 'M0.75 15.21a11.25 11.25 0 0 1 22.5 0h-4.29a6.96 6.96 0 0 0-13.93 0ZM12 10.93a4.29 4.29 0 0 1 4.29 4.29H7.71a4.29 4.29 0 0 1 4.29-4.29ZM0.75 17.36h22.5v3.21h-22.5Z', color: 'var(--ui-hue-pink)' },
|
|
61
|
+
{ name: 'Ploma', path: tile + 'M10.08 5.95V10.08H5.95v3.85h4.13v4.12h3.85v-4.12h4.12v-3.85h-4.12V5.95Z', color: 'var(--ui-hue-blue)' },
|
|
62
|
+
{ name: 'Glimra', path: 'M12 0.75c0.96 6.32 4.93 10.29 11.25 11.25-6.32 0.96-10.29 4.93-11.25 11.25-0.96-6.32-4.93-10.29-11.25-11.25C7.07 11.04 11.04 7.07 12 0.75Z', color: 'var(--ui-accent)' },
|
|
63
|
+
{ name: 'Kiteo', path: 'M11.08 0.75 2.36 9.82l8.72 13.43ZM12.92 0.75l8.72 9.07-8.72 13.43Z', color: 'var(--ui-hue-teal)' },
|
|
64
|
+
{ name: 'Nimbra', path: 'M10.39 0.75h3.21v22.5h-3.21ZM0.75 10.39h22.5v3.21h-22.5ZM5.14 2.89 21.11 18.86l-2.25 2.25L2.89 5.14ZM18.86 2.89l2.25 2.25L5.14 21.11l-2.25-2.25Z', color: 'var(--ui-hue-purple)' },
|
|
65
|
+
{ name: 'Tessaly', path: tile + 'M5.95 5.95v4.95h4.95V5.95ZM13.1 5.95v4.95h4.95V5.95ZM5.95 13.1v4.95h4.95V13.1ZM13.1 13.1v4.95h4.95V13.1Z' },
|
|
66
|
+
{ name: 'Wendlo', path: 'M0.75 4.13h5.63l7.88 7.88-7.88 7.88H0.75l7.88-7.88ZM9.75 4.13h5.63l7.88 7.88-7.88 7.88h-5.63l7.88-7.88Z', color: 'var(--ui-hue-blue)' },
|
|
67
|
+
{ name: 'Orrin', path: ring(11.25, true) + ring(8.57, false) + ring(5.9, true) + ring(3.2, false), color: 'var(--ui-hue-blue)' },
|
|
68
|
+
];
|
|
69
|
+
|
|
70
|
+
/** Put it on your own center mark (an `<img>` or an `<svg>`) to size it to the center tile. */
|
|
71
|
+
@Directive({
|
|
72
|
+
selector: '[uiIntegrationGridMark]',
|
|
73
|
+
host: { style: 'display: block; inline-size: 40.5%; block-size: auto; aspect-ratio: 1; object-fit: contain' },
|
|
74
|
+
})
|
|
75
|
+
export class UiIntegrationGridMark {}
|
|
76
|
+
|
|
77
|
+
interface Slot {
|
|
78
|
+
x: number;
|
|
79
|
+
y: number;
|
|
80
|
+
d: number;
|
|
81
|
+
logo?: IntegrationGridLogo;
|
|
82
|
+
centre?: boolean;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
const W = 1520;
|
|
86
|
+
const M = 50;
|
|
87
|
+
|
|
88
|
+
@Component({
|
|
89
|
+
selector: 'ui-integration-grid',
|
|
90
|
+
host: {
|
|
91
|
+
'[attr.role]': "name() ? 'img' : null",
|
|
92
|
+
'[attr.aria-label]': 'name() || null',
|
|
93
|
+
'[attr.aria-hidden]': "name() ? null : 'true'",
|
|
94
|
+
'[style.aspect-ratio]': "'1520 / ' + board().h",
|
|
95
|
+
},
|
|
96
|
+
template: `
|
|
97
|
+
@let b = board();
|
|
98
|
+
@for (s of b.slots; track $index) {
|
|
99
|
+
<span class="t" [class.c]="s.centre" aria-hidden="true"
|
|
100
|
+
[style.left.%]="(s.x / 15.2)" [style.top.%]="(s.y / b.h) * 100" [style.width.%]="(s.centre ? b.tile * 1.2 : b.tile) / 15.2"
|
|
101
|
+
[style.--d]="s.d" [style.--c]="s.logo?.color" [style.--cd]="s.logo?.darkColor">
|
|
102
|
+
@if (s.centre) {
|
|
103
|
+
<ng-content select="[uiIntegrationGridMark]">
|
|
104
|
+
<svg viewBox="0 0 48 48" aria-hidden="true">
|
|
105
|
+
<path opacity=".32" d="M24 3 45 24 24 45 3 24Z" />
|
|
106
|
+
<path d="M24 5c1.4 9.6 9.4 17.6 19 19-9.6 1.4-17.6 9.4-19 19-1.4-9.6-9.4-17.6-19-19 9.6-1.4 17.6-9.4 19-19Z" />
|
|
107
|
+
<circle class="h" cx="24" cy="24" r="3.4" />
|
|
108
|
+
</svg>
|
|
109
|
+
</ng-content>
|
|
110
|
+
} @else if (s.logo) {
|
|
111
|
+
<svg viewBox="0 0 24 24" aria-hidden="true"><path [attr.d]="s.logo.path" /></svg>
|
|
112
|
+
}
|
|
113
|
+
</span>
|
|
114
|
+
}
|
|
115
|
+
`,
|
|
116
|
+
styles: `
|
|
117
|
+
@layer ui {
|
|
118
|
+
:host { position: relative; display: block; inline-size: min(760px, 100%); aspect-ratio: 1520 / 560; }
|
|
119
|
+
}
|
|
120
|
+
:host {
|
|
121
|
+
--_f: var(--ui-integration-grid-face, var(--ui-bg-surface));
|
|
122
|
+
--_l: var(--ui-integration-grid-line, color-mix(in srgb, var(--ui-text) 15%, transparent));
|
|
123
|
+
--_cf: var(--ui-integration-grid-centre-face, var(--ui-bg-overlay));
|
|
124
|
+
--_cl: var(--ui-integration-grid-centre-line, color-mix(in srgb, var(--ui-text) 16%, transparent));
|
|
125
|
+
--_ink: var(--ui-integration-grid-ink, var(--ui-text));
|
|
126
|
+
box-sizing: border-box;
|
|
127
|
+
}
|
|
128
|
+
:host::before { content: 'x x x x x x x x' / ''; display: block; block-size: 0; overflow: hidden; font-size: 0; word-spacing: calc(760px / 7); }
|
|
129
|
+
.t {
|
|
130
|
+
position: absolute;
|
|
131
|
+
box-sizing: border-box;
|
|
132
|
+
display: grid;
|
|
133
|
+
place-items: center;
|
|
134
|
+
aspect-ratio: 1;
|
|
135
|
+
border-radius: 15.7%;
|
|
136
|
+
background: color-mix(in srgb, var(--_f) calc(62% - var(--d) * 11%), transparent);
|
|
137
|
+
box-shadow: inset 0 0 0 0.5px color-mix(in srgb, var(--_l) calc(100% - var(--d) * 3%), transparent),
|
|
138
|
+
0 1.5px 1.5px -1px color-mix(in srgb, var(--ui-bg-scrim) 22%, transparent);
|
|
139
|
+
}
|
|
140
|
+
svg {
|
|
141
|
+
inline-size: 37.1%;
|
|
142
|
+
block-size: auto;
|
|
143
|
+
aspect-ratio: 1;
|
|
144
|
+
overflow: visible;
|
|
145
|
+
color: light-dark(var(--c, var(--_ink)), var(--cd, var(--c, var(--_ink))));
|
|
146
|
+
fill: currentColor;
|
|
147
|
+
forced-color-adjust: none;
|
|
148
|
+
transition: scale calc(350ms * var(--ui-motion-scale, 1)) var(--ui-ease-out);
|
|
149
|
+
}
|
|
150
|
+
.c {
|
|
151
|
+
z-index: 1;
|
|
152
|
+
border-radius: 16.7%;
|
|
153
|
+
background: var(--_cf);
|
|
154
|
+
box-shadow: inset 0 0 0 0.5px var(--_cl), 0 4px 10px -3px color-mix(in srgb, var(--ui-bg-scrim) 32%, transparent);
|
|
155
|
+
}
|
|
156
|
+
.c svg { inline-size: 40.5%; color: var(--_ink); transition: none; }
|
|
157
|
+
.h { fill: var(--_cf); }
|
|
158
|
+
@media (hover: hover) {
|
|
159
|
+
.t:not(.c):hover > svg { scale: 1.18; }
|
|
160
|
+
}
|
|
161
|
+
@media (forced-colors: active) {
|
|
162
|
+
:host { --_ink: CanvasText; }
|
|
163
|
+
.t { border: 1px solid CanvasText; }
|
|
164
|
+
.h { fill: Canvas; }
|
|
165
|
+
}
|
|
166
|
+
`,
|
|
167
|
+
})
|
|
168
|
+
export class UiIntegrationGrid {
|
|
169
|
+
/** The logos, filled row by row around the center. Extra logos beyond the outer tiles are dropped. */
|
|
170
|
+
readonly logos = input<readonly IntegrationGridLogo[]>(INTEGRATION_GRID_LOGOS);
|
|
171
|
+
/** Tiles in the middle row; the rows above and below hold two fewer. Fewer columns make larger tiles. */
|
|
172
|
+
readonly columns = input<IntegrationGridColumns>(9);
|
|
173
|
+
/** What screen readers hear. Left out, it lists the integrations shown. An empty string hides the wall as decoration. */
|
|
174
|
+
readonly label = input<string>();
|
|
175
|
+
/** Words for the generated label. */
|
|
176
|
+
readonly labels = input<Partial<IntegrationGridLabels>>({});
|
|
177
|
+
|
|
178
|
+
protected readonly board = computed(() => {
|
|
179
|
+
const cols = this.columns() === 5 || this.columns() === 7 ? this.columns() : 9;
|
|
180
|
+
const pitch = (W - 2 * M + 20) / cols;
|
|
181
|
+
const size = pitch * 0.875;
|
|
182
|
+
const mid = (cols - 1) / 2;
|
|
183
|
+
const logos = this.logos();
|
|
184
|
+
const slots: Slot[] = [];
|
|
185
|
+
let n = 0;
|
|
186
|
+
for (let row = 0; row < 3; row++) {
|
|
187
|
+
const count = row === 1 ? cols : cols - 2;
|
|
188
|
+
for (let k = 0; k < count; k++) {
|
|
189
|
+
const col = row === 1 ? k : k + 1;
|
|
190
|
+
const y = M + row * pitch;
|
|
191
|
+
const d = (Math.abs(col - mid) / mid) * 4;
|
|
192
|
+
if (row === 1 && col === mid) {
|
|
193
|
+
const grow = size * 0.1;
|
|
194
|
+
slots.push({ x: M + col * pitch - grow, y: y - grow, d: 0, centre: true });
|
|
195
|
+
} else {
|
|
196
|
+
slots.push({ x: M + col * pitch, y, d, logo: logos[n++] });
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
return { slots, tile: size, h: 3 * size + 2 * (pitch - size) + 2 * M, shown: logos.slice(0, n) };
|
|
201
|
+
});
|
|
202
|
+
|
|
203
|
+
protected readonly name = computed(() => {
|
|
204
|
+
const label = this.label();
|
|
205
|
+
if (label !== undefined) return label;
|
|
206
|
+
const names = this.board().shown.map((l) => l.name);
|
|
207
|
+
return names.length ? `${this.labels().integratesWith ?? LABELS.integratesWith} ${names.join(', ')}` : '';
|
|
208
|
+
});
|
|
209
|
+
}
|
package/registry/kbd.ts
ADDED
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
// Ochre (https://ochreui.dev), MIT License, Copyright (c) 2026 Ochre. Keep this notice in copies of this file.
|
|
2
|
+
/**
|
|
3
|
+
* Kbd, from Ochre (https://ochreui.dev).
|
|
4
|
+
* Needs ochre.css (the --ui-* tokens), which `npx ochreui init` adds once.
|
|
5
|
+
*
|
|
6
|
+
* Public styling hooks (set them on the element or any ancestor):
|
|
7
|
+
* --ui-kbd-bg chip fill (default: a faint wash of the text color; --ui-bg-overlay with data-ui-look="tray")
|
|
8
|
+
* --ui-kbd-edge chip ring (default: a faint ring of the text color; --ui-border with data-ui-look="tray")
|
|
9
|
+
*
|
|
10
|
+
* With data-ui-look="tray" the chip is a keycap: 2px larger, muted text and a darker bottom edge.
|
|
11
|
+
*/
|
|
12
|
+
import { Component, DOCUMENT, ElementRef, PLATFORM_ID, afterEveryRender, computed, inject, input, signal } from '@angular/core';
|
|
13
|
+
import { isPlatformBrowser } from '@angular/common';
|
|
14
|
+
|
|
15
|
+
export type KbdPlatform = 'mac' | 'other';
|
|
16
|
+
export type KbdSize = 'sm' | 'md';
|
|
17
|
+
|
|
18
|
+
export interface KbdKey {
|
|
19
|
+
/** What is drawn. */
|
|
20
|
+
glyph: string;
|
|
21
|
+
/** What screen readers hear. */
|
|
22
|
+
spoken: string;
|
|
23
|
+
/** A symbol such as ⌘ or ↵, drawn a little larger so it looks the same size as a letter. */
|
|
24
|
+
symbol: boolean;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
type Named = [mac: string, macSpoken: string, other: string, otherSpoken: string];
|
|
28
|
+
|
|
29
|
+
const NAMED: Record<string, Named> = {
|
|
30
|
+
mod: ['⌘', 'Command', 'Ctrl', 'Control'],
|
|
31
|
+
cmd: ['⌘', 'Command', '⌘', 'Command'],
|
|
32
|
+
ctrl: ['⌃', 'Control', 'Ctrl', 'Control'],
|
|
33
|
+
alt: ['⌥', 'Option', 'Alt', 'Alt'],
|
|
34
|
+
shift: ['⇧', 'Shift', 'Shift', 'Shift'],
|
|
35
|
+
enter: ['↵', 'Return', 'Enter', 'Enter'],
|
|
36
|
+
esc: ['Esc', 'Escape', 'Esc', 'Escape'],
|
|
37
|
+
tab: ['⇥', 'Tab', 'Tab', 'Tab'],
|
|
38
|
+
space: ['Space', 'Space', 'Space', 'Space'],
|
|
39
|
+
backspace: ['⌫', 'Backspace', 'Backspace', 'Backspace'],
|
|
40
|
+
delete: ['⌦', 'Delete', 'Del', 'Delete'],
|
|
41
|
+
up: ['↑', 'Up arrow', '↑', 'Up arrow'],
|
|
42
|
+
down: ['↓', 'Down arrow', '↓', 'Down arrow'],
|
|
43
|
+
left: ['←', 'Left arrow', '←', 'Left arrow'],
|
|
44
|
+
right: ['→', 'Right arrow', '→', 'Right arrow'],
|
|
45
|
+
pageup: ['PgUp', 'Page up', 'PgUp', 'Page up'],
|
|
46
|
+
pagedown: ['PgDn', 'Page down', 'PgDn', 'Page down'],
|
|
47
|
+
home: ['Home', 'Home', 'Home', 'Home'],
|
|
48
|
+
end: ['End', 'End', 'End', 'End'],
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
const PUNCTUATION: Record<string, string> = {
|
|
52
|
+
'.': 'Period',
|
|
53
|
+
',': 'Comma',
|
|
54
|
+
'/': 'Slash',
|
|
55
|
+
'\\': 'Backslash',
|
|
56
|
+
'?': 'Question mark',
|
|
57
|
+
'!': 'Exclamation mark',
|
|
58
|
+
';': 'Semicolon',
|
|
59
|
+
':': 'Colon',
|
|
60
|
+
"'": 'Quote',
|
|
61
|
+
'`': 'Backtick',
|
|
62
|
+
'-': 'Minus',
|
|
63
|
+
'=': 'Equals',
|
|
64
|
+
'+': 'Plus',
|
|
65
|
+
'[': 'Left bracket',
|
|
66
|
+
']': 'Right bracket',
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
const SYMBOL = /^[⌘⌃⌥⇧↵⇥⌫⌦↑↓←→]$/;
|
|
70
|
+
|
|
71
|
+
/** Turns one key name into what is drawn and what is read. */
|
|
72
|
+
export function resolveKey(key: string, platform: KbdPlatform): KbdKey {
|
|
73
|
+
const named = NAMED[key === ' ' ? 'space' : key.toLowerCase()];
|
|
74
|
+
if (named) {
|
|
75
|
+
const [glyph, spoken] = platform === 'mac' ? [named[0], named[1]] : [named[2], named[3]];
|
|
76
|
+
return { glyph, spoken, symbol: SYMBOL.test(glyph) };
|
|
77
|
+
}
|
|
78
|
+
const glyph = key.length === 1 ? key.toUpperCase() : key;
|
|
79
|
+
return { glyph, spoken: PUNCTUATION[key] ?? glyph, symbol: false };
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function detectPlatform(nav?: Navigator & { userAgentData?: { platform?: string } }): KbdPlatform {
|
|
83
|
+
return /mac|iphone|ipad|ipod/i.test(nav?.userAgentData?.platform || nav?.platform || '') ? 'mac' : 'other';
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
@Component({
|
|
87
|
+
selector: 'kbd[ui-kbd]',
|
|
88
|
+
host: {
|
|
89
|
+
class: 'ui-kbd',
|
|
90
|
+
'[attr.data-size]': 'size()',
|
|
91
|
+
'[attr.data-platform]': 'resolved()',
|
|
92
|
+
'[attr.data-empty]': '!parts().length && blank() ? "" : null',
|
|
93
|
+
},
|
|
94
|
+
template: `
|
|
95
|
+
@if (parts().length) {
|
|
96
|
+
<span class="keys" aria-hidden="true">
|
|
97
|
+
@for (k of parts(); track $index) {
|
|
98
|
+
<span [class.sym]="k.symbol">{{ k.glyph }}</span>
|
|
99
|
+
}
|
|
100
|
+
</span>
|
|
101
|
+
<span class="sr">{{ spoken() }}</span>
|
|
102
|
+
} @else {
|
|
103
|
+
<ng-content />
|
|
104
|
+
}
|
|
105
|
+
`,
|
|
106
|
+
styles: `
|
|
107
|
+
:host {
|
|
108
|
+
--_t: var(--ui-look-tray, 0);
|
|
109
|
+
--_d: calc(1px * var(--_t));
|
|
110
|
+
--_h: var(--ui-space-4);
|
|
111
|
+
--_px: var(--ui-space-1);
|
|
112
|
+
--_fs: calc(var(--ui-text-sm) * 0.875 + 0.5px * var(--_t));
|
|
113
|
+
--_edge: var(--ui-kbd-edge, color-mix(in srgb, var(--ui-border) calc(var(--_t) * 100%), color-mix(in srgb, currentColor 8%, transparent)));
|
|
114
|
+
display: inline-flex;
|
|
115
|
+
align-items: center;
|
|
116
|
+
justify-content: center;
|
|
117
|
+
box-sizing: border-box;
|
|
118
|
+
block-size: calc(var(--_h) + 2 * var(--_d));
|
|
119
|
+
min-inline-size: calc(var(--_h) + 2 * var(--_d));
|
|
120
|
+
padding: 0 calc(var(--_px) + var(--_d));
|
|
121
|
+
border-radius: calc(var(--_px) + var(--_d));
|
|
122
|
+
background: var(--ui-kbd-bg, color-mix(in srgb, var(--ui-bg-overlay) calc(var(--_t) * 100%), color-mix(in srgb, currentColor 10%, transparent)));
|
|
123
|
+
box-shadow: inset 0 calc(-1px * var(--_t)) 0 var(--ui-border-strong), inset 0 0 0 calc(0.5px + 0.5px * var(--_t)) var(--_edge);
|
|
124
|
+
color: color-mix(in srgb, var(--ui-text-muted) calc(var(--_t) * 100%), currentColor);
|
|
125
|
+
font-family: var(--ui-font-sans);
|
|
126
|
+
font-size: var(--_fs);
|
|
127
|
+
font-weight: var(--ui-weight-medium);
|
|
128
|
+
line-height: 1;
|
|
129
|
+
letter-spacing: 0.02em;
|
|
130
|
+
font-variant-numeric: tabular-nums;
|
|
131
|
+
white-space: nowrap;
|
|
132
|
+
vertical-align: middle;
|
|
133
|
+
user-select: none;
|
|
134
|
+
}
|
|
135
|
+
:host([data-size='md']) {
|
|
136
|
+
--_h: var(--ui-space-5);
|
|
137
|
+
--_px: calc(var(--ui-space-1) + 1px);
|
|
138
|
+
--_fs: var(--ui-text-sm);
|
|
139
|
+
}
|
|
140
|
+
:host(:empty),
|
|
141
|
+
:host([data-empty]) { display: none; }
|
|
142
|
+
.keys { display: flex; align-items: center; gap: 1px; direction: ltr; unicode-bidi: isolate; }
|
|
143
|
+
:host([data-platform='other']) .keys { gap: 3px; }
|
|
144
|
+
.sym { font-size: 1.1em; }
|
|
145
|
+
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
|
|
146
|
+
@media (prefers-contrast: more) {
|
|
147
|
+
:host { --_edge: var(--ui-kbd-edge, color-mix(in srgb, var(--ui-border-strong) calc(var(--_t) * 100%), color-mix(in srgb, currentColor 45%, transparent))); }
|
|
148
|
+
}
|
|
149
|
+
@media (forced-colors: active) {
|
|
150
|
+
:host { border: 1px solid CanvasText; box-shadow: none; }
|
|
151
|
+
}
|
|
152
|
+
`,
|
|
153
|
+
})
|
|
154
|
+
export class UiKbd {
|
|
155
|
+
/** One key or a combo, in the order people press them: `'esc'` or `['mod', 'shift', 'a']`. `mod` is ⌘ on a Mac and Ctrl elsewhere. */
|
|
156
|
+
readonly keys = input<string | readonly string[]>();
|
|
157
|
+
/** `sm` for menus and running text, `md` for shortcut lists. */
|
|
158
|
+
readonly size = input<KbdSize>('sm');
|
|
159
|
+
/** Forces Mac symbols or Windows and Linux words. Detected from the browser when left out. */
|
|
160
|
+
readonly platform = input<KbdPlatform>();
|
|
161
|
+
|
|
162
|
+
private readonly detected: KbdPlatform = isPlatformBrowser(inject(PLATFORM_ID)) ? detectPlatform(inject(DOCUMENT).defaultView?.navigator) : 'other';
|
|
163
|
+
protected readonly resolved = computed(() => this.platform() ?? this.detected);
|
|
164
|
+
protected readonly parts = computed(() => {
|
|
165
|
+
const keys = this.keys();
|
|
166
|
+
const list = keys === undefined ? [] : typeof keys === 'string' ? [keys] : keys;
|
|
167
|
+
return list.filter((k) => k !== '').map((k) => resolveKey(k, this.resolved()));
|
|
168
|
+
});
|
|
169
|
+
protected readonly spoken = computed(() => this.parts().map((k) => k.spoken).join(' '));
|
|
170
|
+
protected readonly blank = signal(false);
|
|
171
|
+
|
|
172
|
+
constructor() {
|
|
173
|
+
const host = inject<ElementRef<HTMLElement>>(ElementRef).nativeElement;
|
|
174
|
+
afterEveryRender({ read: () => this.blank.set(!host.textContent?.trim()) });
|
|
175
|
+
}
|
|
176
|
+
}
|