@primate/angular 0.10.0 → 0.10.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.
@@ -34,7 +34,7 @@ export default class AngularApp {
34
34
  this.#root.instance.p = props;
35
35
  this.#app.tick();
36
36
  if (data.csr) {
37
- const start = () => client.boot((next, update) => {
37
+ const start = () => client.boot("angular", (next, update) => {
38
38
  this.#root.instance.p = root.toProps(next, update);
39
39
  this.#app.tick();
40
40
  update?.();
@@ -3,15 +3,20 @@ export default (depth) => {
3
3
  const n = depth;
4
4
  const layer = (i, child) => {
5
5
  const slot = `slot_${i}`;
6
- const childTemplate = child
7
- ? `<ng-template #${slot}>${child}</ng-template>`
8
- : "";
9
- const inputs = child
10
- ? `(has(${i + 1}) ? slotInputs(${i}, ${slot}) : inputs(${i}))`
11
- : `inputs(${i})`;
12
- return `${childTemplate}
13
- <ng-container *ngComponentOutlet="comp(${i}); inputs: ${inputs}">
6
+ const leaf = `@for (key of pageKey(); track key) {
7
+ <ng-container *ngComponentOutlet="comp(${i}); inputs: inputs(${i})">
14
8
  </ng-container>
9
+ }`;
10
+ if (child === null)
11
+ return leaf;
12
+ return `<ng-template #${slot}>${child}</ng-template>
13
+ @if (has(${i + 1})) {
14
+ <ng-container
15
+ *ngComponentOutlet="comp(${i}); inputs: slotInputs(${i}, ${slot})"
16
+ ></ng-container>
17
+ } @else {
18
+ ${leaf}
19
+ }
15
20
  `;
16
21
  };
17
22
  let body = layer(n, null);
@@ -75,6 +80,11 @@ export default class RootComponent {
75
80
  return (this.P?.props?.[i] ?? {}) as Dict;
76
81
  }
77
82
 
83
+ pageKey() {
84
+ const { pathname, search } = this.P.request.url;
85
+ return [pathname + search];
86
+ }
87
+
78
88
  slotInputs(i: number, slot: TemplateRef<unknown>) {
79
89
  const base = (this.P?.props?.[i] ?? {}) as Dict;
80
90
  return { ...base, slot };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@primate/angular",
3
- "version": "0.10.0",
3
+ "version": "0.10.2",
4
4
  "description": "Angular for Primate",
5
5
  "homepage": "https://primate.run/docs/frontend/angular",
6
6
  "bugs": "https://github.com/primate-run/primate/issues",
@@ -24,14 +24,14 @@
24
24
  "@angular/platform-browser": "^22.0.6",
25
25
  "@angular/platform-server": "^22.0.6",
26
26
  "@angular/ssr": "^22.0.4",
27
- "typescript": "npm:@typescript/typescript6@^6.0.2",
28
- "@primate/core": "^0.9.0"
27
+ "@primate/core": "^0.9.20",
28
+ "typescript": "npm:@typescript/typescript6@^6.0.2"
29
29
  },
30
30
  "devDependencies": {
31
31
  "@rcompat/type": "^0.18.0"
32
32
  },
33
33
  "peerDependencies": {
34
- "primate": "^0.40.0"
34
+ "primate": "^0.40.1"
35
35
  },
36
36
  "imports": {
37
37
  "#*": {