@ethlete/core 5.0.0-next.6 → 5.0.0-next.61

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.
Files changed (35) hide show
  1. package/CHANGELOG.md +714 -0
  2. package/README.md +28 -4
  3. package/fesm2022/ethlete-core.mjs +8061 -3502
  4. package/fesm2022/ethlete-core.mjs.map +1 -1
  5. package/generators/devtools-about/generator.js +122 -0
  6. package/generators/devtools-about/schema.json +25 -0
  7. package/generators/generators.json +26 -5
  8. package/generators/migrate-provider-shape/migration-scope.js +35 -0
  9. package/generators/migrate-provider-shape/migration.js +50 -0
  10. package/generators/migrate-provider-shape/provider-shape.js +284 -0
  11. package/generators/migrate-provider-shape/schema.json +26 -0
  12. package/generators/migrate-surface-interaction-swatch/interaction-swatch.js +63 -0
  13. package/generators/migrate-surface-interaction-swatch/migration.js +36 -0
  14. package/generators/migrate-surface-interaction-swatch/schema.json +26 -0
  15. package/generators/migrate-to-v5/apply-replacements.js +14 -0
  16. package/generators/migrate-to-v5/color-naming.js +124 -0
  17. package/generators/migrate-to-v5/create-provider.js +67 -55
  18. package/generators/migrate-to-v5/migration-files.js +13 -0
  19. package/generators/migrate-to-v5/migration.js +33 -19
  20. package/generators/migrate-to-v5/removed-exports.js +73 -0
  21. package/generators/migrate-to-v5/router-state-service.js +123 -330
  22. package/generators/migrate-to-v5/schema.json +22 -0
  23. package/generators/migrate-to-v5/service-classes.js +108 -0
  24. package/generators/migrate-to-v5/viewport-service.js +224 -491
  25. package/generators/tailwind-4-color-theme/generator.js +594 -0
  26. package/generators/tailwind-4-color-theme/schema.json +44 -0
  27. package/generators/tailwind-4-surface-theme/generator.js +599 -0
  28. package/generators/tailwind-4-surface-theme/schema.json +48 -0
  29. package/migrations/seo-directive-removed.md +80 -0
  30. package/migrations/surface-theme-regenerate.md +20 -0
  31. package/migrations.json +43 -0
  32. package/package.json +25 -14
  33. package/types/ethlete-core.d.ts +3337 -1775
  34. package/generators/tailwind-4-theme/generator.js +0 -490
  35. package/generators/tailwind-4-theme/schema.json +0 -32
