@blotch/angular-lynx 22.2.2 → 22.2.4
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/README.md +47 -23
- package/fesm2022/blotch-angular-lynx-web-glass-ciDHw7Bw.mjs +961 -0
- package/fesm2022/blotch-angular-lynx-web-glass-ciDHw7Bw.mjs.map +1 -0
- package/fesm2022/blotch-angular-lynx.mjs +2426 -831
- package/fesm2022/blotch-angular-lynx.mjs.map +1 -1
- package/package.json +1 -1
- package/schematics/add-i18n/index.js +24 -7
- package/schematics/add-tailwind/index.js +14 -75
- package/schematics/add-tailwind/schema.json +6 -1
- package/schematics/collection.json +1 -1
- package/schematics/migrations/accessibility-traits/index.js +56 -0
- package/schematics/migrations/dev-logs-gitignore/index.js +9 -0
- package/schematics/migrations/extract-i18n-target/index.js +31 -0
- package/schematics/migrations/tailwind-html-templates/index.js +44 -0
- package/schematics/migrations.json +22 -1
- package/schematics/ng-add/index.js +20 -66
- package/schematics/ng-add/schema.json +7 -2
- package/schematics/ng-add/versions.js +8 -2
- package/schematics/utility/dev-logs-gitignore.js +25 -0
- package/schematics/utility/extract-i18n-target.js +58 -0
- package/schematics/utility/tailwind.js +167 -0
- package/types/blotch-angular-lynx.d.ts +950 -350
package/README.md
CHANGED
|
@@ -20,18 +20,44 @@ Then work as in any Angular app: `ng serve`, `ng build`, `ng test`, and `ng gene
|
|
|
20
20
|
|
|
21
21
|
- Standalone components with signals, `@if`/`@for`/`@switch`, DI, and pipes
|
|
22
22
|
- Zoneless change detection — signals as the primary reactivity model
|
|
23
|
-
- Full Angular Router with in-memory navigation for Lynx
|
|
23
|
+
- Full Angular Router with in-memory navigation for Lynx, including `routerLink` and `routerLinkActive` on any element
|
|
24
24
|
- Gestures — tap, pan, long-press, fling, pinch, rotation with composition
|
|
25
25
|
- Animations — CSS transitions, keyframes, and programmatic `animate()` API
|
|
26
26
|
- Content projection, portals, `@defer`, and lazy-loaded routes
|
|
27
|
-
- Tailwind CSS
|
|
27
|
+
- Tailwind CSS 4, with the build rewriting its CSS for Lynx (or Tailwind CSS 3 with `@lynx-js/tailwind-preset`)
|
|
28
28
|
|
|
29
29
|
## Documentation
|
|
30
30
|
|
|
31
|
-
Full docs and guides at [angularlynx.
|
|
31
|
+
Full docs and guides at [angularlynx.js.org](https://angularlynx.js.org).
|
|
32
32
|
|
|
33
33
|
---
|
|
34
34
|
|
|
35
|
+
## Routing
|
|
36
|
+
|
|
37
|
+
`provideRouter()` from `@blotch/angular-lynx` sets up Angular's Router with in-memory history. Everything else comes from `@angular/router`, as on the web, `routerLink` and `routerLinkActive` included:
|
|
38
|
+
|
|
39
|
+
```typescript
|
|
40
|
+
import { Component } from '@angular/core';
|
|
41
|
+
import { RouterLink, RouterLinkActive, RouterOutlet } from '@angular/router';
|
|
42
|
+
import { LYNX_ELEMENTS } from '@blotch/angular-lynx';
|
|
43
|
+
|
|
44
|
+
@Component({
|
|
45
|
+
selector: 'app-root',
|
|
46
|
+
imports: [LYNX_ELEMENTS, RouterOutlet, RouterLink, RouterLinkActive],
|
|
47
|
+
template: `
|
|
48
|
+
<view routerLink="/settings" routerLinkActive="active">
|
|
49
|
+
<text>Settings</text>
|
|
50
|
+
</view>
|
|
51
|
+
<router-outlet />
|
|
52
|
+
`,
|
|
53
|
+
})
|
|
54
|
+
export class App {}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
- A tap on the element navigates: the renderer delivers Lynx's `tap` to `click` listeners, as Lynx for Web does, and `RouterLink` listens for `click`.
|
|
58
|
+
- While the link's route is active, `routerLinkActive` adds its classes and `LYNX_ELEMENTS` adds `selected` to the element's `accessibility-traits`, keeping its own (`LynxRouterLinkActive`). On a component's host, list `LynxRouterLinkActive` in `hostDirectives` next to `RouterLinkActive`.
|
|
59
|
+
- Event handlers can navigate directly, with `Router.navigate()` or `Location.back()`.
|
|
60
|
+
|
|
35
61
|
## Animation API
|
|
36
62
|
|
|
37
63
|
Three animation approaches are available, all running natively on the Lynx engine.
|
|
@@ -103,25 +129,23 @@ export class ExampleComponent {
|
|
|
103
129
|
#animation: LynxAnimation | null = null;
|
|
104
130
|
|
|
105
131
|
runAnimation(): void {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
);
|
|
124
|
-
}, 0);
|
|
132
|
+
const el = this.boxRef();
|
|
133
|
+
if (!el) return;
|
|
134
|
+
|
|
135
|
+
// Cancel previous animation before starting a new one.
|
|
136
|
+
this.#animation?.cancel();
|
|
137
|
+
|
|
138
|
+
this.#animation = el.nativeElement.animate(
|
|
139
|
+
[
|
|
140
|
+
{ transform: 'scale(1)', opacity: 1 },
|
|
141
|
+
{ transform: 'scale(1.3)', opacity: 0.7 },
|
|
142
|
+
{ transform: 'scale(1)', opacity: 1 },
|
|
143
|
+
],
|
|
144
|
+
{
|
|
145
|
+
duration: 600,
|
|
146
|
+
easing: 'ease-in-out',
|
|
147
|
+
},
|
|
148
|
+
);
|
|
125
149
|
}
|
|
126
150
|
}
|
|
127
151
|
```
|
|
@@ -181,4 +205,4 @@ Available events: `animationstart`, `animationend`, `animationcancel`, `animatio
|
|
|
181
205
|
#### Important Notes
|
|
182
206
|
|
|
183
207
|
- The `animate()` API is **main-thread only**. Calling it on the background thread throws an error.
|
|
184
|
-
-
|
|
208
|
+
- Call `animate()` straight from an event handler; it doesn't need a `setTimeout`.
|