@ssgoi/angular 7.1.0 → 7.1.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/dist/README.md ADDED
@@ -0,0 +1,125 @@
1
+ # @ssgoi/angular
2
+
3
+ Angular bindings for SSGOI.
4
+
5
+ [![SSGOI live showcase](https://ssgoi.dev/readme.png)](https://ssgoi.dev)
6
+
7
+ [Live demos](https://ssgoi.dev) · [Hero, Zoom, Film, and Sheet in motion](https://ssgoi.dev/blog/view-transition-api-limitations)
8
+
9
+ ```bash
10
+ npm install @ssgoi/angular
11
+ ```
12
+
13
+ Agent setup guide: https://ssgoi.dev/llms.txt
14
+
15
+ ## Setup
16
+
17
+ Create one SSGOI root above the router outlet.
18
+
19
+ ```ts
20
+ import { Component, signal } from "@angular/core";
21
+ import { RouterOutlet } from "@angular/router";
22
+ import { Ssgoi, type SsgoiConfig } from "@ssgoi/angular";
23
+ import { drill } from "@ssgoi/angular/view-transitions";
24
+
25
+ @Component({
26
+ selector: "app-root",
27
+ standalone: true,
28
+ imports: [RouterOutlet, Ssgoi],
29
+ template: `
30
+ <main
31
+ ssgoi
32
+ [config]="config()"
33
+ style="position:relative;z-index:0;overflow-x:clip"
34
+ >
35
+ <router-outlet />
36
+ </main>
37
+ `,
38
+ })
39
+ export class AppComponent {
40
+ protected readonly config = signal<SsgoiConfig>({
41
+ transitions: [{ on: "/posts/**", except: "/posts", transition: drill() }],
42
+ });
43
+ }
44
+ ```
45
+
46
+ ## Route boundary
47
+
48
+ Mark the root element of each routed component.
49
+
50
+ ```ts
51
+ @Component({
52
+ selector: "app-post",
53
+ standalone: true,
54
+ template: `
55
+ <article data-ssgoi-transition="/posts/42">
56
+ <!-- page -->
57
+ </article>
58
+ `,
59
+ })
60
+ export class PostComponent {}
61
+ ```
62
+
63
+ The id must match the config route patterns.
64
+
65
+ ## Config
66
+
67
+ ```ts
68
+ import type { SsgoiConfig } from "@ssgoi/angular";
69
+ import { drill, slide, zoom } from "@ssgoi/angular/view-transitions";
70
+
71
+ const config: SsgoiConfig = {
72
+ transitions: [
73
+ {
74
+ on: "/posts/**",
75
+ except: "/posts",
76
+ transition: drill(),
77
+ },
78
+ {
79
+ from: "/gallery",
80
+ to: "/gallery/*",
81
+ transition: zoom(),
82
+ },
83
+ {
84
+ ordered: ["/tabs/a", "/tabs/b"],
85
+ transition: slide(),
86
+ },
87
+ ],
88
+ };
89
+ ```
90
+
91
+ - `on`: route family.
92
+ - `from`/`to`: precise pair.
93
+ - `ordered`: directional sequence.
94
+ - Scroll is automatic: `on` and `from`/`to` restore `from` and reset `to`;
95
+ `ordered` restores both. Override with
96
+ `preserveScroll: { from: boolean, to: boolean }`.
97
+ - Patterns support exact paths, a `*` path segment, and suffix `**`.
98
+ - Higher `priority` wins before path specificity.
99
+
100
+ ## Effect index
101
+
102
+ - `fade`: unrelated pages.
103
+ - `drill`: list → detail.
104
+ - `slide`: ordered tabs.
105
+ - `axis`: sibling destinations.
106
+ - `sheet`: modal-like routes.
107
+ - `zoom`: card/image → detail.
108
+ - `hero`: shared elements and page chrome.
109
+ - `scroll`: vertical sequences.
110
+ - `strip`, `film`, `rotate`, `blind`, `jaemin`: expressive transitions.
111
+
112
+ Options: https://ssgoi.dev/llms.txt#7-transition-index
113
+
114
+ ## API
115
+
116
+ - `[ssgoi]`: creates the root transition context.
117
+ - `[config]`: accepts `SsgoiConfig`.
118
+ - `[host]`: accepts an optional `HostAnimation`.
119
+ - `data-ssgoi-transition`: marks a route boundary.
120
+ - `injectSsgoi()`: returns the transition context.
121
+ - `[ssgoiTransition]`: deprecated; use the data attribute.
122
+
123
+ ## License
124
+
125
+ MIT
@@ -0,0 +1,6 @@
1
+ export * from '@ssgoi/core';
2
+
3
+ /**
4
+ * Generated bundle index. Do not edit.
5
+ */
6
+ //# sourceMappingURL=ssgoi-angular-view-transitions.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ssgoi-angular-view-transitions.mjs","sources":["../../view-transitions/ssgoi-angular-view-transitions.ts"],"sourcesContent":["/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;AAAA;;AAEG"}
@@ -0,0 +1,119 @@
1
+ import * as i0 from '@angular/core';
2
+ import { InjectionToken, inject, input, ElementRef, PLATFORM_ID, forwardRef, Directive } from '@angular/core';
3
+ import { isPlatformBrowser } from '@angular/common';
4
+ import { createSggoiTransitionContext, observeSsgoiTransitions } from '@ssgoi/core/internal';
5
+ export * from '@ssgoi/core';
6
+
7
+ const SSGOI_CONTEXT = new InjectionToken("ssgoi-context");
8
+ const noopContext = {
9
+ register: () => { },
10
+ refFor: () => () => { },
11
+ };
12
+ function injectSsgoi() {
13
+ const context = inject(SSGOI_CONTEXT, { optional: true });
14
+ if (!context) {
15
+ // During SSR or when not wrapped in <ssgoi>, return a no-op context
16
+ // This prevents errors during server-side rendering
17
+ return noopContext;
18
+ }
19
+ return context;
20
+ }
21
+
22
+ function createSsgoiContext(component) {
23
+ return component.getContext();
24
+ }
25
+ class Ssgoi {
26
+ config = input({}, ...(ngDevMode ? [{ debugName: "config" }] : []));
27
+ host = input(undefined, ...(ngDevMode ? [{ debugName: "host" }] : []));
28
+ el = inject((ElementRef));
29
+ platformId = inject(PLATFORM_ID);
30
+ contextValue;
31
+ stopObserving;
32
+ getContext() {
33
+ if (!isPlatformBrowser(this.platformId)) {
34
+ return undefined;
35
+ }
36
+ this.contextValue ??= createSggoiTransitionContext(this.config(), {
37
+ host: this.host(),
38
+ });
39
+ return this.contextValue;
40
+ }
41
+ ngAfterViewInit() {
42
+ const ssgoi = this.getContext();
43
+ if (!ssgoi)
44
+ return;
45
+ this.stopObserving = observeSsgoiTransitions(this.el.nativeElement, ssgoi);
46
+ }
47
+ ngOnDestroy() {
48
+ this.stopObserving?.();
49
+ }
50
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: Ssgoi, deps: [], target: i0.ɵɵFactoryTarget.Directive });
51
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.3.9", type: Ssgoi, isStandalone: true, selector: "[ssgoi]", inputs: { config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: false, transformFunction: null }, host: { classPropertyName: "host", publicName: "host", isSignal: true, isRequired: false, transformFunction: null } }, providers: [
52
+ {
53
+ provide: SSGOI_CONTEXT,
54
+ useFactory: createSsgoiContext,
55
+ deps: [forwardRef(() => Ssgoi)],
56
+ },
57
+ ], ngImport: i0 });
58
+ }
59
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: Ssgoi, decorators: [{
60
+ type: Directive,
61
+ args: [{
62
+ selector: "[ssgoi]",
63
+ standalone: true,
64
+ providers: [
65
+ {
66
+ provide: SSGOI_CONTEXT,
67
+ useFactory: createSsgoiContext,
68
+ deps: [forwardRef(() => Ssgoi)],
69
+ },
70
+ ],
71
+ }]
72
+ }], propDecorators: { config: [{ type: i0.Input, args: [{ isSignal: true, alias: "config", required: false }] }], host: [{ type: i0.Input, args: [{ isSignal: true, alias: "host", required: false }] }] } });
73
+
74
+ /**
75
+ * @deprecated Set `data-ssgoi-transition` directly on the page boundary
76
+ * element inside `[ssgoi]` instead.
77
+ */
78
+ class SsgoiTransition {
79
+ // The directive attribute value becomes the transition ID
80
+ ssgoiTransition = input.required(...(ngDevMode ? [{ debugName: "ssgoiTransition" }] : []));
81
+ ssgoi = injectSsgoi();
82
+ el = inject((ElementRef));
83
+ platformId = inject(PLATFORM_ID);
84
+ ngOnInit() {
85
+ if (!isPlatformBrowser(this.platformId)) {
86
+ return;
87
+ }
88
+ // Set data attribute on host element
89
+ this.el.nativeElement.setAttribute("data-ssgoi-transition", this.ssgoiTransition());
90
+ }
91
+ ngAfterViewInit() {
92
+ if (!isPlatformBrowser(this.platformId)) {
93
+ return;
94
+ }
95
+ // Use the host element itself as the transition target
96
+ const targetElement = this.el.nativeElement;
97
+ this.ssgoi.refFor(this.ssgoiTransition())(targetElement);
98
+ }
99
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: SsgoiTransition, deps: [], target: i0.ɵɵFactoryTarget.Directive });
100
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.3.9", type: SsgoiTransition, isStandalone: true, selector: "[ssgoiTransition]", inputs: { ssgoiTransition: { classPropertyName: "ssgoiTransition", publicName: "ssgoiTransition", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0 });
101
+ }
102
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: SsgoiTransition, decorators: [{
103
+ type: Directive,
104
+ args: [{
105
+ selector: "[ssgoiTransition]",
106
+ standalone: true,
107
+ }]
108
+ }], propDecorators: { ssgoiTransition: [{ type: i0.Input, args: [{ isSignal: true, alias: "ssgoiTransition", required: true }] }] } });
109
+
110
+ /*
111
+ * Public API Surface of @ssgoi/angular
112
+ */
113
+
114
+ /**
115
+ * Generated bundle index. Do not edit.
116
+ */
117
+
118
+ export { SSGOI_CONTEXT, Ssgoi, SsgoiTransition, injectSsgoi };
119
+ //# sourceMappingURL=ssgoi-angular.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ssgoi-angular.mjs","sources":["../../src/lib/context.ts","../../src/lib/ssgoi.directive.ts","../../src/lib/ssgoi-transition.directive.ts","../../src/public-api.ts","../../src/ssgoi-angular.ts"],"sourcesContent":["import { InjectionToken, inject } from \"@angular/core\";\nimport type { SsgoiContext } from \"@ssgoi/core/types\";\n\nexport const SSGOI_CONTEXT = new InjectionToken<SsgoiContext | undefined>(\n \"ssgoi-context\",\n);\n\nconst noopContext: SsgoiContext = {\n register: () => {},\n refFor: () => () => {},\n};\n\nexport function injectSsgoi(): SsgoiContext {\n const context = inject(SSGOI_CONTEXT, { optional: true });\n\n if (!context) {\n // During SSR or when not wrapped in <ssgoi>, return a no-op context\n // This prevents errors during server-side rendering\n return noopContext;\n }\n\n return context;\n}\n","import {\n AfterViewInit,\n Directive,\n ElementRef,\n OnDestroy,\n input,\n forwardRef,\n PLATFORM_ID,\n inject,\n} from \"@angular/core\";\nimport { isPlatformBrowser } from \"@angular/common\";\nimport {\n createSggoiTransitionContext,\n observeSsgoiTransitions,\n} from \"@ssgoi/core/internal\";\nimport type { HostAnimation } from \"@ssgoi/core/internal\";\nimport type { SsgoiConfig, SsgoiContext } from \"@ssgoi/core/types\";\nimport { SSGOI_CONTEXT } from \"./context\";\n\nfunction createSsgoiContext(component: Ssgoi): SsgoiContext | undefined {\n return component.getContext();\n}\n\n@Directive({\n selector: \"[ssgoi]\",\n standalone: true,\n providers: [\n {\n provide: SSGOI_CONTEXT,\n useFactory: createSsgoiContext,\n deps: [forwardRef(() => Ssgoi)],\n },\n ],\n})\nexport class Ssgoi implements AfterViewInit, OnDestroy {\n readonly config = input<SsgoiConfig>({});\n readonly host = input<HostAnimation | undefined>(undefined);\n\n private readonly el = inject(ElementRef<HTMLElement>);\n private readonly platformId = inject(PLATFORM_ID);\n private contextValue?: SsgoiContext;\n private stopObserving?: () => void;\n\n getContext(): SsgoiContext | undefined {\n if (!isPlatformBrowser(this.platformId)) {\n return undefined;\n }\n\n this.contextValue ??= createSggoiTransitionContext(this.config(), {\n host: this.host(),\n });\n return this.contextValue;\n }\n\n ngAfterViewInit(): void {\n const ssgoi = this.getContext();\n if (!ssgoi) return;\n\n this.stopObserving = observeSsgoiTransitions(this.el.nativeElement, ssgoi);\n }\n\n ngOnDestroy(): void {\n this.stopObserving?.();\n }\n}\n","import {\n Directive,\n input,\n OnInit,\n AfterViewInit,\n ElementRef,\n inject,\n PLATFORM_ID,\n} from \"@angular/core\";\nimport { isPlatformBrowser } from \"@angular/common\";\nimport { injectSsgoi } from \"./context\";\n\n/**\n * @deprecated Set `data-ssgoi-transition` directly on the page boundary\n * element inside `[ssgoi]` instead.\n */\n@Directive({\n selector: \"[ssgoiTransition]\",\n standalone: true,\n})\nexport class SsgoiTransition implements OnInit, AfterViewInit {\n // The directive attribute value becomes the transition ID\n readonly ssgoiTransition = input.required<string>();\n\n private readonly ssgoi = injectSsgoi();\n private readonly el = inject(ElementRef<HTMLElement>);\n private readonly platformId = inject(PLATFORM_ID);\n\n ngOnInit(): void {\n if (!isPlatformBrowser(this.platformId)) {\n return;\n }\n\n // Set data attribute on host element\n this.el.nativeElement.setAttribute(\n \"data-ssgoi-transition\",\n this.ssgoiTransition(),\n );\n }\n\n ngAfterViewInit(): void {\n if (!isPlatformBrowser(this.platformId)) {\n return;\n }\n\n // Use the host element itself as the transition target\n const targetElement = this.el.nativeElement;\n this.ssgoi.refFor(this.ssgoiTransition())(targetElement);\n }\n}\n","/*\n * Public API Surface of @ssgoi/angular\n */\n\nexport * from \"./lib/index\";\nexport * from \"./lib/types\";\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;MAGa,aAAa,GAAG,IAAI,cAAc,CAC7C,eAAe;AAGjB,MAAM,WAAW,GAAiB;AAChC,IAAA,QAAQ,EAAE,MAAK,EAAE,CAAC;AAClB,IAAA,MAAM,EAAE,MAAM,QAAO,CAAC;CACvB;SAEe,WAAW,GAAA;AACzB,IAAA,MAAM,OAAO,GAAG,MAAM,CAAC,aAAa,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAEzD,IAAI,CAAC,OAAO,EAAE;;;AAGZ,QAAA,OAAO,WAAW;IACpB;AAEA,IAAA,OAAO,OAAO;AAChB;;ACHA,SAAS,kBAAkB,CAAC,SAAgB,EAAA;AAC1C,IAAA,OAAO,SAAS,CAAC,UAAU,EAAE;AAC/B;MAaa,KAAK,CAAA;AACP,IAAA,MAAM,GAAG,KAAK,CAAc,EAAE,kDAAC;AAC/B,IAAA,IAAI,GAAG,KAAK,CAA4B,SAAS,gDAAC;AAE1C,IAAA,EAAE,GAAG,MAAM,EAAC,UAAuB,EAAC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C;IAC1D;uGA5BW,eAAe,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;2FAAf,eAAe,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,mBAAA,EAAA,MAAA,EAAA,EAAA,eAAA,EAAA,EAAA,iBAAA,EAAA,iBAAA,EAAA,UAAA,EAAA,iBAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,IAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA;;2FAAf,eAAe,EAAA,UAAA,EAAA,CAAA;kBAJ3B,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,mBAAmB;AAC7B,oBAAA,UAAU,EAAE,IAAI;AACjB,iBAAA;;;ACnBD;;AAEG;;ACFH;;AAEG;;;;"}
@@ -0,0 +1,40 @@
1
+ import * as i0 from '@angular/core';
2
+ import { AfterViewInit, OnDestroy, OnInit, InjectionToken } from '@angular/core';
3
+ import { HostAnimation } from '@ssgoi/core/internal';
4
+ import { SsgoiConfig, SsgoiContext } from '@ssgoi/core/types';
5
+ export * from '@ssgoi/core/types';
6
+ export * from '@ssgoi/core';
7
+
8
+ declare class Ssgoi implements AfterViewInit, OnDestroy {
9
+ readonly config: i0.InputSignal<SsgoiConfig>;
10
+ readonly host: i0.InputSignal<HostAnimation>;
11
+ private readonly el;
12
+ private readonly platformId;
13
+ private contextValue?;
14
+ private stopObserving?;
15
+ getContext(): SsgoiContext | undefined;
16
+ ngAfterViewInit(): void;
17
+ ngOnDestroy(): void;
18
+ static ɵfac: i0.ɵɵFactoryDeclaration<Ssgoi, never>;
19
+ static ɵdir: i0.ɵɵDirectiveDeclaration<Ssgoi, "[ssgoi]", never, { "config": { "alias": "config"; "required": false; "isSignal": true; }; "host": { "alias": "host"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
20
+ }
21
+
22
+ /**
23
+ * @deprecated Set `data-ssgoi-transition` directly on the page boundary
24
+ * element inside `[ssgoi]` instead.
25
+ */
26
+ declare class SsgoiTransition implements OnInit, AfterViewInit {
27
+ readonly ssgoiTransition: i0.InputSignal<string>;
28
+ private readonly ssgoi;
29
+ private readonly el;
30
+ private readonly platformId;
31
+ ngOnInit(): void;
32
+ ngAfterViewInit(): void;
33
+ static ɵfac: i0.ɵɵFactoryDeclaration<SsgoiTransition, never>;
34
+ static ɵdir: i0.ɵɵDirectiveDeclaration<SsgoiTransition, "[ssgoiTransition]", never, { "ssgoiTransition": { "alias": "ssgoiTransition"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
35
+ }
36
+
37
+ declare const SSGOI_CONTEXT: InjectionToken<SsgoiContext>;
38
+ declare function injectSsgoi(): SsgoiContext;
39
+
40
+ export { SSGOI_CONTEXT, Ssgoi, SsgoiTransition, injectSsgoi };
@@ -0,0 +1 @@
1
+ export * from '@ssgoi/core';
package/package.json CHANGED
@@ -1,12 +1,29 @@
1
1
  {
2
2
  "name": "@ssgoi/angular",
3
- "version": "7.1.0",
3
+ "version": "7.1.2",
4
4
  "description": "Angular bindings for SSGOI - Native app-like page transitions for Angular applications",
5
5
  "private": false,
6
6
  "type": "module",
7
+ "module": "./dist/fesm2022/ssgoi-angular.mjs",
7
8
  "types": "./dist/index.d.ts",
9
+ "files": [
10
+ "dist"
11
+ ],
12
+ "exports": {
13
+ ".": {
14
+ "types": "./dist/index.d.ts",
15
+ "default": "./dist/fesm2022/ssgoi-angular.mjs"
16
+ },
17
+ "./view-transitions": {
18
+ "types": "./dist/view-transitions/index.d.ts",
19
+ "default": "./dist/fesm2022/ssgoi-angular-view-transitions.mjs"
20
+ },
21
+ "./package.json": {
22
+ "default": "./package.json"
23
+ }
24
+ },
8
25
  "dependencies": {
9
- "@ssgoi/core": "^7.1.0"
26
+ "@ssgoi/core": "^7.1.2"
10
27
  },
11
28
  "peerDependencies": {
12
29
  "@angular/common": "^20.0.0",
package/eslint.config.mjs DELETED
@@ -1,75 +0,0 @@
1
- import tseslint from "@typescript-eslint/eslint-plugin";
2
- import tsparser from "@typescript-eslint/parser";
3
- import angular from "@angular-eslint/eslint-plugin";
4
- import angularTemplate from "@angular-eslint/eslint-plugin-template";
5
- import angularTemplateParser from "@angular-eslint/template-parser";
6
-
7
- export default [
8
- {
9
- ignores: ["dist/**", "node_modules/**", "*.js", "*.mjs"],
10
- },
11
- // TypeScript files
12
- {
13
- files: ["**/*.ts"],
14
- languageOptions: {
15
- parser: tsparser,
16
- parserOptions: {
17
- project: ["./tsconfig.lib.json"],
18
- tsconfigRootDir: import.meta.dirname,
19
- ecmaVersion: 2022,
20
- sourceType: "module",
21
- },
22
- },
23
- plugins: {
24
- "@typescript-eslint": tseslint,
25
- "@angular-eslint": angular,
26
- },
27
- rules: {
28
- // TypeScript recommended rules
29
- "@typescript-eslint/no-explicit-any": "warn",
30
- "@typescript-eslint/no-unused-vars": [
31
- "error",
32
- { argsIgnorePattern: "^_" },
33
- ],
34
- "@typescript-eslint/explicit-function-return-type": "off",
35
- "@typescript-eslint/explicit-module-boundary-types": "off",
36
-
37
- // Angular recommended rules
38
- "@angular-eslint/directive-selector": [
39
- "error",
40
- {
41
- type: "attribute",
42
- prefix: ["ssgoi", "transition"],
43
- style: "camelCase",
44
- },
45
- ],
46
- "@angular-eslint/component-selector": [
47
- "error",
48
- {
49
- type: "element",
50
- prefix: "ssgoi",
51
- style: "kebab-case",
52
- },
53
- ],
54
- "@angular-eslint/no-input-rename": "error",
55
- "@angular-eslint/no-output-rename": "error",
56
- "@angular-eslint/use-lifecycle-interface": "error",
57
- "@angular-eslint/use-pipe-transform-interface": "error",
58
- },
59
- },
60
- // HTML template files
61
- {
62
- files: ["**/*.html"],
63
- languageOptions: {
64
- parser: angularTemplateParser,
65
- },
66
- plugins: {
67
- "@angular-eslint/template": angularTemplate,
68
- },
69
- rules: {
70
- "@angular-eslint/template/no-negated-async": "error",
71
- "@angular-eslint/template/eqeqeq": "error",
72
- "@angular-eslint/template/no-any": "warn",
73
- },
74
- },
75
- ];
package/ng-package.json DELETED
@@ -1,10 +0,0 @@
1
- {
2
- "$schema": "node_modules/ng-packagr/ng-package.schema.json",
3
- "dest": "./dist",
4
- "lib": {
5
- "entryFile": "src/public-api.ts"
6
- },
7
- "allowedNonPeerDependencies": [
8
- "@ssgoi/core"
9
- ]
10
- }
@@ -1,23 +0,0 @@
1
- import { InjectionToken, inject } from "@angular/core";
2
- import type { SsgoiContext } from "@ssgoi/core/types";
3
-
4
- export const SSGOI_CONTEXT = new InjectionToken<SsgoiContext | undefined>(
5
- "ssgoi-context",
6
- );
7
-
8
- const noopContext: SsgoiContext = {
9
- register: () => {},
10
- refFor: () => () => {},
11
- };
12
-
13
- export function injectSsgoi(): SsgoiContext {
14
- const context = inject(SSGOI_CONTEXT, { optional: true });
15
-
16
- if (!context) {
17
- // During SSR or when not wrapped in <ssgoi>, return a no-op context
18
- // This prevents errors during server-side rendering
19
- return noopContext;
20
- }
21
-
22
- return context;
23
- }
package/src/lib/index.ts DELETED
@@ -1,6 +0,0 @@
1
- export { Ssgoi } from "./ssgoi.directive";
2
- /** @deprecated Set `data-ssgoi-transition` directly on an element inside `[ssgoi]` instead. */
3
- export { SsgoiTransition } from "./ssgoi-transition.directive";
4
- export { injectSsgoi, SSGOI_CONTEXT } from "./context";
5
- export * from "./types";
6
- export * from "@ssgoi/core";
@@ -1,50 +0,0 @@
1
- import {
2
- Directive,
3
- input,
4
- OnInit,
5
- AfterViewInit,
6
- ElementRef,
7
- inject,
8
- PLATFORM_ID,
9
- } from "@angular/core";
10
- import { isPlatformBrowser } from "@angular/common";
11
- import { injectSsgoi } from "./context";
12
-
13
- /**
14
- * @deprecated Set `data-ssgoi-transition` directly on the page boundary
15
- * element inside `[ssgoi]` instead.
16
- */
17
- @Directive({
18
- selector: "[ssgoiTransition]",
19
- standalone: true,
20
- })
21
- export class SsgoiTransition implements OnInit, AfterViewInit {
22
- // The directive attribute value becomes the transition ID
23
- readonly ssgoiTransition = input.required<string>();
24
-
25
- private readonly ssgoi = injectSsgoi();
26
- private readonly el = inject(ElementRef<HTMLElement>);
27
- private readonly platformId = inject(PLATFORM_ID);
28
-
29
- ngOnInit(): void {
30
- if (!isPlatformBrowser(this.platformId)) {
31
- return;
32
- }
33
-
34
- // Set data attribute on host element
35
- this.el.nativeElement.setAttribute(
36
- "data-ssgoi-transition",
37
- this.ssgoiTransition(),
38
- );
39
- }
40
-
41
- ngAfterViewInit(): void {
42
- if (!isPlatformBrowser(this.platformId)) {
43
- return;
44
- }
45
-
46
- // Use the host element itself as the transition target
47
- const targetElement = this.el.nativeElement;
48
- this.ssgoi.refFor(this.ssgoiTransition())(targetElement);
49
- }
50
- }
@@ -1,65 +0,0 @@
1
- import {
2
- AfterViewInit,
3
- Directive,
4
- ElementRef,
5
- OnDestroy,
6
- input,
7
- forwardRef,
8
- PLATFORM_ID,
9
- inject,
10
- } from "@angular/core";
11
- import { isPlatformBrowser } from "@angular/common";
12
- import {
13
- createSggoiTransitionContext,
14
- observeSsgoiTransitions,
15
- } from "@ssgoi/core/internal";
16
- import type { HostAnimation } from "@ssgoi/core/internal";
17
- import type { SsgoiConfig, SsgoiContext } from "@ssgoi/core/types";
18
- import { SSGOI_CONTEXT } from "./context";
19
-
20
- function createSsgoiContext(component: Ssgoi): SsgoiContext | undefined {
21
- return component.getContext();
22
- }
23
-
24
- @Directive({
25
- selector: "[ssgoi]",
26
- standalone: true,
27
- providers: [
28
- {
29
- provide: SSGOI_CONTEXT,
30
- useFactory: createSsgoiContext,
31
- deps: [forwardRef(() => Ssgoi)],
32
- },
33
- ],
34
- })
35
- export class Ssgoi implements AfterViewInit, OnDestroy {
36
- readonly config = input<SsgoiConfig>({});
37
- readonly host = input<HostAnimation | undefined>(undefined);
38
-
39
- private readonly el = inject(ElementRef<HTMLElement>);
40
- private readonly platformId = inject(PLATFORM_ID);
41
- private contextValue?: SsgoiContext;
42
- private stopObserving?: () => void;
43
-
44
- getContext(): SsgoiContext | undefined {
45
- if (!isPlatformBrowser(this.platformId)) {
46
- return undefined;
47
- }
48
-
49
- this.contextValue ??= createSggoiTransitionContext(this.config(), {
50
- host: this.host(),
51
- });
52
- return this.contextValue;
53
- }
54
-
55
- ngAfterViewInit(): void {
56
- const ssgoi = this.getContext();
57
- if (!ssgoi) return;
58
-
59
- this.stopObserving = observeSsgoiTransitions(this.el.nativeElement, ssgoi);
60
- }
61
-
62
- ngOnDestroy(): void {
63
- this.stopObserving?.();
64
- }
65
- }
package/src/lib/types.ts DELETED
@@ -1 +0,0 @@
1
- export type * from "@ssgoi/core/types";
package/src/public-api.ts DELETED
@@ -1,6 +0,0 @@
1
- /*
2
- * Public API Surface of @ssgoi/angular
3
- */
4
-
5
- export * from "./lib/index";
6
- export * from "./lib/types";
package/tsconfig.lib.json DELETED
@@ -1,26 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "ES2022",
4
- "module": "ES2022",
5
- "lib": ["ES2022", "DOM"],
6
- "moduleResolution": "node",
7
- "experimentalDecorators": true,
8
- "emitDecoratorMetadata": true,
9
- "skipLibCheck": true,
10
- "strict": true,
11
- "esModuleInterop": true,
12
- "forceConsistentCasingInFileNames": true,
13
- "outDir": "./dist",
14
- "declaration": true,
15
- "declarationMap": true,
16
- "inlineSources": true,
17
- "types": []
18
- },
19
- "exclude": ["src/test.ts", "**/*.spec.ts", "**/*.test.ts"],
20
- "angularCompilerOptions": {
21
- "skipTemplateCodegen": true,
22
- "strictMetadataEmit": true,
23
- "enableResourceInlining": true,
24
- "compilationMode": "partial"
25
- }
26
- }
@@ -1,6 +0,0 @@
1
- {
2
- "$schema": "../../../node_modules/ng-packagr/ng-package.schema.json",
3
- "lib": {
4
- "entryFile": "public-api.ts"
5
- }
6
- }
@@ -1 +0,0 @@
1
- export * from "@ssgoi/core";