Preface |
|
xv | |
Acknowledgments |
|
xvi | |
About This Book |
|
xviii | |
About The Author |
|
xxiii | |
About The Cover Illustration |
|
xxiv | |
|
|
1 | (40) |
|
|
3 | (16) |
|
|
4 | (9) |
|
|
4 | (5) |
|
|
9 | (2) |
|
|
11 | (1) |
|
|
11 | (2) |
|
|
13 | (1) |
|
|
13 | (3) |
|
|
14 | (1) |
|
|
15 | (1) |
|
When should Sapper be used? |
|
|
16 | (1) |
|
When should Sapper not be used? |
|
|
16 | (1) |
|
1.3 Introducing Svelte Native |
|
|
16 | (1) |
|
1.4 How does Svelte compare with other web frameworks? |
|
|
17 | (1) |
|
|
17 | (1) |
|
|
17 | (1) |
|
|
17 | (1) |
|
1.5 What tools are needed to get started? |
|
|
18 | (1) |
|
|
19 | (22) |
|
|
20 | (11) |
|
|
20 | (2) |
|
|
22 | (4) |
|
|
26 | (2) |
|
|
28 | (1) |
|
|
28 | (1) |
|
|
29 | (1) |
|
|
29 | (1) |
|
|
30 | (1) |
|
|
30 | (1) |
|
2.2 Working outside the REPL |
|
|
31 | (6) |
|
|
31 | (2) |
|
|
33 | (1) |
|
|
33 | (2) |
|
|
35 | (2) |
|
|
37 | (4) |
|
PART 2 DEEPER INTO SVELTE |
|
|
41 | (220) |
|
|
43 | (21) |
|
3.1 Content of svelte files |
|
|
44 | (1) |
|
|
45 | (2) |
|
|
47 | (1) |
|
|
48 | (1) |
|
|
49 | (1) |
|
3.6 Scoped vs. global styles |
|
|
50 | (3) |
|
3.7 Using CSS preprocessors |
|
|
53 | (1) |
|
|
53 | (1) |
|
|
54 | (1) |
|
|
55 | (2) |
|
|
57 | (2) |
|
3.12 Building a custom component |
|
|
59 | (1) |
|
3.13 Building the Travel Packing app |
|
|
60 | (4) |
|
|
64 | (18) |
|
4.1 Conditional logic with {#if} |
|
|
65 | (1) |
|
4.2 Iteration with (#each) |
|
|
66 | (1) |
|
4.3 Promises with {#await} |
|
|
67 | (3) |
|
4.4 Building the Travel Packing app |
|
|
70 | (12) |
|
|
71 | (2) |
|
|
73 | (1) |
|
|
73 | (3) |
|
|
76 | (3) |
|
|
79 | (1) |
|
|
80 | (2) |
|
5 Component communication |
|
|
82 | (24) |
|
5.1 Component communication options |
|
|
83 | (1) |
|
|
83 | (13) |
|
|
84 | (2) |
|
|
86 | (1) |
|
|
86 | (1) |
|
|
87 | (1) |
|
The bind directive on form elements |
|
|
88 | (2) |
|
|
90 | (2) |
|
|
92 | (4) |
|
|
96 | (1) |
|
|
97 | (3) |
|
|
97 | (2) |
|
|
99 | (1) |
|
|
99 | (1) |
|
|
100 | (1) |
|
5.6 Building the Travel Packing app |
|
|
101 | (5) |
|
|
106 | (18) |
|
|
107 | (1) |
|
|
108 | (1) |
|
6.3 Where to define stores |
|
|
109 | (1) |
|
|
109 | (7) |
|
|
116 | (1) |
|
|
117 | (1) |
|
6.7 Using stores with classes |
|
|
118 | (4) |
|
|
122 | (1) |
|
6.9 Building the Travel Packing app |
|
|
123 | (1) |
|
|
124 | (17) |
|
|
125 | (3) |
|
|
128 | (1) |
|
|
129 | (3) |
|
7.4 Implementing a dialog component |
|
|
132 | (3) |
|
|
135 | (2) |
|
7.6 Building the Travel Packing app |
|
|
137 | (4) |
|
|
141 | (11) |
|
|
142 | (1) |
|
8.2 The onMount lifecycle function |
|
|
143 | (2) |
|
|
143 | (1) |
|
Retrieving data from an API service |
|
|
144 | (1) |
|
8.3 The onDestroy lifecycle function |
|
|
145 | (1) |
|
8.4 The beforeUpdate lifecycle function |
|
|
146 | (1) |
|
8.5 The afterUpdate lifecycle function |
|
|
147 | (1) |
|
8.6 Using helper functions |
|
|
148 | (2) |
|
8.7 Building the Travel Packing app |
|
|
150 | (2) |
|
|
152 | (18) |
|
|
153 | (7) |
|
|
160 | (2) |
|
9.3 Using the page.js library |
|
|
162 | (2) |
|
9.4 Using path and query parameters with page.js |
|
|
164 | (3) |
|
9.5 Building the Travel Packing app |
|
|
167 | (3) |
|
|
170 | (20) |
|
|
171 | (1) |
|
10.2 The svelte/animate package |
|
|
172 | (2) |
|
10.3 The svelte/motion package |
|
|
174 | (3) |
|
10.4 The svelte/transition package |
|
|
177 | (2) |
|
10.5 The fade transition and flip animation |
|
|
179 | (2) |
|
10.6 The crossfade transition |
|
|
181 | (2) |
|
|
183 | (1) |
|
|
184 | (2) |
|
10.9 The transition vs. in and out props |
|
|
186 | (1) |
|
|
186 | (1) |
|
10.11 Building the Travel Packing app |
|
|
187 | (3) |
|
|
190 | (8) |
|
|
191 | (2) |
|
|
193 | (1) |
|
|
194 | (4) |
|
|
198 | (37) |
|
12.1 Unit tests with Jest |
|
|
199 | (9) |
|
Unit tests for the Todo app |
|
|
201 | (2) |
|
Unit tests for the Travel Packing app |
|
|
203 | (5) |
|
12.2 End-to-end tests with Cypress |
|
|
208 | (8) |
|
End-to-end tests for the Todo app |
|
|
210 | (1) |
|
End-to-end tests for the Travel Packing app |
|
|
211 | (5) |
|
|
216 | (9) |
|
|
217 | (1) |
|
|
217 | (3) |
|
|
220 | (3) |
|
|
223 | (2) |
|
12.4 Component demos and debugging with Storybook |
|
|
225 | (10) |
|
Storybook for Travel Packing app |
|
|
227 | (8) |
|
|
235 | (7) |
|
13.1 Deploying to any HTTP server |
|
|
236 | (1) |
|
|
236 | (3) |
|
|
237 | (1) |
|
Netlify from the command line |
|
|
238 | (1) |
|
|
239 | (1) |
|
|
239 | (2) |
|
|
240 | (1) |
|
Vercel from the command line |
|
|
240 | (1) |
|
|
241 | (1) |
|
|
241 | (1) |
|
|
242 | (19) |
|
|
243 | (4) |
|
|
247 | (3) |
|
|
250 | (4) |
|
14.4 Importing JSON files |
|
|
254 | (1) |
|
14.5 Creating component libraries |
|
|
254 | (2) |
|
|
256 | (5) |
|
PART 3 DEEPER INTO SAPPER |
|
|
261 | (80) |
|
|
263 | (8) |
|
15.1 Creating a new Sapper app |
|
|
265 | (1) |
|
15.2 Recreating the shopping app with Sapper |
|
|
266 | (5) |
|
|
271 | (18) |
|
16.1 Sapper file structure |
|
|
272 | (3) |
|
|
275 | (1) |
|
|
276 | (3) |
|
|
279 | (1) |
|
16.5 Running on both server and client |
|
|
279 | (1) |
|
|
280 | (1) |
|
|
280 | (2) |
|
|
282 | (2) |
|
|
284 | (1) |
|
16.10 Building the Travel Packing app |
|
|
285 | (4) |
|
|
289 | (18) |
|
17.1 Server route source files |
|
|
290 | (1) |
|
17.2 Server route functions |
|
|
291 | (1) |
|
17.3 A create/retrieve/update/delete (CRUD) example |
|
|
292 | (7) |
|
17.4 Switching to Express |
|
|
299 | (1) |
|
17.5 Building the Travel Packing app |
|
|
300 | (7) |
|
18 Exporting static sites with Sapper |
|
|
307 | (14) |
|
|
308 | (1) |
|
|
308 | (1) |
|
|
309 | (12) |
|
19 Sapper offline support |
|
|
321 | (20) |
|
19.1 Service worker overview |
|
|
322 | (1) |
|
|
323 | (3) |
|
19.3 Sapper service worker configuration |
|
|
326 | (1) |
|
19.4 Service worker events |
|
|
327 | (1) |
|
19.5 Managing service workers in Chrome |
|
|
328 | (4) |
|
19.6 Enabling the use of HTTPS in the Sapper server |
|
|
332 | (2) |
|
19.7 Verifying offline behavior |
|
|
334 | (1) |
|
19.8 Building the Travel Packing app |
|
|
335 | (6) |
|
PART 4 BEYOND SVELTE AND SAPPER |
|
|
341 | (50) |
|
|
343 | (13) |
|
20.1 Custom preprocessing |
|
|
344 | (2) |
|
|
345 | (1) |
|
20.2 The svelte-preprocess package |
|
|
346 | (6) |
|
|
347 | (1) |
|
|
347 | (2) |
|
|
349 | (1) |
|
|
349 | (1) |
|
|
350 | (2) |
|
|
352 | (1) |
|
|
352 | (2) |
|
20.4 Using multiple preprocessors |
|
|
354 | (1) |
|
|
354 | (2) |
|
|
356 | (35) |
|
|
357 | (6) |
|
|
357 | (1) |
|
|
358 | (1) |
|
|
358 | (1) |
|
|
359 | (1) |
|
|
359 | (4) |
|
|
363 | (1) |
|
21.2 Getting started with Svelte Native |
|
|
363 | (1) |
|
21.3 Developing Svelte Native apps locally |
|
|
364 | (1) |
|
21.4 NativeScript styling |
|
|
365 | (1) |
|
21.5 Predefined NativeScript CSS classes |
|
|
366 | (2) |
|
|
368 | (1) |
|
21.7 Comprehensive example |
|
|
368 | (17) |
|
21.8 NativeScript UI component library |
|
|
385 | (5) |
|
21.9 Svelte Native issues |
|
|
390 | (1) |
Appendix A Resources |
|
391 | (6) |
Appendix B Calling REST services |
|
397 | (3) |
Appendix C MongoDB |
|
400 | (7) |
Appendix D ESLint for Svelte |
|
407 | (2) |
Appendix E Prettier for Svelte |
|
409 | (2) |
Appendix F VS Code |
|
411 | (4) |
Appendix G Snowpack |
|
415 | (4) |
Index |
|
419 | |