@qwik.dev/core 0.0.0 → 2.0.0-alpha.0

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 (258) hide show
  1. package/LICENSE +22 -0
  2. package/bindings/qwik.linux-x64-gnu.node +0 -0
  3. package/bindings/qwik.wasm.cjs +484 -0
  4. package/bindings/qwik.wasm.mjs +477 -0
  5. package/bindings/qwik_wasm_bg.wasm +0 -0
  6. package/build.d.ts +2 -0
  7. package/dist/build/index.cjs +35 -0
  8. package/dist/build/index.cjs.map +7 -0
  9. package/dist/build/index.d.ts +22 -0
  10. package/dist/build/index.dev.cjs +37 -0
  11. package/dist/build/index.dev.cjs.map +7 -0
  12. package/dist/build/index.dev.mjs +12 -0
  13. package/dist/build/index.dev.mjs.map +7 -0
  14. package/dist/build/index.mjs +12 -0
  15. package/dist/build/index.mjs.map +7 -0
  16. package/dist/build/index.prod.cjs +37 -0
  17. package/dist/build/index.prod.cjs.map +7 -0
  18. package/dist/build/index.prod.mjs +12 -0
  19. package/dist/build/index.prod.mjs.map +7 -0
  20. package/dist/build/package.json +8 -0
  21. package/dist/cli.cjs +4890 -0
  22. package/dist/core-internal.d.ts +3895 -0
  23. package/dist/core.cjs +10923 -0
  24. package/dist/core.cjs.map +1 -0
  25. package/dist/core.min.mjs +1 -0
  26. package/dist/core.mjs +10819 -0
  27. package/dist/core.mjs.map +1 -0
  28. package/dist/core.prod.cjs +5181 -0
  29. package/dist/core.prod.mjs +6025 -0
  30. package/dist/index.d.ts +2 -0
  31. package/dist/insights/index.d.ts +1 -0
  32. package/dist/insights/index.qwik.cjs +751 -0
  33. package/dist/insights/index.qwik.mjs +751 -0
  34. package/dist/insights/insights.d.ts +59 -0
  35. package/dist/insights/vite/index.cjs +82 -0
  36. package/dist/insights/vite/index.d.ts +1 -0
  37. package/dist/insights/vite/index.mjs +55 -0
  38. package/dist/insights/vite/insights-plugin.d.ts +10 -0
  39. package/dist/jsx-runtime/index.d.ts +2 -0
  40. package/dist/jsx-runtime.d.ts +2 -0
  41. package/dist/loader/index.cjs +4 -0
  42. package/dist/loader/index.d.ts +2 -0
  43. package/dist/loader/index.mjs +3 -0
  44. package/dist/loader/package.json +8 -0
  45. package/dist/optimizer.cjs +9145 -0
  46. package/dist/optimizer.d.ts +707 -0
  47. package/dist/optimizer.mjs +9709 -0
  48. package/dist/prefetch/index.cjs +4 -0
  49. package/dist/prefetch/index.d.ts +2 -0
  50. package/dist/prefetch/index.mjs +3 -0
  51. package/dist/prefetch/package.json +8 -0
  52. package/dist/qwik-prefetch.debug.js +244 -0
  53. package/dist/qwik-prefetch.js +1 -0
  54. package/dist/qwikloader.debug.js +228 -0
  55. package/dist/qwikloader.js +3 -0
  56. package/dist/server-modules.d.ts +38 -0
  57. package/dist/server.cjs +8942 -0
  58. package/dist/server.d.ts +404 -0
  59. package/dist/server.mjs +8877 -0
  60. package/dist/starters/adapters/aws-lambda/.eslintignore +2 -0
  61. package/dist/starters/adapters/aws-lambda/.prettierignore +2 -0
  62. package/dist/starters/adapters/aws-lambda/adapters/aws-lambda/vite.config.mts +21 -0
  63. package/dist/starters/adapters/aws-lambda/gitignore +2 -0
  64. package/dist/starters/adapters/aws-lambda/package.json +23 -0
  65. package/dist/starters/adapters/aws-lambda/serverless.yml +31 -0
  66. package/dist/starters/adapters/aws-lambda/src/entry_aws-lambda.tsx +32 -0
  67. package/dist/starters/adapters/azure-swa/README.md +13 -0
  68. package/dist/starters/adapters/azure-swa/adapters/azure-swa/vite.config.mts +23 -0
  69. package/dist/starters/adapters/azure-swa/azure-functions/host.json +20 -0
  70. package/dist/starters/adapters/azure-swa/gitignore +3 -0
  71. package/dist/starters/adapters/azure-swa/package.json +28 -0
  72. package/dist/starters/adapters/azure-swa/public/staticwebapp.config.json +23 -0
  73. package/dist/starters/adapters/azure-swa/src/entry.azure-swa.tsx +22 -0
  74. package/dist/starters/adapters/azure-swa/swa-cli.config.json +11 -0
  75. package/dist/starters/adapters/bun/README.md +9 -0
  76. package/dist/starters/adapters/bun/adapters/bun/vite.config.mts +28 -0
  77. package/dist/starters/adapters/bun/package.json +27 -0
  78. package/dist/starters/adapters/bun/src/entry.bun.ts +46 -0
  79. package/dist/starters/adapters/cloud-run/Dockerfile +24 -0
  80. package/dist/starters/adapters/cloud-run/README.md +7 -0
  81. package/dist/starters/adapters/cloud-run/adapters/cloud-run/vite.config.mts +15 -0
  82. package/dist/starters/adapters/cloud-run/package.json +24 -0
  83. package/dist/starters/adapters/cloud-run/src/entry.cloud-run.tsx +96 -0
  84. package/dist/starters/adapters/cloudflare-pages/README.md +46 -0
  85. package/dist/starters/adapters/cloudflare-pages/adapters/cloudflare-pages/vite.config.mts +15 -0
  86. package/dist/starters/adapters/cloudflare-pages/gitignore +2 -0
  87. package/dist/starters/adapters/cloudflare-pages/package.json +28 -0
  88. package/dist/starters/adapters/cloudflare-pages/public/_headers +9 -0
  89. package/dist/starters/adapters/cloudflare-pages/public/_redirects +1 -0
  90. package/dist/starters/adapters/cloudflare-pages/src/entry.cloudflare-pages.tsx +24 -0
  91. package/dist/starters/adapters/deno/README.md +9 -0
  92. package/dist/starters/adapters/deno/adapters/deno/vite.config.mts +23 -0
  93. package/dist/starters/adapters/deno/package.json +24 -0
  94. package/dist/starters/adapters/deno/src/entry.deno.ts +45 -0
  95. package/dist/starters/adapters/express/README.md +9 -0
  96. package/dist/starters/adapters/express/adapters/express/vite.config.mts +15 -0
  97. package/dist/starters/adapters/express/package.json +33 -0
  98. package/dist/starters/adapters/express/src/entry.express.tsx +70 -0
  99. package/dist/starters/adapters/fastify/README.md +9 -0
  100. package/dist/starters/adapters/fastify/adapters/fastify/vite.config.mts +15 -0
  101. package/dist/starters/adapters/fastify/package.json +33 -0
  102. package/dist/starters/adapters/fastify/src/entry.fastify.tsx +48 -0
  103. package/dist/starters/adapters/fastify/src/plugins/fastify-qwik.ts +42 -0
  104. package/dist/starters/adapters/firebase/.eslintignore +1 -0
  105. package/dist/starters/adapters/firebase/.prettierignore +1 -0
  106. package/dist/starters/adapters/firebase/adapters/firebase/vite.config.mts +21 -0
  107. package/dist/starters/adapters/firebase/firebase.json +24 -0
  108. package/dist/starters/adapters/firebase/functions/.gitkeep +0 -0
  109. package/dist/starters/adapters/firebase/functions/index.js +5 -0
  110. package/dist/starters/adapters/firebase/functions/package.json +25 -0
  111. package/dist/starters/adapters/firebase/gitignore +3 -0
  112. package/dist/starters/adapters/firebase/package.json +24 -0
  113. package/dist/starters/adapters/firebase/src/entry-firebase.tsx +22 -0
  114. package/dist/starters/adapters/netlify-edge/README.md +64 -0
  115. package/dist/starters/adapters/netlify-edge/adapters/netlify-edge/vite.config.mts +16 -0
  116. package/dist/starters/adapters/netlify-edge/gitignore +2 -0
  117. package/dist/starters/adapters/netlify-edge/netlify.toml +3 -0
  118. package/dist/starters/adapters/netlify-edge/package.json +29 -0
  119. package/dist/starters/adapters/netlify-edge/public/_headers +2 -0
  120. package/dist/starters/adapters/netlify-edge/src/entry.netlify-edge.tsx +22 -0
  121. package/dist/starters/adapters/node-server/README.md +12 -0
  122. package/dist/starters/adapters/node-server/adapters/node-server/vite.config.mts +15 -0
  123. package/dist/starters/adapters/node-server/package.json +23 -0
  124. package/dist/starters/adapters/node-server/src/entry.node-server.tsx +39 -0
  125. package/dist/starters/adapters/static/README.md +5 -0
  126. package/dist/starters/adapters/static/adapters/static/vite.config.mts +19 -0
  127. package/dist/starters/adapters/static/package.json +19 -0
  128. package/dist/starters/adapters/vercel-edge/README.md +43 -0
  129. package/dist/starters/adapters/vercel-edge/adapters/vercel-edge/vite.config.mts +16 -0
  130. package/dist/starters/adapters/vercel-edge/gitignore +2 -0
  131. package/dist/starters/adapters/vercel-edge/package.json +28 -0
  132. package/dist/starters/adapters/vercel-edge/src/entry.vercel-edge.tsx +22 -0
  133. package/dist/starters/adapters/vercel-edge/vercel.json +22 -0
  134. package/dist/starters/features/auth/package.json +20 -0
  135. package/dist/starters/features/auth/src/routes/plugin@auth.ts +8 -0
  136. package/dist/starters/features/bootstrap/package.json +33 -0
  137. package/dist/starters/features/bootstrap/src/components/bootstrap/alert.tsx +8 -0
  138. package/dist/starters/features/bootstrap/src/components/bootstrap/button.tsx +8 -0
  139. package/dist/starters/features/bootstrap/src/components/bootstrap/index.ts +4 -0
  140. package/dist/starters/features/bootstrap/src/components/bootstrap/navbar.tsx +44 -0
  141. package/dist/starters/features/bootstrap/src/components/bootstrap/spinner.tsx +13 -0
  142. package/dist/starters/features/bootstrap/src/constants/data.ts +10 -0
  143. package/dist/starters/features/bootstrap/src/models/bootstrap.ts +8 -0
  144. package/dist/starters/features/bootstrap/src/routes/bootstrap/alerts/index.tsx +28 -0
  145. package/dist/starters/features/bootstrap/src/routes/bootstrap/buttons/index.tsx +32 -0
  146. package/dist/starters/features/bootstrap/src/routes/bootstrap/index.tsx +32 -0
  147. package/dist/starters/features/bootstrap/src/routes/bootstrap/layout.tsx +36 -0
  148. package/dist/starters/features/bootstrap/src/routes/bootstrap/spinners/index.tsx +45 -0
  149. package/dist/starters/features/builder.io/README.md +15 -0
  150. package/dist/starters/features/builder.io/package.json +27 -0
  151. package/dist/starters/features/builder.io/src/components/builder-registry.ts +25 -0
  152. package/dist/starters/features/builder.io/src/components/counter/counter.module.css +23 -0
  153. package/dist/starters/features/builder.io/src/components/counter/counter.tsx +81 -0
  154. package/dist/starters/features/builder.io/src/components/gauge/gauge.module.css +27 -0
  155. package/dist/starters/features/builder.io/src/components/gauge/index.tsx +38 -0
  156. package/dist/starters/features/builder.io/src/routes/[...index]/index.tsx +44 -0
  157. package/dist/starters/features/cypress/cypress/fixtures/example.json +5 -0
  158. package/dist/starters/features/cypress/cypress/support/commands.ts +37 -0
  159. package/dist/starters/features/cypress/cypress/support/component-index.html +12 -0
  160. package/dist/starters/features/cypress/cypress/support/component.ts +42 -0
  161. package/dist/starters/features/cypress/cypress/tsconfig.cy.json +17 -0
  162. package/dist/starters/features/cypress/cypress.config.ts +10 -0
  163. package/dist/starters/features/cypress/cypress.d.ts +14 -0
  164. package/dist/starters/features/cypress/package.json +28 -0
  165. package/dist/starters/features/cypress/src/components/example/example.cy.tsx +18 -0
  166. package/dist/starters/features/cypress/src/components/example/example.tsx +17 -0
  167. package/dist/starters/features/drizzle/drizzle/db/.gitkeep +0 -0
  168. package/dist/starters/features/drizzle/drizzle/migrations/.gitkeep +0 -0
  169. package/dist/starters/features/drizzle/drizzle/schema.ts +24 -0
  170. package/dist/starters/features/drizzle/drizzle.config.ts +9 -0
  171. package/dist/starters/features/drizzle/package.json +41 -0
  172. package/dist/starters/features/drizzle/src/routes/create/index.tsx +42 -0
  173. package/dist/starters/features/drizzle/src/routes/users/[userId]/index.tsx +36 -0
  174. package/dist/starters/features/drizzle/src/routes/users/index.tsx +30 -0
  175. package/dist/starters/features/leaflet-map/package.json +30 -0
  176. package/dist/starters/features/leaflet-map/src/components/leaflet-map/index.tsx +60 -0
  177. package/dist/starters/features/leaflet-map/src/helpers/boundary-box.tsx +6 -0
  178. package/dist/starters/features/leaflet-map/src/models/location.ts +9 -0
  179. package/dist/starters/features/leaflet-map/src/models/map.ts +7 -0
  180. package/dist/starters/features/leaflet-map/src/routes/basic-map/index.tsx +25 -0
  181. package/dist/starters/features/localize/package.json +37 -0
  182. package/dist/starters/features/localize/src/entry.ssr.tsx +32 -0
  183. package/dist/starters/features/localize/src/locales/message.en.json +8 -0
  184. package/dist/starters/features/localize/src/locales/message.it.json +8 -0
  185. package/dist/starters/features/localize/src/routes/[locale]/i18n-utils.ts +94 -0
  186. package/dist/starters/features/localize/src/routes/[locale]/index.tsx +52 -0
  187. package/dist/starters/features/localize/src/routes/[locale]/layout.tsx +12 -0
  188. package/dist/starters/features/orama/package.json +23 -0
  189. package/dist/starters/features/orama/src/orama/index.ts +41 -0
  190. package/dist/starters/features/orama/src/routes/orama/index.tsx +110 -0
  191. package/dist/starters/features/pandacss/.eslintignore +3 -0
  192. package/dist/starters/features/pandacss/.prettierignore +2 -0
  193. package/dist/starters/features/pandacss/gitignore +2 -0
  194. package/dist/starters/features/pandacss/package.json +31 -0
  195. package/dist/starters/features/pandacss/panda.config.ts +22 -0
  196. package/dist/starters/features/pandacss/postcss.config.js +5 -0
  197. package/dist/starters/features/pandacss/src/global.css +5 -0
  198. package/dist/starters/features/pandacss/src/routes/pandacss/index.tsx +18 -0
  199. package/dist/starters/features/partytown/package.json +41 -0
  200. package/dist/starters/features/partytown/src/components/partytown/partytown.tsx +19 -0
  201. package/dist/starters/features/playwright/package.json +18 -0
  202. package/dist/starters/features/playwright/playwright-report/index.html +22024 -0
  203. package/dist/starters/features/playwright/playwright.config.ts +40 -0
  204. package/dist/starters/features/playwright/tests/example.spec.ts +14 -0
  205. package/dist/starters/features/postcss/.vscode/settings.json +3 -0
  206. package/dist/starters/features/postcss/package.json +17 -0
  207. package/dist/starters/features/postcss/postcss.config.js +11 -0
  208. package/dist/starters/features/prisma/package.json +35 -0
  209. package/dist/starters/features/prisma/prisma/schema.prisma +17 -0
  210. package/dist/starters/features/prisma/src/routes/create/index.tsx +42 -0
  211. package/dist/starters/features/prisma/src/routes/users/[userId]/index.tsx +31 -0
  212. package/dist/starters/features/prisma/src/routes/users/index.tsx +27 -0
  213. package/dist/starters/features/react/package.json +41 -0
  214. package/dist/starters/features/react/src/integrations/react/mui.tsx +60 -0
  215. package/dist/starters/features/react/src/routes/react/index.tsx +45 -0
  216. package/dist/starters/features/storybook/.storybook/main.ts +22 -0
  217. package/dist/starters/features/storybook/.storybook/preview-head.html +3 -0
  218. package/dist/starters/features/storybook/.storybook/preview.tsx +19 -0
  219. package/dist/starters/features/storybook/.storybook/tsconfig.json +24 -0
  220. package/dist/starters/features/storybook/package.json +25 -0
  221. package/dist/starters/features/storybook/src/components/button/button.stories.tsx +17 -0
  222. package/dist/starters/features/storybook/src/components/button/button.tsx +27 -0
  223. package/dist/starters/features/styled-vanilla-extract/package.json +28 -0
  224. package/dist/starters/features/styled-vanilla-extract/src/routes/styled-flower/flower.css.ts +83 -0
  225. package/dist/starters/features/styled-vanilla-extract/src/routes/styled-flower/index.tsx +75 -0
  226. package/dist/starters/features/tailwind/.prettierrc.js +3 -0
  227. package/dist/starters/features/tailwind/.vscode/settings.json +3 -0
  228. package/dist/starters/features/tailwind/package.json +18 -0
  229. package/dist/starters/features/tailwind/postcss.config.cjs +6 -0
  230. package/dist/starters/features/tailwind/src/global.css +7 -0
  231. package/dist/starters/features/tailwind/tailwind.config.js +8 -0
  232. package/dist/starters/features/turso/.env.local +2 -0
  233. package/dist/starters/features/turso/package.json +30 -0
  234. package/dist/starters/features/turso/src/utils/turso.ts +21 -0
  235. package/dist/starters/features/vitest/package.json +20 -0
  236. package/dist/starters/features/vitest/src/components/example/example.spec.tsx +32 -0
  237. package/dist/starters/features/vitest/src/components/example/example.tsx +17 -0
  238. package/dist/templates/barrel/component/index.tsx.template +13 -0
  239. package/dist/templates/barrel/markdown/index.md.template +5 -0
  240. package/dist/templates/barrel/mdx/index.mdx.template +5 -0
  241. package/dist/templates/barrel/route/index.tsx.template +9 -0
  242. package/dist/templates/qwik/component/[slug].tsx.template +13 -0
  243. package/dist/templates/qwik/markdown/index.md.template +5 -0
  244. package/dist/templates/qwik/mdx/index.mdx.template +5 -0
  245. package/dist/templates/qwik/route/index.tsx.template +9 -0
  246. package/dist/testing/index.cjs +32425 -0
  247. package/dist/testing/index.d.ts +140 -0
  248. package/dist/testing/index.mjs +32389 -0
  249. package/dist/testing/package.json +9 -0
  250. package/jsx-dev-runtime.d.ts +2 -0
  251. package/jsx-runtime.d.ts +2 -0
  252. package/loader.d.ts +2 -0
  253. package/optimizer.d.ts +2 -0
  254. package/package.json +20 -12
  255. package/public.d.ts +68 -0
  256. package/qwik-cli.cjs +4 -0
  257. package/server.d.ts +15 -0
  258. package/testing.d.ts +2 -0
