-
-
Notifications
You must be signed in to change notification settings - Fork 258
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1531 from analogjs/beta
chore: release 1.11.0
- Loading branch information
Showing
52 changed files
with
1,470 additions
and
429 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,10 @@ | ||
import { mergeApplicationConfig, ApplicationConfig } from '@angular/core'; | ||
import { | ||
provideServerRendering, | ||
ɵSERVER_CONTEXT as SERVER_CONTEXT, | ||
} from '@angular/platform-server'; | ||
import { provideServerRendering } from '@angular/platform-server'; | ||
|
||
import { appConfig } from './app.config'; | ||
|
||
const serverConfig: ApplicationConfig = { | ||
providers: [ | ||
provideServerRendering(), | ||
{ provide: SERVER_CONTEXT, useValue: 'ssr-analog' }, | ||
], | ||
providers: [provideServerRendering()], | ||
}; | ||
|
||
export const config = mergeApplicationConfig(appConfig, serverConfig); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { ChangeDetectionStrategy, Component, signal } from '@angular/core'; | ||
import { ServerOnly } from '@analogjs/router'; | ||
|
||
@Component({ | ||
standalone: true, | ||
imports: [ServerOnly], | ||
changeDetection: ChangeDetectionStrategy.OnPush, | ||
template: ` | ||
<h2>Client Component</h2> | ||
<ServerOnly component="hello" [props]="props()" (outputs)="log($event)" /> | ||
<ServerOnly component="hello" [props]="props2()" (outputs)="log($event)" /> | ||
<p> | ||
<button (click)="update()">Update</button> | ||
</p> | ||
`, | ||
}) | ||
export default class ClientComponent { | ||
props = signal({ name: 'Brandon', count: 0 }); | ||
props2 = signal({ name: 'Brandon', count: 4 }); | ||
|
||
update() { | ||
this.props.update((data) => ({ ...data, count: ++data.count })); | ||
} | ||
|
||
log($event: object) { | ||
console.log({ outputs: $event }); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<script lang="ts"> | ||
import { ServerOnly } from '@analogjs/router' with { analog: 'imports' }; | ||
</script> | ||
|
||
<template> | ||
Goodbye on the client | ||
|
||
<ServerOnly component="goodbye" /> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { RouteMeta } from '@analogjs/router'; | ||
|
||
import { ServerOnly } from '@analogjs/router'; | ||
|
||
export const routeMeta: RouteMeta = { | ||
data: { | ||
component: 'hello', | ||
}, | ||
}; | ||
|
||
export default ServerOnly; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,8 @@ | ||
import 'zone.js/node'; | ||
import { enableProdMode } from '@angular/core'; | ||
import { bootstrapApplication } from '@angular/platform-browser'; | ||
import { renderApplication } from '@angular/platform-server'; | ||
import { provideServerContext } from '@analogjs/router/server'; | ||
import type { ServerContext } from '@analogjs/router/tokens'; | ||
import '@angular/platform-server/init'; | ||
import { render } from '@analogjs/router/server'; | ||
|
||
import { config } from './app/app.config.server'; | ||
import { AppComponent } from './app/app.component'; | ||
|
||
if (import.meta.env.PROD) { | ||
enableProdMode(); | ||
} | ||
|
||
export function bootstrap() { | ||
return bootstrapApplication(AppComponent, config); | ||
} | ||
|
||
export default async function render( | ||
url: string, | ||
document: string, | ||
serverContext: ServerContext | ||
) { | ||
const html = await renderApplication(bootstrap, { | ||
document, | ||
url, | ||
platformProviders: [provideServerContext(serverContext)], | ||
}); | ||
|
||
return html; | ||
} | ||
export default render(AppComponent, config); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<template> | ||
Goodbye from the server | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { ChangeDetectionStrategy, Component, computed } from '@angular/core'; | ||
|
||
import { | ||
injectStaticOutputs, | ||
injectStaticProps, | ||
} from '@analogjs/router/server'; | ||
|
||
@Component({ | ||
selector: 'app-hello', | ||
standalone: true, | ||
changeDetection: ChangeDetectionStrategy.OnPush, | ||
template: ` | ||
<h3>Hello From the Server</h3> | ||
<p>Props: {{ json() }}</p> | ||
<p>Time: {{ Date.now().toString() }}</p> | ||
`, | ||
styles: ` | ||
h3 { | ||
color: blue; | ||
} | ||
`, | ||
}) | ||
export default class HelloComponent { | ||
Date = Date; | ||
props = injectStaticProps(); | ||
outputs = injectStaticOutputs<{ loaded: boolean }>(); | ||
json = computed(() => JSON.stringify(this.props)); | ||
|
||
ngOnInit() { | ||
this.outputs.set({ loaded: true }); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,8 @@ | ||
import 'zone.js/node'; | ||
import { enableProdMode } from '@angular/core'; | ||
import { bootstrapApplication } from '@angular/platform-browser'; | ||
import { renderApplication } from '@angular/platform-server'; | ||
import { provideServerContext } from '@analogjs/router/server'; | ||
import { ServerContext } from '@analogjs/router/tokens'; | ||
import '@angular/platform-server/init'; | ||
import { render } from '@analogjs/router/server'; | ||
|
||
import { config } from './app/app.config.server'; | ||
import { AppComponent } from './app/app.component'; | ||
|
||
if (import.meta.env.PROD) { | ||
enableProdMode(); | ||
} | ||
|
||
export function bootstrap() { | ||
return bootstrapApplication(AppComponent, config); | ||
} | ||
|
||
export default async function render( | ||
url: string, | ||
document: string, | ||
serverContext: ServerContext | ||
) { | ||
const html = await renderApplication(bootstrap, { | ||
document, | ||
url, | ||
platformProviders: [provideServerContext(serverContext)], | ||
}); | ||
|
||
return html; | ||
} | ||
export default render(AppComponent, config); |
Oops, something went wrong.