@primate/angular 0.10.1 → 0.10.3

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.
@@ -1,5 +1,6 @@
1
1
  import "#client/AAA";
2
2
  import root from "#client/root";
3
+ import request from "#request/store";
3
4
  import INITIAL_PROPS from "#INITIAL_PROPS";
4
5
  import { enableProdMode } from "@angular/core";
5
6
  import { bootstrapApplication, provideClientHydration, } from "@angular/platform-browser";
@@ -38,6 +39,9 @@ export default class AngularApp {
38
39
  this.#root.instance.p = root.toProps(next, update);
39
40
  this.#app.tick();
40
41
  update?.();
42
+ }, (url, query) => {
43
+ request.update(value => ({ ...value, query, url }));
44
+ this.#app.tick();
41
45
  });
42
46
  if (document.readyState === "loading") {
43
47
  window.addEventListener("DOMContentLoaded", start, { once: true });
@@ -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.1",
3
+ "version": "0.10.3",
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.7"
27
+ "@primate/core": "^0.9.28",
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
  "#*": {