@@ -0,0 +1,45 @@
1
+ import type { DocumentHead } from "@qwik.dev/router";
2
+ import { component$ } from "@qwik.dev/core";
3
+ import { Spinner } from "~/components/bootstrap";
4
+ import { colorVariantsList } from "~/constants/data";
5
+
6
+ export default component$(() => {
7
+ return (
8
+ <>
9
+ <h2>Spinners</h2>
10
+ <hr />
11
+ <h3>Border</h3>
12
+ {colorVariantsList.map((colorVariant, index) => (
13
+ <>
14
+ <Spinner
15
+ key={`${index + 1}_${colorVariant}`}
16
+ colorVariant={colorVariant}
17
+ growing={false}
18
+ />
19
+ <span class="me-3"></span>
20
+ </>
21
+ ))}
22
+ <h3 class="mt-2">Growing</h3>
23
+ {colorVariantsList.map((colorVariant, index) => (
24
+ <>
25
+ <Spinner
26
+ key={`${index + 1}_${colorVariant}`}
27
+ colorVariant={colorVariant}
28
+ growing={true}
29
+ />
30
+ <span class="me-3"></span>
31
+ </>
32
+ ))}
33
+ </>
34
+ );
35
+ });
36
+
37
+ export const head: DocumentHead = {
38
+ title: "Qwik - Bootstrap v5 - Spinners",
39
+ meta: [
40
+ {
41
+ name: "description",
42
+ content: "Spinners with Boostrap in Qwik",
43
+ },
44
+ ],
45
+ };
@@ -0,0 +1,15 @@
1
+ ## Builder.io + Qwik
2
+
3
+ An example of using [Builder.io's](https://www.builder.io/) visual editor with Qwik.
4
+
5
+ See the catchall route at [src/routes/[...index]/index.tsx](src/routes/[...index]/index.tsx) for the integration code.
6
+
7
+ Registered components can be found in [src/components/builder-registry.ts](src/components/builder-registry.ts)
8
+
9
+ ### Docs
10
+
11
+ See our full integration guides [here](https://www.builder.io/c/docs/developers)
12
+
13
+ Also, when you push your integration to production, go back and update your preview URL to your production URL so now anyone on your team can visuall create content in your Qwik app!
14
+
15
+ Also, to integrate structured data, see [this guide](https://www.builder.io/c/docs/integrate-cms-data)
@@ -0,0 +1,27 @@
1
+ {
2
+ "description": "Visual headless CMS",
3
+ "__qwik__": {
4
+ "displayName": "Integration: Builder.io",
5
+ "priority": -10,
6
+ "viteConfig": {
7
+ "imports": [
8
+ {
9
+ "namedImports": [
10
+ "builderDevTools"
11
+ ],
12
+ "importPath": "@builder.io/dev-tools/vite"
13
+ }
14
+ ],
15
+ "vitePluginsPrepend": [
16
+ "builderDevTools()"
17
+ ]
18
+ },
19
+ "docs": [
20
+ "https://www.builder.io/c/docs/quickstart"
21
+ ]
22
+ },
23
+ "devDependencies": {
24
+ "@builder.io/dev-tools": "^1.0.1",
25
+ "@builder.io/sdk-qwik": "^0.14.10"
26
+ }
27
+ }
@@ -0,0 +1,25 @@
1
+ import type { RegisteredComponent } from "@builder.io/sdk-qwik";
2
+ import Counter from "./counter/counter";
3
+
4
+ /**
5
+ * This array is used to integrate custom components within Builder.
6
+ * https://www.builder.io/c/docs/custom-components-intro
7
+ *
8
+ * These components will be found the "Custom Components"
9
+ * section of Builder's visual editor.
10
+ * You can also turn on "components only mode" to limit
11
+ * editing to only these components.
12
+ * https://www.builder.io/c/docs/guides/components-only-mode
13
+ */
14
+ export const CUSTOM_COMPONENTS: RegisteredComponent[] = [
15
+ {
16
+ component: Counter,
17
+ name: "Counter",
18
+ inputs: [
19
+ {
20
+ name: "initialValue",
21
+ type: "number",
22
+ },
23
+ ],
24
+ },
25
+ ];
@@ -0,0 +1,23 @@
1
+ .wrapper {
2
+ display: flex;
3
+ align-items: center;
4
+ justify-content: center;
5
+ gap: 20px;
6
+ }
7
+
8
+ .button {
9
+ background: #1d2033;
10
+ border: none;
11
+ border-radius: 8px;
12
+ color: white;
13
+ cursor: pointer;
14
+ padding: 10px;
15
+ text-align: center;
16
+ font-weight: 700;
17
+ font-size: 2em;
18
+ min-width: 50px;
19
+ }
20
+
21
+ .button:hover {
22
+ background: #006ce9;
23
+ }
@@ -0,0 +1,81 @@
1
+ import { $, component$, useSignal } from "@qwik.dev/core";
2
+ import Gauge from "../gauge";
3
+ import styles from "./counter.module.css";
4
+
5
+ export default component$((props: { initialValue: number }) => {
6
+ const count = useSignal(props.initialValue || 99);
7
+
8
+ const setCount = $((newValue: number) => {
9
+ if (newValue >= 0 && newValue <= 100) {
10
+ count.value = newValue;
11
+
12
+ if (newValue === 100) {
13
+ celebrate();
14
+ }
15
+ }
16
+ });
17
+
18
+ return (
19
+ <div class={styles.wrapper}>
20
+ <button class={styles.button} onClick$={() => setCount(count.value - 1)}>
21
+ -
22
+ </button>
23
+ <Gauge value={count.value} />
24
+ <button class={styles.button} onClick$={() => setCount(count.value + 1)}>
25
+ +
26
+ </button>
27
+ </div>
28
+ );
29
+ });
30
+
31
+ export const celebrate = $(async () => {
32
+ const defaults = {
33
+ spread: 360,
34
+ ticks: 70,
35
+ gravity: 0,
36
+ decay: 0.95,
37
+ startVelocity: 30,
38
+ colors: ["006ce9", "ac7ff4", "18b6f6", "713fc2", "ffffff"],
39
+ origin: {
40
+ x: 0.5,
41
+ y: 0.35,
42
+ },
43
+ };
44
+
45
+ function loadConfetti() {
46
+ return new Promise<(opts: any) => void>((resolve, reject) => {
47
+ if ((globalThis as any).confetti) {
48
+ return resolve((globalThis as any).confetti as any);
49
+ }
50
+ const script = document.createElement("script");
51
+ script.src =
52
+ "https://cdn.jsdelivr.net/npm/canvas-confetti@1.5.1/dist/confetti.browser.min.js";
53
+ script.onload = () => resolve((globalThis as any).confetti as any);
54
+ script.onerror = reject;
55
+ document.head.appendChild(script);
56
+ script.remove();
57
+ });
58
+ }
59
+
60
+ const confetti = await loadConfetti();
61
+
62
+ function shoot() {
63
+ confetti({
64
+ ...defaults,
65
+ particleCount: 80,
66
+ scalar: 1.2,
67
+ });
68
+
69
+ confetti({
70
+ ...defaults,
71
+ particleCount: 60,
72
+ scalar: 0.75,
73
+ });
74
+ }
75
+
76
+ setTimeout(shoot, 0);
77
+ setTimeout(shoot, 100);
78
+ setTimeout(shoot, 200);
79
+ setTimeout(shoot, 300);
80
+ setTimeout(shoot, 400);
81
+ });
@@ -0,0 +1,27 @@
1
+ .wrapper {
2
+ position: relative;
3
+ }
4
+
5
+ .gauge {
6
+ width: 160px;
7
+ }
8
+
9
+ .value {
10
+ position: absolute;
11
+ top: 50%;
12
+ left: 50%;
13
+ color: white;
14
+ font-size: 3rem;
15
+ transform: translate(-50%, -50%);
16
+ width: 200px;
17
+ text-align: center;
18
+ }
19
+
20
+ @media screen and (min-width: 768px) {
21
+ .gauge {
22
+ width: 400px;
23
+ }
24
+ .value {
25
+ font-size: 7rem;
26
+ }
27
+ }
@@ -0,0 +1,38 @@
1
+ import { component$ } from "@qwik.dev/core";
2
+ import styles from "./gauge.module.css";
3
+
4
+ export default component$(({ value = 50 }: { value?: number }) => {
5
+ const safeValue = value >= 0 && value <= 100 ? value : 50;
6
+
7
+ return (
8
+ <div class={styles.wrapper}>
9
+ <svg viewBox="0 0 120 120" class={styles.gauge}>
10
+ <defs>
11
+ <linearGradient id="gradient" x1="0%" y1="0%" x2="100%" y2="100%">
12
+ <stop offset="0%" stop-color="#18B6F6" />
13
+ <stop offset="1000%" stop-color="#AC7FF4" />
14
+ </linearGradient>
15
+ </defs>
16
+
17
+ <circle
18
+ r="56"
19
+ cx="60"
20
+ cy="60"
21
+ stroke-width="8"
22
+ style="fill: #000; stroke: #0000"
23
+ ></circle>
24
+
25
+ <circle
26
+ r="56"
27
+ cx="60"
28
+ cy="60"
29
+ stroke-width="8"
30
+ style={`transform: rotate(-87.9537deg); stroke-dasharray: ${
31
+ safeValue * 3.51
32
+ }, 351.858; fill:none; transform-origin:50% 50%; stroke-linecap:round; stroke:url(#gradient)`}
33
+ ></circle>
34
+ </svg>
35
+ <span class={styles.value}>{safeValue}</span>
36
+ </div>
37
+ );
38
+ });
@@ -0,0 +1,44 @@
1
+ import { Content, fetchOneEntry } from "@builder.io/sdk-qwik";
2
+ import { component$ } from "@qwik.dev/core";
3
+ import { routeLoader$ } from "@qwik.dev/router";
4
+ import { CUSTOM_COMPONENTS } from "~/components/builder-registry";
5
+
6
+ export const BUILDER_MODEL = "page";
7
+
8
+ // Use Qwik Router's `useBuilderContent` to get your content from Builder.
9
+ // `routeLoader$()` takes an async function to fetch content
10
+ // from Builder with `fetchOneEntry()`.
11
+ export const useBuilderContent = routeLoader$(async (event) => {
12
+ const isPreviewing = event.url.searchParams.has("builder.preview");
13
+
14
+ const builderContent = await fetchOneEntry({
15
+ model: BUILDER_MODEL,
16
+ apiKey: import.meta.env.PUBLIC_BUILDER_API_KEY,
17
+ userAttributes: { urlPath: event.url.pathname },
18
+ options: event.query,
19
+ });
20
+
21
+ // If there's no content, throw a 404.
22
+ // You can use your own 404 component here
23
+ if (!builderContent && !isPreviewing) {
24
+ throw event.error(404, "Page not found");
25
+ }
26
+ // return content fetched from Builder, which is JSON
27
+ return builderContent;
28
+ });
29
+
30
+ export default component$(() => {
31
+ const content = useBuilderContent();
32
+
33
+ // Content uses `content` to
34
+ // render the content of the given model, here a page,
35
+ // of your space (specified by the API Key)
36
+ return (
37
+ <Content
38
+ model={BUILDER_MODEL}
39
+ content={content.value}
40
+ apiKey={import.meta.env.PUBLIC_BUILDER_API_KEY}
41
+ customComponents={CUSTOM_COMPONENTS}
42
+ />
43
+ );
44
+ });
@@ -0,0 +1,5 @@
1
+ {
2
+ "name": "Using fixtures to represent data",
3
+ "email": "hello@cypress.io",
4
+ "body": "Fixtures are a great way to mock data for responses to routes"
5
+ }
@@ -0,0 +1,37 @@
1
+ /// <reference types="cypress" />
2
+ // ***********************************************
3
+ // This example commands.ts shows you how to
4
+ // create various custom commands and overwrite
5
+ // existing commands.
6
+ //
7
+ // For more comprehensive examples of custom
8
+ // commands please read more here:
9
+ // https://on.cypress.io/custom-commands
10
+ // ***********************************************
11
+ //
12
+ //
13
+ // -- This is a parent command --
14
+ // Cypress.Commands.add('login', (email, password) => { ... })
15
+ //
16
+ //
17
+ // -- This is a child command --
18
+ // Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... })
19
+ //
20
+ //
21
+ // -- This is a dual command --
22
+ // Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... })
23
+ //
24
+ //
25
+ // -- This will overwrite an existing command --
26
+ // Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })
27
+ //
28
+ // declare global {
29
+ // namespace Cypress {
30
+ // interface Chainable {
31
+ // login(email: string, password: string): Chainable<void>
32
+ // drag(subject: string, options?: Partial<TypeOptions>): Chainable<Element>
33
+ // dismiss(subject: string, options?: Partial<TypeOptions>): Chainable<Element>
34
+ // visit(originalFn: CommandOriginalFn, url: string, options: Partial<VisitOptions>): Chainable<Element>
35
+ // }
36
+ // }
37
+ // }
@@ -0,0 +1,12 @@
1
+ <!doctype html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <meta http-equiv="X-UA-Compatible" content="IE=edge" />
6
+ <meta name="viewport" content="width=device-width,initial-scale=1.0" />
7
+ <title>Components App</title>
8
+ </head>
9
+ <body>
10
+ <div data-cy-root></div>
11
+ </body>
12
+ </html>
@@ -0,0 +1,42 @@
1
+ // ***********************************************************
2
+ // This example support/component.ts is processed and
3
+ // loaded automatically before your test files.
4
+ //
5
+ // This is a great place to put global configuration and
6
+ // behavior that modifies Cypress.
7
+ //
8
+ // You can change the location of this file or turn off
9
+ // automatically serving support files with the
10
+ // 'supportFile' configuration option.
11
+ //
12
+ // You can read more here:
13
+ // https://on.cypress.io/configuration
14
+ // ***********************************************************
15
+
16
+ import { addQwikLoader } from "cypress-ct-qwik";
17
+ addQwikLoader();
18
+
19
+ // Import commands.js using ES2015 syntax:
20
+ import "./commands";
21
+
22
+ // Alternatively you can use CommonJS syntax:
23
+ // require('./commands')
24
+
25
+ import { mount } from "cypress-ct-qwik";
26
+
27
+ // Augment the Cypress namespace to include type definitions for
28
+ // your custom command.
29
+ // Alternatively, can be defined in cypress/support/component.d.ts
30
+ // with a <reference path="./component" /> at the top of your spec.
31
+ declare global {
32
+ namespace Cypress {
33
+ interface Chainable {
34
+ mount: typeof mount;
35
+ }
36
+ }
37
+ }
38
+
39
+ Cypress.Commands.add("mount", mount);
40
+
41
+ // Example use:
42
+ // cy.mount(MyComponent)
@@ -0,0 +1,17 @@
1
+ {
2
+ "extends": "../tsconfig.json",
3
+ "compilerOptions": {
4
+ "outDir": "../../../dist/out-tsc",
5
+ "module": "commonjs",
6
+ "types": ["cypress", "node"]
7
+ },
8
+ "include": [
9
+ "support/**/*.ts",
10
+ "../cypress.config.ts",
11
+ "../**/*.cy.ts",
12
+ "../**/*.cy.tsx",
13
+ "../**/*.cy.js",
14
+ "../**/*.cy.jsx",
15
+ "../**/*.d.ts"
16
+ ]
17
+ }
@@ -0,0 +1,10 @@
1
+ import { defineConfig } from "cypress";
2
+
3
+ export default defineConfig({
4
+ component: {
5
+ devServer: {
6
+ framework: "cypress-ct-qwik" as any,
7
+ bundler: "vite",
8
+ },
9
+ },
10
+ });
@@ -0,0 +1,14 @@
1
+ /// <reference types="cypress" />
2
+
3
+ import type { mount } from "cypress-ct-qwik";
4
+
5
+ type MountParams = Parameters<typeof mount>;
6
+ type OptionsParam = MountParams[0];
7
+
8
+ declare global {
9
+ namespace Cypress {
10
+ interface Chainable {
11
+ mount: typeof mount;
12
+ }
13
+ }
14
+ }
@@ -0,0 +1,28 @@
1
+ {
2
+ "description": "Add Cypress component testing",
3
+ "__qwik__": {
4
+ "displayName": "Integration: Cypress",
5
+ "priority": -10,
6
+ "docs": [
7
+ "https://qwik.dev/integrations/integration/cypress/",
8
+ "https://docs.cypress.io/guides/getting-started/installing-cypress",
9
+ "https://docs.cypress.io/guides/component-testing/overview",
10
+ "https://github.com/qwikifiers/cypress-qwik"
11
+ ],
12
+ "nextSteps": {
13
+ "title": "New example component",
14
+ "lines": [
15
+ " We created an example componenet in 'src/components/example'",
16
+ " There you will see a '.cy.tsx' file which is the component test"
17
+ ]
18
+ }
19
+ },
20
+ "devDependencies": {
21
+ "cypress": "~12.17.2",
22
+ "cypress-ct-qwik": "~0.3.0"
23
+ },
24
+ "scripts": {
25
+ "cypress.open": "cypress open --component",
26
+ "cypress.run": "cypress run --component"
27
+ }
28
+ }
@@ -0,0 +1,18 @@
1
+ import { ExampleTest } from "./example";
2
+
3
+ it("should render ⭐", () => {
4
+ cy.mount(<ExampleTest flag={true} />);
5
+ cy.get("div.icon").should("contain.text", "⭐");
6
+ });
7
+
8
+ it("should render 💣", () => {
9
+ cy.mount(<ExampleTest flag={false} />);
10
+ cy.get("div.icon").should("contain.text", "💣");
11
+ });
12
+
13
+ it("should count clicks", () => {
14
+ cy.mount(<ExampleTest flag={true} />);
15
+ cy.get("span").should("contain.text", "Count:0");
16
+ cy.get("button").click();
17
+ cy.get("span").should("contain.text", "Count:1");
18
+ });
@@ -0,0 +1,17 @@
1
+ import { component$, useStore } from "@qwik.dev/core";
2
+
3
+ export const ExampleTest = component$((props: { flag: boolean }) => {
4
+ const state = useStore({
5
+ counter: 0,
6
+ });
7
+
8
+ return (
9
+ <>
10
+ <span>Count:{state.counter}</span>
11
+ <div class="icon">Flag: {props.flag ? "⭐" : "💣"}</div>
12
+ <button class="btn-counter" onClick$={() => state.counter++}>
13
+ Increment counter
14
+ </button>
15
+ </>
16
+ );
17
+ });
@@ -0,0 +1,24 @@
1
+ // // This is your drizzle schema file.
2
+
3
+ // import { pgTable, serial, text, timestamp } from "drizzle-orm/pg-core";
4
+
5
+ // export const users = pgTable("users", {
6
+ // id: serial("id").primaryKey(),
7
+ // name: text("name").default("not_provided"),
8
+ // email: text("email").notNull(),
9
+ // });
10
+
11
+ // export const schema = {
12
+ // users,
13
+ // };
14
+ import { sqliteTable, integer, text } from "drizzle-orm/sqlite-core";
15
+
16
+ export const users = sqliteTable("users", {
17
+ id: integer("id", { mode: "number" }).primaryKey({ autoIncrement: true }),
18
+ name: text("name").default("not_provided"),
19
+ email: text("email").notNull(),
20
+ });
21
+
22
+ export const schema = {
23
+ users,
24
+ };
@@ -0,0 +1,9 @@
1
+ import type { Config } from "drizzle-kit";
2
+ export default {
3
+ schema: "./drizzle/schema.ts",
4
+ out: "./drizzle/migrations/",
5
+ driver: "better-sqlite",
6
+ dbCredentials: {
7
+ url: "./drizzle/db/db.sqlite",
8
+ },
9
+ } satisfies Config;
@@ -0,0 +1,41 @@
1
+ {
2
+ "description": "Headless TypeScript ORM with a head 🐲",
3
+ "__qwik__": {
4
+ "displayName": "Integration: Drizzle (Database ORM)",
5
+ "priority": -10,
6
+ "viteConfig": {},
7
+ "docs": [
8
+ "https://qwik.dev/integrations/integration/drizzle/",
9
+ "https://orm.drizzle.team/docs/overview"
10
+ ],
11
+ "nextSteps": {
12
+ "title": "Next Steps",
13
+ "lines": [
14
+ " Drizzle was installed with a simple DB schema and some demo routes,",
15
+ "",
16
+ " better-sqlite3 was configured by default, but in production",
17
+ " you'll want to use Postgres or MySQL.",
18
+ "",
19
+ "",
20
+ " Drizzle studio was also added which you can access by running `npm run drizzle:studio`,",
21
+ "",
22
+ " Check out the Drizzle docs for more info:",
23
+ " - https://orm.drizzle.team/docs/overview"
24
+ ]
25
+ }
26
+ },
27
+ "devDependencies": {
28
+ "@types/better-sqlite3": "^7.6.9",
29
+ "drizzle-kit": "^0.20.14"
30
+ },
31
+ "dependencies": {
32
+ "better-sqlite3": "^9.4.3",
33
+ "drizzle-orm": "^0.29.4"
34
+ },
35
+ "scripts": {
36
+ "postinstall": "drizzle-kit generate:sqlite",
37
+ "drizzle:generate": "drizzle-kit generate:sqlite",
38
+ "drizzle:migrate": "drizzle-kit push:sqlite",
39
+ "drizzle:studio": "drizzle-kit studio --host 127.0.0.1"
40
+ }
41
+ }
@@ -0,0 +1,42 @@
1
+ import { Form, routeAction$, z, zod$ } from "@qwik.dev/router";
2
+ import { component$ } from "@qwik.dev/core";
3
+ import Database from "better-sqlite3";
4
+ import { drizzle } from "drizzle-orm/better-sqlite3";
5
+ import { schema } from "../../../drizzle/schema";
6
+ export const useCreateUser = routeAction$(
7
+ async (data) => {
8
+ const sqlite = new Database("./drizzle/db/db.sqlite");
9
+ const db = drizzle(sqlite, { schema });
10
+ const user = await db.insert(schema.users).values(data);
11
+ return user;
12
+ },
13
+ zod$({
14
+ name: z.string(),
15
+ email: z.string().email(),
16
+ }),
17
+ );
18
+
19
+ export default component$(() => {
20
+ const createUserAction = useCreateUser();
21
+ return (
22
+ <section>
23
+ <h1>Create User</h1>
24
+ <Form action={createUserAction}>
25
+ <label>
26
+ Name
27
+ <input name="name" value={createUserAction.formData?.get("name")} />
28
+ </label>
29
+ <label>
30
+ Email
31
+ <input name="email" value={createUserAction.formData?.get("email")} />
32
+ </label>
33
+ <button type="submit">Create</button>
34
+ </Form>
35
+ {createUserAction.value && (
36
+ <div>
37
+ <h2>User created successfully!</h2>
38
+ </div>
39
+ )}
40
+ </section>
41
+ );
42
+ });