create-qwik 0.0.109-0 → 0.0.110
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/index.cjs +63 -67
- package/package.json +1 -1
- package/starters/apps/base/README.md +46 -11
- package/starters/apps/base/package.json +11 -10
- package/starters/apps/base/public/favicon.svg +1 -0
- package/starters/apps/base/src/entry.dev.tsx +6 -4
- package/starters/apps/base/src/entry.preview.tsx +15 -2
- package/starters/apps/base/src/entry.ssr.tsx +12 -0
- package/starters/apps/base/src/global.css +7 -0
- package/starters/apps/base/src/routes/service-worker.ts +18 -0
- package/starters/apps/base/vite.config.ts +3 -1
- package/starters/apps/basic/package.json +9 -0
- package/starters/apps/basic/src/components/header/header.css +37 -0
- package/starters/apps/basic/src/components/header/header.tsx +34 -0
- package/starters/apps/basic/src/components/icons/qwik.tsx +32 -0
- package/starters/apps/basic/src/components/router-head/router-head.tsx +43 -0
- package/starters/apps/basic/src/global.css +125 -0
- package/starters/apps/basic/src/root.tsx +26 -0
- package/starters/apps/basic/src/routes/flower/flower.css +71 -0
- package/starters/apps/basic/src/routes/flower/index.tsx +54 -0
- package/starters/apps/basic/src/routes/index.tsx +133 -0
- package/starters/apps/basic/src/routes/layout.tsx +20 -0
- package/starters/apps/documentation-site/package.json +9 -0
- package/starters/apps/{qwik-city → documentation-site}/src/components/breadcrumbs/breadcrumbs.css +0 -0
- package/starters/apps/{qwik-city → documentation-site}/src/components/breadcrumbs/breadcrumbs.tsx +0 -0
- package/starters/apps/{qwik-city → documentation-site}/src/components/footer/footer.css +4 -4
- package/starters/apps/documentation-site/src/components/footer/footer.tsx +36 -0
- package/starters/apps/documentation-site/src/components/header/header.css +34 -0
- package/starters/apps/documentation-site/src/components/header/header.tsx +26 -0
- package/starters/apps/documentation-site/src/components/icons/qwik.tsx +20 -0
- package/starters/apps/{qwik-city → documentation-site}/src/components/menu/menu.css +0 -0
- package/starters/apps/{qwik-city → documentation-site}/src/components/menu/menu.tsx +1 -1
- package/starters/apps/documentation-site/src/components/on-this-page/on-this-page.css +33 -0
- package/starters/apps/documentation-site/src/components/on-this-page/on-this-page.tsx +62 -0
- package/starters/apps/documentation-site/src/components/router-head/router-head.tsx +43 -0
- package/starters/apps/documentation-site/src/global.css +66 -0
- package/starters/apps/documentation-site/src/root.tsx +26 -0
- package/starters/apps/documentation-site/src/routes/about-us/index.md +15 -0
- package/starters/apps/documentation-site/src/routes/docs/advanced/index.md +11 -0
- package/starters/apps/documentation-site/src/routes/docs/docs.css +22 -0
- package/starters/apps/documentation-site/src/routes/docs/getting-started/index.md +13 -0
- package/starters/apps/documentation-site/src/routes/docs/index.md +22 -0
- package/starters/apps/documentation-site/src/routes/docs/layout.tsx +25 -0
- package/starters/apps/documentation-site/src/routes/docs/menu.md +21 -0
- package/starters/apps/documentation-site/src/routes/index.tsx +137 -0
- package/starters/apps/{qwik-city → documentation-site}/src/routes/layout.tsx +4 -4
- package/starters/apps/library/package.json +2 -7
- package/starters/apps/base/public/favicon.ico +0 -0
- package/starters/apps/base/public/favicons/android-chrome-192x192.png +0 -0
- package/starters/apps/base/public/favicons/apple-touch-icon.png +0 -0
- package/starters/apps/base/public/favicons/favicon-16x16.png +0 -0
- package/starters/apps/base/public/favicons/favicon-32x32.png +0 -0
- package/starters/apps/base/public/favicons/favicon.svg +0 -13
- package/starters/apps/base/src/root.tsx +0 -14
- package/starters/apps/blank/dist/q-manifest.json +0 -105
- package/starters/apps/blank/package.json +0 -7
- package/starters/apps/blank/src/components/app/app.tsx +0 -54
- package/starters/apps/blank/src/components/logo/logo.tsx +0 -16
- package/starters/apps/blank/src/entry.preview.tsx +0 -18
- package/starters/apps/blank/src/entry.ssr.tsx +0 -15
- package/starters/apps/blank/src/global.css +0 -3
- package/starters/apps/blank/src/root.tsx +0 -18
- package/starters/apps/qwik-city/dist/favicons/android-chrome-192x192.png +0 -0
- package/starters/apps/qwik-city/dist/favicons/android-chrome-256x256.png +0 -0
- package/starters/apps/qwik-city/dist/favicons/apple-touch-icon.png +0 -0
- package/starters/apps/qwik-city/dist/favicons/favicon.svg +0 -1
- package/starters/apps/qwik-city/dist/logos/qwik-logo.svg +0 -1
- package/starters/apps/qwik-city/dist/logos/qwik.svg +0 -1
- package/starters/apps/qwik-city/dist/q-manifest.json +0 -904
- package/starters/apps/qwik-city/dist/service-worker.js +0 -167
- package/starters/apps/qwik-city/package.json +0 -8
- package/starters/apps/qwik-city/src/components/counter/counter.tsx +0 -19
- package/starters/apps/qwik-city/src/components/footer/footer.tsx +0 -27
- package/starters/apps/qwik-city/src/components/head/analytics.tsx +0 -13
- package/starters/apps/qwik-city/src/components/head/head.tsx +0 -34
- package/starters/apps/qwik-city/src/components/head/social.tsx +0 -10
- package/starters/apps/qwik-city/src/components/header/header.css +0 -46
- package/starters/apps/qwik-city/src/components/header/header.tsx +0 -36
- package/starters/apps/qwik-city/src/entry.ssr.tsx +0 -17
- package/starters/apps/qwik-city/src/global.css +0 -24
- package/starters/apps/qwik-city/src/root.tsx +0 -16
- package/starters/apps/qwik-city/src/routes/about-us/index.tsx +0 -17
- package/starters/apps/qwik-city/src/routes/api/[org]/[user].json/index.ts +0 -15
- package/starters/apps/qwik-city/src/routes/api/api.css +0 -14
- package/starters/apps/qwik-city/src/routes/api/data.json/index.ts +0 -9
- package/starters/apps/qwik-city/src/routes/api/index@api.tsx +0 -34
- package/starters/apps/qwik-city/src/routes/api/layout-api.tsx +0 -37
- package/starters/apps/qwik-city/src/routes/blog/[...slug]/index.tsx +0 -36
- package/starters/apps/qwik-city/src/routes/blog/index.md +0 -7
- package/starters/apps/qwik-city/src/routes/blog/layout.tsx +0 -21
- package/starters/apps/qwik-city/src/routes/dashboard/dashboard.css +0 -14
- package/starters/apps/qwik-city/src/routes/dashboard/index.tsx +0 -15
- package/starters/apps/qwik-city/src/routes/dashboard/layout!.tsx +0 -44
- package/starters/apps/qwik-city/src/routes/dashboard/profile/index.tsx +0 -15
- package/starters/apps/qwik-city/src/routes/dashboard/settings/index.tsx +0 -15
- package/starters/apps/qwik-city/src/routes/docs/[category]/[id]/index.tsx +0 -23
- package/starters/apps/qwik-city/src/routes/docs/docs.css +0 -10
- package/starters/apps/qwik-city/src/routes/docs/getting-started/index.md +0 -44
- package/starters/apps/qwik-city/src/routes/docs/index.tsx +0 -14
- package/starters/apps/qwik-city/src/routes/docs/layout!.tsx +0 -31
- package/starters/apps/qwik-city/src/routes/docs/menu.md +0 -11
- package/starters/apps/qwik-city/src/routes/docs/overview/index.md +0 -7
- package/starters/apps/qwik-city/src/routes/index.tsx +0 -16
- package/starters/apps/qwik-city/src/routes/products/[id]/index.tsx +0 -123
- package/starters/apps/qwik-city/src/routes/service-worker.ts +0 -10
- package/starters/apps/qwik-city/vite.config.ts +0 -10
|
@@ -1,167 +0,0 @@
|
|
|
1
|
-
/* Qwik Service Worker */
|
|
2
|
-
const appBundles=[["@qwik-city-entries.js",[40]],["@qwik-city-plan.js",[40]],["entry_____slug_.js",[40],["ka0hlr6QzZc"]],["entry__id_.js",[40],["lz5fUgqIg0k","Su1JqxAuf5Q"]],["entry_about_us.js",[40],["Hm2iCxmEwPU"]],["entry_Breadcrumbs.js",[13,19,40],["4iUgD00bac8","7RRY6XBONP8"]],["entry_dashboard.js",[40],["qNEEbvpCkDo"]],["entry_docs.js",[40],["HPWwM5ITvKw"]],["entry_footer.js",[40],["cj9ZVB0Fla8","fLHnZgqH9Ss"]],["entry_Head.js",[40],["62TTxKadIG8"]],["entry_header.js",[40],["EqiDdxC5oCg","q2ZiFPIhnRY"]],["entry_index_api.js",[40],["r1zOEK3uvrE","5wjtnwJM61o"]],["entry_layout.js",[19,40],["cP1MN6aKI1E","Z38JINctLvc"]],["entry_layout_.js",[19,40],["3vmOtZFNja8","IpEw2cQaLBs","0vFw6sjzoiI","sBSnbJkWlgw"]],["entry_layout_api.js",[40],["LchrSne39gg","NEVycXm2DbI"]],["entry_Menu.js",[40],["K1eRBSD0Gpc","6tTHmIfcOQ8"]],["entry_profile.js",[40],["xCyaa0wPF6s"]],["entry_routes.js",[40],["LqnNyU1Iy8c"]],["entry_settings.js",[40],["soEjIdhmYDQ"]],["header.js",[40]],["index.js",[40]],["index10.js",[40]],["index11.js",[40]],["index12.js",[40]],["index2.js",[40]],["index3.js",[40]],["index4.js",[40]],["index5.js",[40]],["index6.js",[40]],["index7.js",[40]],["index8.js",[40]],["index9.js",[40]],["index@api.js",[40]],["layout!.js",[40]],["layout!2.js",[40]],["layout-api.js",[40]],["layout.js",[40]],["layout2.js",[40]],["menu.js",[]],["root.js",[40]],["root2.js",[]],["service-worker.js",[]]];
|
|
3
|
-
const libraryBundleIds=[1];
|
|
4
|
-
const linkBundles=[[/^\/$/,[37,12,20,17]],[/^\/about-us\/?$/,[37,12,24,4]],[/^\/api\/?$/,[37,12,35,14,32,11]],[/^\/blog\/?$/,[37,12,36,25]],[/^\/dashboard\/?$/,[33,13,26,6]],[/^\/docs\/?$/,[34,13,27,7]],[/^\/api\/data\.json$/,[37,12]],[/^\/dashboard\/profile\/?$/,[33,13,28,16]],[/^\/dashboard\/settings\/?$/,[33,13,29,18]],[/^\/docs\/getting-started\/?$/,[34,13,30]],[/^\/docs\/overview\/?$/,[34,13,31]],[/^\/products\/([^/]+?)\/?$/,[37,12,21,3]],[/^\/api\/([^/]+?)\/([^/]+?)\.json$/,[37,12]],[/^\/docs\/([^/]+?)\/([^/]+?)\/?$/,[34,13,22,3]],[/^\/blog(?:\/(.*))?\/?$/,[37,12,36,23,2]]];
|
|
5
|
-
const qBuildCacheName = "QwikBuild";
|
|
6
|
-
const existingPrefetches = /* @__PURE__ */ new Set();
|
|
7
|
-
const awaitingRequests = /* @__PURE__ */ new Map();
|
|
8
|
-
const getCacheToDelete = (appBundles2, cachedUrls) => {
|
|
9
|
-
return cachedUrls.filter((url) => !appBundles2.some((appBundle) => url.endsWith(appBundle[0])));
|
|
10
|
-
};
|
|
11
|
-
const useCache = (request, response) => !!response && !hasNoCacheHeader(request) && !hasNoCacheHeader(response);
|
|
12
|
-
const hasNoCacheHeader = (r) => {
|
|
13
|
-
const cacheControl = r.headers.get("Cache-Control") || "";
|
|
14
|
-
return cacheControl.includes("no-cache") || cacheControl.includes("max-age=0");
|
|
15
|
-
};
|
|
16
|
-
const isAppBundleRequest = (appBundles2, requestPathname) => appBundles2.some((b) => requestPathname.endsWith("/" + b[0]));
|
|
17
|
-
const getAppBundleByName = (appBundles2, appBundleName) => appBundles2.find((b) => b[0] === appBundleName);
|
|
18
|
-
const getAppBundlesNamesFromIds = (appBundles2, bundleIds) => bundleIds.map((bundleId) => appBundles2[bundleId] ? appBundles2[bundleId][0] : null);
|
|
19
|
-
const cachedFetch = (cache, fetch2, awaitingRequests2, request) => new Promise((promiseResolve, promiseReject) => {
|
|
20
|
-
const url = request.url;
|
|
21
|
-
const awaitingRequestResolves = awaitingRequests2.get(url);
|
|
22
|
-
if (awaitingRequestResolves) {
|
|
23
|
-
awaitingRequestResolves.push([promiseResolve, promiseReject]);
|
|
24
|
-
} else {
|
|
25
|
-
const resolve = (response) => {
|
|
26
|
-
const resolves = awaitingRequests2.get(url);
|
|
27
|
-
if (resolves) {
|
|
28
|
-
awaitingRequests2.delete(url);
|
|
29
|
-
for (const [awaitingResolve] of resolves) {
|
|
30
|
-
awaitingResolve(response.clone());
|
|
31
|
-
}
|
|
32
|
-
} else {
|
|
33
|
-
promiseResolve(response.clone());
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
const reject = (msg) => {
|
|
37
|
-
const resolves = awaitingRequests2.get(url);
|
|
38
|
-
if (resolves) {
|
|
39
|
-
awaitingRequests2.delete(url);
|
|
40
|
-
for (const [_, awaitingReject] of resolves) {
|
|
41
|
-
awaitingReject(msg);
|
|
42
|
-
}
|
|
43
|
-
} else {
|
|
44
|
-
promiseReject(msg);
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
awaitingRequests2.set(url, [[promiseResolve, promiseReject]]);
|
|
48
|
-
cache.match(url).then((cachedResponse) => {
|
|
49
|
-
if (useCache(request, cachedResponse)) {
|
|
50
|
-
resolve(cachedResponse);
|
|
51
|
-
} else {
|
|
52
|
-
return fetch2(request).then((networkResponse) => {
|
|
53
|
-
return cache.put(url, networkResponse.clone()).then(() => {
|
|
54
|
-
resolve(networkResponse);
|
|
55
|
-
});
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
}).catch((err) => {
|
|
59
|
-
return cache.match(url).then((cachedResponse) => {
|
|
60
|
-
if (cachedResponse) {
|
|
61
|
-
resolve(cachedResponse);
|
|
62
|
-
} else {
|
|
63
|
-
reject(err);
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
|
-
const prefetchBundleNames = (appBundles2, qBuildCache, fetch2, baseUrl, prefetchAppBundleNames) => {
|
|
70
|
-
const prefetchAppBundle = (prefetchAppBundleName) => {
|
|
71
|
-
try {
|
|
72
|
-
const appBundle = getAppBundleByName(appBundles2, prefetchAppBundleName);
|
|
73
|
-
if (appBundle && !existingPrefetches.has(prefetchAppBundleName)) {
|
|
74
|
-
existingPrefetches.add(prefetchAppBundleName);
|
|
75
|
-
const importedBundleNames = getAppBundlesNamesFromIds(appBundles2, appBundle[1]);
|
|
76
|
-
const url = new URL(prefetchAppBundleName, baseUrl);
|
|
77
|
-
const request = new Request(url);
|
|
78
|
-
cachedFetch(qBuildCache, fetch2, awaitingRequests, request);
|
|
79
|
-
importedBundleNames.forEach(prefetchAppBundle);
|
|
80
|
-
}
|
|
81
|
-
} catch (e) {
|
|
82
|
-
console.error(e);
|
|
83
|
-
}
|
|
84
|
-
};
|
|
85
|
-
if (Array.isArray(prefetchAppBundleNames)) {
|
|
86
|
-
prefetchAppBundleNames.forEach(prefetchAppBundle);
|
|
87
|
-
}
|
|
88
|
-
};
|
|
89
|
-
const prefetchLinkBundles = (appBundles2, libraryBundleIds2, linkBundles2, qBuildCache, fetch2, baseUrl, linkPathnames) => {
|
|
90
|
-
try {
|
|
91
|
-
prefetchBundleNames(appBundles2, qBuildCache, fetch2, baseUrl, getAppBundlesNamesFromIds(appBundles2, libraryBundleIds2));
|
|
92
|
-
} catch (e) {
|
|
93
|
-
console.error(e);
|
|
94
|
-
}
|
|
95
|
-
for (const linkPathname of linkPathnames) {
|
|
96
|
-
try {
|
|
97
|
-
for (const linkBundle of linkBundles2) {
|
|
98
|
-
const [route, linkBundleIds] = linkBundle;
|
|
99
|
-
console;
|
|
100
|
-
if (route.test(linkPathname)) {
|
|
101
|
-
prefetchBundleNames(appBundles2, qBuildCache, fetch2, baseUrl, getAppBundlesNamesFromIds(appBundles2, linkBundleIds));
|
|
102
|
-
break;
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
} catch (e) {
|
|
106
|
-
console.error(e);
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
};
|
|
110
|
-
const prefetchWaterfall = (appBundles2, qBuildCache, fetch2, requestedBuildUrl) => {
|
|
111
|
-
try {
|
|
112
|
-
const segments = requestedBuildUrl.href.split("/");
|
|
113
|
-
const requestedBundleName = segments[segments.length - 1];
|
|
114
|
-
segments[segments.length - 1] = "";
|
|
115
|
-
const baseUrl = new URL(segments.join("/"));
|
|
116
|
-
prefetchBundleNames(appBundles2, qBuildCache, fetch2, baseUrl, [requestedBundleName]);
|
|
117
|
-
} catch (e) {
|
|
118
|
-
console.error(e);
|
|
119
|
-
}
|
|
120
|
-
};
|
|
121
|
-
const setupServiceWorkerScope = (swScope, appBundles2, libraryBundleIds2, linkBundles2) => {
|
|
122
|
-
swScope.addEventListener("fetch", (ev) => {
|
|
123
|
-
const request = ev.request;
|
|
124
|
-
if (request.method === "GET") {
|
|
125
|
-
const url = new URL(request.url);
|
|
126
|
-
if (isAppBundleRequest(appBundles2, url.pathname)) {
|
|
127
|
-
const nativeFetch = swScope.fetch.bind(swScope);
|
|
128
|
-
ev.respondWith(swScope.caches.open(qBuildCacheName).then((qBuildCache) => {
|
|
129
|
-
prefetchWaterfall(appBundles2, qBuildCache, nativeFetch, url);
|
|
130
|
-
return cachedFetch(qBuildCache, nativeFetch, awaitingRequests, request);
|
|
131
|
-
}));
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
});
|
|
135
|
-
swScope.addEventListener("message", async ({ data }) => {
|
|
136
|
-
if (data.type === "qprefetch" && typeof data.base === "string") {
|
|
137
|
-
const nativeFetch = swScope.fetch.bind(swScope);
|
|
138
|
-
const qBuildCache = await swScope.caches.open(qBuildCacheName);
|
|
139
|
-
const baseUrl = new URL(data.base, swScope.origin);
|
|
140
|
-
if (Array.isArray(data.links)) {
|
|
141
|
-
prefetchLinkBundles(appBundles2, libraryBundleIds2, linkBundles2, qBuildCache, fetch, baseUrl, data.links);
|
|
142
|
-
}
|
|
143
|
-
if (Array.isArray(data.bundles)) {
|
|
144
|
-
prefetchBundleNames(appBundles2, qBuildCache, nativeFetch, baseUrl, data.bundles);
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
});
|
|
148
|
-
swScope.addEventListener("activate", async () => {
|
|
149
|
-
try {
|
|
150
|
-
const qBuildCache = await swScope.caches.open(qBuildCacheName);
|
|
151
|
-
const cachedRequestKeys = await qBuildCache.keys();
|
|
152
|
-
const cachedUrls = cachedRequestKeys.map((r) => r.url);
|
|
153
|
-
const cachedRequestsToDelete = getCacheToDelete(appBundles2, cachedUrls);
|
|
154
|
-
await Promise.all(cachedRequestsToDelete.map((r) => qBuildCache.delete(r)));
|
|
155
|
-
} catch (e) {
|
|
156
|
-
console.error(e);
|
|
157
|
-
}
|
|
158
|
-
});
|
|
159
|
-
};
|
|
160
|
-
const setupServiceWorker = () => {
|
|
161
|
-
if (typeof self !== "undefined" && typeof appBundles !== "undefined") {
|
|
162
|
-
setupServiceWorkerScope(self, appBundles, libraryBundleIds, linkBundles);
|
|
163
|
-
}
|
|
164
|
-
};
|
|
165
|
-
setupServiceWorker();
|
|
166
|
-
addEventListener("install", () => self.skipWaiting());
|
|
167
|
-
addEventListener("activate", () => self.clients.claim());
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { component$, useStyles$, useStore } from '@builder.io/qwik';
|
|
2
|
-
|
|
3
|
-
export const Counter = component$(() => {
|
|
4
|
-
const store = useStore({ count: 0 });
|
|
5
|
-
useStyles$(`
|
|
6
|
-
.counter {
|
|
7
|
-
border: 3px solid #1474ff;
|
|
8
|
-
padding: 10px;
|
|
9
|
-
border-radius: 10px;
|
|
10
|
-
color: #1474ff;
|
|
11
|
-
}
|
|
12
|
-
`);
|
|
13
|
-
|
|
14
|
-
return (
|
|
15
|
-
<button class="counter" type="button" onClick$={() => store.count++}>
|
|
16
|
-
Increment {store.count}
|
|
17
|
-
</button>
|
|
18
|
-
);
|
|
19
|
-
});
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { component$, useStyles$ } from '@builder.io/qwik';
|
|
2
|
-
import styles from './footer.css?inline';
|
|
3
|
-
|
|
4
|
-
export default component$(() => {
|
|
5
|
-
useStyles$(styles);
|
|
6
|
-
|
|
7
|
-
return (
|
|
8
|
-
<footer>
|
|
9
|
-
<ul>
|
|
10
|
-
<li>
|
|
11
|
-
<a href="/blog">Blog</a>
|
|
12
|
-
</li>
|
|
13
|
-
<li>
|
|
14
|
-
<a href="/docs">Docs</a>
|
|
15
|
-
</li>
|
|
16
|
-
<li>
|
|
17
|
-
<a href="/about-us">About Us</a>
|
|
18
|
-
</li>
|
|
19
|
-
<li>
|
|
20
|
-
<a class="footer-home" href="/">
|
|
21
|
-
Home
|
|
22
|
-
</a>
|
|
23
|
-
</li>
|
|
24
|
-
</ul>
|
|
25
|
-
</footer>
|
|
26
|
-
);
|
|
27
|
-
});
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { RouteLocation } from '@builder.io/qwik-city';
|
|
2
|
-
|
|
3
|
-
interface AnalyticsProps {
|
|
4
|
-
loc: RouteLocation;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export const Analytics = ({ loc }: AnalyticsProps) => {
|
|
8
|
-
return (
|
|
9
|
-
<>
|
|
10
|
-
<script dangerouslySetInnerHTML={`console.log("🧨 Analytics! ${loc.pathname}");`} />
|
|
11
|
-
</>
|
|
12
|
-
);
|
|
13
|
-
};
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { component$ } from '@builder.io/qwik';
|
|
2
|
-
import { useDocumentHead, useLocation } from '@builder.io/qwik-city';
|
|
3
|
-
import { Analytics } from './analytics';
|
|
4
|
-
import { Social } from './social';
|
|
5
|
-
|
|
6
|
-
export const Head = component$(() => {
|
|
7
|
-
const head = useDocumentHead();
|
|
8
|
-
const loc = useLocation();
|
|
9
|
-
|
|
10
|
-
return (
|
|
11
|
-
<head>
|
|
12
|
-
<meta charSet="utf-8" />
|
|
13
|
-
|
|
14
|
-
<title>{head.title ? `${head.title} - Qwik` : `Qwik`}</title>
|
|
15
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
16
|
-
<link rel="canonical" href={loc.href} />
|
|
17
|
-
|
|
18
|
-
{head.meta.map((m) => (
|
|
19
|
-
<meta {...m} />
|
|
20
|
-
))}
|
|
21
|
-
|
|
22
|
-
{head.links.map((l) => (
|
|
23
|
-
<link {...l} />
|
|
24
|
-
))}
|
|
25
|
-
|
|
26
|
-
{head.styles.map((s) => (
|
|
27
|
-
<style {...s.props} dangerouslySetInnerHTML={s.style} />
|
|
28
|
-
))}
|
|
29
|
-
|
|
30
|
-
<Social />
|
|
31
|
-
<Analytics loc={loc} />
|
|
32
|
-
</head>
|
|
33
|
-
);
|
|
34
|
-
});
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export const Social = () => {
|
|
2
|
-
return (
|
|
3
|
-
<>
|
|
4
|
-
<meta property="og:site_name" content="Qwik" />
|
|
5
|
-
<meta name="twitter:card" content="summary_large_image" />
|
|
6
|
-
<meta name="twitter:site" content="@QwikDev" />
|
|
7
|
-
<meta name="twitter:title" content="Qwik" />
|
|
8
|
-
</>
|
|
9
|
-
);
|
|
10
|
-
};
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
header {
|
|
2
|
-
background-color: #0093ee;
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
header .header-inner {
|
|
6
|
-
display: grid;
|
|
7
|
-
grid-template-columns: 1fr auto auto;
|
|
8
|
-
padding: 10px;
|
|
9
|
-
max-width: 800px;
|
|
10
|
-
margin: 0 auto;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
.full-screen header .header-inner {
|
|
14
|
-
max-width: 100%;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
header a {
|
|
18
|
-
color: white;
|
|
19
|
-
text-decoration: none;
|
|
20
|
-
padding: 4px 8px;
|
|
21
|
-
margin-right: 5px;
|
|
22
|
-
border-radius: 4px;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
header a:hover {
|
|
26
|
-
background-color: #ffffff50;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
header .active {
|
|
30
|
-
background-color: #ffffff30;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
.theme-toggle {
|
|
34
|
-
background: transparent;
|
|
35
|
-
width: 30px;
|
|
36
|
-
border: none;
|
|
37
|
-
cursor: pointer;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
.theme-light .theme-toggle::before {
|
|
41
|
-
content: '☽';
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
.theme-dark .theme-toggle::before {
|
|
45
|
-
content: '☀';
|
|
46
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { component$, useStyles$ } from '@builder.io/qwik';
|
|
2
|
-
import { useLocation } from '@builder.io/qwik-city';
|
|
3
|
-
import styles from './header.css?inline';
|
|
4
|
-
|
|
5
|
-
export default component$(() => {
|
|
6
|
-
useStyles$(styles);
|
|
7
|
-
|
|
8
|
-
const pathname = useLocation().pathname;
|
|
9
|
-
|
|
10
|
-
return (
|
|
11
|
-
<header>
|
|
12
|
-
<div class="header-inner">
|
|
13
|
-
<section class="logo">
|
|
14
|
-
<a href="/">Qwik City 🏙</a>
|
|
15
|
-
</section>
|
|
16
|
-
<nav>
|
|
17
|
-
<a href="/blog" class={{ active: pathname.startsWith('/blog') }}>
|
|
18
|
-
Blog
|
|
19
|
-
</a>
|
|
20
|
-
<a href="/docs" class={{ active: pathname.startsWith('/docs') }}>
|
|
21
|
-
Docs
|
|
22
|
-
</a>
|
|
23
|
-
<a href="/api" class={{ active: pathname.startsWith('/api') }}>
|
|
24
|
-
API
|
|
25
|
-
</a>
|
|
26
|
-
<a href="/products/hat" class={{ active: pathname.startsWith('/products') }}>
|
|
27
|
-
Products
|
|
28
|
-
</a>
|
|
29
|
-
<a href="/about-us" class={{ active: pathname.startsWith('/about-us') }}>
|
|
30
|
-
About Us
|
|
31
|
-
</a>
|
|
32
|
-
</nav>
|
|
33
|
-
</div>
|
|
34
|
-
</header>
|
|
35
|
-
);
|
|
36
|
-
});
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { renderToStream, RenderToStreamOptions } from '@builder.io/qwik/server';
|
|
2
|
-
import { manifest } from '@qwik-client-manifest';
|
|
3
|
-
import Root from './root';
|
|
4
|
-
|
|
5
|
-
export default function (opts: RenderToStreamOptions) {
|
|
6
|
-
return renderToStream(<Root />, {
|
|
7
|
-
manifest,
|
|
8
|
-
...opts,
|
|
9
|
-
prefetchStrategy: {
|
|
10
|
-
implementation: {
|
|
11
|
-
linkInsert: null,
|
|
12
|
-
workerFetchInsert: null,
|
|
13
|
-
prefetchEvent: 'always',
|
|
14
|
-
},
|
|
15
|
-
},
|
|
16
|
-
});
|
|
17
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
body {
|
|
2
|
-
margin: 0;
|
|
3
|
-
padding: 0;
|
|
4
|
-
font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue',
|
|
5
|
-
sans-serif;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
main {
|
|
9
|
-
padding: 10px 20px;
|
|
10
|
-
max-width: 800px;
|
|
11
|
-
margin: 0 auto;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
.full-screen main {
|
|
15
|
-
max-width: 100%;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
a {
|
|
19
|
-
color: #006eb3;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
a:hover {
|
|
23
|
-
text-decoration: none;
|
|
24
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { QwikCity, RouterOutlet, ServiceWorkerRegister } from '@builder.io/qwik-city';
|
|
2
|
-
import { Head } from './components/head/head';
|
|
3
|
-
|
|
4
|
-
import './global.css';
|
|
5
|
-
|
|
6
|
-
export default function () {
|
|
7
|
-
return (
|
|
8
|
-
<QwikCity>
|
|
9
|
-
<Head />
|
|
10
|
-
<body lang="en">
|
|
11
|
-
<RouterOutlet />
|
|
12
|
-
<ServiceWorkerRegister />
|
|
13
|
-
</body>
|
|
14
|
-
</QwikCity>
|
|
15
|
-
);
|
|
16
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { component$ } from '@builder.io/qwik';
|
|
2
|
-
import type { DocumentHead } from '@builder.io/qwik-city';
|
|
3
|
-
|
|
4
|
-
export default component$(() => {
|
|
5
|
-
return (
|
|
6
|
-
<div>
|
|
7
|
-
<h1>About Us</h1>
|
|
8
|
-
<p>
|
|
9
|
-
<a href="/">Home</a>
|
|
10
|
-
</p>
|
|
11
|
-
</div>
|
|
12
|
-
);
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
export const head: DocumentHead = {
|
|
16
|
-
title: 'About Us',
|
|
17
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { RequestHandler } from '@builder.io/qwik-city';
|
|
2
|
-
|
|
3
|
-
export const onGet: RequestHandler = ({ request, params }) => {
|
|
4
|
-
return {
|
|
5
|
-
timestamp: Date.now(),
|
|
6
|
-
method: request.method,
|
|
7
|
-
url: request.url,
|
|
8
|
-
params,
|
|
9
|
-
};
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export const onPost: RequestHandler = async ({ request, response }) => {
|
|
13
|
-
response.headers.set('Content-Type', 'text/plain');
|
|
14
|
-
return `HTTP Method: ${request.method}`;
|
|
15
|
-
};
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { component$, useClientEffect$, useStore } from '@builder.io/qwik';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Uses named layout `foo`
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
export default component$(() => {
|
|
8
|
-
const store = useStore({ timestamp: '' });
|
|
9
|
-
|
|
10
|
-
useClientEffect$(async () => {
|
|
11
|
-
const url = `/api/builder.io/oss.json`;
|
|
12
|
-
const rsp = await fetch(url);
|
|
13
|
-
const data: any = await rsp.json();
|
|
14
|
-
|
|
15
|
-
store.timestamp = data.timestamp;
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
return (
|
|
19
|
-
<div>
|
|
20
|
-
<h1>Qwik City Test API!</h1>
|
|
21
|
-
|
|
22
|
-
<ul>
|
|
23
|
-
<li>
|
|
24
|
-
<a href="/api/builder.io/oss.json">/api/[org]/[user].json</a>
|
|
25
|
-
</li>
|
|
26
|
-
<li>
|
|
27
|
-
<a href="/api/data.json">/api/data.json</a>
|
|
28
|
-
</li>
|
|
29
|
-
</ul>
|
|
30
|
-
|
|
31
|
-
<p>Timestamp: {store.timestamp}</p>
|
|
32
|
-
</div>
|
|
33
|
-
);
|
|
34
|
-
});
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { component$, Slot, useStyles$ } from '@builder.io/qwik';
|
|
2
|
-
import type { DocumentHead } from '@builder.io/qwik-city';
|
|
3
|
-
import styles from './api.css?inline';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Named layout `foo`
|
|
7
|
-
* Any index files named `index@foo.tsx` will use this layout
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
export default component$(() => {
|
|
11
|
-
useStyles$(styles);
|
|
12
|
-
|
|
13
|
-
return (
|
|
14
|
-
<div class="api">
|
|
15
|
-
<aside class="api-menu">
|
|
16
|
-
<h2>API</h2>
|
|
17
|
-
<ul>
|
|
18
|
-
<li>
|
|
19
|
-
<a href="/api/builder.io/oss.json">Org/User</a>
|
|
20
|
-
</li>
|
|
21
|
-
<li>
|
|
22
|
-
<a href="/api/data.json">Data</a>
|
|
23
|
-
</li>
|
|
24
|
-
</ul>
|
|
25
|
-
</aside>
|
|
26
|
-
<section class="api-content">
|
|
27
|
-
<Slot />
|
|
28
|
-
</section>
|
|
29
|
-
</div>
|
|
30
|
-
);
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
export const head: DocumentHead = ({ pathname }) => {
|
|
34
|
-
return {
|
|
35
|
-
title: `API: ${pathname}`,
|
|
36
|
-
};
|
|
37
|
-
};
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { component$, Resource } from '@builder.io/qwik';
|
|
2
|
-
import { useEndpoint, DocumentHead, RequestHandler } from '@builder.io/qwik-city';
|
|
3
|
-
|
|
4
|
-
export default component$(() => {
|
|
5
|
-
const resource = useEndpoint<typeof onGet>();
|
|
6
|
-
|
|
7
|
-
return (
|
|
8
|
-
<div>
|
|
9
|
-
<Resource
|
|
10
|
-
value={resource}
|
|
11
|
-
onResolved={(blog) => (
|
|
12
|
-
<>
|
|
13
|
-
<h1>{blog.blogTitle}</h1>
|
|
14
|
-
<p>{blog.blogContent}</p>
|
|
15
|
-
</>
|
|
16
|
-
)}
|
|
17
|
-
/>
|
|
18
|
-
</div>
|
|
19
|
-
);
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
export const onGet: RequestHandler<EndpointData> = async ({ params, url }) => {
|
|
23
|
-
return {
|
|
24
|
-
blogTitle: `Blog: ${params.slug}`,
|
|
25
|
-
blogContent: `${params.slug}, ${url.pathname}`,
|
|
26
|
-
};
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
export const head: DocumentHead<EndpointData> = ({ data }) => {
|
|
30
|
-
return { title: data?.blogTitle };
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
export interface EndpointData {
|
|
34
|
-
blogTitle: string;
|
|
35
|
-
blogContent: string;
|
|
36
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { component$, Slot } from '@builder.io/qwik';
|
|
2
|
-
|
|
3
|
-
export default component$(() => {
|
|
4
|
-
return (
|
|
5
|
-
<div>
|
|
6
|
-
<section class="blog-content">
|
|
7
|
-
<Slot />
|
|
8
|
-
</section>
|
|
9
|
-
<aside class="blog-menu">
|
|
10
|
-
<ul>
|
|
11
|
-
<li>
|
|
12
|
-
<a href="/blog/what-is-resumability">What Is Resumability?</a>
|
|
13
|
-
</li>
|
|
14
|
-
<li>
|
|
15
|
-
<a href="/blog/serializing-props">Serializing Props</a>
|
|
16
|
-
</li>
|
|
17
|
-
</ul>
|
|
18
|
-
</aside>
|
|
19
|
-
</div>
|
|
20
|
-
);
|
|
21
|
-
});
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { component$ } from '@builder.io/qwik';
|
|
2
|
-
import type { DocumentHead } from '@builder.io/qwik-city';
|
|
3
|
-
|
|
4
|
-
export default component$(() => {
|
|
5
|
-
return (
|
|
6
|
-
<div>
|
|
7
|
-
<h1>Dashboard</h1>
|
|
8
|
-
<p>Welcome to the dashboard.</p>
|
|
9
|
-
</div>
|
|
10
|
-
);
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
export const head: DocumentHead = {
|
|
14
|
-
title: 'Home',
|
|
15
|
-
};
|