@primate/angular 0.3.1 → 0.4.0

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,7 +1,7 @@
1
1
  import { InjectionToken } from "@angular/core";
2
2
  import type Dict from "@rcompat/type/Dict";
3
3
  type RootProps = {
4
- components: any[];
4
+ views: any[];
5
5
  props: Dict[];
6
6
  request: any;
7
7
  update?: () => void;
@@ -11,7 +11,7 @@ export default class Runtime extends FrontendModule {
11
11
  defaultExtensions = [".component.ts"];
12
12
  layouts = true;
13
13
  client = true;
14
- render = async (RootComponent, props) => {
14
+ render = async (view, props) => {
15
15
  const providers = [
16
16
  importProvidersFrom(BrowserModule),
17
17
  provideServerRendering(),
@@ -22,7 +22,7 @@ export default class Runtime extends FrontendModule {
22
22
  useValue: props,
23
23
  },
24
24
  ];
25
- const bootstrap = (context) => bootstrapApplication(RootComponent, { providers }, context);
25
+ const bootstrap = (context) => bootstrapApplication(view, { providers }, context);
26
26
  const html = await renderApplication(bootstrap, {
27
27
  document: `<${root}></${root}>`,
28
28
  });
@@ -3,12 +3,12 @@ import "@angular/compiler";
3
3
  import type ClientData from "@primate/core/client/Data";
4
4
  import type Dict from "@rcompat/type/Dict";
5
5
  type Data = ClientData<{
6
- components: string[];
6
+ views: string[];
7
7
  props: Dict[];
8
8
  }>;
9
9
  export default class AngularClient {
10
10
  #private;
11
- static mount(_component: string, data: ClientData<Data>): Promise<void>;
11
+ static mount(_view: string, data: ClientData<Data>): Promise<void>;
12
12
  }
13
13
  export {};
14
14
  //# sourceMappingURL=index.d.ts.map
@@ -4,10 +4,10 @@ import "@angular/compiler";
4
4
  import { NgZone, provideZoneChangeDetection, } from "@angular/core";
5
5
  import { bootstrapApplication, provideClientHydration, } from "@angular/platform-browser";
6
6
  import spa from "@primate/core/client/spa";
7
- import * as components from "angular:components";
8
7
  import root from "angular:root";
8
+ import * as views from "angular:views";
9
9
  const make_props = (data) => ({
10
- components: data.components.map(name => components[name]),
10
+ views: data.views.map(name => views[name]),
11
11
  props: data.props,
12
12
  request: {
13
13
  ...data.request,
@@ -19,7 +19,7 @@ export default class AngularClient {
19
19
  static #app;
20
20
  static #root;
21
21
  static #zone;
22
- static async mount(_component, data) {
22
+ static async mount(_view, data) {
23
23
  const providers = [];
24
24
  // Add hydration provider for SSR
25
25
  if (data.ssr) {
@@ -27,7 +27,7 @@ export default class AngularClient {
27
27
  }
28
28
  // Add zone.js change detection
29
29
  providers.push(provideZoneChangeDetection({ eventCoalescing: true }));
30
- // Create the root component props
30
+ // Create the root view props
31
31
  const props = make_props(data);
32
32
  // Bootstrap the application
33
33
  try {
@@ -44,7 +44,7 @@ ${i18n_imports}
44
44
 
45
45
  type Dict = Record<string, any>;
46
46
  type RootProps = {
47
- components: any[];
47
+ views: any[];
48
48
  props: Dict[];
49
49
  request: any;
50
50
  update?: () => void
@@ -77,11 +77,11 @@ export default class RootComponent implements OnDestroy {
77
77
  get p(): RootProps { return this.#p; }
78
78
  get P(): RootProps { return this.#p; }
79
79
 
80
- // is there a component at index i?
81
- has(i: number) { return !!this.P?.components?.[i]; }
80
+ // is there a view at index i?
81
+ has(i: number) { return !!this.P?.views?.[i]; }
82
82
 
83
- // component type for index i
84
- comp(i: number) { return this.P?.components?.[i]; }
83
+ // view type for index i
84
+ comp(i: number) { return this.P?.views?.[i]; }
85
85
 
86
86
  // per-layer inputs without slot
87
87
  inputs(i: number) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@primate/angular",
3
- "version": "0.3.1",
3
+ "version": "0.4.0",
4
4
  "description": "Primate Angular frontend",
5
5
  "homepage": "https://primate.run/docs/frontend/angular",
6
6
  "bugs": "https://github.com/primate-run/primate/issues",
@@ -29,10 +29,10 @@
29
29
  "@rcompat/record": "^0.9.1",
30
30
  "typescript": "^5.9.2",
31
31
  "zone.js": "^0.15.1",
32
- "@primate/core": "^0.2.1"
32
+ "@primate/core": "^0.3.0"
33
33
  },
34
34
  "peerDependencies": {
35
- "primate": "^0.33.1"
35
+ "primate": "^0.34.0"
36
36
  },
37
37
  "type": "module",
38
38
  "imports": {