create-qwik 0.21.0 → 0.22.0-dev20230314171944

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.
Files changed (26) hide show
  1. package/index.cjs +67 -66
  2. package/package.json +2 -2
  3. package/starters/apps/base/package.json +8 -8
  4. package/starters/apps/basic/src/components/counter/counter.css +19 -0
  5. package/starters/apps/basic/src/components/counter/counter.tsx +15 -0
  6. package/starters/apps/basic/src/components/footer/footer.css +11 -0
  7. package/starters/apps/basic/src/components/footer/footer.tsx +16 -0
  8. package/starters/apps/basic/src/components/header/header.css +5 -6
  9. package/starters/apps/basic/src/components/header/header.tsx +4 -16
  10. package/starters/apps/basic/src/components/hero/hero.css +15 -0
  11. package/starters/apps/basic/src/components/hero/hero.tsx +55 -0
  12. package/starters/apps/basic/src/components/icons/qwik.tsx +4 -4
  13. package/starters/apps/basic/src/components/infobox/infobox.css +12 -0
  14. package/starters/apps/basic/src/components/infobox/infobox.tsx +14 -0
  15. package/starters/apps/basic/src/components/router-head/router-head.tsx +1 -1
  16. package/starters/apps/basic/src/components/starter/starter.css +13 -0
  17. package/starters/apps/basic/src/components/starter/starter.tsx +93 -0
  18. package/starters/apps/basic/src/global.css +102 -71
  19. package/starters/apps/basic/src/root.tsx +2 -0
  20. package/starters/apps/basic/src/routes/flower/index.tsx +31 -29
  21. package/starters/apps/basic/src/routes/index.tsx +94 -137
  22. package/starters/apps/basic/src/routes/layout.tsx +9 -11
  23. package/starters/apps/basic/src/routes/service-worker.ts +18 -0
  24. package/starters/apps/basic/src/routes/todolist/index.tsx +33 -15
  25. package/starters/apps/basic/src/routes/todolist/todolist.css +13 -0
  26. package/starters/apps/library/package.json +7 -7
@@ -1,150 +1,107 @@
1
1
  import { component$ } from '@builder.io/qwik';
2
2
  import type { DocumentHead } from '@builder.io/qwik-city';
3
- import { Link } from '@builder.io/qwik-city';
3
+ import Counter from '~/components/counter/counter';
4
+ import Hero from '~/components/hero/hero';
5
+ import Infobox from '~/components/infobox/infobox';
6
+ import Starter from '~/components/starter/starter';
4
7
 
