create-qwik 0.0.34 → 0.0.36-dev20220707204814
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/create-qwik +45 -45
- package/index.js +9 -9
- package/package.json +2 -2
- package/starters/apps/base/package.json +9 -9
- package/starters/apps/base/src/entry.dev.tsx +1 -1
- package/starters/apps/{library → base}/src/entry.ssr.tsx +1 -1
- package/starters/apps/base/src/root.tsx +1 -1
- package/starters/apps/blank/package.json +18 -0
- package/starters/apps/{starter → blank}/src/components/app/app.tsx +0 -0
- package/starters/apps/{starter → blank}/src/components/logo/logo.tsx +0 -0
- package/starters/apps/blank/src/entry.express.tsx +52 -0
- package/starters/apps/{todo → blank}/src/entry.ssr.tsx +1 -1
- package/starters/apps/{starter-partytown → blank}/src/global.css +0 -0
- package/starters/apps/{starter → blank}/src/root.tsx +1 -1
- package/starters/apps/library/package.json +0 -1
- package/starters/apps/library/src/root.tsx +1 -1
- package/starters/apps/qwik-city/package.json +4 -2
- package/starters/apps/qwik-city/src/components/footer/footer.css +21 -4
- package/starters/apps/qwik-city/src/components/footer/footer.tsx +23 -9
- package/starters/apps/qwik-city/src/components/head/analytics.tsx +13 -0
- package/starters/apps/qwik-city/src/components/head/head.tsx +37 -0
- package/starters/apps/qwik-city/src/components/head/social.tsx +10 -0
- package/starters/apps/qwik-city/src/components/header/header.css +34 -2
- package/starters/apps/qwik-city/src/components/header/header.tsx +41 -13
- package/starters/apps/qwik-city/src/components/menu/menu.css +3 -0
- package/starters/apps/qwik-city/src/components/menu/menu.tsx +39 -0
- package/starters/apps/qwik-city/src/root.tsx +8 -22
- package/starters/apps/qwik-city/src/routes/__auth/_layout.tsx +17 -0
- package/starters/apps/qwik-city/src/routes/__auth/sign-in.tsx +29 -0
- package/starters/apps/qwik-city/src/routes/__auth/sign-up.tsx +33 -0
- package/starters/apps/qwik-city/src/routes/_layout.tsx +15 -0
- package/starters/apps/qwik-city/src/routes/about-us.tsx +21 -0
- package/starters/apps/qwik-city/src/routes/api/[org]/[user].json/index.ts +42 -0
- package/starters/apps/qwik-city/src/routes/api/_layout-foo/api.css +14 -0
- package/starters/apps/qwik-city/src/routes/api/_layout-foo/index.tsx +40 -0
- package/starters/apps/qwik-city/src/routes/api/data.json.ts +21 -0
- package/starters/apps/qwik-city/src/routes/api/index@foo.tsx +36 -0
- package/starters/apps/qwik-city/src/routes/blog/[...slug].tsx +13 -0
- package/starters/apps/qwik-city/src/routes/blog/_layout/index.tsx +21 -0
- package/starters/apps/qwik-city/src/routes/blog/index.md +7 -0
- package/starters/apps/qwik-city/src/routes/dashboard/_layout-dashboard.tsx +18 -0
- package/starters/apps/qwik-city/src/routes/dashboard/index.tsx +9 -0
- package/starters/apps/qwik-city/src/routes/dashboard/profile@dashboard.tsx +10 -0
- package/starters/apps/qwik-city/src/routes/dashboard/settings/index@dashboard.tsx +10 -0
- package/starters/apps/qwik-city/src/routes/docs/[category]/[id]/index.tsx +15 -0
- package/starters/apps/qwik-city/src/routes/docs/_layout/docs.css +9 -0
- package/starters/apps/qwik-city/src/routes/docs/_layout/index.tsx +25 -0
- package/starters/apps/qwik-city/src/routes/docs/_menu.md +9 -0
- package/starters/apps/qwik-city/src/{pages/index.mdx → routes/docs/getting-started.mdx} +1 -1
- package/starters/apps/qwik-city/src/routes/docs/index.tsx +18 -0
- package/starters/apps/qwik-city/src/routes/docs/introduction/index.md +7 -0
- package/starters/apps/qwik-city/src/routes/index.tsx +11 -0
- package/starters/apps/qwik-city/tsconfig.json +24 -0
- package/starters/apps/qwik-city/vite.config.ts +3 -7
- package/starters/features/prettier/package.json +1 -1
- package/starters/features/react/package.json +26 -0
- package/starters/{apps/qwik-city → features/react}/src/entry.ssr.tsx +3 -2
- package/starters/features/react/src/react/app.tsx +14 -0
- package/starters/servers/cloudflare-pages/functions/[[path]].ts +1 -1
- package/starters/servers/cloudflare-pages/src/entry.cloudflare.tsx +2 -2
- package/starters/servers/express/src/entry.express.tsx +5 -38
- package/starters/servers/netlify/package.json +1 -1
- package/starters/apps/qwik-city/src/components/app/app.tsx +0 -13
- package/starters/apps/qwik-city/src/components/page/page.tsx +0 -24
- package/starters/apps/qwik-city/src/components/sidebar/sidebar.css +0 -12
- package/starters/apps/qwik-city/src/components/sidebar/sidebar.tsx +0 -54
- package/starters/apps/qwik-city/src/entry.dev.tsx +0 -13
- package/starters/apps/qwik-city/src/layouts/default/default.css +0 -171
- package/starters/apps/qwik-city/src/layouts/default/default.tsx +0 -24
- package/starters/apps/qwik-city/src/layouts/not-found/not-found.css +0 -0
- package/starters/apps/qwik-city/src/layouts/not-found/not-found.tsx +0 -18
- package/starters/apps/qwik-city/src/pages/INDEX +0 -16
- package/starters/apps/qwik-city/src/pages/blog/progressive.mdx +0 -70
- package/starters/apps/qwik-city/src/pages/blog/reactivity.mdx +0 -155
- package/starters/apps/qwik-city/src/pages/blog/resumable.mdx +0 -107
- package/starters/apps/starter/package.json +0 -10
- package/starters/apps/starter/src/entry.ssr.tsx +0 -15
- package/starters/apps/starter/src/global.css +0 -3
- package/starters/apps/starter-partytown/package.json +0 -13
- package/starters/apps/starter-partytown/src/components/app/app.tsx +0 -89
- package/starters/apps/starter-partytown/src/entry.ssr.tsx +0 -16
- package/starters/apps/starter-partytown/src/root.tsx +0 -36
- package/starters/apps/todo/package.json +0 -7
- package/starters/apps/todo/src/components/app/app.tsx +0 -39
- package/starters/apps/todo/src/components/app/base.css +0 -141
- package/starters/apps/todo/src/components/app/index.css +0 -378
- package/starters/apps/todo/src/components/body/body.tsx +0 -16
- package/starters/apps/todo/src/components/footer/footer.tsx +0 -63
- package/starters/apps/todo/src/components/header/header.tsx +0 -40
- package/starters/apps/todo/src/components/item/item.tsx +0 -76
- package/starters/apps/todo/src/root.tsx +0 -15
- package/starters/apps/todo/src/state/state.ts +0 -29
package/index.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";/**
|
|
2
2
|
* @license
|
|
3
3
|
* create-qwik
|
|
4
4
|
* Copyright Builder.io, Inc. All Rights Reserved.
|
|
5
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6
6
|
* found in the LICENSE file at https://github.com/BuilderIO/qwik/blob/main/LICENSE
|
|
7
7
|
*/
|
|
8
|
-
var
|
|
9
|
-
`)}function
|
|
8
|
+
var I=Object.defineProperty;var q=Object.getOwnPropertyDescriptor;var G=Object.getOwnPropertyNames;var F=Object.prototype.hasOwnProperty;var M=(e,t)=>{for(var r in t)I(e,r,{get:t[r],enumerable:!0})},Q=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of G(t))!F.call(e,o)&&o!==r&&I(e,o,{get:()=>t[o],enumerable:!(n=q(t,o))||n.enumerable});return e};var L=e=>Q(I({},"__esModule",{value:!0}),e);var W={};M(W,{generateStarter:()=>T,getStarters:()=>_});module.exports=L(W);var y=require("fs"),v=require("path");var p=require("fs"),k=require("path");function g(e,t,r){let n=(0,p.readdirSync)(e);for(let o of n){let s=o==="gitignore"?".gitignore":o,i=(0,k.join)(e,o),d=(0,k.join)(t,s),l=(0,p.statSync)(i);if(l.isDirectory())(0,p.mkdirSync)(d,{recursive:!0}),g(i,d,r);else if(l.isFile())if(r.length>0&&[".json",".toml",".md",".html","vite.config.ts"].some(f=>i.endsWith(f))){let f=(0,p.readFileSync)(i,"utf8");for(let m of r)f=f.replace(m[0],m[1]);(0,p.writeFileSync)(d,f)}else(0,p.copyFileSync)(i,d)}}function u(e){let t=(0,k.join)(e,"package.json");return JSON.parse((0,p.readFileSync)(t,"utf-8"))}function P(e,t){let r=(0,k.join)(e,"package.json");(0,p.writeFileSync)(r,JSON.stringify(t,null,2)+`
|
|
9
|
+
`)}function x(e){return e.toLocaleLowerCase().split("-").map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")}function R(e){return e.toLocaleLowerCase().replace(/ /g,"-")}function D(e,t){["scripts","dependencies","devDependencies"].forEach(n=>{U(e,t,n)})}function U(e,t,r){if(t[r]){e[r]?Object.assign(e[r],{...t[r]}):e[r]={...t[r]};let n={},o=Object.keys(e[r]).sort();for(let s of o)n[s]=e[r][s];e[r]=n}}async function T(e){if(!O(e.projectName))throw new Error("Missing project name");if(!O(e.appId))throw new Error("Missing starter id");if(!O(e.outDir))throw new Error("Missing outDir");(0,y.existsSync)(e.outDir)||(0,y.mkdirSync)(e.outDir,{recursive:!0});let t={projectName:e.projectName,appId:e.appId,serverId:e.serverId,outDir:e.outDir},r=await _(),n=r.apps.find(i=>i.id===e.appId),o=r.servers.find(i=>i.id===e.serverId),s=r.features.filter(i=>e.featureIds.includes(i.id));if(n)B(r,t,n,o,s);else throw new Error(`Invalid starter id "${e.appId}".`);return t}function B(e,t,r,n,o){var J;let s=[[/\bqwik-project-name\b/g,t.projectName]],i=e.apps.find(a=>a.id==="base");if(!i)throw new Error("Unable to find base app.");if(n){let c=(J=u(n.dir).__qwik__)==null?void 0:J.vite;s.push([/\/\* VITE_IMPORTS \*\//g,(c==null?void 0:c.VITE_IMPORTS)??""]),s.push([/\/\* VITE_CONFIG \*\//g,(c==null?void 0:c.VITE_CONFIG)??""]),s.push([/\/\* VITE_QWIK \*\//g,(c==null?void 0:c.VITE_QWIK)??""]),s.push([/\/\* VITE_PLUGINS \*\//g,(c==null?void 0:c.VITE_PLUGINS)??""])}g(i.dir,t.outDir,s),g(r.dir,t.outDir,s);let d=u(i.dir),l=u(r.dir);D(d,l);let w=["version","private","main","module","qwik","types","exports","files"];for(let a of w)l[a]!==void 0&&(d[a]=l[a]);let f=i.readme.trim()+`
|
|
10
10
|
|
|
11
|
-
`,m=[r.description,"Vite.js tooling."];if(n){g(n.dir,t.outDir,s);let a=u(n.dir);
|
|
11
|
+
`,m=[r.description,"Vite.js tooling."];if(n){g(n.dir,t.outDir,s);let a=u(n.dir);D(d,a),a.description&&m.push(a.description),n.readme&&(f+=n.readme.trim()+`
|
|
12
12
|
|
|
13
|
-
`)}for(let a of o){g(a.dir,t.outDir,s);let c=u(a.dir);
|
|
13
|
+
`)}for(let a of o){g(a.dir,t.outDir,s);let c=u(a.dir);D(d,c),c.description&&m.push(c.description),a.readme&&(f+=a.readme.trim()+`
|
|
14
14
|
|
|
15
|
-
`)}d.name=
|
|
16
|
-
`).trim(),
|
|
17
|
-
`);(0,y.writeFileSync)(
|
|
18
|
-
`);let
|
|
15
|
+
`)}d.name=R(t.projectName),d.description=m.join(" ").trim();let E=(0,v.join)(t.outDir,"README.md"),C=m.map(a=>`- ${a}`).join(`
|
|
16
|
+
`).trim(),b=[`# Qwik ${t.projectName} \u26A1\uFE0F`,"",C,"",f.trim(),"","--------------------","","## Related","","- [Qwik Docs](https://qwik.builder.io/)","- [Qwik Github](https://github.com/BuilderIO/qwik)","- [@QwikDev](https://twitter.com/QwikDev)","- [Discord](https://qwik.builder.io/chat)","- [Vite](https://vitejs.dev/)","- [Partytown](https://partytown.builder.io/)","- [Mitosis](https://github.com/BuilderIO/mitosis)","- [Builder.io](https://www.builder.io/)"].join(`
|
|
17
|
+
`);(0,y.writeFileSync)(E,b.trim()+`
|
|
18
|
+
`);let V=A(d);P(t.outDir,V)}function A(e){e={...e};let t={name:e.name,version:e.version,description:e.description,scripts:e.scripts,dependencies:e.dependencies,devDependencies:e.devDependencies};Object.keys(t).forEach(n=>{delete e[n]}),delete e.__qwik__;let r=Object.keys(e).sort();for(let n of r)t[n]=e[n];return t}function O(e){return typeof e=="string"&&e.trim().length>0}var S=require("fs"),h=require("path");var j=null;async function _(){return j==null&&(j=K((0,h.join)(__dirname,"starters"))),j}function K(e){return{apps:N(e,"apps"),servers:N(e,"servers"),features:N(e,"features")}}function N(e,t){let r=(0,h.join)(e,t);return(0,S.readdirSync)(r).filter(o=>(0,S.statSync)((0,h.join)(r,o)).isDirectory()).map(o=>{var w,f,m;let s=(0,h.join)(r,o),i=u(s),d=null;try{d=(0,S.readFileSync)((0,h.join)(s,"README.md"),"utf-8")}catch{}return{id:o,name:x(o),description:i.description??"",readme:d,dir:s,selectServer:((w=i==null?void 0:i.__qwik__)==null?void 0:w.selectServer)??!1,priority:((f=i==null?void 0:i.__qwik__)==null?void 0:f.priority)??0,featureOptions:((m=i==null?void 0:i.__qwik__)==null?void 0:m.featureOptions)??[]}}).sort((o,s)=>o.priority>s.priority?-1:o.priority<s.priority?1:o.name<s.name?-1:o.name>s.name?1:0)}0&&(module.exports={generateStarter,getStarters});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-qwik",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.36-dev20220707204814",
|
|
4
4
|
"description": "Interactive CLI and API for generating Qwik projects.",
|
|
5
5
|
"bin": "create-qwik",
|
|
6
6
|
"main": "index.js",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@types/prompts": "2.0.14",
|
|
29
|
-
"kleur": "4.1.
|
|
29
|
+
"kleur": "4.1.5",
|
|
30
30
|
"prompts": "2.4.2"
|
|
31
31
|
},
|
|
32
32
|
"engines": {
|
|
@@ -11,19 +11,19 @@
|
|
|
11
11
|
"dev.debug": "node --inspect-brk node_modules/vite/bin/vite.js --mode ssr",
|
|
12
12
|
"start": "npm run dev",
|
|
13
13
|
"lint": "eslint \"src/**/*.ts*\"",
|
|
14
|
-
"typecheck": "tsc --noEmit"
|
|
14
|
+
"typecheck": "tsc --incremental --noEmit"
|
|
15
15
|
},
|
|
16
16
|
"devDependencies": {
|
|
17
|
-
"@builder.io/qwik": "0.0.
|
|
18
|
-
"@types/eslint": "8.4.
|
|
17
|
+
"@builder.io/qwik": "0.0.36-dev20220707204814",
|
|
18
|
+
"@types/eslint": "8.4.5",
|
|
19
19
|
"@types/node": "latest",
|
|
20
|
-
"@typescript-eslint/eslint-plugin": "5.
|
|
21
|
-
"@typescript-eslint/parser": "5.
|
|
22
|
-
"eslint-plugin-qwik": "0.0.
|
|
23
|
-
"eslint": "8.
|
|
20
|
+
"@typescript-eslint/eslint-plugin": "5.30.0",
|
|
21
|
+
"@typescript-eslint/parser": "5.30.0",
|
|
22
|
+
"eslint-plugin-qwik": "0.0.36-dev20220707204814",
|
|
23
|
+
"eslint": "8.18.0",
|
|
24
24
|
"node-fetch": "2.6.7",
|
|
25
|
-
"typescript": "4.7.
|
|
26
|
-
"vite": "2.9.
|
|
25
|
+
"typescript": "4.7.4",
|
|
26
|
+
"vite": "2.9.13"
|
|
27
27
|
},
|
|
28
28
|
"homepage": "https://qwik.builder.io/",
|
|
29
29
|
"private": true,
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"description": "Blank Qwik starter app.",
|
|
3
|
+
"scripts": {
|
|
4
|
+
"build.ssr": "vite build --ssr src/entry.express.tsx",
|
|
5
|
+
"serve": "node server/entry.express.js"
|
|
6
|
+
},
|
|
7
|
+
"devDependencies": {
|
|
8
|
+
"@types/express": "4.17.13",
|
|
9
|
+
"express": "4.17.3"
|
|
10
|
+
},
|
|
11
|
+
"__qwik__": {
|
|
12
|
+
"priority": 0,
|
|
13
|
+
"featureOptions": [
|
|
14
|
+
"prettier",
|
|
15
|
+
"tailwindcss"
|
|
16
|
+
]
|
|
17
|
+
}
|
|
18
|
+
}
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import express from 'express';
|
|
2
|
+
import { join } from 'path';
|
|
3
|
+
import { render } from './entry.ssr';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Create an express server
|
|
7
|
+
* https://expressjs.com/
|
|
8
|
+
*/
|
|
9
|
+
const app = express();
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Serve static client build files,
|
|
13
|
+
* hashed filenames, immutable cache-control
|
|
14
|
+
*/
|
|
15
|
+
app.use(
|
|
16
|
+
'/build',
|
|
17
|
+
express.static(join(__dirname, '..', 'dist', 'build'), {
|
|
18
|
+
immutable: true,
|
|
19
|
+
maxAge: '1y',
|
|
20
|
+
})
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Serve static public files at the root
|
|
25
|
+
*/
|
|
26
|
+
app.use(express.static(join(__dirname, '..', 'dist'), { index: false }));
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Server-Side Render Qwik application
|
|
30
|
+
*/
|
|
31
|
+
app.get('/*', async (req, res, next) => {
|
|
32
|
+
try {
|
|
33
|
+
// Render the Root component to a string
|
|
34
|
+
const result = await render({
|
|
35
|
+
url: req.url,
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
// respond with SSR'd HTML
|
|
39
|
+
res.send(result.html);
|
|
40
|
+
} catch (e) {
|
|
41
|
+
// Error while server-side rendering
|
|
42
|
+
next(e);
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Start the express server
|
|
48
|
+
*/
|
|
49
|
+
app.listen(8080, () => {
|
|
50
|
+
/* eslint-disable */
|
|
51
|
+
console.log(`http://localhost:8080/`);
|
|
52
|
+
});
|
|
File without changes
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
{
|
|
2
|
-
"description": "
|
|
2
|
+
"description": "File based routing and MDX support",
|
|
3
3
|
"__qwik__": {
|
|
4
4
|
"priority": 1,
|
|
5
|
+
"selectServer": true,
|
|
5
6
|
"featureOptions": [
|
|
6
7
|
"prettier",
|
|
7
8
|
"tailwindcss"
|
|
8
9
|
]
|
|
9
10
|
},
|
|
10
11
|
"devDependencies": {
|
|
11
|
-
"@builder.io/qwik-city": "0.0.
|
|
12
|
+
"@builder.io/qwik-city": "0.0.16",
|
|
13
|
+
"vite-tsconfig-paths": "3.5.0"
|
|
12
14
|
}
|
|
13
15
|
}
|
|
@@ -1,5 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
footer {
|
|
2
|
+
border-top: 1px solid #949494;
|
|
3
|
+
margin-top: 40px;
|
|
4
|
+
padding: 20px;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
footer a {
|
|
8
|
+
color: #949494;
|
|
9
|
+
font-size: 12px;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
footer ul {
|
|
13
|
+
list-style: none;
|
|
14
|
+
margin: 0;
|
|
15
|
+
padding: 0;
|
|
16
|
+
text-align: center;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
footer li {
|
|
20
|
+
display: inline-block;
|
|
21
|
+
padding: 4px 12px;
|
|
5
22
|
}
|
|
@@ -1,19 +1,33 @@
|
|
|
1
|
-
import { component$, Host,
|
|
1
|
+
import { component$, Host, useStyles$ } from '@builder.io/qwik';
|
|
2
2
|
import styles from './footer.css?inline';
|
|
3
3
|
|
|
4
|
-
export
|
|
4
|
+
export default component$(
|
|
5
5
|
() => {
|
|
6
|
-
|
|
6
|
+
useStyles$(styles);
|
|
7
7
|
|
|
8
8
|
return (
|
|
9
9
|
<Host>
|
|
10
|
-
<
|
|
11
|
-
<
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
<ul>
|
|
11
|
+
<li>
|
|
12
|
+
<a href="/blog">Blog</a>
|
|
13
|
+
</li>
|
|
14
|
+
<li>
|
|
15
|
+
<a href="/docs">Docs</a>
|
|
16
|
+
</li>
|
|
17
|
+
<li>
|
|
18
|
+
<a href="/about-us">About Us</a>
|
|
19
|
+
</li>
|
|
20
|
+
<li>
|
|
21
|
+
<a href="/sign-in">Sign In</a>
|
|
22
|
+
</li>
|
|
23
|
+
<li>
|
|
24
|
+
<a href="/">Home</a>
|
|
25
|
+
</li>
|
|
26
|
+
</ul>
|
|
15
27
|
</Host>
|
|
16
28
|
);
|
|
17
29
|
},
|
|
18
|
-
{
|
|
30
|
+
{
|
|
31
|
+
tagName: 'footer',
|
|
32
|
+
}
|
|
19
33
|
);
|
|
@@ -0,0 +1,13 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
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
|
+
() => {
|
|
8
|
+
const head = useDocumentHead();
|
|
9
|
+
const loc = useLocation();
|
|
10
|
+
|
|
11
|
+
return (
|
|
12
|
+
<>
|
|
13
|
+
<meta charSet="utf-8" />
|
|
14
|
+
|
|
15
|
+
<title>{head.title ? `${head.title} - Qwik` : `Qwik`}</title>
|
|
16
|
+
|
|
17
|
+
<link rel="canonical" href={loc.href} />
|
|
18
|
+
|
|
19
|
+
{head.meta.map((m) => (
|
|
20
|
+
<meta {...m} />
|
|
21
|
+
))}
|
|
22
|
+
|
|
23
|
+
{head.links.map((l) => (
|
|
24
|
+
<link {...l} />
|
|
25
|
+
))}
|
|
26
|
+
|
|
27
|
+
{head.styles.map((s) => (
|
|
28
|
+
<style {...s.props} dangerouslySetInnerHTML={s.style} />
|
|
29
|
+
))}
|
|
30
|
+
|
|
31
|
+
<Social />
|
|
32
|
+
<Analytics loc={loc} />
|
|
33
|
+
</>
|
|
34
|
+
);
|
|
35
|
+
},
|
|
36
|
+
{ tagName: 'head' }
|
|
37
|
+
);
|
|
@@ -0,0 +1,10 @@
|
|
|
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,5 +1,37 @@
|
|
|
1
1
|
header {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
display: grid;
|
|
3
|
+
grid-template-columns: 1fr auto auto;
|
|
4
|
+
padding: 10px;
|
|
5
|
+
background-color: #0093ee;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
header a {
|
|
4
9
|
color: white;
|
|
10
|
+
text-decoration: none;
|
|
11
|
+
padding: 4px 8px;
|
|
12
|
+
margin-right: 5px;
|
|
13
|
+
border-radius: 4px;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
header a:hover {
|
|
17
|
+
background-color: #ffffff50;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
header .active {
|
|
21
|
+
background-color: #ffffff30;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.theme-toggle {
|
|
25
|
+
background: transparent;
|
|
26
|
+
width: 30px;
|
|
27
|
+
border: none;
|
|
28
|
+
cursor: pointer;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.theme-light .theme-toggle::before {
|
|
32
|
+
content: '☽';
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.theme-dark .theme-toggle::before {
|
|
36
|
+
content: '☀';
|
|
5
37
|
}
|
|
@@ -1,21 +1,49 @@
|
|
|
1
|
-
import { component$, Host,
|
|
1
|
+
import { component$, Host, useStyles$ } from '@builder.io/qwik';
|
|
2
|
+
import { useLocation } from '@builder.io/qwik-city';
|
|
2
3
|
import styles from './header.css?inline';
|
|
3
4
|
|
|
4
|
-
export
|
|
5
|
-
() => {
|
|
6
|
-
|
|
5
|
+
export default component$(
|
|
6
|
+
(props: { fullWidth?: boolean }) => {
|
|
7
|
+
useStyles$(styles);
|
|
8
|
+
|
|
9
|
+
const pathname = useLocation().pathname;
|
|
7
10
|
|
|
8
11
|
return (
|
|
9
|
-
<Host>
|
|
10
|
-
<
|
|
11
|
-
<
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
<Host class={{ 'full-width': !!props.fullWidth }}>
|
|
13
|
+
<section>
|
|
14
|
+
<a href="/">Qwik City 🏙</a>
|
|
15
|
+
</section>
|
|
16
|
+
<nav>
|
|
17
|
+
<a href="/blog" class={{ active: pathname === '/blog' }}>
|
|
18
|
+
Blog
|
|
19
|
+
</a>
|
|
20
|
+
<a href="/docs" class={{ active: pathname === '/docs' }}>
|
|
21
|
+
Docs
|
|
22
|
+
</a>
|
|
23
|
+
<a href="/api" class={{ active: pathname === '/api' }}>
|
|
24
|
+
API
|
|
25
|
+
</a>
|
|
26
|
+
<a href="/about-us" class={{ active: pathname === '/about-us' }}>
|
|
27
|
+
About Us
|
|
28
|
+
</a>
|
|
29
|
+
<a href="/sign-in" class={{ active: pathname === '/sign-in' }}>
|
|
30
|
+
Sign In
|
|
31
|
+
</a>
|
|
32
|
+
</nav>
|
|
33
|
+
{/* <button
|
|
34
|
+
class="theme-toggle"
|
|
35
|
+
onClick$={() => {
|
|
36
|
+
if (themeCtx.theme === 'light') {
|
|
37
|
+
themeCtx.theme = 'dark';
|
|
38
|
+
} else {
|
|
39
|
+
themeCtx.theme = 'light';
|
|
40
|
+
}
|
|
41
|
+
}}
|
|
42
|
+
/> */}
|
|
17
43
|
</Host>
|
|
18
44
|
);
|
|
19
45
|
},
|
|
20
|
-
{
|
|
46
|
+
{
|
|
47
|
+
tagName: 'header',
|
|
48
|
+
}
|
|
21
49
|
);
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { component$, Host, useScopedStyles$ } from '@builder.io/qwik';
|
|
2
|
+
import { useContentMenu, useLocation } from '@builder.io/qwik-city';
|
|
3
|
+
import styles from './menu.css?inline';
|
|
4
|
+
|
|
5
|
+
export const Menu = component$(
|
|
6
|
+
() => {
|
|
7
|
+
useScopedStyles$(styles);
|
|
8
|
+
|
|
9
|
+
const menu = useContentMenu();
|
|
10
|
+
const loc = useLocation();
|
|
11
|
+
|
|
12
|
+
return (
|
|
13
|
+
<Host class="menu">
|
|
14
|
+
{menu
|
|
15
|
+
? menu.items?.map((item) => (
|
|
16
|
+
<>
|
|
17
|
+
<h5>{item.text}</h5>
|
|
18
|
+
<ul>
|
|
19
|
+
{item.items?.map((item) => (
|
|
20
|
+
<li>
|
|
21
|
+
<a
|
|
22
|
+
href={item.href}
|
|
23
|
+
class={{
|
|
24
|
+
'is-active': loc.pathname === item.href,
|
|
25
|
+
}}
|
|
26
|
+
>
|
|
27
|
+
{item.text}
|
|
28
|
+
</a>
|
|
29
|
+
</li>
|
|
30
|
+
))}
|
|
31
|
+
</ul>
|
|
32
|
+
</>
|
|
33
|
+
))
|
|
34
|
+
: null}
|
|
35
|
+
</Host>
|
|
36
|
+
);
|
|
37
|
+
},
|
|
38
|
+
{ tagName: 'aside' }
|
|
39
|
+
);
|
|
@@ -1,30 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Content, Html } from '@builder.io/qwik-city';
|
|
2
|
+
import cityPlan from '@qwik-city-plan';
|
|
3
|
+
import { Head } from './components/head/head';
|
|
2
4
|
|
|
3
5
|
import './global.css';
|
|
4
6
|
|
|
5
|
-
export
|
|
7
|
+
export default () => {
|
|
6
8
|
return (
|
|
7
|
-
<
|
|
8
|
-
<
|
|
9
|
-
<Head />
|
|
10
|
-
</head>
|
|
9
|
+
<Html lang="en" cityPlan={cityPlan}>
|
|
10
|
+
<Head />
|
|
11
11
|
<body>
|
|
12
|
-
<
|
|
12
|
+
<Content />
|
|
13
13
|
</body>
|
|
14
|
-
</
|
|
14
|
+
</Html>
|
|
15
15
|
);
|
|
16
16
|
};
|
|
17
|
-
|
|
18
|
-
const Head = () => (
|
|
19
|
-
<>
|
|
20
|
-
<meta charSet="utf-8" />
|
|
21
|
-
|
|
22
|
-
<title>QwikCity Example</title>
|
|
23
|
-
<meta name="viewport" content="width=device-width" />
|
|
24
|
-
|
|
25
|
-
<link rel="apple-touch-icon" sizes="180x180" href="/favicons/apple-touch-icon.png" />
|
|
26
|
-
<link rel="icon" href="/favicons/favicon.svg" type="image/svg+xml" />
|
|
27
|
-
|
|
28
|
-
<meta property="og:locale" content="en_US" />
|
|
29
|
-
</>
|
|
30
|
-
);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { component$, Host, Slot } from '@builder.io/qwik';
|
|
2
|
+
|
|
3
|
+
export default component$(() => {
|
|
4
|
+
return (
|
|
5
|
+
<Host>
|
|
6
|
+
<section>
|
|
7
|
+
<Slot />
|
|
8
|
+
</section>
|
|
9
|
+
<aside>
|
|
10
|
+
<p>Account Help</p>
|
|
11
|
+
<ul>
|
|
12
|
+
<li>Forgot password</li>
|
|
13
|
+
</ul>
|
|
14
|
+
</aside>
|
|
15
|
+
</Host>
|
|
16
|
+
);
|
|
17
|
+
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { component$, Host } from '@builder.io/qwik';
|
|
2
|
+
import type { HeadComponent } from '@builder.io/qwik-city';
|
|
3
|
+
|
|
4
|
+
export default component$(() => {
|
|
5
|
+
return (
|
|
6
|
+
<Host>
|
|
7
|
+
<h1>Sign In</h1>
|
|
8
|
+
<form>
|
|
9
|
+
<label>
|
|
10
|
+
<span>Username</span>
|
|
11
|
+
<input type="text" />
|
|
12
|
+
</label>
|
|
13
|
+
<label>
|
|
14
|
+
<span>Password</span>
|
|
15
|
+
<input type="password" />
|
|
16
|
+
</label>
|
|
17
|
+
<button>Log In</button>
|
|
18
|
+
</form>
|
|
19
|
+
</Host>
|
|
20
|
+
);
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
export const head: HeadComponent = () => {
|
|
24
|
+
return (
|
|
25
|
+
<>
|
|
26
|
+
<title>Sign In</title>
|
|
27
|
+
</>
|
|
28
|
+
);
|
|
29
|
+
};
|