@analogjs/platform 0.2.0-beta.9 → 0.2.0-rc.1
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.
- package/migrations/migration.json +4 -0
- package/package.json +4 -4
- package/src/lib/clear-client-page-endpoint.d.ts +2 -0
- package/src/lib/clear-client-page-endpoint.js +37 -0
- package/src/lib/content-plugin.d.ts +0 -10
- package/src/lib/content-plugin.js +26 -43
- package/src/lib/nx-plugin/generators.json +16 -3
- package/src/lib/nx-plugin/package.json +5 -5
- package/src/lib/nx-plugin/src/generators/app/files/index-page/src/app/pages/(home).page.ts__template__ +14 -0
- package/src/lib/nx-plugin/src/generators/app/files/template-angular-v15/src/main.ts__template__ +2 -2
- package/src/lib/nx-plugin/src/generators/app/files/template-angular-v15/vite.config.ts__template__ +0 -2
- package/src/lib/nx-plugin/src/generators/app/files/template-angular-v16/src/{app.config.ts__template__ → app/app.config.ts__template__} +4 -2
- package/src/lib/nx-plugin/src/generators/app/files/template-angular-v16/src/main.server.ts__template__ +3 -2
- package/src/lib/nx-plugin/src/generators/app/files/template-angular-v16/src/main.ts__template__ +1 -1
- package/src/lib/nx-plugin/src/generators/app/files/template-angular-v16/vite.config.ts__template__ +1 -31
- package/src/lib/nx-plugin/src/generators/app/files/{tRPC → trpc}/src/server/trpc/routers/notes.ts__template__ +2 -2
- package/src/lib/nx-plugin/src/generators/app/files/{tRPC → trpc}/src/trpc-client.ts__template__ +3 -3
- package/src/lib/nx-plugin/src/generators/app/files/welcome-components/css/src/app/pages/analog-welcome.component.ts__template__ +264 -0
- package/src/lib/nx-plugin/src/generators/app/files/welcome-components/css-trpc/src/app/pages/analog-welcome.component.ts__template__ +439 -0
- package/src/lib/nx-plugin/src/generators/app/files/welcome-components/tailwind/src/app/pages/analog-welcome.component.ts__template__ +76 -0
- package/src/lib/nx-plugin/src/generators/app/files/welcome-components/tailwind-trpc/src/app/pages/analog-welcome.component.ts__template__ +162 -0
- package/src/lib/nx-plugin/src/generators/app/generator.js +16 -6
- package/src/lib/nx-plugin/src/generators/app/generator.js.map +1 -1
- package/src/lib/nx-plugin/src/generators/app/lib/add-analog-dependencies.d.ts +2 -2
- package/src/lib/nx-plugin/src/generators/app/lib/add-analog-dependencies.js +9 -27
- package/src/lib/nx-plugin/src/generators/app/lib/add-analog-dependencies.js.map +1 -1
- package/src/lib/nx-plugin/src/generators/app/lib/add-analog-project-config.js +0 -10
- package/src/lib/nx-plugin/src/generators/app/lib/add-analog-project-config.js.map +1 -1
- package/src/lib/nx-plugin/src/generators/app/lib/add-eslint.d.ts +3 -0
- package/src/lib/nx-plugin/src/generators/app/lib/add-eslint.js +29 -0
- package/src/lib/nx-plugin/src/generators/app/lib/add-eslint.js.map +1 -0
- package/src/lib/nx-plugin/src/generators/app/lib/add-files.d.ts +1 -1
- package/src/lib/nx-plugin/src/generators/app/lib/add-files.js +1 -1
- package/src/lib/nx-plugin/src/generators/app/lib/add-files.js.map +1 -1
- package/src/lib/nx-plugin/src/generators/app/lib/add-home-page.d.ts +3 -0
- package/src/lib/nx-plugin/src/generators/app/lib/add-home-page.js +16 -0
- package/src/lib/nx-plugin/src/generators/app/lib/add-home-page.js.map +1 -0
- package/src/lib/nx-plugin/src/generators/app/lib/add-tailwind-config.d.ts +1 -1
- package/src/lib/nx-plugin/src/generators/app/lib/add-tailwind-config.js +5 -2
- package/src/lib/nx-plugin/src/generators/app/lib/add-tailwind-config.js.map +1 -1
- package/src/lib/nx-plugin/src/generators/app/lib/add-trpc.d.ts +2 -2
- package/src/lib/nx-plugin/src/generators/app/lib/add-trpc.js +7 -15
- package/src/lib/nx-plugin/src/generators/app/lib/add-trpc.js.map +1 -1
- package/src/lib/nx-plugin/src/generators/app/lib/initialize-analog-workspace.js +58 -44
- package/src/lib/nx-plugin/src/generators/app/lib/initialize-analog-workspace.js.map +1 -1
- package/src/lib/nx-plugin/src/generators/app/schema.d.ts +1 -1
- package/src/lib/nx-plugin/src/generators/app/schema.json +2 -2
- package/src/lib/nx-plugin/src/generators/app/versions/README.md +30 -0
- package/src/lib/nx-plugin/src/generators/app/versions/dependencies.d.ts +9 -0
- package/src/lib/nx-plugin/src/generators/app/versions/dependencies.js +54 -0
- package/src/lib/nx-plugin/src/generators/app/versions/dependencies.js.map +1 -0
- package/src/lib/nx-plugin/src/generators/app/versions/dev-dependencies.d.ts +4 -0
- package/src/lib/nx-plugin/src/generators/app/versions/dev-dependencies.js +75 -0
- package/src/lib/nx-plugin/src/generators/app/versions/dev-dependencies.js.map +1 -0
- package/src/lib/nx-plugin/src/generators/app/versions/minimum-supported-versions.d.ts +6 -0
- package/src/lib/nx-plugin/src/generators/app/versions/minimum-supported-versions.js +14 -0
- package/src/lib/nx-plugin/src/generators/app/versions/minimum-supported-versions.js.map +1 -0
- package/src/lib/nx-plugin/src/generators/app/versions/nx-dependencies.d.ts +7 -0
- package/src/lib/nx-plugin/src/generators/app/versions/nx-dependencies.js +54 -0
- package/src/lib/nx-plugin/src/generators/app/versions/nx-dependencies.js.map +1 -0
- package/src/lib/nx-plugin/src/generators/app/versions/nx_15_X/versions.d.ts +26 -0
- package/src/lib/nx-plugin/src/generators/app/versions/nx_15_X/versions.js +33 -0
- package/src/lib/nx-plugin/src/generators/app/versions/nx_15_X/versions.js.map +1 -0
- package/src/lib/nx-plugin/src/generators/app/versions/nx_16_X/versions.d.ts +24 -0
- package/src/lib/nx-plugin/src/generators/app/versions/nx_16_X/versions.js +31 -0
- package/src/lib/nx-plugin/src/generators/app/versions/nx_16_X/versions.js.map +1 -0
- package/src/lib/nx-plugin/src/generators/app/versions/trpc-dependencies.d.ts +4 -0
- package/src/lib/nx-plugin/src/generators/app/versions/trpc-dependencies.js +44 -0
- package/src/lib/nx-plugin/src/generators/app/versions/trpc-dependencies.js.map +1 -0
- package/src/lib/nx-plugin/src/generators/app/versions.d.ts +14 -12
- package/src/lib/nx-plugin/src/generators/app/versions.js +15 -13
- package/src/lib/nx-plugin/src/generators/app/versions.js.map +1 -1
- package/src/lib/nx-plugin/src/generators/page/__snapshots__/generator.spec.ts.snap +88 -0
- package/src/lib/nx-plugin/src/generators/page/files/__fileName__.page.ts__template__ +22 -0
- package/src/lib/nx-plugin/src/generators/page/generator.d.ts +5 -0
- package/src/lib/nx-plugin/src/generators/page/generator.js +46 -0
- package/src/lib/nx-plugin/src/generators/page/generator.js.map +1 -0
- package/src/lib/nx-plugin/src/generators/page/schema.d.ts +13 -0
- package/src/lib/nx-plugin/src/generators/page/schema.json +60 -0
- package/src/lib/nx-plugin/src/generators/preset/generator.d.ts +1 -1
- package/src/lib/nx-plugin/src/generators/preset/schema.d.ts +1 -1
- package/src/lib/nx-plugin/src/generators/preset/schema.json +3 -3
- package/src/lib/nx-plugin/src/utils/version-utils.d.ts +1 -1
- package/src/lib/nx-plugin/src/utils/version-utils.js +2 -2
- package/src/lib/nx-plugin/src/utils/version-utils.js.map +1 -1
- package/src/lib/options.d.ts +5 -1
- package/src/lib/platform-plugin.js +5 -3
- package/src/lib/router-plugin.js +19 -2
- package/src/lib/nx-plugin/src/generators/app/files/index-pages/css/src/app/pages/index.page.ts__template__ +0 -355
- package/src/lib/nx-plugin/src/generators/app/files/index-pages/css-trpc/src/app/pages/index.page.ts__template__ +0 -585
- package/src/lib/nx-plugin/src/generators/app/files/index-pages/tailwind/src/app/pages/index.page.ts__template__ +0 -158
- package/src/lib/nx-plugin/src/generators/app/files/index-pages/tailwind-trpc/src/app/pages/index.page.ts__template__ +0 -269
- package/src/lib/nx-plugin/src/generators/app/files/template-angular-v16/src/public/assets/vite.svg__template__ +0 -1
- package/src/lib/nx-plugin/src/generators/app/lib/add-index-pages.d.ts +0 -3
- package/src/lib/nx-plugin/src/generators/app/lib/add-index-pages.js +0 -15
- package/src/lib/nx-plugin/src/generators/app/lib/add-index-pages.js.map +0 -1
- /package/src/lib/nx-plugin/src/generators/app/files/template-angular-v16/src/{app.config.server.ts__template__ → app/app.config.server.ts__template__} +0 -0
- /package/src/lib/nx-plugin/src/generators/app/files/{tRPC → trpc}/src/note.ts__template__ +0 -0
- /package/src/lib/nx-plugin/src/generators/app/files/{tRPC → trpc}/src/server/routes/trpc/[trpc].ts__template__ +0 -0
- /package/src/lib/nx-plugin/src/generators/app/files/{tRPC → trpc}/src/server/trpc/context.ts__template__ +0 -0
- /package/src/lib/nx-plugin/src/generators/app/files/{tRPC → trpc}/src/server/trpc/routers/index.ts__template__ +0 -0
- /package/src/lib/nx-plugin/src/generators/app/files/{tRPC → trpc}/src/server/trpc/trpc.ts__template__ +0 -0
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
import { Component } from '@angular/core';
|
|
2
|
+
|
|
3
|
+
@Component({
|
|
4
|
+
selector: '<%= fileName %>-analog-welcome',
|
|
5
|
+
standalone: true,
|
|
6
|
+
styles: [
|
|
7
|
+
`
|
|
8
|
+
:host {
|
|
9
|
+
font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
|
|
10
|
+
'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif,
|
|
11
|
+
'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol',
|
|
12
|
+
'Noto Color Emoji';
|
|
13
|
+
display: flex;
|
|
14
|
+
padding: 2rem 1rem 8rem;
|
|
15
|
+
flex-direction: column;
|
|
16
|
+
background: rgb(250 250 250);
|
|
17
|
+
height: 100%;
|
|
18
|
+
}
|
|
19
|
+
a {
|
|
20
|
+
color: inherit;
|
|
21
|
+
text-decoration: inherit;
|
|
22
|
+
}
|
|
23
|
+
.main {
|
|
24
|
+
margin: 0 auto;
|
|
25
|
+
flex: 1 1 0;
|
|
26
|
+
}
|
|
27
|
+
.intro-section {
|
|
28
|
+
padding-top: 1.5rem;
|
|
29
|
+
padding-bottom: 2rem;
|
|
30
|
+
}
|
|
31
|
+
.intro-section > * + * {
|
|
32
|
+
margin-top: 1.5rem;
|
|
33
|
+
}
|
|
34
|
+
@media (min-width: 768px) {
|
|
35
|
+
.intro-section {
|
|
36
|
+
padding-top: 2.5rem;
|
|
37
|
+
padding-bottom: 3rem;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
@media (min-width: 1024px) {
|
|
41
|
+
.intro-section {
|
|
42
|
+
padding-top: 8rem;
|
|
43
|
+
padding-bottom: 8rem;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
.intro-container {
|
|
47
|
+
display: flex;
|
|
48
|
+
flex-direction: column;
|
|
49
|
+
text-align: center;
|
|
50
|
+
gap: 1rem;
|
|
51
|
+
align-items: center;
|
|
52
|
+
max-width: 64rem;
|
|
53
|
+
}
|
|
54
|
+
.intro-logo {
|
|
55
|
+
height: 3rem;
|
|
56
|
+
width: 3rem;
|
|
57
|
+
}
|
|
58
|
+
.intro-badge {
|
|
59
|
+
transition-property: color, background-color, border-color,
|
|
60
|
+
text-decoration-color, fill, stroke;
|
|
61
|
+
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
|
|
62
|
+
transition-duration: 150ms;
|
|
63
|
+
font-weight: 500;
|
|
64
|
+
font-size: 0.875rem;
|
|
65
|
+
line-height: 1.25rem;
|
|
66
|
+
padding: 0.375rem 1rem;
|
|
67
|
+
background-color: rgb(228 228 231);
|
|
68
|
+
border-radius: 1rem;
|
|
69
|
+
}
|
|
70
|
+
.intro-heading {
|
|
71
|
+
margin: 0;
|
|
72
|
+
font-weight: 500;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
@media (min-width: 640px) {
|
|
76
|
+
.intro-heading {
|
|
77
|
+
font-size: 3rem;
|
|
78
|
+
line-height: 1;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
@media (min-width: 768px) {
|
|
82
|
+
.intro-heading {
|
|
83
|
+
font-size: 3.75rem;
|
|
84
|
+
line-height: 1;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
@media (min-width: 1024px) {
|
|
88
|
+
.intro-heading {
|
|
89
|
+
font-size: 4.5rem;
|
|
90
|
+
line-height: 1;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
.intro-analog {
|
|
94
|
+
color: #dd0031;
|
|
95
|
+
}
|
|
96
|
+
.intro-description {
|
|
97
|
+
line-height: 1.5;
|
|
98
|
+
max-width: 42rem;
|
|
99
|
+
margin: 0;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
@media (min-width: 640px) {
|
|
103
|
+
.intro-description {
|
|
104
|
+
line-height: 2rem;
|
|
105
|
+
font-size: 1.25rem;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
.btn-container > * + * {
|
|
109
|
+
margin-left: 1rem;
|
|
110
|
+
}
|
|
111
|
+
.darkBtn {
|
|
112
|
+
transition-property: color, background-color, border-color,
|
|
113
|
+
text-decoration-color, fill, stroke;
|
|
114
|
+
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
|
|
115
|
+
transition-duration: 150ms;
|
|
116
|
+
color: rgb(250 250 250);
|
|
117
|
+
font-weight: 500;
|
|
118
|
+
font-size: 0.875rem;
|
|
119
|
+
line-height: 1.25rem;
|
|
120
|
+
padding-left: 2rem;
|
|
121
|
+
padding-right: 2rem;
|
|
122
|
+
background-color: rgb(9 9 11);
|
|
123
|
+
border-radius: 0.375rem;
|
|
124
|
+
justify-content: center;
|
|
125
|
+
align-items: center;
|
|
126
|
+
height: 2.75rem;
|
|
127
|
+
cursor: pointer;
|
|
128
|
+
display: inline-flex;
|
|
129
|
+
}
|
|
130
|
+
.darkBtn:hover {
|
|
131
|
+
background-color: rgb(9 9 11 / 0.9);
|
|
132
|
+
}
|
|
133
|
+
.lightBtn {
|
|
134
|
+
transition-property: color, background-color, border-color,
|
|
135
|
+
text-decoration-color, fill, stroke;
|
|
136
|
+
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
|
|
137
|
+
transition-duration: 150ms;
|
|
138
|
+
color: rgb(24, 24, 27);
|
|
139
|
+
background: rgb(250 250 250);
|
|
140
|
+
font-weight: 500;
|
|
141
|
+
font-size: 0.875rem;
|
|
142
|
+
line-height: 1.25rem;
|
|
143
|
+
padding-left: 2rem;
|
|
144
|
+
padding-right: 2rem;
|
|
145
|
+
border-radius: 0.375rem;
|
|
146
|
+
border: 1px solid rgb(229, 231, 235);
|
|
147
|
+
justify-content: center;
|
|
148
|
+
align-items: center;
|
|
149
|
+
height: 2.75rem;
|
|
150
|
+
display: inline-flex;
|
|
151
|
+
cursor: pointer;
|
|
152
|
+
}
|
|
153
|
+
.lightBtn:hover {
|
|
154
|
+
background-color: rgb(244 244 245);
|
|
155
|
+
}
|
|
156
|
+
.counter-section {
|
|
157
|
+
padding-top: 2rem;
|
|
158
|
+
padding-bottom: 2rem;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
@media (min-width: 768px) {
|
|
162
|
+
.counter-section {
|
|
163
|
+
padding-top: 3rem;
|
|
164
|
+
padding-bottom: 3rem;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
@media (min-width: 1024px) {
|
|
169
|
+
.counter-section {
|
|
170
|
+
padding-top: 6rem;
|
|
171
|
+
padding-bottom: 6rem;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
.counter-container {
|
|
175
|
+
text-align: center;
|
|
176
|
+
gap: 1rem;
|
|
177
|
+
justify-content: center;
|
|
178
|
+
align-items: center;
|
|
179
|
+
flex-direction: column;
|
|
180
|
+
max-width: 58rem;
|
|
181
|
+
display: flex;
|
|
182
|
+
margin-left: auto;
|
|
183
|
+
margin-right: auto;
|
|
184
|
+
}
|
|
185
|
+
.counter-heading {
|
|
186
|
+
color: #dd0031;
|
|
187
|
+
line-height: 1.1;
|
|
188
|
+
font-weight: 500;
|
|
189
|
+
font-size: 1.875rem;
|
|
190
|
+
margin: 0;
|
|
191
|
+
}
|
|
192
|
+
.counter-description {
|
|
193
|
+
line-height: 1.5;
|
|
194
|
+
max-width: 85%;
|
|
195
|
+
margin: 0;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
@media (min-width: 640px) {
|
|
199
|
+
.counter-description {
|
|
200
|
+
line-height: 1.75rem;
|
|
201
|
+
font-size: 1.125rem;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
.count {
|
|
205
|
+
margin-left: 0.25rem;
|
|
206
|
+
font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
|
|
207
|
+
}
|
|
208
|
+
`,
|
|
209
|
+
],
|
|
210
|
+
template: `
|
|
211
|
+
<main class="main">
|
|
212
|
+
<section class="intro-section">
|
|
213
|
+
<div class="intro-container">
|
|
214
|
+
<img
|
|
215
|
+
class="intro-logo"
|
|
216
|
+
src="https://analogjs.org/img/logos/analog-logo.svg"
|
|
217
|
+
alt="AnalogJs logo. Two red triangles and a white analog wave in front"
|
|
218
|
+
/>
|
|
219
|
+
<a
|
|
220
|
+
class="intro-badge"
|
|
221
|
+
target="_blank"
|
|
222
|
+
href="https://twitter.com/analogjs"
|
|
223
|
+
>Follow along on Twitter</a
|
|
224
|
+
>
|
|
225
|
+
<h1 class="intro-heading">
|
|
226
|
+
<span class="intro-analog">Analog.</span> The fullstack Angular
|
|
227
|
+
meta-framework
|
|
228
|
+
</h1>
|
|
229
|
+
<p class="intro-description">
|
|
230
|
+
Analog is for building applications and websites with Angular.
|
|
231
|
+
<br />Powered by Vite.
|
|
232
|
+
</p>
|
|
233
|
+
<div class="btn-container">
|
|
234
|
+
<a class="darkBtn" href="https://analogjs.org">Read the docs</a>
|
|
235
|
+
<a
|
|
236
|
+
target="_blank"
|
|
237
|
+
rel="noreferrer"
|
|
238
|
+
class="lightBtn"
|
|
239
|
+
href="https://github.com/analogjs/analog"
|
|
240
|
+
>Star on GitHub</a
|
|
241
|
+
>
|
|
242
|
+
</div>
|
|
243
|
+
</div>
|
|
244
|
+
</section>
|
|
245
|
+
<section id="counter-demo" class="section">
|
|
246
|
+
<div class="counter-container">
|
|
247
|
+
<h2 class="counter-heading">Counter</h2>
|
|
248
|
+
<p class="counter-description">
|
|
249
|
+
This is a simple interactive counter. Powered by Angular.
|
|
250
|
+
</p>
|
|
251
|
+
<button (click)="increment()" class="lightBtn">
|
|
252
|
+
Count: <span class="count">{{ count }}</span>
|
|
253
|
+
</button>
|
|
254
|
+
</div>
|
|
255
|
+
</section>
|
|
256
|
+
</main>
|
|
257
|
+
`,
|
|
258
|
+
})
|
|
259
|
+
export class AnalogWelcomeComponent {
|
|
260
|
+
count = 0;
|
|
261
|
+
increment() {
|
|
262
|
+
this.count++;
|
|
263
|
+
}
|
|
264
|
+
}
|
|
@@ -0,0 +1,439 @@
|
|
|
1
|
+
import { Component } from '@angular/core';
|
|
2
|
+
import { AsyncPipe, DatePipe, NgFor, NgIf } from '@angular/common';
|
|
3
|
+
import { FormsModule, NgForm } from '@angular/forms';
|
|
4
|
+
import { waitFor } from '@analogjs/trpc';
|
|
5
|
+
import { shareReplay, Subject, switchMap, take } from 'rxjs';
|
|
6
|
+
import { injectTrpcClient } from '../../trpc-client';
|
|
7
|
+
import { Note } from '../../note';
|
|
8
|
+
|
|
9
|
+
@Component({
|
|
10
|
+
selector: '<%= fileName %>-analog-welcome',
|
|
11
|
+
standalone: true,
|
|
12
|
+
imports: [AsyncPipe, FormsModule, NgFor, DatePipe, NgIf],
|
|
13
|
+
styles: [
|
|
14
|
+
`
|
|
15
|
+
:host {
|
|
16
|
+
font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
|
|
17
|
+
'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif,
|
|
18
|
+
'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol',
|
|
19
|
+
'Noto Color Emoji';
|
|
20
|
+
display: flex;
|
|
21
|
+
padding: 2rem 1rem 8rem;
|
|
22
|
+
flex-direction: column;
|
|
23
|
+
background: rgb(250 250 250);
|
|
24
|
+
height: 100%;
|
|
25
|
+
}
|
|
26
|
+
a {
|
|
27
|
+
color: inherit;
|
|
28
|
+
text-decoration: inherit;
|
|
29
|
+
}
|
|
30
|
+
.main {
|
|
31
|
+
margin: 0 auto;
|
|
32
|
+
flex: 1 1 0;
|
|
33
|
+
}
|
|
34
|
+
.intro-section {
|
|
35
|
+
padding-top: 1.5rem;
|
|
36
|
+
padding-bottom: 2rem;
|
|
37
|
+
}
|
|
38
|
+
.intro-section > * + * {
|
|
39
|
+
margin-top: 1.5rem;
|
|
40
|
+
}
|
|
41
|
+
@media (min-width: 768px) {
|
|
42
|
+
.intro-section {
|
|
43
|
+
padding-top: 2.5rem;
|
|
44
|
+
padding-bottom: 3rem;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
@media (min-width: 1024px) {
|
|
48
|
+
.intro-section {
|
|
49
|
+
padding-top: 8rem;
|
|
50
|
+
padding-bottom: 8rem;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
.intro-container {
|
|
54
|
+
display: flex;
|
|
55
|
+
flex-direction: column;
|
|
56
|
+
text-align: center;
|
|
57
|
+
gap: 1rem;
|
|
58
|
+
align-items: center;
|
|
59
|
+
max-width: 64rem;
|
|
60
|
+
}
|
|
61
|
+
.intro-logo {
|
|
62
|
+
height: 3rem;
|
|
63
|
+
width: 3rem;
|
|
64
|
+
}
|
|
65
|
+
.intro-badge {
|
|
66
|
+
transition-property: color, background-color, border-color,
|
|
67
|
+
text-decoration-color, fill, stroke;
|
|
68
|
+
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
|
|
69
|
+
transition-duration: 150ms;
|
|
70
|
+
font-weight: 500;
|
|
71
|
+
font-size: 0.875rem;
|
|
72
|
+
line-height: 1.25rem;
|
|
73
|
+
padding: 0.375rem 1rem;
|
|
74
|
+
background-color: rgb(228 228 231);
|
|
75
|
+
border-radius: 1rem;
|
|
76
|
+
}
|
|
77
|
+
.intro-heading {
|
|
78
|
+
margin: 0;
|
|
79
|
+
font-weight: 500;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
@media (min-width: 640px) {
|
|
83
|
+
.intro-heading {
|
|
84
|
+
font-size: 3rem;
|
|
85
|
+
line-height: 1;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
@media (min-width: 768px) {
|
|
89
|
+
.intro-heading {
|
|
90
|
+
font-size: 3.75rem;
|
|
91
|
+
line-height: 1;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
@media (min-width: 1024px) {
|
|
95
|
+
.intro-heading {
|
|
96
|
+
font-size: 4.5rem;
|
|
97
|
+
line-height: 1;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
.intro-analog {
|
|
101
|
+
color: #dd0031;
|
|
102
|
+
}
|
|
103
|
+
.intro-description {
|
|
104
|
+
line-height: 1.5;
|
|
105
|
+
max-width: 42rem;
|
|
106
|
+
margin: 0;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
@media (min-width: 640px) {
|
|
110
|
+
.intro-description {
|
|
111
|
+
line-height: 2rem;
|
|
112
|
+
font-size: 1.25rem;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
.btn-container > * + * {
|
|
116
|
+
margin-left: 1rem;
|
|
117
|
+
}
|
|
118
|
+
.darkBtn {
|
|
119
|
+
transition-property: color, background-color, border-color,
|
|
120
|
+
text-decoration-color, fill, stroke;
|
|
121
|
+
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
|
|
122
|
+
transition-duration: 150ms;
|
|
123
|
+
color: rgb(250 250 250);
|
|
124
|
+
font-weight: 500;
|
|
125
|
+
font-size: 0.875rem;
|
|
126
|
+
line-height: 1.25rem;
|
|
127
|
+
padding-left: 2rem;
|
|
128
|
+
padding-right: 2rem;
|
|
129
|
+
background-color: rgb(9 9 11);
|
|
130
|
+
border-radius: 0.375rem;
|
|
131
|
+
justify-content: center;
|
|
132
|
+
align-items: center;
|
|
133
|
+
height: 2.75rem;
|
|
134
|
+
cursor: pointer;
|
|
135
|
+
display: inline-flex;
|
|
136
|
+
}
|
|
137
|
+
.darkBtn:hover {
|
|
138
|
+
background-color: rgb(9 9 11 / 0.9);
|
|
139
|
+
}
|
|
140
|
+
.lightBtn {
|
|
141
|
+
transition-property: color, background-color, border-color,
|
|
142
|
+
text-decoration-color, fill, stroke;
|
|
143
|
+
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
|
|
144
|
+
transition-duration: 150ms;
|
|
145
|
+
color: rgb(24, 24, 27);
|
|
146
|
+
background: rgb(250 250 250);
|
|
147
|
+
font-weight: 500;
|
|
148
|
+
font-size: 0.875rem;
|
|
149
|
+
line-height: 1.25rem;
|
|
150
|
+
padding-left: 2rem;
|
|
151
|
+
padding-right: 2rem;
|
|
152
|
+
border-radius: 0.375rem;
|
|
153
|
+
border: 1px solid rgb(229, 231, 235);
|
|
154
|
+
justify-content: center;
|
|
155
|
+
align-items: center;
|
|
156
|
+
height: 2.75rem;
|
|
157
|
+
display: inline-flex;
|
|
158
|
+
cursor: pointer;
|
|
159
|
+
}
|
|
160
|
+
.lightBtn:hover {
|
|
161
|
+
background-color: rgb(244 244 245);
|
|
162
|
+
}
|
|
163
|
+
.trpc-section {
|
|
164
|
+
padding-top: 2rem;
|
|
165
|
+
padding-bottom: 2rem;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
@media (min-width: 768px) {
|
|
169
|
+
.trpc-section {
|
|
170
|
+
padding-top: 3rem;
|
|
171
|
+
padding-bottom: 3rem;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
@media (min-width: 1024px) {
|
|
176
|
+
.trpc-section {
|
|
177
|
+
padding-top: 6rem;
|
|
178
|
+
padding-bottom: 6rem;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
.trpc-container {
|
|
182
|
+
text-align: center;
|
|
183
|
+
gap: 1rem;
|
|
184
|
+
justify-content: center;
|
|
185
|
+
align-items: center;
|
|
186
|
+
flex-direction: column;
|
|
187
|
+
max-width: 58rem;
|
|
188
|
+
display: flex;
|
|
189
|
+
margin-left: auto;
|
|
190
|
+
margin-right: auto;
|
|
191
|
+
}
|
|
192
|
+
.trpc-heading {
|
|
193
|
+
color: #dd0031;
|
|
194
|
+
line-height: 1.1;
|
|
195
|
+
font-weight: 500;
|
|
196
|
+
font-size: 1.875rem;
|
|
197
|
+
margin: 0;
|
|
198
|
+
}
|
|
199
|
+
.trpc-description {
|
|
200
|
+
line-height: 1.5;
|
|
201
|
+
max-width: 85%;
|
|
202
|
+
margin: 0;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
@media (min-width: 640px) {
|
|
206
|
+
.trpc-description {
|
|
207
|
+
line-height: 1.75rem;
|
|
208
|
+
font-size: 1.125rem;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
.trpc-form {
|
|
212
|
+
padding-bottom: 0.5rem;
|
|
213
|
+
align-items: center;
|
|
214
|
+
display: flex;
|
|
215
|
+
margin-top: 2rem;
|
|
216
|
+
gap: 0.5rem;
|
|
217
|
+
}
|
|
218
|
+
.sr-only {
|
|
219
|
+
position: absolute;
|
|
220
|
+
width: 1px;
|
|
221
|
+
height: 1px;
|
|
222
|
+
padding: 0;
|
|
223
|
+
margin: -1px;
|
|
224
|
+
overflow: hidden;
|
|
225
|
+
clip: rect(0, 0, 0, 0);
|
|
226
|
+
white-space: nowrap;
|
|
227
|
+
border-width: 0;
|
|
228
|
+
}
|
|
229
|
+
.trpcInput {
|
|
230
|
+
transition-property: color, background-color, border-color,
|
|
231
|
+
text-decoration-color, fill, stroke;
|
|
232
|
+
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
|
|
233
|
+
transition-duration: 150ms;
|
|
234
|
+
font-weight: 500;
|
|
235
|
+
font-size: 0.875rem;
|
|
236
|
+
line-height: 1.25rem;
|
|
237
|
+
padding-left: 0.5rem;
|
|
238
|
+
padding-right: 0.5rem;
|
|
239
|
+
border-radius: 0.375rem;
|
|
240
|
+
justify-content: center;
|
|
241
|
+
align-items: center;
|
|
242
|
+
width: 100%;
|
|
243
|
+
height: 2.5rem;
|
|
244
|
+
font-family: inherit;
|
|
245
|
+
font-feature-settings: inherit;
|
|
246
|
+
font-variation-settings: inherit;
|
|
247
|
+
color: inherit;
|
|
248
|
+
margin: 0;
|
|
249
|
+
border: 1px solid rgb(229, 231, 235);
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
.notes {
|
|
253
|
+
margin-top: 1rem;
|
|
254
|
+
}
|
|
255
|
+
.note {
|
|
256
|
+
padding: 1rem;
|
|
257
|
+
margin-bottom: 1rem;
|
|
258
|
+
border-radius: 0.375rem;
|
|
259
|
+
font-weight: 400;
|
|
260
|
+
border: 1px solid rgb(229, 231, 235);
|
|
261
|
+
}
|
|
262
|
+
.note-head {
|
|
263
|
+
display: flex;
|
|
264
|
+
justify-content: space-between;
|
|
265
|
+
align-items: center;
|
|
266
|
+
}
|
|
267
|
+
.note-date {
|
|
268
|
+
font-size: 0.875rem;
|
|
269
|
+
margin: 0;
|
|
270
|
+
line-height: 1.25rem;
|
|
271
|
+
color: rgb(161, 161, 170);
|
|
272
|
+
}
|
|
273
|
+
.note-note {
|
|
274
|
+
margin: 0 0 2rem 0;
|
|
275
|
+
}
|
|
276
|
+
.noteDeleteBtn {
|
|
277
|
+
transition-property: color, background-color, border-color,
|
|
278
|
+
text-decoration-color, fill, stroke;
|
|
279
|
+
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
|
|
280
|
+
transition-duration: 150ms;
|
|
281
|
+
font-weight: 500;
|
|
282
|
+
font-size: 0.875rem;
|
|
283
|
+
line-height: 1.25rem;
|
|
284
|
+
border-radius: 0.375rem;
|
|
285
|
+
justify-content: center;
|
|
286
|
+
align-items: center;
|
|
287
|
+
width: 1.5rem;
|
|
288
|
+
height: 1.5rem;
|
|
289
|
+
display: inline-flex;
|
|
290
|
+
cursor: pointer;
|
|
291
|
+
background: none;
|
|
292
|
+
border: 1px solid transparent;
|
|
293
|
+
}
|
|
294
|
+
.noteDeleteBtn:hover {
|
|
295
|
+
background-color: rgb(244 244 245);
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
.no-notes {
|
|
299
|
+
padding: 5rem;
|
|
300
|
+
border-radius: 0.75rem;
|
|
301
|
+
text-align: center;
|
|
302
|
+
}
|
|
303
|
+
.no-notes-headline {
|
|
304
|
+
font-size: 1.25rem;
|
|
305
|
+
line-height: 1.75rem;
|
|
306
|
+
font-weight: 500;
|
|
307
|
+
margin: 0;
|
|
308
|
+
}
|
|
309
|
+
.no-notes-desc {
|
|
310
|
+
color: rgb(161 161 170);
|
|
311
|
+
margin: 0;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
.loading-text {
|
|
315
|
+
margin-top: 1rem;
|
|
316
|
+
text-align: center;
|
|
317
|
+
}
|
|
318
|
+
`,
|
|
319
|
+
],
|
|
320
|
+
template: `
|
|
321
|
+
<main class="main">
|
|
322
|
+
<section class="intro-section">
|
|
323
|
+
<div class="intro-container">
|
|
324
|
+
<img
|
|
325
|
+
class="intro-logo"
|
|
326
|
+
src="https://analogjs.org/img/logos/analog-logo.svg"
|
|
327
|
+
alt="AnalogJs logo. Two red triangles and a white analog wave in front"
|
|
328
|
+
/>
|
|
329
|
+
<a
|
|
330
|
+
class="intro-badge"
|
|
331
|
+
target="_blank"
|
|
332
|
+
href="https://twitter.com/analogjs"
|
|
333
|
+
>Follow along on Twitter</a
|
|
334
|
+
>
|
|
335
|
+
<h1 class="intro-heading">
|
|
336
|
+
<span class="intro-analog">Analog.</span> The fullstack Angular
|
|
337
|
+
meta-framework
|
|
338
|
+
</h1>
|
|
339
|
+
<p class="intro-description">
|
|
340
|
+
Analog is for building applications and websites with Angular.
|
|
341
|
+
<br />Powered by Vite.
|
|
342
|
+
</p>
|
|
343
|
+
<div class="btn-container">
|
|
344
|
+
<a class="darkBtn" href="https://analogjs.org">Read the docs</a>
|
|
345
|
+
<a
|
|
346
|
+
target="_blank"
|
|
347
|
+
rel="noreferrer"
|
|
348
|
+
class="lightBtn"
|
|
349
|
+
href="https://github.com/analogjs/analog"
|
|
350
|
+
>Star on GitHub</a
|
|
351
|
+
>
|
|
352
|
+
</div>
|
|
353
|
+
</div>
|
|
354
|
+
</section>
|
|
355
|
+
<section id="trpc-demo" class="trpc-section">
|
|
356
|
+
<div class="trpc-container">
|
|
357
|
+
<h2 class="trpc-heading">Leave a note</h2>
|
|
358
|
+
<p class="trpc-description">
|
|
359
|
+
This is an example of how to you can use tRPC to superpower you
|
|
360
|
+
client server interaction.
|
|
361
|
+
</p>
|
|
362
|
+
</div>
|
|
363
|
+
<form class="trpc-form" #f="ngForm" (ngSubmit)="addNote(f)">
|
|
364
|
+
<label class="sr-only" for="newNote"> Note </label>
|
|
365
|
+
<input
|
|
366
|
+
required
|
|
367
|
+
autocomplete="off"
|
|
368
|
+
name="newNote"
|
|
369
|
+
[(ngModel)]="newNote"
|
|
370
|
+
class="trpcInput"
|
|
371
|
+
/>
|
|
372
|
+
<button class="lightBtn">+</button>
|
|
373
|
+
</form>
|
|
374
|
+
<div class="notes" *ngIf="notes$ | async as notes; else loading">
|
|
375
|
+
<div
|
|
376
|
+
class="note"
|
|
377
|
+
*ngFor="let note of notes; trackBy: noteTrackBy; let i = index"
|
|
378
|
+
>
|
|
379
|
+
<div class="note-head">
|
|
380
|
+
<p class="note-date">{{ note.createdAt | date }}</p>
|
|
381
|
+
<button class="noteDeleteBtn" (click)="removeNote(note.id)">
|
|
382
|
+
x
|
|
383
|
+
</button>
|
|
384
|
+
</div>
|
|
385
|
+
<p class="note-note">{{ note.note }}</p>
|
|
386
|
+
</div>
|
|
387
|
+
|
|
388
|
+
<div class="no-notes " *ngIf="notes.length === 0">
|
|
389
|
+
<h3 class="no-notes-headline">No notes yet!</h3>
|
|
390
|
+
<p class="no-notes-desc">
|
|
391
|
+
Add a new one and see them appear here...
|
|
392
|
+
</p>
|
|
393
|
+
</div>
|
|
394
|
+
</div>
|
|
395
|
+
<ng-template #loading>
|
|
396
|
+
<p class="loading-text">Loading...</p>
|
|
397
|
+
</ng-template>
|
|
398
|
+
</section>
|
|
399
|
+
</main>
|
|
400
|
+
`,
|
|
401
|
+
})
|
|
402
|
+
export class AnalogWelcomeComponent {
|
|
403
|
+
private _trpc = injectTrpcClient();
|
|
404
|
+
public triggerRefresh$ = new Subject<void>();
|
|
405
|
+
public notes$ = this.triggerRefresh$.pipe(
|
|
406
|
+
switchMap(() => this._trpc.note.list.query()),
|
|
407
|
+
shareReplay(1)
|
|
408
|
+
);
|
|
409
|
+
public newNote = '';
|
|
410
|
+
|
|
411
|
+
constructor() {
|
|
412
|
+
void waitFor(this.notes$);
|
|
413
|
+
this.triggerRefresh$.next();
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
public noteTrackBy = (index: number, note: Note) => {
|
|
417
|
+
return note.id;
|
|
418
|
+
};
|
|
419
|
+
|
|
420
|
+
public addNote(form: NgForm) {
|
|
421
|
+
if (!form.valid) {
|
|
422
|
+
form.form.markAllAsTouched();
|
|
423
|
+
return;
|
|
424
|
+
}
|
|
425
|
+
this._trpc.note.create
|
|
426
|
+
.mutate({ note: this.newNote })
|
|
427
|
+
.pipe(take(1))
|
|
428
|
+
.subscribe(() => this.triggerRefresh$.next());
|
|
429
|
+
this.newNote = '';
|
|
430
|
+
form.form.reset();
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
public removeNote(id: number) {
|
|
434
|
+
this._trpc.note.remove
|
|
435
|
+
.mutate({ id })
|
|
436
|
+
.pipe(take(1))
|
|
437
|
+
.subscribe(() => this.triggerRefresh$.next());
|
|
438
|
+
}
|
|
439
|
+
}
|