5
8
  export default component$(() => {
6
9
  return (
7
- <div>
8
- <h1>
9
- Welcome to Qwik <span class="lightning">⚡️</span>
10
- </h1>
10
+ <>
11
+ <Hero />
11
12
 
12
- <ul>
13
- <li>
14
- Check out the <code>src/routes</code> directory to get started.
15
- </li>
16
- <li>
17
- Add integrations with <code>npm run qwik add</code>.
18
- </li>
19
- <li>
20
- More info about development in <code>README.md</code>
21
- </li>
22
- </ul>
13
+ <div class="section bright">
14
+ <div class="container center">
15
+ <Starter />
16
+ </div>
17
+ </div>
23
18
 
24
- <h2>Commands</h2>
19
+ <div class="section">
20
+ <div class="container center">
21
+ <h3>
22
+ You can <b>count</b> on me
23
+ </h3>
24
+ <Counter />
25
+ </div>
26
+ </div>
25
27
 
26
- <table class="commands">
27
- <tbody>
28
- <tr>
29
- <td>
30
- <code>npm run dev</code>
31
- </td>
32
- <td>Start the dev server and watch for changes.</td>
33
- </tr>
34
- <tr>
35
- <td>
36
- <code>npm run preview</code>
37
- </td>
38
- <td>Production build and start preview server.</td>
39
- </tr>
40
- <tr>
41
- <td>
42
- <code>npm run build</code>
43
- </td>
44
- <td>Production build.</td>
45
- </tr>
46
- <tr>
47
- <td>
48
- <code>npm run qwik add</code>
49
- </td>
50
- <td>Select an integration to add.</td>
51
- </tr>
52
- </tbody>
53
- </table>
28
+ <div class="section">
29
+ <div class="container topics">
30
+ <Infobox>
31
+ <div q:slot="title" class="icon icon-cli">
32
+ CLI Commands
33
+ </div>
34
+ <>
35
+ <p>
36
+ <code>npm run dev</code>
37
+ <br />
38
+ Starts the development server and watches for changes
39
+ </p>
40
+ <p>
41
+ <code>npm run preview</code>
42
+ <br />
43
+ Creates production build and starts a server to preview it
44
+ </p>
45
+ <p>
46
+ <code>npm run build</code>
47
+ <br />
48
+ Creates production build
49
+ </p>
50
+ <p>
51
+ <code>npm run qwik add</code>
52
+ <br />
53
+ Runs the qwik CLI to add integrations
54
+ </p>
55
+ </>
56
+ </Infobox>
54
57
 
55
- <h2>Add Integrations</h2>
58
+ <div>
59
+ <Infobox>
60
+ <div q:slot="title" class="icon icon-apps">
61
+ Example Apps
62
+ </div>
63
+ <p>
64
+ Have a look at the <a href="/flower">React Flower App</a> or the{' '}
65
+ <a href="/todolist">Todo App</a>.
66
+ </p>
67
+ </Infobox>
56
68
 
57
- <table class="commands">
58
- <tbody>
59
- <tr>
60
- <td>
61
- <code>npm run qwik add azure-swa</code>
62
- </td>
63
- <td>
64
- <a href="https://learn.microsoft.com/azure/static-web-apps/overview" target="_blank">
65
- Azure Static Web Apps
66
- </a>
67
- </td>
68
- </tr>
69
- <tr>
70
- <td>
71
- <code>npm run qwik add cloudflare-pages</code>
72
- </td>
73
- <td>
74
- <a href="https://developers.cloudflare.com/pages" target="_blank">
75
- Cloudflare Pages Server
76
- </a>
77
- </td>
78
- </tr>
79
- <tr>
80
- <td>
81
- <code>npm run qwik add express</code>
82
- </td>
83
- <td>
84
- <a href="https://expressjs.com/" target="_blank">
85
- Nodejs Express Server
86
- </a>
87
- </td>
88
- </tr>
89
- <tr>
90
- <td>
91
- <code>npm run qwik add netlify-edge</code>
92
- </td>
93
- <td>
94
- <a href="https://docs.netlify.com/" target="_blank">
95
- Netlify Edge Functions
96
- </a>
97
- </td>
98
- </tr>
99
- <tr>
100
- <td>
101
- <code>npm run qwik add vercel-edge</code>
102
- </td>
103
- <td>
104
- <a href="https://vercel.com/docs/concepts/get-started" target="_blank">
105
- Vercel Edge Functions
106
- </a>
107
- </td>
108
- </tr>
109
- </tbody>
110
- </table>
111
-
112
- <h2>Community</h2>
113
-
114
- <ul>
115
- <li>
116
- <span>Questions or just want to say hi? </span>
117
- <a href="https://qwik.builder.io/chat" target="_blank">
118
- Chat on discord!
119
- </a>
120
- </li>
121
- <li>
122
- <span>Follow </span>
123
- <a href="https://twitter.com/QwikDev" target="_blank">
124
- @QwikDev
125
- </a>
126
- <span> on Twitter</span>
127
- </li>
128
- <li>
129
- <span>Open issues and contribute on </span>
130
- <a href="https://github.com/BuilderIO/qwik" target="_blank">
131
- GitHub
132
- </a>
133
- </li>
134
- <li>
135
- <span>Watch </span>
136
- <a href="https://qwik.builder.io/media/" target="_blank">
137
- Presentations, Podcasts, Videos, etc.
138
- </a>
139
- </li>
140
- </ul>
141
- <Link class="mindblow" href="/flower/">
142
- Blow my mind 🤯
143
- </Link>
144
- <Link class="todolist" href="/todolist/">
145
- TODO demo 📝
146
- </Link>
147
- </div>
69
+ <Infobox>
70
+ <div q:slot="title" class="icon icon-community">
71
+ Community
72
+ </div>
73
+ <ul>
74
+ <li>
75
+ <span>Questions or just want to say hi? </span>
76
+ <a href="https://qwik.builder.io/chat" target="_blank">
77
+ Chat on discord!
78
+ </a>
79
+ </li>
80
+ <li>
81
+ <span>Follow </span>
82
+ <a href="https://twitter.com/QwikDev" target="_blank">
83
+ @QwikDev
84
+ </a>
85
+ <span> on Twitter</span>
86
+ </li>
87
+ <li>
88
+ <span>Open issues and contribute on </span>
89
+ <a href="https://github.com/BuilderIO/qwik" target="_blank">
90
+ GitHub
91
+ </a>
92
+ </li>
93
+ <li>
94
+ <span>Watch </span>
95
+ <a href="https://qwik.builder.io/media/" target="_blank">
96
+ Presentations, Podcasts, Videos, etc.
97
+ </a>
98
+ </li>
99
+ </ul>
100
+ </Infobox>
101
+ </div>
102
+ </div>
103
+ </div>
104
+ </>
148
105
  );
149
106
  });
