@ssgoi/angular
v6.3.0
Published
Angular bindings for SSGOI - Native app-like page transitions for Angular applications
Maintainers
Readme
@ssgoi/angular
Angular bindings for SSGOI that give any Angular 20+ app native-feeling page transitions powered by the @ssgoi/core animation engine.
Installation
npm install @ssgoi/angular
# or
pnpm add @ssgoi/angular
# or
yarn add @ssgoi/angularWhat You Get
Ssgoidirective (selector:[ssgoi]) that bootstraps the core transition context on the client and gracefully no-ops during SSR.SsgoiTransitiondirective (selector:[ssgoiTransition]) that wires individual route containers into the transition system.injectSsgoi()helper andSSGOI_CONTEXTinjection token for retrieving the transition context anywhere in your component tree.- Re-exported transition factories under
@ssgoi/angular/view-transitions.
Quick Start
1. Provide the transition context once
import { Component, signal } from "@angular/core";
import { RouterOutlet } from "@angular/router";
import { Ssgoi, SsgoiConfig } from "@ssgoi/angular";
import { fade } from "@ssgoi/angular/view-transitions";
@Component({
selector: "app-root",
standalone: true,
imports: [RouterOutlet, Ssgoi],
template: `
<div
ssgoi
[config]="ssgoiConfig()"
style="position: relative; min-height: 100vh"
>
<router-outlet />
</div>
`,
})
export class AppComponent {
protected readonly ssgoiConfig = signal<SsgoiConfig>({
transitions: [fade({ paths: ["/home", "/about"] })],
});
}2. Mark each routed view with SsgoiTransition
import { Component } from "@angular/core";
import { SsgoiTransition } from "@ssgoi/angular";
@Component({
selector: "app-home",
standalone: true,
imports: [SsgoiTransition],
template: `
<section [ssgoiTransition]="'/home'">
<h1>Home Page</h1>
</section>
`,
})
export class HomeComponent {}The value you pass to [ssgoiTransition] should uniquely identify the view (commonly the route path).
How It Works
SsgoiwrapscreateSggoiTransitionContextfrom@ssgoi/coreand injects it viaSSGOI_CONTEXT. The directive guards against the server platform so SSR renders stay deterministic.SsgoiTransitionreads that context withinjectSsgoi(), setsdata-ssgoi-transitionon the host, and subscribes the element to the core transition runner.
Because everything is driven by signals, Angular change detection stays minimal and the bundle remains fully tree-shakeable.
API Reference
Ssgoiconfig: SsgoiConfig(input, optional) – global transition configuration. Uses{}as default.host: HostAnimation | undefined(input, optional) – external playback host for debug tooling.
SsgoiTransitionssgoiTransition: string(required input) – identifier for the target view/container.
injectSsgoi(): SsgoiContext– returns the adapter context. During SSR it falls back to a no-op implementation so you can call it unconditionally.
Available Transitions
View-level factories:
import {
fade,
scroll,
drill,
hero,
slide,
zoom,
} from "@ssgoi/angular/view-transitions";Sample Configuration
import { fade, scroll } from "@ssgoi/angular/view-transitions";
import type { SsgoiConfig } from "@ssgoi/angular";
export const config: SsgoiConfig = {
transitions: [
fade({ paths: ["/", "/home"] }),
scroll({ paths: ["/home", "/about"] }),
],
};License
MIT © MeurSyphus