@@ -0,0 +1,80 @@
1
+ # Replace `SeoDirective` with the `apply*Binding` functions
2
+
3
+ `SeoDirective` and its `SeoConfig` types were removed in `@ethlete/core` v5. The directive wrote to
4
+ `document` directly, so it never worked under server rendering, and it held one config object per
5
+ component, so a child route could only override a parent by re-declaring the whole config.
6
+
7
+ No codemod can do this rewrite: an Observable value becomes a signal, and one config key becomes one
8
+ function call. Both are decisions about the call site.
9
+
10
+ ## What to change
11
+
12
+ 1. Find every component that injects `SeoDirective` or lists it in `hostDirectives` or `imports`.
13
+ 2. Remove the directive from the component.
14
+ 3. Replace the `updateConfig({ … })` call with one `apply*Binding` call per key it set.
15
+ 4. Turn an Observable value into a signal: `toSignal()` at the edge of the component, or a
16
+ `computed()` over a signal that is already there.
17
+ 5. Import each `apply*Binding` function from `@ethlete/core`.
18
+
19
+ ## The replacement for each key
20
+
21
+ | `SeoConfig` key | Replacement |
22
+ | ---------------------------- | ------------------------------------------------------------- |
23
+ | `title` | `applyHeadTitleBinding` |
24
+ | `description` | `applyDescriptionBinding` |
25
+ | `keywords` | `applyKeywordsBinding` |
26
+ | `robots` | `applyRobotsBinding` (takes a directive object, not a string) |
27
+ | `icon` | `applyLinkBinding({ rel: 'icon', href })` |
28
+ | `themeColor` / `colorScheme` | `applyMetaBinding({ name: 'theme-color' \| 'color-scheme' })` |
29
+ | `canonical` | `applyCanonicalBinding` |
30
+ | `alternate` | `applyAlternateBinding` / `applyAlternateLanguagesBindings` |
31
+ | `og` | `applyOpenGraphBindings` |
32
+ | `twitter` | `applyTwitterCardBindings` |
33
+ | `facebook` | `applyOpenGraphBindings` (Facebook reads Open Graph) |
34
+ | any other key | `applyMetaBinding({ name, content })` |
35
+
36
+ ## Example
37
+
38
+ ```ts
39
+ // before
40
+ @Component({ hostDirectives: [SeoDirective] })
41
+ export class ArticleComponent {
42
+ private seo = inject(SeoDirective);
43
+
44
+ constructor() {
45
+ this.seo.updateConfig({
46
+ title: this.article$.pipe(map((a) => a.title)),
47
+ description: 'A brief description',
48
+ canonical: 'https://example.com/article',
49
+ og: { image: 'https://example.com/image.jpg' },
50
+ });
51
+ }
52
+ }
53
+
54
+ // after
55
+ @Component({})
56
+ export class ArticleComponent {
57
+ private article = toSignal(this.article$);
58
+
59
+ constructor() {
60
+ applyHeadTitleBinding(computed(() => this.article()?.title ?? ''));
61
+ applyDescriptionBinding('A brief description');
62
+ applyCanonicalBinding('https://example.com/article');
63
+ applyOpenGraphBindings({ images: ['https://example.com/image.jpg'] });
64
+ }
65
+ }
66
+ ```
67
+
68
+ ## Two things to watch
69
+
70
+ - A child component no longer re-declares its parent's config to override one key. Title parts
71
+ compose through the title store, and duplicate meta and link tags are deduplicated by selector.
72
+ Delete a re-declaration instead of porting it.
73
+ - `robots` took a string and now takes a directive object, for example `{ index: true, follow: true }`.
74
+
75
+ ## When you are done
76
+
77
+ Nothing may import `SeoDirective` or `SeoConfig` any more. Run the type check and the lint task of
78
+ every project you changed.
79
+
80
+ The full guide, with every binding and its options, is at <https://ethlete-sdk-docs.web.app/core/seo>.
@@ -0,0 +1,20 @@
1
+ # Regenerate the surface theme after the swatch change
2
+
3
+ `SurfaceTheme['interactionColor']` is a swatch now: `{ color, onColor, inkColor }` instead of a single
4
+ colour. `nx g @ethlete/core:migrate-surface-interaction-swatch` rewrites the theme definitions, but the
5
+ generated stylesheet still holds the CSS variables of the old shape.
6
+
7
+ Regenerate it with the same command that created it, in each app that has a surface theme:
8
+
9
+ ```bash
10
+ nx g @ethlete/core:tailwind-4-surface-theme
11
+ ```
12
+
13
+ The generator asks for the same answers as the first time. It overwrites the generated stylesheet, so
14
+ check the diff: a hand-written override inside the generated file is lost.
15
+
16
+ `onColor` and `inkColor` carry the two foreground colours an interaction surface needs. The codemod
17
+ fills them from the old single colour, which keeps the rendering identical but is rarely the design
18
+ intent. Read the swatch through with the designer once, then correct the values.
19
+
20
+ The theming guide is at <https://ethlete-sdk-docs.web.app/core/theming>.
@@ -0,0 +1,43 @@
1
+ {
2
+ "migrations": [
3
+ {
4
+ "name": "to-v5",
5
+ "version": "5.0.0-beta.11",
6
+ "kind": "auto",
7
+ "description": "Rewrite the v4 core API into its v5 shape.",
8
+ "generator": "@ethlete/core:migrate-to-v5"
9
+ },
10
+ {
11
+ "name": "provider-shape",
12
+ "version": "5.0.0-next.37",
13
+ "kind": "auto",
14
+ "description": "Rewrite destructured provider tuples into the tree-shakeable definition shape.",
15
+ "generator": "@ethlete/core:migrate-provider-shape",
16
+ "docs": "/core/providers"
17
+ },
18
+ {
19
+ "name": "seo-directive-removed",
20
+ "version": "5.0.0-next.41",
21
+ "kind": "assisted",
22
+ "description": "SeoDirective and SeoConfig are gone. Every call site moves to the apply*Binding function for its key.",
23
+ "instructions": "./migrations/seo-directive-removed.md",
24
+ "docs": "/core/seo"
25
+ },
26
+ {
27
+ "name": "surface-interaction-swatch",
28
+ "version": "5.0.0-next.46",
29
+ "kind": "auto",
30
+ "description": "Rewrite surface theme interactionColor maps into the { color, onColor, inkColor } swatch shape.",
31
+ "generator": "@ethlete/core:migrate-surface-interaction-swatch",
32
+ "docs": "/core/theming"
33
+ },
34
+ {
35
+ "name": "surface-theme-regenerate",
36
+ "version": "5.0.0-next.46",
37
+ "kind": "manual",
38
+ "description": "Regenerate the surface theme stylesheet, so the new swatch reaches the CSS variables.",
39
+ "instructions": "./migrations/surface-theme-regenerate.md",
40
+ "docs": "/core/theming"
41
+ }
42
+ ]
43
+ }
package/package.json CHANGED
@@ -1,24 +1,34 @@
1
1
  {
2
2
  "name": "@ethlete/core",
3
- "version": "5.0.0-next.6",
3
+ "version": "5.0.0-next.61",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "peerDependencies": {
7
- "@analogjs/vite-plugin-angular": "2.3.1",
8
- "@angular/cdk": "21.2.1",
9
- "@angular/common": "21.2.1",
10
- "@angular/core": "21.2.1",
11
- "@angular/forms": "21.2.1",
12
- "@angular/platform-browser": "21.2.1",
13
- "@angular/router": "21.2.1",
14
- "@ethlete/types": "^2.0.0-next.0",
15
- "@floating-ui/dom": "1.7.6",
16
- "@nx/devkit": "22.5.4",
17
- "@nx/vite": "22.5.4",
7
+ "@angular/common": "22.1.6",
8
+ "@angular/core": "22.1.6",
9
+ "@angular/forms": "22.1.6",
10
+ "@angular/platform-browser": "22.1.6",
11
+ "@angular/router": "22.1.6",
12
+ "@ethlete/types": "^2.0.0-beta.4",
13
+ "@floating-ui/dom": "1.8.0",
14
+ "@nx/devkit": "23.1.0",
18
15
  "rxjs": "7.8.2",
19
16
  "ts-morph": "21.0.1",
20
- "typescript": "5.9.3",
21
- "vite": "^7.0.0"
17
+ "typescript": "6.0.3"
18
+ },
19
+ "peerDependenciesMeta": {
20
+ "@nx/devkit": {
21
+ "optional": true
22
+ },
23
+ "ts-morph": {
24
+ "optional": true
25
+ },
26
+ "typescript": {
27
+ "optional": true
28
+ }
29
+ },
30
+ "ethlete": {
31
+ "migrations": "./migrations.json"
22
32
  },
23
33
  "generators": "./generators/generators.json",
24
34
  "module": "fesm2022/ethlete-core.mjs",
@@ -32,6 +42,7 @@
32
42
  "default": "./fesm2022/ethlete-core.mjs"
33
43
  }
34
44
  },
45
+ "type": "module",
35
46
  "dependencies": {
36
47
  "tslib": "^2.3.0"
37
48
  }