@hyalo/angular 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +41 -0
- package/LICENSE +21 -0
- package/README.md +32 -3
- package/fesm2022/hyalo-angular-accordion.mjs +230 -0
- package/fesm2022/hyalo-angular-accordion.mjs.map +1 -0
- package/fesm2022/hyalo-angular-button.mjs +203 -0
- package/fesm2022/hyalo-angular-button.mjs.map +1 -0
- package/fesm2022/hyalo-angular-card.mjs +221 -0
- package/fesm2022/hyalo-angular-card.mjs.map +1 -0
- package/fesm2022/hyalo-angular-choice.mjs +788 -0
- package/fesm2022/hyalo-angular-choice.mjs.map +1 -0
- package/fesm2022/hyalo-angular-dialog.mjs +571 -0
- package/fesm2022/hyalo-angular-dialog.mjs.map +1 -0
- package/fesm2022/hyalo-angular-field.mjs +312 -0
- package/fesm2022/hyalo-angular-field.mjs.map +1 -0
- package/fesm2022/hyalo-angular-icon.mjs +343 -0
- package/fesm2022/hyalo-angular-icon.mjs.map +1 -0
- package/fesm2022/hyalo-angular-interaction.mjs +455 -0
- package/fesm2022/hyalo-angular-interaction.mjs.map +1 -0
- package/fesm2022/hyalo-angular-navbar.mjs +343 -0
- package/fesm2022/hyalo-angular-navbar.mjs.map +1 -0
- package/fesm2022/hyalo-angular-overlay.mjs +94 -0
- package/fesm2022/hyalo-angular-overlay.mjs.map +1 -0
- package/fesm2022/hyalo-angular-popover-overlay-kit-6wPwnxln.mjs +3 -0
- package/fesm2022/hyalo-angular-popover.mjs +487 -0
- package/fesm2022/hyalo-angular-popover.mjs.map +1 -0
- package/fesm2022/hyalo-angular-segmented.mjs +223 -0
- package/fesm2022/hyalo-angular-segmented.mjs.map +1 -0
- package/fesm2022/hyalo-angular-select.mjs +464 -0
- package/fesm2022/hyalo-angular-select.mjs.map +1 -0
- package/fesm2022/hyalo-angular-tabs.mjs +324 -0
- package/fesm2022/hyalo-angular-tabs.mjs.map +1 -0
- package/fesm2022/hyalo-angular-theme.mjs +94 -0
- package/fesm2022/hyalo-angular-theme.mjs.map +1 -0
- package/fesm2022/hyalo-angular-toast.mjs +322 -0
- package/fesm2022/hyalo-angular-toast.mjs.map +1 -0
- package/fesm2022/hyalo-angular.mjs +473 -0
- package/fesm2022/hyalo-angular.mjs.map +1 -0
- package/package.json +133 -3
- package/styles/hyalo-core.css +25 -0
- package/styles/hyalo.css +17 -0
- package/styles/overlays/dialog.css +9 -0
- package/styles/overlays/popover.css +9 -0
- package/styles/overlays/select.css +9 -0
- package/styles/overlays/toast.css +8 -0
- package/styles/palettes/aurora.css +47 -0
- package/styles/palettes/ember.css +47 -0
- package/styles/palettes/graphite.css +47 -0
- package/styles/palettes/ocean.css +47 -0
- package/styles/palettes/orchid.css +47 -0
- package/styles/palettes/rose.css +47 -0
- package/styles/parts/card.css +49 -0
- package/styles/parts/dialog.css +116 -0
- package/styles/parts/drawer.css +124 -0
- package/styles/parts/field.css +36 -0
- package/styles/parts/glass.css +137 -0
- package/styles/parts/motion.css +82 -0
- package/styles/parts/navbar.css +55 -0
- package/styles/parts/popover.css +27 -0
- package/styles/parts/presence.css +55 -0
- package/styles/parts/reset.css +42 -0
- package/styles/parts/select.css +46 -0
- package/styles/parts/themes.css +105 -0
- package/styles/parts/toast.css +128 -0
- package/styles/parts/tokens.css +151 -0
- package/styles/parts/typography.css +64 -0
- package/types/hyalo-angular-accordion.d.ts +74 -0
- package/types/hyalo-angular-button.d.ts +88 -0
- package/types/hyalo-angular-card.d.ts +61 -0
- package/types/hyalo-angular-choice.d.ts +259 -0
- package/types/hyalo-angular-dialog.d.ts +170 -0
- package/types/hyalo-angular-field.d.ts +135 -0
- package/types/hyalo-angular-icon.d.ts +122 -0
- package/types/hyalo-angular-interaction.d.ts +131 -0
- package/types/hyalo-angular-navbar.d.ts +110 -0
- package/types/hyalo-angular-overlay.d.ts +31 -0
- package/types/hyalo-angular-popover.d.ts +142 -0
- package/types/hyalo-angular-segmented.d.ts +79 -0
- package/types/hyalo-angular-select.d.ts +130 -0
- package/types/hyalo-angular-tabs.d.ts +102 -0
- package/types/hyalo-angular-theme.d.ts +46 -0
- package/types/hyalo-angular-toast.d.ts +79 -0
- package/types/hyalo-angular.d.ts +345 -0
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import * as i1 from "@angular/aria/tabs";
|
|
2
|
+
import { TabPanel } from "@angular/aria/tabs";
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
/**
|
|
5
|
+
* One tab and its panel. The panel content is rendered up front and hidden
|
|
6
|
+
* with `inert` while another tab is selected.
|
|
7
|
+
*/
|
|
8
|
+
export declare class HyTab {
|
|
9
|
+
readonly panel: TabPanel;
|
|
10
|
+
/** Text of the tab button. */
|
|
11
|
+
readonly label: import("@angular/core").InputSignal<string>;
|
|
12
|
+
/** Optional icon name shown before the label. */
|
|
13
|
+
readonly icon: import("@angular/core").InputSignal<string | undefined>;
|
|
14
|
+
/** Disables this tab. Arrow keys skip it. */
|
|
15
|
+
readonly disabled: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
16
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<HyTab, never>;
|
|
17
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<HyTab, "hy-tab", never, {
|
|
18
|
+
"label": {
|
|
19
|
+
"alias": "label";
|
|
20
|
+
"required": true;
|
|
21
|
+
"isSignal": true;
|
|
22
|
+
};
|
|
23
|
+
"icon": {
|
|
24
|
+
"alias": "icon";
|
|
25
|
+
"required": false;
|
|
26
|
+
"isSignal": true;
|
|
27
|
+
};
|
|
28
|
+
"disabled": {
|
|
29
|
+
"alias": "disabled";
|
|
30
|
+
"required": false;
|
|
31
|
+
"isSignal": true;
|
|
32
|
+
};
|
|
33
|
+
}, {}, never, ["*"], true, [{
|
|
34
|
+
directive: typeof i1.TabPanel;
|
|
35
|
+
inputs: {
|
|
36
|
+
"value": "value";
|
|
37
|
+
};
|
|
38
|
+
outputs: {};
|
|
39
|
+
}]>;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Tabs with a sliding glass indicator, built on Angular Aria. Arrow keys
|
|
43
|
+
* move between tabs (mirrored in RTL), Home and End jump to the ends.
|
|
44
|
+
*
|
|
45
|
+
* ```html
|
|
46
|
+
* <hy-tabs label="Watch details" [(selected)]="tab">
|
|
47
|
+
* <hy-tab value="overview" label="Overview">...</hy-tab>
|
|
48
|
+
* <hy-tab value="specs" label="Specifications">...</hy-tab>
|
|
49
|
+
* </hy-tabs>
|
|
50
|
+
* ```
|
|
51
|
+
*
|
|
52
|
+
* With `selectionMode="follow"` (the default) a tab opens as soon as it is
|
|
53
|
+
* focused. Use `explicit` when panels are expensive, so users press Enter or
|
|
54
|
+
* Space to open one.
|
|
55
|
+
*/
|
|
56
|
+
export declare class HyTabs {
|
|
57
|
+
protected readonly tabs: import("@angular/core").Signal<readonly HyTab[]>;
|
|
58
|
+
private readonly list;
|
|
59
|
+
private readonly tabEls;
|
|
60
|
+
/** Accessible name for the tab list. */
|
|
61
|
+
readonly label: import("@angular/core").InputSignal<string | undefined>;
|
|
62
|
+
/** Value of the selected tab. Two-way bindable. Defaults to the first tab. */
|
|
63
|
+
readonly selected: import("@angular/core").ModelSignal<string | undefined>;
|
|
64
|
+
/** `follow` opens a tab on focus, `explicit` waits for Enter or Space. */
|
|
65
|
+
readonly selectionMode: import("@angular/core").InputSignal<"follow" | "explicit">;
|
|
66
|
+
/** Stretch tabs to fill the row. */
|
|
67
|
+
readonly stretch: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
68
|
+
/** The selected value, falling back to the first enabled tab. */
|
|
69
|
+
protected readonly current: import("@angular/core").Signal<string | undefined>;
|
|
70
|
+
protected readonly ready: import("@angular/core").Signal<boolean>;
|
|
71
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<HyTabs, never>;
|
|
72
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<HyTabs, "hy-tabs", never, {
|
|
73
|
+
"label": {
|
|
74
|
+
"alias": "label";
|
|
75
|
+
"required": false;
|
|
76
|
+
"isSignal": true;
|
|
77
|
+
};
|
|
78
|
+
"selected": {
|
|
79
|
+
"alias": "selected";
|
|
80
|
+
"required": false;
|
|
81
|
+
"isSignal": true;
|
|
82
|
+
};
|
|
83
|
+
"selectionMode": {
|
|
84
|
+
"alias": "selectionMode";
|
|
85
|
+
"required": false;
|
|
86
|
+
"isSignal": true;
|
|
87
|
+
};
|
|
88
|
+
"stretch": {
|
|
89
|
+
"alias": "stretch";
|
|
90
|
+
"required": false;
|
|
91
|
+
"isSignal": true;
|
|
92
|
+
};
|
|
93
|
+
}, {
|
|
94
|
+
"selected": "selectedChange";
|
|
95
|
+
}, ["tabs"], ["*"], true, [{
|
|
96
|
+
directive: typeof i1.Tabs;
|
|
97
|
+
inputs: {};
|
|
98
|
+
outputs: {};
|
|
99
|
+
}]>;
|
|
100
|
+
}
|
|
101
|
+
/** Everything needed to build tabs. */
|
|
102
|
+
export declare const HY_TABS: readonly [typeof HyTabs, typeof HyTab];
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
/** The palettes in `styles/palettes/`. Apps can add their own names too. */
|
|
3
|
+
export type HyPaletteName = 'aurora' | 'ember' | 'orchid' | 'ocean' | 'rose' | 'graphite';
|
|
4
|
+
/** Where a palette stylesheet is served from when no `paletteHref` is configured. */
|
|
5
|
+
export declare function defaultPaletteHref(name: string): string;
|
|
6
|
+
/**
|
|
7
|
+
* Switches palettes, loading each stylesheet the first time it is needed.
|
|
8
|
+
*
|
|
9
|
+
* Palettes are separate files in `styles/palettes/`, so they never add to
|
|
10
|
+
* the initial CSS. Their rules only match while `data-hy-palette` is on
|
|
11
|
+
* `<html>`, which means a loaded palette costs nothing until it is picked.
|
|
12
|
+
* The attribute is set only after the file has loaded, so the page never
|
|
13
|
+
* shows half a palette, and switching back to a palette is instant.
|
|
14
|
+
*
|
|
15
|
+
* To restore a saved palette before the app boots, an inline script can add
|
|
16
|
+
* `<link rel="stylesheet" data-hy-palette="ocean" href="...">` to the head
|
|
17
|
+
* and the attribute to `<html>`. HyPalette picks up both.
|
|
18
|
+
*/
|
|
19
|
+
export declare class HyPalette {
|
|
20
|
+
private readonly document;
|
|
21
|
+
private readonly config;
|
|
22
|
+
private readonly isBrowser;
|
|
23
|
+
private readonly loads;
|
|
24
|
+
private readonly _current;
|
|
25
|
+
private readonly _selected;
|
|
26
|
+
/** The palette on screen, or null for the built-in one. */
|
|
27
|
+
readonly current: import("@angular/core").Signal<string | null>;
|
|
28
|
+
/**
|
|
29
|
+
* The palette last asked for. It changes straight away, while `current`
|
|
30
|
+
* waits for the stylesheet, so a picker can show the choice immediately.
|
|
31
|
+
*/
|
|
32
|
+
readonly selected: import("@angular/core").Signal<string | null>;
|
|
33
|
+
/**
|
|
34
|
+
* Loads a palette and applies it, or goes back to the built-in palette for
|
|
35
|
+
* null. When several calls overlap, the last one wins. Rejects when the
|
|
36
|
+
* stylesheet fails to load, and leaves the current palette in place. The
|
|
37
|
+
* exception is a palette restored before boot whose file never loaded: the
|
|
38
|
+
* page goes back to the built-in palette instead of claiming it.
|
|
39
|
+
*/
|
|
40
|
+
use(name: HyPaletteName | (string & {}) | null): Promise<void>;
|
|
41
|
+
/** Starts loading a palette without applying it, for example on hover. */
|
|
42
|
+
preload(name: HyPaletteName | (string & {})): void;
|
|
43
|
+
private load;
|
|
44
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<HyPalette, never>;
|
|
45
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
46
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
/** Colour and icon of a toast. */
|
|
3
|
+
export type HyToastTone = 'neutral' | 'info' | 'success' | 'warning' | 'danger';
|
|
4
|
+
/** What to show. */
|
|
5
|
+
export interface HyToastOptions {
|
|
6
|
+
readonly message: string;
|
|
7
|
+
readonly title?: string;
|
|
8
|
+
readonly tone?: HyToastTone;
|
|
9
|
+
/**
|
|
10
|
+
* Milliseconds before it hides. 0 keeps it until dismissed. Defaults to
|
|
11
|
+
* 5000, or 0 when there is an action, so nobody has to race a timer.
|
|
12
|
+
*/
|
|
13
|
+
readonly duration?: number;
|
|
14
|
+
/** One optional action, such as Undo. */
|
|
15
|
+
readonly action?: {
|
|
16
|
+
readonly label: string;
|
|
17
|
+
readonly run: () => void;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
/** @internal One toast in the stack. */
|
|
21
|
+
export interface HyToastItem extends HyToastOptions {
|
|
22
|
+
readonly id: number;
|
|
23
|
+
readonly leaving: boolean;
|
|
24
|
+
}
|
|
25
|
+
/** Handle to a shown toast. */
|
|
26
|
+
export interface HyToastRef {
|
|
27
|
+
dismiss(): void;
|
|
28
|
+
}
|
|
29
|
+
/** @internal Why the timers are on hold. Hover and focus are tracked apart. */
|
|
30
|
+
export type HyToastHold = 'hover' | 'focus';
|
|
31
|
+
/**
|
|
32
|
+
* Shows toasts: short messages about something that just happened.
|
|
33
|
+
*
|
|
34
|
+
* ```ts
|
|
35
|
+
* toaster.show({ message: 'Address saved', tone: 'success' });
|
|
36
|
+
* toaster.show({ message: 'Draft deleted', action: { label: 'Undo', run: () => restore() } });
|
|
37
|
+
* ```
|
|
38
|
+
*
|
|
39
|
+
* Every toast is announced through the live announcer (`danger` toasts
|
|
40
|
+
* assertively, the rest politely). Timers pause while the pointer or focus
|
|
41
|
+
* is in the stack, and toasts can be swiped away. The stack sits at the
|
|
42
|
+
* bottom inline-end corner and is a labelled region, so keyboard and screen
|
|
43
|
+
* reader users can reach the actions.
|
|
44
|
+
*/
|
|
45
|
+
export declare class HyToaster {
|
|
46
|
+
private readonly injector;
|
|
47
|
+
private readonly announcer;
|
|
48
|
+
private readonly isBrowser;
|
|
49
|
+
private readonly timers;
|
|
50
|
+
private overlayRef;
|
|
51
|
+
private nextId;
|
|
52
|
+
private readonly holds;
|
|
53
|
+
/** @internal The current stack, newest last. */
|
|
54
|
+
readonly items: import("@angular/core").WritableSignal<readonly HyToastItem[]>;
|
|
55
|
+
/** Shows a toast. Does nothing during server rendering. */
|
|
56
|
+
show(options: HyToastOptions): HyToastRef;
|
|
57
|
+
success(message: string, title?: string): HyToastRef;
|
|
58
|
+
error(message: string, title?: string): HyToastRef;
|
|
59
|
+
/** Hides one toast with its exit animation, a fade with reduced motion. */
|
|
60
|
+
dismiss(id: number): void;
|
|
61
|
+
/** @internal Removes a toast that already left the screen, as after a swipe. */
|
|
62
|
+
discard(id: number): void;
|
|
63
|
+
private clearTimer;
|
|
64
|
+
/** Hides every toast. */
|
|
65
|
+
dismissAll(): void;
|
|
66
|
+
/**
|
|
67
|
+
* @internal Pauses all timers while the stack is hovered or focused. Each
|
|
68
|
+
* reason is held separately, so the pointer leaving does not restart the
|
|
69
|
+
* timers while focus is still on a toast.
|
|
70
|
+
*/
|
|
71
|
+
pause(reason: HyToastHold): void;
|
|
72
|
+
/** @internal Releases one hold. Timers restart once no hold is left. */
|
|
73
|
+
resume(reason: HyToastHold): void;
|
|
74
|
+
private startTimer;
|
|
75
|
+
private remove;
|
|
76
|
+
private ensureStack;
|
|
77
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<HyToaster, never>;
|
|
78
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
79
|
+
}
|
|
@@ -0,0 +1,345 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import { ElementRef, InjectionToken, Provider, Signal } from "@angular/core";
|
|
3
|
+
/**
|
|
4
|
+
* How see-through a surface is.
|
|
5
|
+
*
|
|
6
|
+
* - `clear`: a light veil, most of the background shows through.
|
|
7
|
+
* - `frosted`: the default glass, blurred and saturated.
|
|
8
|
+
* - `tinted`: frosted glass coloured by the primary colour.
|
|
9
|
+
* - `solid`: opaque. Used automatically when the browser cannot blur, when
|
|
10
|
+
* the user asks for reduced transparency, and on the low fidelity tier.
|
|
11
|
+
*/
|
|
12
|
+
export type HyMaterial = 'clear' | 'frosted' | 'tinted' | 'solid';
|
|
13
|
+
/**
|
|
14
|
+
* How heavy a glass surface reads. Bigger surfaces should be thicker: more
|
|
15
|
+
* blur and a deeper shadow.
|
|
16
|
+
*
|
|
17
|
+
* - `thin`: chips and buttons.
|
|
18
|
+
* - `regular`: the default, for cards, bars, popovers and toasts.
|
|
19
|
+
* - `thick`: dialogs, drawers and sheets.
|
|
20
|
+
*/
|
|
21
|
+
export type HyThickness = 'thin' | 'regular' | 'thick';
|
|
22
|
+
/** Control size. All sizes keep a touch target of at least 32px. */
|
|
23
|
+
export type HySize = 'sm' | 'md' | 'lg';
|
|
24
|
+
/**
|
|
25
|
+
* Colour role of a control. `secondary` uses --hy-secondary when the theme sets
|
|
26
|
+
* it and falls back to the primary colour when it does not.
|
|
27
|
+
*/
|
|
28
|
+
export type HyTone = 'primary' | 'secondary' | 'neutral' | 'success' | 'warning' | 'danger';
|
|
29
|
+
/**
|
|
30
|
+
* How much visual effort the device can afford.
|
|
31
|
+
*
|
|
32
|
+
* - `high`: everything, including cursor physics and (from v0.2) WebGL.
|
|
33
|
+
* - `medium`: GSAP tilt and reveals, no WebGL.
|
|
34
|
+
* - `low`: CSS only. Glass turns solid and nothing waits on JavaScript to
|
|
35
|
+
* become visible.
|
|
36
|
+
*/
|
|
37
|
+
export type HyFidelityTier = 'high' | 'medium' | 'low';
|
|
38
|
+
/**
|
|
39
|
+
* The small part of GSAP that Hyalo uses. Declared here so the kit compiles
|
|
40
|
+
* without GSAP installed. The real `gsap` object satisfies it.
|
|
41
|
+
*/
|
|
42
|
+
export interface HyGsap {
|
|
43
|
+
to(target: Element | Element[], vars: Record<string, unknown>): unknown;
|
|
44
|
+
set(target: Element | Element[], vars: Record<string, unknown>): unknown;
|
|
45
|
+
quickTo(target: Element, property: string, vars?: Record<string, unknown>): (value: number) => unknown;
|
|
46
|
+
killTweensOf(target: Element | Element[]): void;
|
|
47
|
+
}
|
|
48
|
+
/** Returns GSAP, usually through a dynamic import so it lands in its own chunk. */
|
|
49
|
+
export type HyGsapLoader = () => Promise<HyGsap>;
|
|
50
|
+
/** Global defaults read by every Hyalo component. */
|
|
51
|
+
export interface HyConfig {
|
|
52
|
+
/** Default material for glass surfaces. */
|
|
53
|
+
readonly material: HyMaterial;
|
|
54
|
+
/** Default control size. */
|
|
55
|
+
readonly size: HySize;
|
|
56
|
+
/** Default tone for buttons and other coloured controls. */
|
|
57
|
+
readonly tone: HyTone;
|
|
58
|
+
/**
|
|
59
|
+
* Forces a fidelity tier instead of detecting it. Handy for tests,
|
|
60
|
+
* screenshots and low-end kiosks.
|
|
61
|
+
*/
|
|
62
|
+
readonly fidelity?: HyFidelityTier;
|
|
63
|
+
/**
|
|
64
|
+
* Loads GSAP on demand. Without it, Hyalo falls back to CSS transitions,
|
|
65
|
+
* so GSAP stays an optional dependency.
|
|
66
|
+
*
|
|
67
|
+
* ```ts
|
|
68
|
+
* provideHyalo({ gsap: () => import('gsap').then((m) => m.gsap) })
|
|
69
|
+
* ```
|
|
70
|
+
*/
|
|
71
|
+
readonly gsap?: HyGsapLoader;
|
|
72
|
+
/**
|
|
73
|
+
* Maps a palette name to its stylesheet URL for HyPalette. Defaults to
|
|
74
|
+
* `palette-<name>.css`, which is what a non-injected `bundleName` entry
|
|
75
|
+
* in angular.json produces.
|
|
76
|
+
*/
|
|
77
|
+
readonly paletteHref?: (name: string) => string;
|
|
78
|
+
}
|
|
79
|
+
/** Resolved Hyalo configuration. Use {@link provideHyalo} to change it. */
|
|
80
|
+
export declare const HY_CONFIG: InjectionToken<HyConfig>;
|
|
81
|
+
/**
|
|
82
|
+
* Sets Hyalo defaults. Works in `app.config.ts` and in a component's
|
|
83
|
+
* `providers`, where it merges with whatever the parent injector provides.
|
|
84
|
+
* That makes it easy to switch one section of a page to `solid`, for example.
|
|
85
|
+
*/
|
|
86
|
+
export declare function provideHyalo(config?: Partial<HyConfig>): Provider;
|
|
87
|
+
/**
|
|
88
|
+
* Returns a unique id with the given prefix. The counter is per application,
|
|
89
|
+
* so the server and the client produce the same ids during hydration.
|
|
90
|
+
*/
|
|
91
|
+
export declare function injectId(prefix: string): string;
|
|
92
|
+
interface NavigatorHints {
|
|
93
|
+
readonly deviceMemory?: number;
|
|
94
|
+
readonly hardwareConcurrency?: number;
|
|
95
|
+
readonly connection?: {
|
|
96
|
+
readonly saveData?: boolean;
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Picks a tier from what the browser reports. Exported for tests and for
|
|
101
|
+
* apps that want to run the same check themselves.
|
|
102
|
+
*
|
|
103
|
+
* Reduced motion is not a reason to drop a tier: it asks for less movement,
|
|
104
|
+
* not for less glass. HyMotion already turns off decorative motion for it,
|
|
105
|
+
* and reduced transparency is handled in CSS.
|
|
106
|
+
*/
|
|
107
|
+
export declare function detectFidelity(nav: NavigatorHints): HyFidelityTier;
|
|
108
|
+
/**
|
|
109
|
+
* Holds the current fidelity tier. Every effect in Hyalo reads it.
|
|
110
|
+
*
|
|
111
|
+
* The server and the first client render always use `medium`, so hydration
|
|
112
|
+
* sees the same markup. The real tier is detected right after the first
|
|
113
|
+
* render. The tier is also written to `data-hy-fidelity` on `<html>` for
|
|
114
|
+
* CSS that needs it.
|
|
115
|
+
*/
|
|
116
|
+
export declare class HyFidelity {
|
|
117
|
+
private readonly config;
|
|
118
|
+
private readonly document;
|
|
119
|
+
private readonly _tier;
|
|
120
|
+
private overridden;
|
|
121
|
+
/** The active tier. */
|
|
122
|
+
readonly tier: import("@angular/core").Signal<HyFidelityTier>;
|
|
123
|
+
constructor();
|
|
124
|
+
/** Overrides the detected tier, for example from a settings toggle. */
|
|
125
|
+
setTier(tier: HyFidelityTier): void;
|
|
126
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<HyFidelity, never>;
|
|
127
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
128
|
+
}
|
|
129
|
+
/** One named motion: duration in seconds plus matching GSAP and CSS easings. */
|
|
130
|
+
export interface HyMotionPreset {
|
|
131
|
+
readonly duration: number;
|
|
132
|
+
readonly ease: string;
|
|
133
|
+
readonly css: string;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* The shared motion vocabulary. CSS has the same values as `--hy-dur-*` and
|
|
137
|
+
* `--hy-ease-*` tokens.
|
|
138
|
+
*
|
|
139
|
+
* - `settle`: the default for anything that moves into place.
|
|
140
|
+
* - `pop`: a small overshoot. Only for motion the user caused, such as a
|
|
141
|
+
* toggle they just pressed. Never for things that appear on their own.
|
|
142
|
+
* - `quick`: acknowledgements, like a press or a hover.
|
|
143
|
+
* - `scene`: large, slow movements such as section reveals.
|
|
144
|
+
*/
|
|
145
|
+
export declare const MOTION: {
|
|
146
|
+
readonly settle: {
|
|
147
|
+
readonly duration: 0.44;
|
|
148
|
+
readonly ease: "power3.out";
|
|
149
|
+
readonly css: "cubic-bezier(0.215, 0.61, 0.355, 1)";
|
|
150
|
+
};
|
|
151
|
+
readonly pop: {
|
|
152
|
+
readonly duration: 0.5;
|
|
153
|
+
readonly ease: "back.out(1.5)";
|
|
154
|
+
readonly css: "cubic-bezier(0.34, 1.56, 0.64, 1)";
|
|
155
|
+
};
|
|
156
|
+
readonly quick: {
|
|
157
|
+
readonly duration: 0.22;
|
|
158
|
+
readonly ease: "power2.out";
|
|
159
|
+
readonly css: "cubic-bezier(0.25, 0.46, 0.45, 0.94)";
|
|
160
|
+
};
|
|
161
|
+
readonly scene: {
|
|
162
|
+
readonly duration: 0.9;
|
|
163
|
+
readonly ease: "expo.out";
|
|
164
|
+
readonly css: "cubic-bezier(0.16, 1, 0.3, 1)";
|
|
165
|
+
};
|
|
166
|
+
};
|
|
167
|
+
/**
|
|
168
|
+
* Motion state for the whole app: whether the user prefers reduced motion,
|
|
169
|
+
* whether effects may run at all, and lazy access to GSAP.
|
|
170
|
+
*/
|
|
171
|
+
export declare class HyMotion {
|
|
172
|
+
private readonly config;
|
|
173
|
+
private readonly fidelity;
|
|
174
|
+
private readonly document;
|
|
175
|
+
private readonly isBrowser;
|
|
176
|
+
private readonly _reduced;
|
|
177
|
+
private gsapPromise;
|
|
178
|
+
/** True when the OS asks for reduced motion, or the app forced it. */
|
|
179
|
+
readonly reduced: import("@angular/core").Signal<boolean>;
|
|
180
|
+
/** True when decorative motion (tilt, magnetic, reveal) may run. */
|
|
181
|
+
readonly enabled: import("@angular/core").Signal<boolean>;
|
|
182
|
+
constructor();
|
|
183
|
+
/**
|
|
184
|
+
* Forces reduced or full motion regardless of the OS setting, and mirrors
|
|
185
|
+
* the choice to `data-hy-motion` so CSS tokens follow. Pass `null` to go
|
|
186
|
+
* back to the OS setting.
|
|
187
|
+
*/
|
|
188
|
+
setReduced(reduced: boolean | null): void;
|
|
189
|
+
/**
|
|
190
|
+
* Loads GSAP once, if the app provided a loader. Resolves to `null` on the
|
|
191
|
+
* server, without a loader, or if loading fails, so callers can fall back
|
|
192
|
+
* to CSS.
|
|
193
|
+
*/
|
|
194
|
+
gsap(): Promise<HyGsap | null>;
|
|
195
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<HyMotion, never>;
|
|
196
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* A spring in the two numbers Apple designs with.
|
|
200
|
+
*
|
|
201
|
+
* - `damping`: 1 settles without overshoot, lower values bounce.
|
|
202
|
+
* - `response`: roughly how many seconds it takes to get there. Not a
|
|
203
|
+
* duration; the settle time falls out of the physics.
|
|
204
|
+
*/
|
|
205
|
+
export interface HySpringConfig {
|
|
206
|
+
readonly damping: number;
|
|
207
|
+
readonly response: number;
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* The shared springs.
|
|
211
|
+
*
|
|
212
|
+
* - `settle`: the default. No bounce.
|
|
213
|
+
* - `momentum`: after a flick or a drag, when the gesture carried speed.
|
|
214
|
+
*/
|
|
215
|
+
export declare const SPRINGS: {
|
|
216
|
+
readonly settle: {
|
|
217
|
+
readonly damping: 1;
|
|
218
|
+
readonly response: 0.4;
|
|
219
|
+
};
|
|
220
|
+
readonly momentum: {
|
|
221
|
+
readonly damping: 0.8;
|
|
222
|
+
readonly response: 0.3;
|
|
223
|
+
};
|
|
224
|
+
};
|
|
225
|
+
/** Options for {@link HySpring.to}. */
|
|
226
|
+
export interface HySpringTarget extends Partial<HySpringConfig> {
|
|
227
|
+
/** Starting velocity in units per second. Defaults to the current one. */
|
|
228
|
+
readonly velocity?: number;
|
|
229
|
+
/** Runs once the value comes to rest on the target. */
|
|
230
|
+
readonly onRest?: () => void;
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Animates one number on `requestAnimationFrame`. Every `to()` starts from
|
|
234
|
+
* the live value and keeps its velocity, so the motion can be grabbed and
|
|
235
|
+
* redirected at any moment without a jump or a sudden stop.
|
|
236
|
+
*/
|
|
237
|
+
export declare class HySpring {
|
|
238
|
+
private readonly onUpdate;
|
|
239
|
+
/** The value on screen right now. */
|
|
240
|
+
value: number;
|
|
241
|
+
/** Units per second. */
|
|
242
|
+
velocity: number;
|
|
243
|
+
private target;
|
|
244
|
+
private config;
|
|
245
|
+
private onRest;
|
|
246
|
+
private frame;
|
|
247
|
+
private last;
|
|
248
|
+
constructor(initial: number, onUpdate: (value: number) => void);
|
|
249
|
+
/** True while the spring is moving. */
|
|
250
|
+
get running(): boolean;
|
|
251
|
+
/** Springs toward `target`, from wherever it is now. */
|
|
252
|
+
to(target: number, options?: HySpringTarget): void;
|
|
253
|
+
/** Jumps to a value and stops, as when a finger holds it. */
|
|
254
|
+
set(value: number): void;
|
|
255
|
+
/** Stops where it is. A pending `onRest` is dropped. */
|
|
256
|
+
stop(): void;
|
|
257
|
+
private readonly tick;
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* How far a flick travels before it stops, from the velocity in px per
|
|
261
|
+
* second. This is the deceleration curve of scrolling, so a target picked
|
|
262
|
+
* from `position + project(velocity)` lands where the gesture was going.
|
|
263
|
+
*/
|
|
264
|
+
export declare function project(velocity: number, decelerationRate?: number): number;
|
|
265
|
+
/**
|
|
266
|
+
* Resistance past a boundary. The further the overshoot, the less the
|
|
267
|
+
* element follows, so an edge feels soft instead of frozen.
|
|
268
|
+
*/
|
|
269
|
+
export declare function rubberband(overshoot: number, dimension: number, constant?: number): number;
|
|
270
|
+
/** Velocity of a pointer from its last 100ms of movement. */
|
|
271
|
+
export declare class HyVelocityTracker {
|
|
272
|
+
private samples;
|
|
273
|
+
add(value: number, time?: number): void;
|
|
274
|
+
reset(): void;
|
|
275
|
+
/** Units per second. Zero if the pointer has been still for 100ms. */
|
|
276
|
+
velocity(now?: number): number;
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* Turns any element into a glass surface.
|
|
280
|
+
*
|
|
281
|
+
* ```html
|
|
282
|
+
* <aside hyMaterial="clear">...</aside>
|
|
283
|
+
* <section hyMaterial thickness="thick">...</section>
|
|
284
|
+
* ```
|
|
285
|
+
*
|
|
286
|
+
* The look lives in CSS (`.hy-glass[data-material]`), so effects stay cheap
|
|
287
|
+
* and themeable. On the low fidelity tier every material renders as `solid`,
|
|
288
|
+
* because backdrop blur is the most expensive thing on the page.
|
|
289
|
+
*/
|
|
290
|
+
export declare class HyMaterialDirective {
|
|
291
|
+
private readonly config;
|
|
292
|
+
private readonly fidelity;
|
|
293
|
+
/** The material. An empty attribute uses the configured default. */
|
|
294
|
+
readonly material: import("@angular/core").InputSignal<"" | HyMaterial | undefined>;
|
|
295
|
+
/** How heavy the glass reads. Use `thick` for large surfaces. */
|
|
296
|
+
readonly thickness: import("@angular/core").InputSignal<HyThickness>;
|
|
297
|
+
/** The material that is actually rendered after fidelity is applied. */
|
|
298
|
+
readonly resolved: import("@angular/core").Signal<HyMaterial>;
|
|
299
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<HyMaterialDirective, never>;
|
|
300
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<HyMaterialDirective, "[hyMaterial]", never, {
|
|
301
|
+
"material": {
|
|
302
|
+
"alias": "hyMaterial";
|
|
303
|
+
"required": false;
|
|
304
|
+
"isSignal": true;
|
|
305
|
+
};
|
|
306
|
+
"thickness": {
|
|
307
|
+
"alias": "thickness";
|
|
308
|
+
"required": false;
|
|
309
|
+
"isSignal": true;
|
|
310
|
+
};
|
|
311
|
+
}, {}, never, never, true, never>;
|
|
312
|
+
}
|
|
313
|
+
/**
|
|
314
|
+
* Mirrors interaction state to data attributes so glass effects can stay in
|
|
315
|
+
* CSS: `data-hover`, `data-press` and `data-focus-visible`.
|
|
316
|
+
*
|
|
317
|
+
* Hover is only reported for mouse and pen, so touch screens never get a
|
|
318
|
+
* stuck hover state.
|
|
319
|
+
*/
|
|
320
|
+
export declare class HyInteractive {
|
|
321
|
+
private readonly host;
|
|
322
|
+
private readonly focusMonitor;
|
|
323
|
+
protected readonly hovered: import("@angular/core").WritableSignal<boolean>;
|
|
324
|
+
protected readonly pressed: import("@angular/core").WritableSignal<boolean>;
|
|
325
|
+
protected readonly focusVisible: import("@angular/core").WritableSignal<boolean>;
|
|
326
|
+
constructor();
|
|
327
|
+
protected onEnter(event: PointerEvent): void;
|
|
328
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<HyInteractive, never>;
|
|
329
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<HyInteractive, "[hyInteractive]", never, {}, {}, never, never, true, never>;
|
|
330
|
+
}
|
|
331
|
+
/** True in the browser, false during server rendering. Call in an injection context. */
|
|
332
|
+
declare function injectIsBrowser(): boolean;
|
|
333
|
+
/** Reads a media query once. Always false on the server. */
|
|
334
|
+
declare function matchesMedia(query: string): boolean;
|
|
335
|
+
/**
|
|
336
|
+
* Keeps a sliding indicator under the selected item of a row by writing
|
|
337
|
+
* `--hy-ind-x` and `--hy-ind-size` on the row. The offset is physical (from
|
|
338
|
+
* the left edge) and the indicator is placed physically too, so the same
|
|
339
|
+
* numbers work in both directions.
|
|
340
|
+
*
|
|
341
|
+
* Returns a signal that turns true after the first placement, so CSS can
|
|
342
|
+
* enable the transition only from then on.
|
|
343
|
+
*/
|
|
344
|
+
declare function trackIndicator(container: Signal<ElementRef<HTMLElement> | undefined>, selected: () => HTMLElement | null): Signal<boolean>;
|
|
345
|
+
export { injectIsBrowser as ɵinjectIsBrowser, matchesMedia as ɵmatchesMedia, trackIndicator as ɵtrackIndicator };
|