150
107
 
@@ -2,6 +2,7 @@ import { component$, Slot } from '@builder.io/qwik';
2
2
  import { routeLoader$ } from '@builder.io/qwik-city';
3
3
 
4
4
  import Header from '../components/header/header';
5
+ import Footer from '~/components/footer/footer';
5
6
 
6
7
  export const useServerTimeLoader = routeLoader$(() => {
7
8
  return {
@@ -12,19 +13,16 @@ export const useServerTimeLoader = routeLoader$(() => {
12
13
  export default component$(() => {
13
14
  const serverTime = useServerTimeLoader();
14
15
  return (
15
- <>
16
+ <div class="page">
16
17
  <main>
17
18
  <Header />
18
- <section>
19
- <Slot />
20
- </section>
19
+ <Slot />
21
20
  </main>
22
- <footer>
23
- <a href="https://www.builder.io/" target="_blank">
24
- Made with ♡ by Builder.io
25
- <div>{serverTime.value.date}</div>
26
- </a>
27
- </footer>
28
- </>
21
+ <div class="section dark">
22
+ <div class="container">
23
+ <Footer serverTime={serverTime} />
24
+ </div>
25
+ </div>
26
+ </div>
29
27
  );
30
28
  });
@@ -0,0 +1,18 @@
1
+ /*
2
+ * WHAT IS THIS FILE?
3
+ *
4
+ * The service-worker.ts file is used to have state of the art prefetching.
5
+ * https://qwik.builder.io/qwikcity/prefetching/overview/
6
+ *
7
+ * Qwik uses a service worker to speed up your site and reduce latency, ie, not used in the traditional way of offline.
8
+ * You can also use this file to add more functionality that runs in the service worker.
9
+ */
10
+ import { setupServiceWorker } from '@builder.io/qwik-city/service-worker';
11
+
12
+ setupServiceWorker();
13
+
14
+ addEventListener('install', () => self.skipWaiting());
15
+
16
+ addEventListener('activate', () => self.clients.claim());
17
+
18
+ declare const self: ServiceWorkerGlobalScope;
@@ -1,12 +1,13 @@
1
- import { component$ } from '@builder.io/qwik';
1
+ import { component$, useStylesScoped$ } from '@builder.io/qwik';
2
2
  import {
3
3
  type DocumentHead,
4
4
  routeLoader$,
5
- routeAction$,
5
+ globalAction$,
6
6
  zod$,
7
7
  z,
8
8
  Form,
9
9
  } from '@builder.io/qwik-city';
10
+ import style from './todolist.css?inline';
10
11
 
11
12
  interface ListItem {
12
13
  text: string;
@@ -18,7 +19,7 @@ export const useListLoader = routeLoader$(() => {
18
19
  return list;
19
20
  });
20
21
 
21
- export const useAddToListAction = routeAction$(
22
+ export const useAddToListAction = globalAction$(
22
23
  (item) => {
23
24
  list.push(item);
24
25
  return {
@@ -31,26 +32,43 @@ export const useAddToListAction = routeAction$(
31
32
  );
32
33
 
33
34
  export default component$(() => {
35
+ useStylesScoped$(style);
34
36
  const list = useListLoader();
35
37
  const action = useAddToListAction();
36
38
 
37
39
  return (
38
40
  <>
39
- <h1>Form Action TODO list</h1>
40
- <ul>
41
- {list.value.map((item) => (
42
- <li>{item.text}</li>
43
- ))}
44
- </ul>
45
- <Form action={action} spaReset>
46
- <input type="text" name="text" required />
47
- <button type="submit">Add item</button>
48
- </Form>
49
- <p>This little app works even when JavaScript is disabled.</p>
41
+ <div class="section">
42
+ <div class="container center">
43
+ <h1 class="hero">TODO List</h1>
44
+ </div>
45
+ </div>
46
+
47
+ <div class="section bright">
48
+ <div class="container center mh-300">
49
+ {(list.value.length && (
50
+ <ul class="list">
51
+ {list.value.map((item, index) => (
52
+ <li key={`items-${index}`}>{item.text}</li>
53
+ ))}
54
+ </ul>
55
+ )) || <span class="no-content">No items found</span>}
56
+ </div>
57
+ </div>
58
+
59
+ <div class="section">
60
+ <div class="container center">
61
+ <Form action={action} spaReset>
62
+ <input type="text" name="text" required /> <button type="submit">Add item</button>
63
+ </Form>
64
+
65
+ <p class="hint">PS: This little app works even when JavaScript is disabled.</p>
66
+ </div>
67
+ </div>
50
68
  </>
51
69
  );
52
70
  });
53
71
 
54
72
  export const head: DocumentHead = {
55
- title: 'Qwik To-Do',
73
+ title: 'Qwik Todo List',
56
74
  };
@@ -0,0 +1,13 @@
1
+ .list {
2
+ display: flex;
3
+ flex-direction: column;
4
+ gap: 20px;
5
+ }
6
+
7
+ .list li {
8
+ list-style: none;
9
+ }
10
+
11
+ .hint {
12
+ font-size: 0.8rem;
13
+ }
@@ -32,16 +32,16 @@
32
32
  "release": "np"
33
33
  },
34
34
  "devDependencies": {
35
- "@builder.io/qwik": "0.21.0",
36
- "@types/eslint": "8.21.1",
37
- "@types/node": "^18.14.0",
35
+ "@builder.io/qwik": "0.22.0",
36
+ "@types/eslint": "8.21.2",
37
+ "@types/node": "^18.15.3",
38
38
  "@types/node-fetch": "latest",
39
- "@typescript-eslint/eslint-plugin": "5.54.0",
40
- "@typescript-eslint/parser": "5.54.0",
39
+ "@typescript-eslint/eslint-plugin": "5.55.0",
40
+ "@typescript-eslint/parser": "5.55.0",
41
41
  "eslint-plugin-qwik": "latest",
42
- "eslint": "8.35.0",
42
+ "eslint": "8.36.0",
43
43
  "node-fetch": "3.3.0",
44
- "undici": "5.20.0",
44
+ "undici": "5.21.0",
45
45
  "np": "7.6.1",
46
46
  "prettier": "2.8.4",
47
47
  "typescript": "4.9.5",