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,199 @@
|
|
|
1
|
+
// Ochre (https://ochreui.dev), MIT License, Copyright (c) 2026 Ochre. Keep this notice in copies of this file.
|
|
2
|
+
/**
|
|
3
|
+
* Empty Calendar, from Ochre (https://ochreui.dev).
|
|
4
|
+
* Needs ochre.css (the --ui-* tokens), added once by `npx ochreui init`.
|
|
5
|
+
*
|
|
6
|
+
* <ui-empty-calendar class="art" />
|
|
7
|
+
* Three fanned calendar cards marked empty, over a soft coloured glow. 3 : 2 and up to 560px wide.
|
|
8
|
+
* Screen readers hear one image named by `label`; an empty label makes it decorative.
|
|
9
|
+
*
|
|
10
|
+
* Public styling hooks (set them on the element or any ancestor):
|
|
11
|
+
* --ui-empty-calendar-card card fill (default: the surface)
|
|
12
|
+
* --ui-empty-calendar-badge-bg "Empty" badge fill (default: a pale orange)
|
|
13
|
+
* --ui-empty-calendar-badge-text "Empty" badge text (default: orange)
|
|
14
|
+
* --ui-empty-calendar-glow-1/2/3 glow, left to right (default: orange, pink, purple)
|
|
15
|
+
*/
|
|
16
|
+
import {
|
|
17
|
+
Component,
|
|
18
|
+
DOCUMENT,
|
|
19
|
+
DestroyRef,
|
|
20
|
+
ElementRef,
|
|
21
|
+
afterNextRender,
|
|
22
|
+
afterRenderEffect,
|
|
23
|
+
computed,
|
|
24
|
+
inject,
|
|
25
|
+
input,
|
|
26
|
+
signal,
|
|
27
|
+
viewChildren,
|
|
28
|
+
} from '@angular/core';
|
|
29
|
+
|
|
30
|
+
export interface EmptyCalendarLabels {
|
|
31
|
+
/** What screen readers hear. Empty hides the drawing from them. */
|
|
32
|
+
label: string;
|
|
33
|
+
/** Card title. */
|
|
34
|
+
title: string;
|
|
35
|
+
/** Badge at the top right, shown in capitals. */
|
|
36
|
+
badge: string;
|
|
37
|
+
/** Text of the disabled button. */
|
|
38
|
+
action: string;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const LABELS: EmptyCalendarLabels = {
|
|
42
|
+
label: 'Three calendar cards stacked and marked empty, each with a greyed-out join meeting button',
|
|
43
|
+
title: 'Calendar',
|
|
44
|
+
badge: 'Empty',
|
|
45
|
+
action: 'Join meeting',
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
let nextId = 0;
|
|
49
|
+
|
|
50
|
+
@Component({
|
|
51
|
+
selector: 'ui-empty-calendar',
|
|
52
|
+
host: {
|
|
53
|
+
'[attr.role]': "name() ? 'img' : null",
|
|
54
|
+
'[attr.aria-label]': 'name() || null',
|
|
55
|
+
'[attr.aria-hidden]': "name() ? null : 'true'",
|
|
56
|
+
'[attr.data-idle]': "awake() ? null : ''",
|
|
57
|
+
},
|
|
58
|
+
template: `
|
|
59
|
+
<svg viewBox="0 0 320 240" aria-hidden="true" focusable="false" direction="ltr">
|
|
60
|
+
<defs>
|
|
61
|
+
<filter [id]="id + 's'" x="-20%" y="-20%" width="140%" height="150%">
|
|
62
|
+
<feDropShadow dx="0" dy="3" stdDeviation="5" />
|
|
63
|
+
</filter>
|
|
64
|
+
<filter [id]="id + 'b'" x="-40%" y="-150%" width="180%" height="400%">
|
|
65
|
+
<feGaussianBlur stdDeviation="12" />
|
|
66
|
+
</filter>
|
|
67
|
+
<linearGradient [id]="id + 'g'">
|
|
68
|
+
<stop offset="0.1" /><stop offset="0.5" /><stop offset="0.9" />
|
|
69
|
+
</linearGradient>
|
|
70
|
+
</defs>
|
|
71
|
+
<g transform="translate(30 47) scale(0.814)">
|
|
72
|
+
@for (c of cards; track c) {
|
|
73
|
+
<g class="cg" [class]="c">
|
|
74
|
+
@if (c === 'f') {
|
|
75
|
+
<ellipse class="gl" pointer-events="none" cx="160" cy="152" rx="125" ry="35" [attr.fill]="'url(#' + id + 'g)'" [attr.filter]="'url(#' + id + 'b)'" />
|
|
76
|
+
}
|
|
77
|
+
<rect class="cd" x="40" y="20" width="240" height="140" rx="10" stroke-width="0.5" [attr.filter]="'url(#' + id + 's)'" />
|
|
78
|
+
<text class="t" x="56" y="48" font-size="13" font-weight="500">{{ t().title }}</text>
|
|
79
|
+
<rect class="bb" [attr.x]="264 - badge()" y="34" [attr.width]="badge()" height="18" rx="5" />
|
|
80
|
+
<text #bt class="bt" [attr.x]="264 - badge() / 2" y="46.3" font-size="9" font-weight="600" letter-spacing="0.54" text-anchor="middle">{{ t().badge.toUpperCase() }}</text>
|
|
81
|
+
<rect class="ln" x="56" y="64" width="208" height="7" rx="2" />
|
|
82
|
+
<rect class="ln" x="56" y="74" width="208" height="7" rx="2" />
|
|
83
|
+
<rect class="ln" x="56" y="84" width="168" height="7" rx="2" />
|
|
84
|
+
<rect class="btn" x="56" y="104" width="208" height="40" rx="8" stroke-width="0.5" />
|
|
85
|
+
<g class="ic" fill="none" stroke-width="1.3" stroke-linecap="round" [attr.transform]="'translate(' + icon() + ' 124)'">
|
|
86
|
+
<circle r="5" /><line x1="3.5" y1="-3.5" x2="-3.5" y2="3.5" />
|
|
87
|
+
</g>
|
|
88
|
+
<text #al class="al" x="169.5" y="127.6" font-size="10" font-weight="500" text-anchor="middle">{{ t().action }}</text>
|
|
89
|
+
</g>
|
|
90
|
+
}
|
|
91
|
+
</g>
|
|
92
|
+
</svg>
|
|
93
|
+
`,
|
|
94
|
+
styles: `
|
|
95
|
+
@layer ui {
|
|
96
|
+
:host { display: block; position: relative; overflow: hidden; inline-size: min(560px, 100%); aspect-ratio: 3 / 2; }
|
|
97
|
+
}
|
|
98
|
+
:host {
|
|
99
|
+
--_c: var(--ui-empty-calendar-card, var(--ui-bg-surface));
|
|
100
|
+
--_x: var(--ui-text);
|
|
101
|
+
--_tt: light-dark(color-mix(in srgb, var(--ui-text-muted) 75%, var(--_c)), color-mix(in srgb, var(--ui-text-muted) 80%, var(--_c)));
|
|
102
|
+
--_l0: light-dark(color-mix(in srgb, var(--_x) 6.5%, var(--_c)), color-mix(in srgb, var(--_x) 4.5%, var(--_c)));
|
|
103
|
+
--_l1: light-dark(color-mix(in srgb, var(--_x) 13%, var(--_c)), color-mix(in srgb, var(--_x) 11%, var(--_c)));
|
|
104
|
+
--_bf: light-dark(color-mix(in srgb, var(--_x) 4.5%, var(--_c)), color-mix(in srgb, var(--_x) 3.5%, var(--_c)));
|
|
105
|
+
--_bl: light-dark(color-mix(in srgb, var(--ui-text-muted) 65%, var(--_c)), color-mix(in srgb, var(--ui-text-muted) 54%, var(--_c)));
|
|
106
|
+
--_o: var(--ui-hue-orange);
|
|
107
|
+
box-sizing: border-box;
|
|
108
|
+
}
|
|
109
|
+
:host::before { content: 'x x x x x x x x' / ''; display: block; block-size: 0; overflow: hidden; font-size: 0; word-spacing: 80px; }
|
|
110
|
+
svg { display: block; inline-size: 100%; block-size: 100%; font-family: var(--ui-font-sans); }
|
|
111
|
+
.cg {
|
|
112
|
+
transform-box: fill-box;
|
|
113
|
+
transform-origin: center;
|
|
114
|
+
transition: transform calc(350ms * var(--ui-motion-scale, 1))
|
|
115
|
+
linear(0, 0.13 9.1%, 0.38 18.9%, 0.57 28.6%, 0.72 38%, 0.82 47.1%, 0.89 57.1%, 0.94 66.6%, 0.97 76%, 0.99 85.7%, 1 94.9%);
|
|
116
|
+
}
|
|
117
|
+
.l { transform: translate(-22px) rotate(-3deg); }
|
|
118
|
+
.r { transform: translate(22px) rotate(3deg); }
|
|
119
|
+
.f { transform-origin: 50% 70px; }
|
|
120
|
+
feDropShadow { flood-color: light-dark(rgb(0 0 0 / 0.07), rgb(0 0 0 / 0.45)); }
|
|
121
|
+
stop { --_g: var(--ui-empty-calendar-glow-1, var(--_o)); --_k: 16%; --_j: 36%; stop-color: light-dark(color-mix(in srgb, var(--_g) var(--_k), #0000), color-mix(in srgb, var(--_g) var(--_j), #0000)); }
|
|
122
|
+
stop + stop { --_g: var(--ui-empty-calendar-glow-2, light-dark(var(--ui-hue-pink), color-mix(in srgb, var(--ui-hue-pink) 55%, var(--_x)))); --_k: 8%; --_j: 30%; }
|
|
123
|
+
stop + stop + stop { --_g: var(--ui-empty-calendar-glow-3, color-mix(in srgb, var(--ui-hue-purple), var(--ui-hue-blue) 35%)); --_k: 15%; --_j: 34%; }
|
|
124
|
+
.cd { fill: var(--_c); stroke: var(--ui-hairline); }
|
|
125
|
+
.t { fill: var(--_tt); }
|
|
126
|
+
.bb { fill: var(--ui-empty-calendar-badge-bg, light-dark(color-mix(in srgb, var(--_o) 6%, var(--_c)), color-mix(in srgb, var(--_o) 18%, var(--_c)))); }
|
|
127
|
+
.bt { fill: var(--ui-empty-calendar-badge-text, light-dark(color-mix(in srgb, var(--_o) 62%, var(--_c)), color-mix(in srgb, var(--_o) 90%, var(--_x)))); }
|
|
128
|
+
.ln { fill: var(--_l0); animation: ui-ec-p 2400ms ease-in-out infinite; }
|
|
129
|
+
.btn { fill: var(--_bf); stroke: var(--ui-hairline); }
|
|
130
|
+
.ic { stroke: var(--_bl); }
|
|
131
|
+
.al { fill: var(--_bl); }
|
|
132
|
+
.gl { transform-box: fill-box; transform-origin: center; animation: ui-ec-g 5000ms ease-in-out infinite; }
|
|
133
|
+
:host([data-idle]) :is(.ln, .gl) { animation: none; }
|
|
134
|
+
@container style(--ui-motion-scale: 0) { .ln, .gl { animation: none; } }
|
|
135
|
+
@media (prefers-reduced-motion: reduce) { .ln, .gl { animation: none; } }
|
|
136
|
+
@media (hover: hover) {
|
|
137
|
+
.l:hover { transform: translate(-48px, 4px) rotate(-7deg); }
|
|
138
|
+
.r:hover { transform: translate(48px, 4px) rotate(7deg); }
|
|
139
|
+
.f:hover { transform: translate(0, -8px) rotate(2deg); }
|
|
140
|
+
}
|
|
141
|
+
@keyframes ui-ec-p { 50% { fill: var(--_l1); } }
|
|
142
|
+
@keyframes ui-ec-g { from, to { opacity: 0.85; } 50% { opacity: 1; scale: 1.06; } }
|
|
143
|
+
`,
|
|
144
|
+
})
|
|
145
|
+
export class UiEmptyCalendar {
|
|
146
|
+
/** What screen readers hear. Leave it out for the default sentence; set it to "" when the text around already says it all. */
|
|
147
|
+
readonly label = input<string>();
|
|
148
|
+
/** The texts drawn on the cards and the default label, for translation. Keep them about as short as the defaults. */
|
|
149
|
+
readonly labels = input<Partial<EmptyCalendarLabels>>({});
|
|
150
|
+
|
|
151
|
+
protected readonly t = computed(() => ({ ...LABELS, ...this.labels() }));
|
|
152
|
+
protected readonly name = computed(() => (this.label() ?? this.t().label).trim());
|
|
153
|
+
protected readonly cards = ['l', 'r', 'f'] as const;
|
|
154
|
+
protected readonly id = `ui-ec${nextId++}-`;
|
|
155
|
+
/** Badge width, grown for a longer word. */
|
|
156
|
+
protected readonly badge = signal(46);
|
|
157
|
+
/** Icon centre, kept 9 units before the button text as it changes length. */
|
|
158
|
+
protected readonly icon = signal(124.5);
|
|
159
|
+
|
|
160
|
+
private readonly seen = signal(true);
|
|
161
|
+
private readonly shown = signal(true);
|
|
162
|
+
/** On screen in a visible tab: the loops only run then, and start over when it comes back. */
|
|
163
|
+
protected readonly awake = computed(() => this.seen() && this.shown());
|
|
164
|
+
|
|
165
|
+
private readonly doc = inject(DOCUMENT);
|
|
166
|
+
private readonly host = inject<ElementRef<HTMLElement>>(ElementRef).nativeElement;
|
|
167
|
+
private readonly badgeText = viewChildren<ElementRef<SVGTextElement>>('bt');
|
|
168
|
+
private readonly actionText = viewChildren<ElementRef<SVGTextElement>>('al');
|
|
169
|
+
|
|
170
|
+
constructor() {
|
|
171
|
+
const measure = () => {
|
|
172
|
+
const b = this.badgeText()[0]?.nativeElement.getComputedTextLength?.();
|
|
173
|
+
const a = this.actionText()[0]?.nativeElement.getComputedTextLength?.();
|
|
174
|
+
if (b) this.badge.set(Math.max(46, Math.round(b + 11)));
|
|
175
|
+
if (a) this.icon.set(169.5 - a / 2 - 14);
|
|
176
|
+
};
|
|
177
|
+
afterRenderEffect(() => {
|
|
178
|
+
this.t();
|
|
179
|
+
measure();
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
let io: IntersectionObserver | undefined;
|
|
183
|
+
const onVisibility = () => this.shown.set(this.doc.visibilityState !== 'hidden');
|
|
184
|
+
afterNextRender(() => {
|
|
185
|
+
onVisibility();
|
|
186
|
+
this.doc.addEventListener('visibilitychange', onVisibility);
|
|
187
|
+
this.doc.fonts?.ready.then(measure);
|
|
188
|
+
const Observer = this.doc.defaultView?.IntersectionObserver;
|
|
189
|
+
if (!Observer) return;
|
|
190
|
+
io = new Observer((entries) => this.seen.set(entries[entries.length - 1].isIntersecting));
|
|
191
|
+
io.observe(this.host);
|
|
192
|
+
});
|
|
193
|
+
|
|
194
|
+
inject(DestroyRef).onDestroy(() => {
|
|
195
|
+
io?.disconnect();
|
|
196
|
+
this.doc.removeEventListener('visibilitychange', onVisibility);
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
}
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
// Ochre (https://ochreui.dev), MIT License, Copyright (c) 2026 Ochre. Keep this notice in copies of this file.
|
|
2
|
+
/**
|
|
3
|
+
* Empty State, from Ochre (https://ochreui.dev).
|
|
4
|
+
* Needs ochre.css (`npx ochreui init`).
|
|
5
|
+
*
|
|
6
|
+
* <ui-empty-state heading="No webhooks yet" text="Endpoints you add get a POST when a run finishes.">
|
|
7
|
+
* <svg uiEmptyStateIcon viewBox="0 0 24 24">…</svg>
|
|
8
|
+
* <button uiButton variant="secondary" size="sm">Add endpoint</button>
|
|
9
|
+
* </ui-empty-state>
|
|
10
|
+
* What a list, table or panel shows while it has nothing: an icon, a title, one quiet line and the first step.
|
|
11
|
+
* Anything else you put inside becomes the row of actions. `bare` drops the frame, `tall` fills the parent.
|
|
12
|
+
*
|
|
13
|
+
* Public styling hooks (set them on the element or any ancestor):
|
|
14
|
+
* --ui-empty-state-bg frame fill (default: the subtle well; with data-ui-look="tray" none in light, a faint surface wash in dark)
|
|
15
|
+
* --ui-empty-state-edge frame edge (default: a soft 0.5px ring; a 1px dashed border with data-ui-look="tray")
|
|
16
|
+
* --ui-empty-state-radius frame corners (default 12px; 16px with data-ui-look="tray")
|
|
17
|
+
* --ui-empty-state-measure widest the text line gets (default 430px)
|
|
18
|
+
*/
|
|
19
|
+
import {
|
|
20
|
+
Component,
|
|
21
|
+
Directive,
|
|
22
|
+
ElementRef,
|
|
23
|
+
afterNextRender,
|
|
24
|
+
booleanAttribute,
|
|
25
|
+
contentChild,
|
|
26
|
+
inject,
|
|
27
|
+
input,
|
|
28
|
+
isDevMode,
|
|
29
|
+
viewChild,
|
|
30
|
+
} from '@angular/core';
|
|
31
|
+
|
|
32
|
+
export type EmptyStateHeadingLevel = 2 | 3 | 4 | 5 | 6;
|
|
33
|
+
|
|
34
|
+
/** Your own icon for the tile: `<svg uiEmptyStateIcon viewBox="0 0 24 24">`. Hidden from assistive tech and sized to the tile. */
|
|
35
|
+
@Directive({
|
|
36
|
+
selector: 'svg[uiEmptyStateIcon]',
|
|
37
|
+
host: {
|
|
38
|
+
'aria-hidden': 'true',
|
|
39
|
+
focusable: 'false',
|
|
40
|
+
style: 'inline-size: var(--_i); block-size: var(--_i); flex: none',
|
|
41
|
+
},
|
|
42
|
+
})
|
|
43
|
+
export class UiEmptyStateIcon {}
|
|
44
|
+
|
|
45
|
+
/** Rich content for the title, such as a name in bold: `<span uiEmptyStateHeading>`. Replaces `heading`. */
|
|
46
|
+
@Directive({ selector: '[uiEmptyStateHeading]' })
|
|
47
|
+
export class UiEmptyStateHeading {}
|
|
48
|
+
|
|
49
|
+
/** Rich content for the quiet line, such as a link or a key: `<span uiEmptyStateText>`. Replaces `text`. */
|
|
50
|
+
@Directive({ selector: '[uiEmptyStateText]' })
|
|
51
|
+
export class UiEmptyStateText {}
|
|
52
|
+
|
|
53
|
+
@Component({
|
|
54
|
+
selector: 'ui-empty-state',
|
|
55
|
+
host: {
|
|
56
|
+
'[attr.data-bare]': 'bare() || null',
|
|
57
|
+
'[attr.data-tall]': 'tall() || null',
|
|
58
|
+
},
|
|
59
|
+
template: `
|
|
60
|
+
@if (icon()) {
|
|
61
|
+
<span class="tile" aria-hidden="true"><ng-content select="[uiEmptyStateIcon]"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round" focusable="false"><path d="M13.5 3H7.5A2.5 2.5 0 0 0 5 5.5v13A2.5 2.5 0 0 0 7.5 21h9a2.5 2.5 0 0 0 2.5-2.5v-10M13.5 3 19 8.5M13.5 3v4A1.5 1.5 0 0 0 15 8.5h4M9 13h6M9 16.5h4" /></svg></ng-content></span>
|
|
62
|
+
}
|
|
63
|
+
<p #title class="title" dir="auto" [attr.role]="headingLevel() ? 'heading' : null" [attr.aria-level]="headingLevel()"><ng-content select="[uiEmptyStateHeading]">{{ heading() }}</ng-content></p>
|
|
64
|
+
@if (text() || richText()) {
|
|
65
|
+
<p class="text" dir="auto"><ng-content select="[uiEmptyStateText]">{{ text() }}</ng-content></p>
|
|
66
|
+
}
|
|
67
|
+
<div class="actions"><ng-content /></div>
|
|
68
|
+
`,
|
|
69
|
+
styles: `
|
|
70
|
+
:host {
|
|
71
|
+
--_t: var(--ui-look-tray, 0);
|
|
72
|
+
--_i: calc(var(--ui-icon-md) + var(--ui-space-0-5) * (1 + var(--_t)));
|
|
73
|
+
--_e: var(--ui-empty-state-edge, color-mix(in srgb, var(--ui-border) calc(100% * var(--_t)), light-dark(color-mix(in srgb, var(--ui-text) 6%, transparent), var(--ui-hairline))));
|
|
74
|
+
display: flex;
|
|
75
|
+
flex-direction: column;
|
|
76
|
+
align-items: center;
|
|
77
|
+
box-sizing: border-box;
|
|
78
|
+
padding: var(--ui-space-12) var(--ui-space-6) calc(var(--ui-space-12) + var(--ui-space-1));
|
|
79
|
+
border: calc(1px * var(--_t)) solid var(--_e);
|
|
80
|
+
border-radius: var(--ui-empty-state-radius, calc(var(--ui-radius-lg) + var(--ui-space-1) * var(--_t)));
|
|
81
|
+
background: var(--ui-empty-state-bg, color-mix(in srgb, var(--ui-bg-subtle) calc(100% - 100% * var(--_t)), light-dark(transparent, color-mix(in srgb, var(--ui-bg-surface) 60%, transparent))));
|
|
82
|
+
box-shadow: inset 0 0 0 calc(0.5px - 0.5px * var(--_t)) var(--_e);
|
|
83
|
+
color: var(--ui-text);
|
|
84
|
+
font-family: var(--ui-font-sans);
|
|
85
|
+
text-align: center;
|
|
86
|
+
}
|
|
87
|
+
@container style(--ui-look-tray: 1) { :host { border-style: dashed; } }
|
|
88
|
+
:host([data-bare]) { padding: 0; border-width: 0; background: none; box-shadow: none; }
|
|
89
|
+
:host([data-tall]) { min-block-size: 100%; justify-content: center; }
|
|
90
|
+
.tile {
|
|
91
|
+
display: grid;
|
|
92
|
+
place-items: center;
|
|
93
|
+
flex: none;
|
|
94
|
+
box-sizing: border-box;
|
|
95
|
+
inline-size: calc(var(--ui-space-10) + var(--ui-space-0-5) * (1 + var(--_t)));
|
|
96
|
+
block-size: calc(var(--ui-space-10) + var(--ui-space-0-5) * (1 + var(--_t)));
|
|
97
|
+
border: calc(1px * var(--_t)) solid var(--ui-border);
|
|
98
|
+
border-radius: calc(var(--ui-radius-lg) - 1px + 1px * var(--_t));
|
|
99
|
+
background: color-mix(in srgb, var(--ui-bg-surface) calc(100% * var(--_t)), color-mix(in srgb, var(--ui-text) 5%, transparent));
|
|
100
|
+
color: var(--ui-icon);
|
|
101
|
+
}
|
|
102
|
+
@container style(--ui-look-tray: 1) { .tile { box-shadow: 0 1px 2px color-mix(in srgb, var(--ui-bg-scrim) 15%, transparent); } }
|
|
103
|
+
.tile > svg { inline-size: var(--_i); block-size: var(--_i); }
|
|
104
|
+
p { margin: 0; max-inline-size: 100%; overflow-wrap: anywhere; letter-spacing: calc(-0.01em * var(--_t)); }
|
|
105
|
+
.title {
|
|
106
|
+
margin-block-start: var(--ui-space-4);
|
|
107
|
+
font-size: calc(var(--ui-text-base) + 1px * var(--_t));
|
|
108
|
+
line-height: calc(var(--ui-leading-base) + 1px * var(--_t));
|
|
109
|
+
font-weight: var(--ui-weight-medium);
|
|
110
|
+
}
|
|
111
|
+
.title:first-child { margin-block-start: 0; }
|
|
112
|
+
.text {
|
|
113
|
+
margin-block-start: var(--ui-space-1);
|
|
114
|
+
max-inline-size: min(100%, var(--ui-empty-state-measure, 430px));
|
|
115
|
+
color: var(--ui-text-muted);
|
|
116
|
+
font-size: calc(var(--ui-text-base) + 0.5px * var(--_t));
|
|
117
|
+
line-height: var(--ui-leading-base);
|
|
118
|
+
text-wrap: balance;
|
|
119
|
+
}
|
|
120
|
+
.actions {
|
|
121
|
+
display: flex;
|
|
122
|
+
flex-wrap: wrap;
|
|
123
|
+
justify-content: center;
|
|
124
|
+
gap: var(--ui-space-2);
|
|
125
|
+
max-inline-size: 100%;
|
|
126
|
+
margin-block-start: calc(var(--ui-space-4) + var(--ui-space-0-5) * (1 + var(--_t)));
|
|
127
|
+
}
|
|
128
|
+
.actions:empty { display: none; }
|
|
129
|
+
@media (max-width: 559.98px) {
|
|
130
|
+
:host(:not([data-bare])) { padding: calc(var(--ui-space-8) + var(--ui-space-1)) calc(var(--ui-space-4) + var(--ui-space-0-5)) var(--ui-space-10); }
|
|
131
|
+
}
|
|
132
|
+
@media (forced-colors: active) {
|
|
133
|
+
:host(:not([data-bare])), .tile { border-width: 1px; }
|
|
134
|
+
}
|
|
135
|
+
`,
|
|
136
|
+
})
|
|
137
|
+
export class UiEmptyState {
|
|
138
|
+
/** What is empty, in a few words: "No webhooks yet". For rich content, project `<span uiEmptyStateHeading>` instead. */
|
|
139
|
+
readonly heading = input<string>();
|
|
140
|
+
/** Makes the title a heading of this level, so screen-reader users can jump to it. Left out, it is a paragraph. */
|
|
141
|
+
readonly headingLevel = input<EmptyStateHeadingLevel | null, EmptyStateHeadingLevel | `${EmptyStateHeadingLevel}` | null | undefined>(null, {
|
|
142
|
+
transform: (v) => (v ? (Number(v) as EmptyStateHeadingLevel) : null),
|
|
143
|
+
});
|
|
144
|
+
/** One line on what will show up here, or how to get there. Balanced over two lines when it wraps. */
|
|
145
|
+
readonly text = input<string>();
|
|
146
|
+
/** Shows the soft tile with your `svg[uiEmptyStateIcon]`, or a document glyph. `false` leaves the tile out. */
|
|
147
|
+
readonly icon = input(true, { transform: booleanAttribute });
|
|
148
|
+
/** No frame and no padding, for a panel or page where it is the only content. */
|
|
149
|
+
readonly bare = input(false, { transform: booleanAttribute });
|
|
150
|
+
/** Fills the parent's height and centres itself in it. The parent needs a height. */
|
|
151
|
+
readonly tall = input(false, { transform: booleanAttribute });
|
|
152
|
+
|
|
153
|
+
protected readonly richText = contentChild(UiEmptyStateText);
|
|
154
|
+
private readonly title = viewChild.required<ElementRef<HTMLElement>>('title');
|
|
155
|
+
|
|
156
|
+
constructor() {
|
|
157
|
+
const host = inject<ElementRef<HTMLElement>>(ElementRef).nativeElement;
|
|
158
|
+
afterNextRender(() => {
|
|
159
|
+
if (isDevMode() && !this.title().nativeElement.textContent?.trim()) {
|
|
160
|
+
console.warn('ui-empty-state: give it a heading, so people know what is empty.', host);
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
}
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
// Ochre (https://ochreui.dev), MIT License, Copyright (c) 2026 Ochre. Keep this notice in copies of this file.
|
|
2
|
+
/**
|
|
3
|
+
* Enrichment Orbit, from Ochre (https://ochreui.dev).
|
|
4
|
+
* Needs ochre.css (the --ui-* tokens), added once by `npx ochreui init`.
|
|
5
|
+
*
|
|
6
|
+
* <ui-enrichment-orbit />
|
|
7
|
+
* A decorative illustration: a record tile inside two rings, with colour comets running around them and
|
|
8
|
+
* three data nodes orbiting the outer one. 3 : 2 and 560px wide at most.
|
|
9
|
+
*
|
|
10
|
+
* Public styling hooks (set them on the element or any ancestor):
|
|
11
|
+
* --ui-enrichment-orbit-ring ring colour
|
|
12
|
+
* --ui-enrichment-orbit-face tile and node face
|
|
13
|
+
* --ui-enrichment-orbit-ink the mark in the tile
|
|
14
|
+
* --ui-enrichment-orbit-glyph node glyphs (drawn at 55%)
|
|
15
|
+
* --ui-enrichment-orbit-comet-1 warm end of the comets
|
|
16
|
+
* --ui-enrichment-orbit-comet-2 middle of the comets
|
|
17
|
+
* --ui-enrichment-orbit-comet-3 cool end of the comets
|
|
18
|
+
*/
|
|
19
|
+
import { Component, DOCUMENT, DestroyRef, ElementRef, afterNextRender, computed, inject, input, signal } from '@angular/core';
|
|
20
|
+
|
|
21
|
+
let nextId = 0;
|
|
22
|
+
|
|
23
|
+
@Component({
|
|
24
|
+
selector: 'ui-enrichment-orbit',
|
|
25
|
+
host: {
|
|
26
|
+
'[attr.role]': "label() ? 'img' : null",
|
|
27
|
+
'[attr.aria-label]': 'label() || null',
|
|
28
|
+
'[attr.aria-hidden]': "label() ? null : 'true'",
|
|
29
|
+
'[style.--_p]': "awake() ? null : 'paused'",
|
|
30
|
+
},
|
|
31
|
+
template: `
|
|
32
|
+
<div class="c">
|
|
33
|
+
<svg viewBox="0 0 320 240" aria-hidden="true" focusable="false">
|
|
34
|
+
<defs>
|
|
35
|
+
<linearGradient [attr.id]="gid">
|
|
36
|
+
<stop offset="0" class="c1" stop-opacity="0" />
|
|
37
|
+
<stop offset=".2" class="c1" />
|
|
38
|
+
<stop offset=".37" class="c12" />
|
|
39
|
+
<stop offset=".55" class="c2" />
|
|
40
|
+
<stop offset=".8" class="c3" />
|
|
41
|
+
<stop offset="1" class="c3" stop-opacity="0" />
|
|
42
|
+
</linearGradient>
|
|
43
|
+
</defs>
|
|
44
|
+
<g class="ring" fill="none" stroke-width="1.2">
|
|
45
|
+
<circle cx="160" cy="120" r="56" opacity=".45" />
|
|
46
|
+
<circle cx="160" cy="120" r="80" />
|
|
47
|
+
</g>
|
|
48
|
+
@for (k of [epoch()]; track 'epoch:' + k) {
|
|
49
|
+
<g fill="none" stroke-width="1.6" stroke-linecap="round" [attr.stroke]="paint">
|
|
50
|
+
<path class="spin" d="M114.11 54.47A80 80 0 0 1 205.89 54.47" />
|
|
51
|
+
<path class="spin ccw" d="M120.4 80.4A56 56 0 0 1 199.6 80.4" />
|
|
52
|
+
</g>
|
|
53
|
+
<g class="key">
|
|
54
|
+
<rect class="shade" x="134" y="94" width="52" height="52" rx="12" />
|
|
55
|
+
<rect class="face" x="134.25" y="94.25" width="51.5" height="48.75" rx="11.75" />
|
|
56
|
+
<svg class="ink" x="147" y="107" width="26" height="26" viewBox="0 0 24 24">
|
|
57
|
+
<path d="M10 2.5c.8 5.8 3.6 8.6 9.5 9.5-5.9.9-8.7 3.7-9.5 9.5C9.2 15.7 6.4 12.9.5 12c5.9-.9 8.7-3.7 9.5-9.5Z" />
|
|
58
|
+
<path d="M19.5 1c.3 2 1.4 3.2 3.5 3.5-2.1.3-3.2 1.5-3.5 3.5-.3-2-1.4-3.2-3.5-3.5 2.1-.3 3.2-1.5 3.5-3.5Z" />
|
|
59
|
+
</svg>
|
|
60
|
+
</g>
|
|
61
|
+
@for (a of angles; track a) {
|
|
62
|
+
<g class="spin node" [style.--_a.deg]="a">
|
|
63
|
+
<g class="spin ccw up">
|
|
64
|
+
<g class="key">
|
|
65
|
+
<circle class="shade" cx="160" cy="40" r="17" />
|
|
66
|
+
<ellipse class="face" cx="160" cy="38.85" rx="16.75" ry="15.6" />
|
|
67
|
+
<g class="glyph" transform="translate(154 34)">
|
|
68
|
+
<ellipse cx="6" cy="2.6" rx="5" ry="2.1" />
|
|
69
|
+
<path d="M1 4.9v1.5a5 2.1 0 0 0 10 0V4.9a5 2.1 0 0 1-10 0Zm0 3v1.5a5 2.1 0 0 0 10 0V7.9a5 2.1 0 0 1-10 0Z" />
|
|
70
|
+
</g>
|
|
71
|
+
</g>
|
|
72
|
+
</g>
|
|
73
|
+
</g>
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
</svg>
|
|
77
|
+
</div>
|
|
78
|
+
`,
|
|
79
|
+
styles: `
|
|
80
|
+
@layer ui {
|
|
81
|
+
:host { display: block; position: relative; inline-size: min(560px, 100%); aspect-ratio: 3 / 2; }
|
|
82
|
+
}
|
|
83
|
+
:host {
|
|
84
|
+
--_ring: var(--ui-enrichment-orbit-ring, light-dark(color-mix(in srgb, var(--ui-blue-light) 4%, var(--ui-gray-100)), var(--ui-border-strong)));
|
|
85
|
+
--_face: var(--ui-enrichment-orbit-face, light-dark(var(--ui-bg-surface), color-mix(in srgb, var(--ui-text) 3%, var(--ui-bg-surface))));
|
|
86
|
+
--_c1: var(--ui-enrichment-orbit-comet-1, light-dark(color-mix(in srgb, color-mix(in srgb, var(--ui-orange-light), var(--ui-red-light)) 55%, var(--ui-bg-surface)), color-mix(in srgb, var(--ui-orange-dark) 75%, var(--ui-red-dark))));
|
|
87
|
+
--_c2: var(--ui-enrichment-orbit-comet-2, light-dark(color-mix(in srgb, var(--ui-purple-light) 55%, var(--ui-bg-surface)), var(--ui-purple-dark)));
|
|
88
|
+
--_c3: var(--ui-enrichment-orbit-comet-3, light-dark(color-mix(in srgb, color-mix(in srgb, var(--ui-indigo-light), var(--ui-blue-light)) 55%, var(--ui-bg-surface)), color-mix(in srgb, var(--ui-indigo-dark) 80%, var(--ui-blue-dark))));
|
|
89
|
+
box-sizing: border-box;
|
|
90
|
+
}
|
|
91
|
+
:host::before { content: 'x x x x x x x x' / ''; display: block; block-size: 0; overflow: hidden; font-size: 0; word-spacing: 80px; }
|
|
92
|
+
svg { display: block; }
|
|
93
|
+
.c { position: absolute; inset: 0; container-type: inline-size; }
|
|
94
|
+
.c > svg { position: absolute; inset: 0; inline-size: 100%; block-size: 100%; overflow: visible; }
|
|
95
|
+
.c1 { stop-color: var(--_c1); }
|
|
96
|
+
.c12 { stop-color: color-mix(in srgb, var(--_c1), var(--_c2)); }
|
|
97
|
+
.c2 { stop-color: var(--_c2); }
|
|
98
|
+
.c3 { stop-color: var(--_c3); }
|
|
99
|
+
.ring { stroke: var(--_ring); }
|
|
100
|
+
.key { filter: drop-shadow(0 1.5px 1.5px light-dark(color-mix(in srgb, var(--ui-gray-1000) 7%, transparent), color-mix(in srgb, var(--ui-gray-1050) 55%, transparent))); }
|
|
101
|
+
.shade {
|
|
102
|
+
fill: light-dark(color-mix(in srgb, var(--ui-blue-light) 3%, color-mix(in srgb, var(--ui-gray-100) 40%, var(--ui-gray-50))), color-mix(in srgb, var(--ui-gray-1050) 30%, var(--_face)));
|
|
103
|
+
stroke: light-dark(color-mix(in srgb, var(--ui-text) 6%, transparent), var(--ui-hairline));
|
|
104
|
+
stroke-width: 0.5;
|
|
105
|
+
}
|
|
106
|
+
.face { fill: var(--_face); }
|
|
107
|
+
.ink { fill: var(--ui-enrichment-orbit-ink, var(--ui-text)); }
|
|
108
|
+
.glyph { fill: var(--ui-enrichment-orbit-glyph, var(--ui-text-muted)); opacity: 0.55; }
|
|
109
|
+
.spin {
|
|
110
|
+
transform-box: view-box;
|
|
111
|
+
transform-origin: 160px 120px;
|
|
112
|
+
animation: ui-eo-spin calc(7s * var(--ui-motion-scale, 1)) linear infinite var(--_p, running);
|
|
113
|
+
}
|
|
114
|
+
.ccw { animation-direction: reverse; }
|
|
115
|
+
.node { transform: rotate(var(--_a)); animation-duration: calc(22s * var(--ui-motion-scale, 1)); }
|
|
116
|
+
.up { transform: rotate(calc(-1 * var(--_a))); transform-origin: 160px 40px; animation-duration: inherit; }
|
|
117
|
+
.up > .key { transform-box: view-box; transform-origin: 160px 40px; scale: max(1, tan(atan2(245px, 100cqi))); }
|
|
118
|
+
@keyframes ui-eo-spin { to { rotate: 360deg; } }
|
|
119
|
+
@media (prefers-reduced-motion: reduce) {
|
|
120
|
+
.spin { animation: none; }
|
|
121
|
+
}
|
|
122
|
+
`,
|
|
123
|
+
})
|
|
124
|
+
export class UiEnrichmentOrbit {
|
|
125
|
+
/** What a screen reader announces for the illustration. Empty hides it from assistive tech. */
|
|
126
|
+
readonly label = input('A record tile with data nodes orbiting around it');
|
|
127
|
+
|
|
128
|
+
protected readonly gid = `ui-eo-${nextId++}`;
|
|
129
|
+
protected readonly paint = `url(#${this.gid})`;
|
|
130
|
+
protected readonly angles = [0, 120, 240];
|
|
131
|
+
/** Bumped when the illustration comes back into view, so the loop starts over. */
|
|
132
|
+
protected readonly epoch = signal(0);
|
|
133
|
+
private readonly seen = signal(true);
|
|
134
|
+
private readonly shown = signal(true);
|
|
135
|
+
/** On screen in a visible tab: the motion only runs then. */
|
|
136
|
+
protected readonly awake = computed(() => this.seen() && this.shown());
|
|
137
|
+
|
|
138
|
+
private readonly doc = inject(DOCUMENT);
|
|
139
|
+
private readonly host = inject<ElementRef<HTMLElement>>(ElementRef).nativeElement;
|
|
140
|
+
|
|
141
|
+
constructor() {
|
|
142
|
+
let io: IntersectionObserver | undefined;
|
|
143
|
+
const update = (seen: boolean, shown: boolean) => {
|
|
144
|
+
const was = this.awake();
|
|
145
|
+
this.seen.set(seen);
|
|
146
|
+
this.shown.set(shown);
|
|
147
|
+
if (!was && this.awake()) this.epoch.update((n) => n + 1);
|
|
148
|
+
};
|
|
149
|
+
const onVisibility = () => update(this.seen(), this.doc.visibilityState !== 'hidden');
|
|
150
|
+
afterNextRender(() => {
|
|
151
|
+
onVisibility();
|
|
152
|
+
this.doc.addEventListener('visibilitychange', onVisibility);
|
|
153
|
+
const Observer = this.doc.defaultView?.IntersectionObserver;
|
|
154
|
+
if (!Observer) return;
|
|
155
|
+
io = new Observer((entries) => update(entries[entries.length - 1].isIntersecting, this.shown()));
|
|
156
|
+
io.observe(this.host);
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
inject(DestroyRef).onDestroy(() => {
|
|
160
|
+
io?.disconnect();
|
|
161
|
+
this.doc.removeEventListener('visibilitychange', onVisibility);
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
}
|