@qwik.dev/core 0.0.0 → 2.0.0-alpha.1
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/LICENSE +22 -0
- package/bindings/qwik.darwin-arm64.node +0 -0
- package/bindings/qwik.darwin-x64.node +0 -0
- package/bindings/qwik.linux-x64-gnu.node +0 -0
- package/bindings/qwik.wasm.cjs +484 -0
- package/bindings/qwik.wasm.mjs +477 -0
- package/bindings/qwik.win32-x64-msvc.node +0 -0
- package/bindings/qwik_wasm_bg.wasm +0 -0
- package/build.d.ts +2 -0
- package/dist/build/index.cjs +35 -0
- package/dist/build/index.cjs.map +7 -0
- package/dist/build/index.d.ts +22 -0
- package/dist/build/index.dev.cjs +37 -0
- package/dist/build/index.dev.cjs.map +7 -0
- package/dist/build/index.dev.mjs +12 -0
- package/dist/build/index.dev.mjs.map +7 -0
- package/dist/build/index.mjs +12 -0
- package/dist/build/index.mjs.map +7 -0
- package/dist/build/index.prod.cjs +37 -0
- package/dist/build/index.prod.cjs.map +7 -0
- package/dist/build/index.prod.mjs +12 -0
- package/dist/build/index.prod.mjs.map +7 -0
- package/dist/build/package.json +8 -0
- package/dist/cli.cjs +4890 -0
- package/dist/core-internal.d.ts +3895 -0
- package/dist/core.cjs +10929 -0
- package/dist/core.cjs.map +1 -0
- package/dist/core.min.mjs +1 -0
- package/dist/core.mjs +10825 -0
- package/dist/core.mjs.map +1 -0
- package/dist/core.prod.cjs +5184 -0
- package/dist/core.prod.mjs +6028 -0
- package/dist/index.d.ts +2 -0
- package/dist/insights/index.d.ts +1 -0
- package/dist/insights/index.qwik.cjs +751 -0
- package/dist/insights/index.qwik.mjs +751 -0
- package/dist/insights/insights.d.ts +59 -0
- package/dist/insights/vite/index.cjs +82 -0
- package/dist/insights/vite/index.d.ts +1 -0
- package/dist/insights/vite/index.mjs +55 -0
- package/dist/insights/vite/insights-plugin.d.ts +10 -0
- package/dist/jsx-runtime/index.d.ts +2 -0
- package/dist/jsx-runtime.d.ts +2 -0
- package/dist/loader/index.cjs +4 -0
- package/dist/loader/index.d.ts +2 -0
- package/dist/loader/index.mjs +3 -0
- package/dist/loader/package.json +8 -0
- package/dist/optimizer.cjs +9140 -0
- package/dist/optimizer.d.ts +707 -0
- package/dist/optimizer.mjs +9704 -0
- package/dist/prefetch/index.cjs +4 -0
- package/dist/prefetch/index.d.ts +2 -0
- package/dist/prefetch/index.mjs +3 -0
- package/dist/prefetch/package.json +8 -0
- package/dist/qwik-prefetch.debug.js +244 -0
- package/dist/qwik-prefetch.js +1 -0
- package/dist/qwikloader.debug.js +228 -0
- package/dist/qwikloader.js +3 -0
- package/dist/server-modules.d.ts +38 -0
- package/dist/server.cjs +8948 -0
- package/dist/server.d.ts +404 -0
- package/dist/server.mjs +8883 -0
- package/dist/starters/adapters/aws-lambda/.eslintignore +2 -0
- package/dist/starters/adapters/aws-lambda/.prettierignore +2 -0
- package/dist/starters/adapters/aws-lambda/adapters/aws-lambda/vite.config.mts +21 -0
- package/dist/starters/adapters/aws-lambda/gitignore +2 -0
- package/dist/starters/adapters/aws-lambda/package.json +23 -0
- package/dist/starters/adapters/aws-lambda/serverless.yml +31 -0
- package/dist/starters/adapters/aws-lambda/src/entry_aws-lambda.tsx +32 -0
- package/dist/starters/adapters/azure-swa/README.md +13 -0
- package/dist/starters/adapters/azure-swa/adapters/azure-swa/vite.config.mts +23 -0
- package/dist/starters/adapters/azure-swa/azure-functions/host.json +20 -0
- package/dist/starters/adapters/azure-swa/gitignore +3 -0
- package/dist/starters/adapters/azure-swa/package.json +28 -0
- package/dist/starters/adapters/azure-swa/public/staticwebapp.config.json +23 -0
- package/dist/starters/adapters/azure-swa/src/entry.azure-swa.tsx +22 -0
- package/dist/starters/adapters/azure-swa/swa-cli.config.json +11 -0
- package/dist/starters/adapters/bun/README.md +9 -0
- package/dist/starters/adapters/bun/adapters/bun/vite.config.mts +28 -0
- package/dist/starters/adapters/bun/package.json +27 -0
- package/dist/starters/adapters/bun/src/entry.bun.ts +46 -0
- package/dist/starters/adapters/cloud-run/Dockerfile +24 -0
- package/dist/starters/adapters/cloud-run/README.md +7 -0
- package/dist/starters/adapters/cloud-run/adapters/cloud-run/vite.config.mts +15 -0
- package/dist/starters/adapters/cloud-run/package.json +24 -0
- package/dist/starters/adapters/cloud-run/src/entry.cloud-run.tsx +96 -0
- package/dist/starters/adapters/cloudflare-pages/README.md +46 -0
- package/dist/starters/adapters/cloudflare-pages/adapters/cloudflare-pages/vite.config.mts +15 -0
- package/dist/starters/adapters/cloudflare-pages/gitignore +2 -0
- package/dist/starters/adapters/cloudflare-pages/package.json +28 -0
- package/dist/starters/adapters/cloudflare-pages/public/_headers +9 -0
- package/dist/starters/adapters/cloudflare-pages/public/_redirects +1 -0
- package/dist/starters/adapters/cloudflare-pages/src/entry.cloudflare-pages.tsx +24 -0
- package/dist/starters/adapters/deno/README.md +9 -0
- package/dist/starters/adapters/deno/adapters/deno/vite.config.mts +23 -0
- package/dist/starters/adapters/deno/package.json +24 -0
- package/dist/starters/adapters/deno/src/entry.deno.ts +45 -0
- package/dist/starters/adapters/express/README.md +9 -0
- package/dist/starters/adapters/express/adapters/express/vite.config.mts +15 -0
- package/dist/starters/adapters/express/package.json +33 -0
- package/dist/starters/adapters/express/src/entry.express.tsx +70 -0
- package/dist/starters/adapters/fastify/README.md +9 -0
- package/dist/starters/adapters/fastify/adapters/fastify/vite.config.mts +15 -0
- package/dist/starters/adapters/fastify/package.json +33 -0
- package/dist/starters/adapters/fastify/src/entry.fastify.tsx +48 -0
- package/dist/starters/adapters/fastify/src/plugins/fastify-qwik.ts +42 -0
- package/dist/starters/adapters/firebase/.eslintignore +1 -0
- package/dist/starters/adapters/firebase/.prettierignore +1 -0
- package/dist/starters/adapters/firebase/adapters/firebase/vite.config.mts +21 -0
- package/dist/starters/adapters/firebase/firebase.json +24 -0
- package/dist/starters/adapters/firebase/functions/.gitkeep +0 -0
- package/dist/starters/adapters/firebase/functions/index.js +5 -0
- package/dist/starters/adapters/firebase/functions/package.json +25 -0
- package/dist/starters/adapters/firebase/gitignore +3 -0
- package/dist/starters/adapters/firebase/package.json +24 -0
- package/dist/starters/adapters/firebase/src/entry-firebase.tsx +22 -0
- package/dist/starters/adapters/netlify-edge/README.md +64 -0
- package/dist/starters/adapters/netlify-edge/adapters/netlify-edge/vite.config.mts +16 -0
- package/dist/starters/adapters/netlify-edge/gitignore +2 -0
- package/dist/starters/adapters/netlify-edge/netlify.toml +3 -0
- package/dist/starters/adapters/netlify-edge/package.json +29 -0
- package/dist/starters/adapters/netlify-edge/public/_headers +2 -0
- package/dist/starters/adapters/netlify-edge/src/entry.netlify-edge.tsx +22 -0
- package/dist/starters/adapters/node-server/README.md +12 -0
- package/dist/starters/adapters/node-server/adapters/node-server/vite.config.mts +15 -0
- package/dist/starters/adapters/node-server/package.json +23 -0
- package/dist/starters/adapters/node-server/src/entry.node-server.tsx +39 -0
- package/dist/starters/adapters/static/README.md +5 -0
- package/dist/starters/adapters/static/adapters/static/vite.config.mts +19 -0
- package/dist/starters/adapters/static/package.json +19 -0
- package/dist/starters/adapters/vercel-edge/README.md +43 -0
- package/dist/starters/adapters/vercel-edge/adapters/vercel-edge/vite.config.mts +16 -0
- package/dist/starters/adapters/vercel-edge/gitignore +2 -0
- package/dist/starters/adapters/vercel-edge/package.json +28 -0
- package/dist/starters/adapters/vercel-edge/src/entry.vercel-edge.tsx +22 -0
- package/dist/starters/adapters/vercel-edge/vercel.json +22 -0
- package/dist/starters/features/auth/package.json +20 -0
- package/dist/starters/features/auth/src/routes/plugin@auth.ts +8 -0
- package/dist/starters/features/bootstrap/package.json +33 -0
- package/dist/starters/features/bootstrap/src/components/bootstrap/alert.tsx +8 -0
- package/dist/starters/features/bootstrap/src/components/bootstrap/button.tsx +8 -0
- package/dist/starters/features/bootstrap/src/components/bootstrap/index.ts +4 -0
- package/dist/starters/features/bootstrap/src/components/bootstrap/navbar.tsx +44 -0
- package/dist/starters/features/bootstrap/src/components/bootstrap/spinner.tsx +13 -0
- package/dist/starters/features/bootstrap/src/constants/data.ts +10 -0
- package/dist/starters/features/bootstrap/src/models/bootstrap.ts +8 -0
- package/dist/starters/features/bootstrap/src/routes/bootstrap/alerts/index.tsx +28 -0
- package/dist/starters/features/bootstrap/src/routes/bootstrap/buttons/index.tsx +32 -0
- package/dist/starters/features/bootstrap/src/routes/bootstrap/index.tsx +32 -0
- package/dist/starters/features/bootstrap/src/routes/bootstrap/layout.tsx +36 -0
- package/dist/starters/features/bootstrap/src/routes/bootstrap/spinners/index.tsx +45 -0
- package/dist/starters/features/builder.io/README.md +15 -0
- package/dist/starters/features/builder.io/package.json +27 -0
- package/dist/starters/features/builder.io/src/components/builder-registry.ts +25 -0
- package/dist/starters/features/builder.io/src/components/counter/counter.module.css +23 -0
- package/dist/starters/features/builder.io/src/components/counter/counter.tsx +81 -0
- package/dist/starters/features/builder.io/src/components/gauge/gauge.module.css +27 -0
- package/dist/starters/features/builder.io/src/components/gauge/index.tsx +38 -0
- package/dist/starters/features/builder.io/src/routes/[...index]/index.tsx +44 -0
- package/dist/starters/features/cypress/cypress/fixtures/example.json +5 -0
- package/dist/starters/features/cypress/cypress/support/commands.ts +37 -0
- package/dist/starters/features/cypress/cypress/support/component-index.html +12 -0
- package/dist/starters/features/cypress/cypress/support/component.ts +42 -0
- package/dist/starters/features/cypress/cypress/tsconfig.cy.json +17 -0
- package/dist/starters/features/cypress/cypress.config.ts +10 -0
- package/dist/starters/features/cypress/cypress.d.ts +14 -0
- package/dist/starters/features/cypress/package.json +28 -0
- package/dist/starters/features/cypress/src/components/example/example.cy.tsx +18 -0
- package/dist/starters/features/cypress/src/components/example/example.tsx +17 -0
- package/dist/starters/features/drizzle/drizzle/db/.gitkeep +0 -0
- package/dist/starters/features/drizzle/drizzle/migrations/.gitkeep +0 -0
- package/dist/starters/features/drizzle/drizzle/schema.ts +24 -0
- package/dist/starters/features/drizzle/drizzle.config.ts +9 -0
- package/dist/starters/features/drizzle/package.json +41 -0
- package/dist/starters/features/drizzle/src/routes/create/index.tsx +42 -0
- package/dist/starters/features/drizzle/src/routes/users/[userId]/index.tsx +36 -0
- package/dist/starters/features/drizzle/src/routes/users/index.tsx +30 -0
- package/dist/starters/features/leaflet-map/package.json +30 -0
- package/dist/starters/features/leaflet-map/src/components/leaflet-map/index.tsx +60 -0
- package/dist/starters/features/leaflet-map/src/helpers/boundary-box.tsx +6 -0
- package/dist/starters/features/leaflet-map/src/models/location.ts +9 -0
- package/dist/starters/features/leaflet-map/src/models/map.ts +7 -0
- package/dist/starters/features/leaflet-map/src/routes/basic-map/index.tsx +25 -0
- package/dist/starters/features/localize/package.json +37 -0
- package/dist/starters/features/localize/src/entry.ssr.tsx +32 -0
- package/dist/starters/features/localize/src/locales/message.en.json +8 -0
- package/dist/starters/features/localize/src/locales/message.it.json +8 -0
- package/dist/starters/features/localize/src/routes/[locale]/i18n-utils.ts +94 -0
- package/dist/starters/features/localize/src/routes/[locale]/index.tsx +52 -0
- package/dist/starters/features/localize/src/routes/[locale]/layout.tsx +12 -0
- package/dist/starters/features/orama/package.json +23 -0
- package/dist/starters/features/orama/src/orama/index.ts +41 -0
- package/dist/starters/features/orama/src/routes/orama/index.tsx +110 -0
- package/dist/starters/features/pandacss/.eslintignore +3 -0
- package/dist/starters/features/pandacss/.prettierignore +2 -0
- package/dist/starters/features/pandacss/gitignore +2 -0
- package/dist/starters/features/pandacss/package.json +31 -0
- package/dist/starters/features/pandacss/panda.config.ts +22 -0
- package/dist/starters/features/pandacss/postcss.config.js +5 -0
- package/dist/starters/features/pandacss/src/global.css +5 -0
- package/dist/starters/features/pandacss/src/routes/pandacss/index.tsx +18 -0
- package/dist/starters/features/partytown/package.json +41 -0
- package/dist/starters/features/partytown/src/components/partytown/partytown.tsx +19 -0
- package/dist/starters/features/playwright/package.json +18 -0
- package/dist/starters/features/playwright/playwright-report/index.html +22024 -0
- package/dist/starters/features/playwright/playwright.config.ts +40 -0
- package/dist/starters/features/playwright/tests/example.spec.ts +14 -0
- package/dist/starters/features/postcss/.vscode/settings.json +3 -0
- package/dist/starters/features/postcss/package.json +17 -0
- package/dist/starters/features/postcss/postcss.config.js +11 -0
- package/dist/starters/features/prisma/package.json +35 -0
- package/dist/starters/features/prisma/prisma/schema.prisma +17 -0
- package/dist/starters/features/prisma/src/routes/create/index.tsx +42 -0
- package/dist/starters/features/prisma/src/routes/users/[userId]/index.tsx +31 -0
- package/dist/starters/features/prisma/src/routes/users/index.tsx +27 -0
- package/dist/starters/features/react/package.json +41 -0
- package/dist/starters/features/react/src/integrations/react/mui.tsx +60 -0
- package/dist/starters/features/react/src/routes/react/index.tsx +45 -0
- package/dist/starters/features/storybook/.storybook/main.ts +22 -0
- package/dist/starters/features/storybook/.storybook/preview-head.html +3 -0
- package/dist/starters/features/storybook/.storybook/preview.tsx +19 -0
- package/dist/starters/features/storybook/.storybook/tsconfig.json +24 -0
- package/dist/starters/features/storybook/package.json +25 -0
- package/dist/starters/features/storybook/src/components/button/button.stories.tsx +17 -0
- package/dist/starters/features/storybook/src/components/button/button.tsx +27 -0
- package/dist/starters/features/styled-vanilla-extract/package.json +28 -0
- package/dist/starters/features/styled-vanilla-extract/src/routes/styled-flower/flower.css.ts +83 -0
- package/dist/starters/features/styled-vanilla-extract/src/routes/styled-flower/index.tsx +75 -0
- package/dist/starters/features/tailwind/.prettierrc.js +3 -0
- package/dist/starters/features/tailwind/.vscode/settings.json +3 -0
- package/dist/starters/features/tailwind/package.json +18 -0
- package/dist/starters/features/tailwind/postcss.config.cjs +6 -0
- package/dist/starters/features/tailwind/src/global.css +7 -0
- package/dist/starters/features/tailwind/tailwind.config.js +8 -0
- package/dist/starters/features/turso/.env.local +2 -0
- package/dist/starters/features/turso/package.json +30 -0
- package/dist/starters/features/turso/src/utils/turso.ts +21 -0
- package/dist/starters/features/vitest/package.json +20 -0
- package/dist/starters/features/vitest/src/components/example/example.spec.tsx +32 -0
- package/dist/starters/features/vitest/src/components/example/example.tsx +17 -0
- package/dist/templates/barrel/component/index.tsx.template +13 -0
- package/dist/templates/barrel/markdown/index.md.template +5 -0
- package/dist/templates/barrel/mdx/index.mdx.template +5 -0
- package/dist/templates/barrel/route/index.tsx.template +9 -0
- package/dist/templates/qwik/component/[slug].tsx.template +13 -0
- package/dist/templates/qwik/markdown/index.md.template +5 -0
- package/dist/templates/qwik/mdx/index.mdx.template +5 -0
- package/dist/templates/qwik/route/index.tsx.template +9 -0
- package/dist/testing/index.cjs +32431 -0
- package/dist/testing/index.d.ts +140 -0
- package/dist/testing/index.mjs +32395 -0
- package/dist/testing/package.json +9 -0
- package/jsx-dev-runtime.d.ts +2 -0
- package/jsx-runtime.d.ts +2 -0
- package/loader.d.ts +2 -0
- package/optimizer.d.ts +2 -0
- package/package.json +29 -21
- package/public.d.ts +70 -0
- package/qwik-cli.cjs +4 -0
- package/server.d.ts +15 -0
- package/testing.d.ts +2 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { routeLoader$ } 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
|
+
|
|
7
|
+
export const useGetUser = routeLoader$(async (requestEvent) => {
|
|
8
|
+
const userId = parseInt(requestEvent.params["userId"], 10);
|
|
9
|
+
const sqlite = new Database("./drizzle/db/db.sqlite");
|
|
10
|
+
const db = drizzle(sqlite, { schema });
|
|
11
|
+
const user = await db.query.users.findFirst({
|
|
12
|
+
where: (users, { eq }) => eq(users.id, userId),
|
|
13
|
+
});
|
|
14
|
+
if (!user) {
|
|
15
|
+
// Set the status to 404 if the user is not found
|
|
16
|
+
requestEvent.status(404);
|
|
17
|
+
}
|
|
18
|
+
return user;
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
export default component$(() => {
|
|
22
|
+
const user = useGetUser();
|
|
23
|
+
return (
|
|
24
|
+
<section>
|
|
25
|
+
<h1>User detail</h1>
|
|
26
|
+
{user.value ? (
|
|
27
|
+
<>
|
|
28
|
+
<p>Name: {user.value.name}</p>
|
|
29
|
+
<p>Email: {user.value.email}</p>
|
|
30
|
+
</>
|
|
31
|
+
) : (
|
|
32
|
+
<p>User not found</p>
|
|
33
|
+
)}
|
|
34
|
+
</section>
|
|
35
|
+
);
|
|
36
|
+
});
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { routeLoader$ } 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
|
+
|
|
7
|
+
export const useGetUsers = routeLoader$(async () => {
|
|
8
|
+
const sqlite = new Database("./drizzle/db/db.sqlite");
|
|
9
|
+
const db = drizzle(sqlite, { schema });
|
|
10
|
+
const users = await db.query.users.findMany();
|
|
11
|
+
return users;
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
export default component$(() => {
|
|
15
|
+
const users = useGetUsers();
|
|
16
|
+
return (
|
|
17
|
+
<section>
|
|
18
|
+
<h1>User's directory</h1>
|
|
19
|
+
<ul>
|
|
20
|
+
{users.value.map((user) => (
|
|
21
|
+
<li key={user.id}>
|
|
22
|
+
<a href={`/users/${user.id}`}>
|
|
23
|
+
{user.name} ({user.email})
|
|
24
|
+
</a>
|
|
25
|
+
</li>
|
|
26
|
+
))}
|
|
27
|
+
</ul>
|
|
28
|
+
</section>
|
|
29
|
+
);
|
|
30
|
+
});
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"description": "Use Leaflet Maps in your Qwik app",
|
|
3
|
+
"__qwik__": {
|
|
4
|
+
"displayName": "Integration: Leaflet Maps",
|
|
5
|
+
"priority": -10,
|
|
6
|
+
"viteConfig": {},
|
|
7
|
+
"docs": [
|
|
8
|
+
"https://leafletjs.com/reference.html",
|
|
9
|
+
"https://leafletjs.com/examples/quick-start/",
|
|
10
|
+
"https://www.sitepoint.com/leaflet-create-map-beginner-guide/"
|
|
11
|
+
],
|
|
12
|
+
"nextSteps": {
|
|
13
|
+
"lines": [
|
|
14
|
+
"We start the project with the `start` npm script",
|
|
15
|
+
"Once started, we access the /basic-map path to see the demo example.",
|
|
16
|
+
"You can make changes and experiment within src/routes/basic-map/index.tsx",
|
|
17
|
+
"to add a new location, zoom,... and any improvements to the maps component",
|
|
18
|
+
"can be done in the src/components/leaflet-map/index.tsx section.",
|
|
19
|
+
"Have a look at the docs for more info:",
|
|
20
|
+
"https://leafletjs.com/"
|
|
21
|
+
]
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"leaflet": "1.9.4"
|
|
26
|
+
},
|
|
27
|
+
"devDependencies": {
|
|
28
|
+
"@types/leaflet": "^1.9.6"
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import {
|
|
2
|
+
component$,
|
|
3
|
+
noSerialize,
|
|
4
|
+
useSignal,
|
|
5
|
+
useStyles$,
|
|
6
|
+
useVisibleTask$,
|
|
7
|
+
} from "@qwik.dev/core";
|
|
8
|
+
import { Map } from "leaflet";
|
|
9
|
+
import type { MapProps } from "~/models/map";
|
|
10
|
+
|
|
11
|
+
export const LeafletMap = component$<MapProps>(({ location }: MapProps) => {
|
|
12
|
+
// Modify with your preferences. By default take all screen
|
|
13
|
+
useStyles$(`
|
|
14
|
+
#map {
|
|
15
|
+
width: 100%;
|
|
16
|
+
height: 100vh;
|
|
17
|
+
}
|
|
18
|
+
`);
|
|
19
|
+
|
|
20
|
+
const mapContainer$ = useSignal<Map>();
|
|
21
|
+
|
|
22
|
+
useVisibleTask$(async ({ track }) => {
|
|
23
|
+
track(location);
|
|
24
|
+
|
|
25
|
+
const { tileLayer, marker } = await import("leaflet");
|
|
26
|
+
|
|
27
|
+
const { getBoundaryBox } = await import("../../helpers/boundary-box");
|
|
28
|
+
|
|
29
|
+
if (mapContainer$.value) {
|
|
30
|
+
mapContainer$.value.remove();
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const { value: locationData } = location;
|
|
34
|
+
|
|
35
|
+
const centerPosition: [number, number] = locationData.point as [
|
|
36
|
+
number,
|
|
37
|
+
number,
|
|
38
|
+
];
|
|
39
|
+
|
|
40
|
+
const map: any = new Map("map").setView(
|
|
41
|
+
centerPosition,
|
|
42
|
+
locationData.zoom || 14,
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
tileLayer("https://tile.openstreetmap.org/{z}/{x}/{y}.png", {
|
|
46
|
+
maxZoom: 19,
|
|
47
|
+
attribution:
|
|
48
|
+
'© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>',
|
|
49
|
+
}).addTo(map);
|
|
50
|
+
|
|
51
|
+
// Assign select boundary box to use in OSM API if you want
|
|
52
|
+
locationData.boundaryBox = getBoundaryBox(map);
|
|
53
|
+
|
|
54
|
+
locationData.marker &&
|
|
55
|
+
marker(centerPosition).bindPopup(`Soraluze (Gipuzkoa) :)`).addTo(map);
|
|
56
|
+
|
|
57
|
+
mapContainer$.value = noSerialize(map);
|
|
58
|
+
});
|
|
59
|
+
return <div id="map"></div>;
|
|
60
|
+
});
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Map } from "leaflet";
|
|
2
|
+
export const getBoundaryBox = (map: Map) => {
|
|
3
|
+
const northEast = map.getBounds().getNorthEast();
|
|
4
|
+
const southWest = map.getBounds().getSouthWest();
|
|
5
|
+
return `${southWest.lat},${southWest.lng},${northEast.lat},${northEast.lng}`;
|
|
6
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { component$, useSignal, useStyles$ } from "@qwik.dev/core";
|
|
2
|
+
|
|
3
|
+
// Leaflet map styles
|
|
4
|
+
import leafletStyles from "../../../node_modules/leaflet/dist/leaflet.css?inline";
|
|
5
|
+
|
|
6
|
+
import { LeafletMap } from "~/components/leaflet-map";
|
|
7
|
+
import type { LocationsProps } from "~/models/location";
|
|
8
|
+
|
|
9
|
+
export default component$(() => {
|
|
10
|
+
useStyles$(leafletStyles);
|
|
11
|
+
const currentLocation = useSignal<LocationsProps>({
|
|
12
|
+
name: "Soraluze",
|
|
13
|
+
point: [43.17478, -2.41172],
|
|
14
|
+
/**
|
|
15
|
+
* Define rectangle with: Southwest lat, South West Lng, North East lat, North East lng points.
|
|
16
|
+
* Very interesting when use to filter in OpenStreetMap API to take POIs
|
|
17
|
+
* Example: https://qwik-osm-poc.netlify.app/
|
|
18
|
+
*/
|
|
19
|
+
boundaryBox:
|
|
20
|
+
"43.14658914559456,-2.4765586853027344,43.202923523094725,-2.3467826843261723",
|
|
21
|
+
zoom: 9,
|
|
22
|
+
marker: true,
|
|
23
|
+
});
|
|
24
|
+
return <LeafletMap location={currentLocation} />;
|
|
25
|
+
});
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"description": "Add i18n $localize in your Qwik app",
|
|
3
|
+
"__qwik__": {
|
|
4
|
+
"displayName": "Integration: i18n $localize (compile time translations)",
|
|
5
|
+
"priority": -10,
|
|
6
|
+
"viteConfig": {},
|
|
7
|
+
"docs": [
|
|
8
|
+
"https://qwik.dev/docs/integrations/i18n/#localize",
|
|
9
|
+
"https://github.com/mhevery/qwik-i18n",
|
|
10
|
+
"https://angular.io/api/localize/init/$localize"
|
|
11
|
+
],
|
|
12
|
+
"nextSteps": {
|
|
13
|
+
"title": "Next Steps",
|
|
14
|
+
"lines": [
|
|
15
|
+
" - /src/routes/[locale]: New public route showcasing i18n $localize integration",
|
|
16
|
+
"",
|
|
17
|
+
" Check out the i18n $localize docs for more info:",
|
|
18
|
+
" - https://qwik.dev/docs/integrations/i18n/#localize",
|
|
19
|
+
" - https://github.com/mhevery/qwik-i18n",
|
|
20
|
+
" - https://angular.io/api/localize/init/$localize"
|
|
21
|
+
]
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"@angular/localize": "^16.2.2"
|
|
26
|
+
},
|
|
27
|
+
"devDependencies": {
|
|
28
|
+
"@angular/compiler": "^16.2.2",
|
|
29
|
+
"@angular/compiler-cli": "^16.2.2"
|
|
30
|
+
},
|
|
31
|
+
"scripts": {
|
|
32
|
+
"build.client": "vite build && npm run i18n-translate",
|
|
33
|
+
"prei18n-extract": "vite build",
|
|
34
|
+
"i18n-extract": "node_modules/.bin/localize-extract -s \"dist/build/*.js\" -f json -o src/locales/message.en.json",
|
|
35
|
+
"i18n-translate": "node_modules/.bin/localize-translate -s \"*.js\" -t src/locales/message.*.json -o dist/build/{{LOCALE}} -r ./dist/build"
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WHAT IS THIS FILE?
|
|
3
|
+
*
|
|
4
|
+
* SSR entry point, in all cases the application is rendered outside the browser, this
|
|
5
|
+
* entry point will be the common one.
|
|
6
|
+
*
|
|
7
|
+
* - Server (express, cloudflare...)
|
|
8
|
+
* - npm run start
|
|
9
|
+
* - npm run preview
|
|
10
|
+
* - npm run build
|
|
11
|
+
*
|
|
12
|
+
*/
|
|
13
|
+
import { manifest } from "@qwik-client-manifest";
|
|
14
|
+
import {
|
|
15
|
+
renderToStream,
|
|
16
|
+
type RenderToStreamOptions,
|
|
17
|
+
} from "@qwik.dev/core/server";
|
|
18
|
+
import Root from "./root";
|
|
19
|
+
import { extractBase } from "./routes/[locale]/i18n-utils";
|
|
20
|
+
|
|
21
|
+
export default function (opts: RenderToStreamOptions) {
|
|
22
|
+
return renderToStream(<Root />, {
|
|
23
|
+
manifest,
|
|
24
|
+
...opts,
|
|
25
|
+
base: extractBase, // determine the base URL for the client code
|
|
26
|
+
// Use container attributes to set attributes on the html tag.
|
|
27
|
+
containerAttributes: {
|
|
28
|
+
lang: opts.serverData?.locale ?? "en-us",
|
|
29
|
+
...opts.containerAttributes,
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
{
|
|
2
|
+
"locale": "en",
|
|
3
|
+
"translations": {
|
|
4
|
+
"1573294495032945047": "Hello from {$PH}!",
|
|
5
|
+
"8569626659814641312": "Use the following links to change the translation.",
|
|
6
|
+
"6563882999249543998": "Translation is performed as part of the build step so translated strings are inlined into the application, there is no need to load or look them up at runtime. However, these advantages mean that the user cannot change the language without refreshing the page."
|
|
7
|
+
}
|
|
8
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
{
|
|
2
|
+
"locale": "it",
|
|
3
|
+
"translations": {
|
|
4
|
+
"1573294495032945047": "Un saluto da {$PH}!",
|
|
5
|
+
"8569626659814641312": "Usa i seguenti link per cambiare la traduzione.",
|
|
6
|
+
"6563882999249543998": "La traduzione viene eseguita come parte della fase di build e le stringhe tradotte vengono integrate nell'applicazione, non è necessario caricarle o cercarle in fase di runtime.\nTuttavia, questi vantaggi significano che l'utente non può cambiare la lingua senza ricaricare la pagina."
|
|
7
|
+
}
|
|
8
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { loadTranslations } from "@angular/localize";
|
|
2
|
+
import "@angular/localize/init";
|
|
3
|
+
import { $, getLocale, useOnDocument, withLocale } from "@qwik.dev/core";
|
|
4
|
+
import type { RenderOptions } from "@qwik.dev/core/server";
|
|
5
|
+
|
|
6
|
+
// You must declare all your locales here
|
|
7
|
+
import EN from "../../locales/message.en.json";
|
|
8
|
+
import IT from "../../locales/message.it.json";
|
|
9
|
+
|
|
10
|
+
// Make sure it's obvious when the default locale was selected
|
|
11
|
+
const DEFAULT_LOCALE = "en";
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* This file is left for the developer to customize to get the behavior they want for localization.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/// Declare location where extra types will be stored.
|
|
18
|
+
const $localizeFn = $localize as any as {
|
|
19
|
+
TRANSLATIONS: Record<string, any>;
|
|
20
|
+
TRANSLATION_BY_LOCALE: Map<string, Record<string, any>>;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* This solution uses the `@angular/localize` package for translations, however out of the box
|
|
25
|
+
* `$localize` works with a single translation only. This code adds support for multiple locales
|
|
26
|
+
* concurrently. It does this by intercepting the `TRANSLATIONS` property read and returning
|
|
27
|
+
* appropriate translation based on the current locale which is store in the `usEnvDate('local')`.
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
if (!$localizeFn.TRANSLATION_BY_LOCALE) {
|
|
31
|
+
$localizeFn.TRANSLATION_BY_LOCALE = new Map([["", {}]]);
|
|
32
|
+
Object.defineProperty($localize, "TRANSLATIONS", {
|
|
33
|
+
get: function () {
|
|
34
|
+
const locale = getLocale(DEFAULT_LOCALE);
|
|
35
|
+
let translations = $localizeFn.TRANSLATION_BY_LOCALE.get(locale);
|
|
36
|
+
if (!translations) {
|
|
37
|
+
$localizeFn.TRANSLATION_BY_LOCALE.set(locale, (translations = {}));
|
|
38
|
+
}
|
|
39
|
+
return translations;
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Function used to load all translations variants.
|
|
46
|
+
*/
|
|
47
|
+
export function initTranslations() {
|
|
48
|
+
[EN, IT].forEach(({ translations, locale }) => {
|
|
49
|
+
withLocale(locale, () => loadTranslations(translations));
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Function used to examine the request and determine the locale to use.
|
|
55
|
+
*
|
|
56
|
+
* This function is meant to be used with `RenderOptions.locale` property
|
|
57
|
+
*
|
|
58
|
+
* @returns The locale to use which will be stored in the `useEnvData('locale')`.
|
|
59
|
+
*/
|
|
60
|
+
export function extractLang(locale: string): string {
|
|
61
|
+
return locale && $localizeFn.TRANSLATION_BY_LOCALE.has(locale)
|
|
62
|
+
? locale
|
|
63
|
+
: DEFAULT_LOCALE;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Function used to determine the base URL to use for loading the chunks in the browser.
|
|
68
|
+
*
|
|
69
|
+
* The function returns `/build` in dev mode or `/build/<locale>` in prod mode.
|
|
70
|
+
*
|
|
71
|
+
* This function is meant to be used with `RenderOptions.base` property
|
|
72
|
+
*
|
|
73
|
+
* @returns The base URL to use for loading the chunks in the browser.
|
|
74
|
+
*/
|
|
75
|
+
export function extractBase({ serverData }: RenderOptions): string {
|
|
76
|
+
if (import.meta.env.DEV) {
|
|
77
|
+
return `${import.meta.env.BASE_URL}build`;
|
|
78
|
+
} else {
|
|
79
|
+
return `${import.meta.env.BASE_URL}build/` + serverData!.locale;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export function useI18n() {
|
|
84
|
+
if (import.meta.env.DEV) {
|
|
85
|
+
// During development only, load all translations in memory when the app starts on the client.
|
|
86
|
+
// eslint-disable-next-line
|
|
87
|
+
useOnDocument("qinit", $(initTranslations));
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// We always need the translations on the server
|
|
92
|
+
if (import.meta.env.SSR) {
|
|
93
|
+
initTranslations();
|
|
94
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { component$, useStylesScoped$ } from "@qwik.dev/core";
|
|
2
|
+
|
|
3
|
+
export default component$(() => {
|
|
4
|
+
useStylesScoped$(`
|
|
5
|
+
.card {
|
|
6
|
+
width: 300px;
|
|
7
|
+
border-radius: .5rem;
|
|
8
|
+
border: 1px black solid;
|
|
9
|
+
background-color: white;
|
|
10
|
+
color: black;
|
|
11
|
+
margin: auto;
|
|
12
|
+
text-align:center;
|
|
13
|
+
padding: 2rem;
|
|
14
|
+
margin-top: 4rem;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.links {
|
|
18
|
+
display: flex;
|
|
19
|
+
justify-content: space-evenly;
|
|
20
|
+
padding: 1.25rem 0;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.link {
|
|
24
|
+
font-weight: 500;
|
|
25
|
+
color: rgb(63 131 248/1);
|
|
26
|
+
}
|
|
27
|
+
`);
|
|
28
|
+
const name = "Qwik";
|
|
29
|
+
return (
|
|
30
|
+
<div class="card">
|
|
31
|
+
<div style="padding-bottom: 1.25rem;">
|
|
32
|
+
<div style="font-weight: 700; font-size: 1.5rem;">{$localize`Hello from ${name}!`}</div>
|
|
33
|
+
</div>
|
|
34
|
+
<div style="padding-bottom: 1.25rem;">
|
|
35
|
+
<div style="font-weight: 700; font-size: 1.0rem;">
|
|
36
|
+
{$localize`Use the following links to change the translation.`}
|
|
37
|
+
<div class="links">
|
|
38
|
+
<a class="link" href="/en/">
|
|
39
|
+
English
|
|
40
|
+
</a>
|
|
41
|
+
<a class="link" href="/it/">
|
|
42
|
+
Italiano
|
|
43
|
+
</a>
|
|
44
|
+
</div>
|
|
45
|
+
<div style="font-size: 1.0rem;">
|
|
46
|
+
{$localize`Translation is performed as part of the build step so translated strings are inlined into the application, there is no need to load or look them up at runtime. However, these advantages mean that the user cannot change the language without refreshing the page.`}
|
|
47
|
+
</div>
|
|
48
|
+
</div>
|
|
49
|
+
</div>
|
|
50
|
+
</div>
|
|
51
|
+
);
|
|
52
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { RequestHandler } from "@qwik.dev/router";
|
|
2
|
+
import { component$, Slot } from "@qwik.dev/core";
|
|
3
|
+
import { extractLang, useI18n } from "~/routes/[locale]/i18n-utils";
|
|
4
|
+
|
|
5
|
+
export const onRequest: RequestHandler = ({ locale, params }) => {
|
|
6
|
+
locale(extractLang(params.locale));
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export default component$(() => {
|
|
10
|
+
useI18n();
|
|
11
|
+
return <Slot />;
|
|
12
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"description": "Use Orama in your Qwik app",
|
|
3
|
+
"__qwik__": {
|
|
4
|
+
"displayName": "Integration: Orama (full-text search engine)",
|
|
5
|
+
"priority": -10,
|
|
6
|
+
"viteConfig": {},
|
|
7
|
+
"docs": [
|
|
8
|
+
"https://docs.oramasearch.com/"
|
|
9
|
+
],
|
|
10
|
+
"nextSteps": {
|
|
11
|
+
"title": "Next Steps",
|
|
12
|
+
"lines": [
|
|
13
|
+
" - /src/routes/orama: New public route showcasing Orama integration",
|
|
14
|
+
"",
|
|
15
|
+
" Check out the Orama docs for more info:",
|
|
16
|
+
" - https://docs.oramasearch.com/"
|
|
17
|
+
]
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"devDependencies": {
|
|
21
|
+
"@orama/orama": "^1.2.11"
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { type Orama, create, insert } from "@orama/orama";
|
|
2
|
+
|
|
3
|
+
export type Pokemon = { name: string; description: string; image: string };
|
|
4
|
+
|
|
5
|
+
const pokedex: Pokemon[] = [
|
|
6
|
+
{
|
|
7
|
+
name: "Bulbasaur",
|
|
8
|
+
description:
|
|
9
|
+
"There is a plant seed on its back right from the day this Pokémon is born. The seed slowly grows larger.",
|
|
10
|
+
image: "https://assets.pokemon.com/assets/cms2/img/pokedex/full/001.png",
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
name: "Charmander",
|
|
14
|
+
description:
|
|
15
|
+
"It has a preference for hot things. When it rains, steam is said to spout from the tip of its tail.",
|
|
16
|
+
image: "https://assets.pokemon.com/assets/cms2/img/pokedex/full/004.png",
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
name: "Squirtle",
|
|
20
|
+
description:
|
|
21
|
+
"When it retracts its long neck into its shell, it squirts out water with vigorous force.",
|
|
22
|
+
image: "https://assets.pokemon.com/assets/cms2/img/pokedex/full/007.png",
|
|
23
|
+
},
|
|
24
|
+
];
|
|
25
|
+
|
|
26
|
+
export let oramaDb: Orama;
|
|
27
|
+
|
|
28
|
+
export const createOramaDb = async () => {
|
|
29
|
+
if (oramaDb) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
const db = await create({
|
|
33
|
+
schema: {
|
|
34
|
+
name: "string",
|
|
35
|
+
description: "string",
|
|
36
|
+
image: "string",
|
|
37
|
+
},
|
|
38
|
+
});
|
|
39
|
+
oramaDb = db;
|
|
40
|
+
pokedex.map(async (pokemon) => await insert(oramaDb, pokemon));
|
|
41
|
+
};
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { search } from "@orama/orama";
|
|
2
|
+
import { server$ } from "@qwik.dev/router";
|
|
3
|
+
import { $, component$, useSignal, useStylesScoped$ } from "@qwik.dev/core";
|
|
4
|
+
import { type Pokemon, createOramaDb, oramaDb } from "~/orama";
|
|
5
|
+
|
|
6
|
+
createOramaDb();
|
|
7
|
+
|
|
8
|
+
export default component$(() => {
|
|
9
|
+
useStylesScoped$(`
|
|
10
|
+
.search {
|
|
11
|
+
font-size: 100%;
|
|
12
|
+
width: calc(100% - 38px);
|
|
13
|
+
border-radius: 0.5rem;
|
|
14
|
+
border: 1px black solid;
|
|
15
|
+
padding: 1rem;
|
|
16
|
+
color: black;
|
|
17
|
+
outline: none;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.search-button {
|
|
21
|
+
border: none;
|
|
22
|
+
padding: 6px 0px;
|
|
23
|
+
cursor: pointer;
|
|
24
|
+
background-color: transparent;
|
|
25
|
+
position: absolute;
|
|
26
|
+
right: 0.6rem;
|
|
27
|
+
padding: 0.7rem 0.5rem 0.4rem 0.5rem;
|
|
28
|
+
outline: none;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.list {
|
|
32
|
+
display: flex;
|
|
33
|
+
flex-wrap: wrap;
|
|
34
|
+
justify-content: space-around;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.card {
|
|
38
|
+
width: 300px;
|
|
39
|
+
border-radius: .5rem;
|
|
40
|
+
border: 1px black solid;
|
|
41
|
+
background-color: white;
|
|
42
|
+
color: black;
|
|
43
|
+
}
|
|
44
|
+
`);
|
|
45
|
+
const termSignal = useSignal("");
|
|
46
|
+
const pokedexSig = useSignal<Pokemon[]>([]);
|
|
47
|
+
|
|
48
|
+
const onSearch = $(async (term: string) => {
|
|
49
|
+
const response = await execSearch(term);
|
|
50
|
+
pokedexSig.value = (response.hits || []).map(
|
|
51
|
+
(hit) => hit.document as unknown as Pokemon,
|
|
52
|
+
);
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
return (
|
|
56
|
+
<div>
|
|
57
|
+
<div style="margin: 1rem;">
|
|
58
|
+
<div style="position: relative;">
|
|
59
|
+
<input
|
|
60
|
+
class="search"
|
|
61
|
+
placeholder="e.g. search for plant, water, hot."
|
|
62
|
+
bind:value={termSignal}
|
|
63
|
+
onKeyDown$={(e) => {
|
|
64
|
+
if (e.key === "Enter") {
|
|
65
|
+
onSearch(termSignal.value);
|
|
66
|
+
}
|
|
67
|
+
}}
|
|
68
|
+
/>
|
|
69
|
+
<button
|
|
70
|
+
type="submit"
|
|
71
|
+
class="search-button"
|
|
72
|
+
onClick$={() => onSearch(termSignal.value)}
|
|
73
|
+
>
|
|
74
|
+
<svg
|
|
75
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
76
|
+
width="32"
|
|
77
|
+
height="32"
|
|
78
|
+
viewBox="0 0 24 24"
|
|
79
|
+
>
|
|
80
|
+
<path
|
|
81
|
+
fill="currentColor"
|
|
82
|
+
d="M15.5 14h-.79l-.28-.27A6.471 6.471 0 0 0 16 9.5A6.5 6.5 0 1 0 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5S14 7.01 14 9.5S11.99 14 9.5 14z"
|
|
83
|
+
/>
|
|
84
|
+
</svg>
|
|
85
|
+
</button>
|
|
86
|
+
</div>
|
|
87
|
+
</div>
|
|
88
|
+
<div class="list">
|
|
89
|
+
{pokedexSig.value.map(({ name, description, image }) => (
|
|
90
|
+
<div key={name} class="card">
|
|
91
|
+
<div style="padding: 1.25rem; text-align:center;">
|
|
92
|
+
<img width={200} height={200} src={image} alt={name} />
|
|
93
|
+
<div style="font-weight: 700; font-size: 1.5rem;">{name}</div>
|
|
94
|
+
<p>{description}</p>
|
|
95
|
+
</div>
|
|
96
|
+
</div>
|
|
97
|
+
))}
|
|
98
|
+
</div>
|
|
99
|
+
</div>
|
|
100
|
+
);
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
export const execSearch = server$(async (term: string) => {
|
|
104
|
+
const response = await search(oramaDb, {
|
|
105
|
+
term,
|
|
106
|
+
properties: "*",
|
|
107
|
+
boost: { name: 1.5 },
|
|
108
|
+
});
|
|
109
|
+
return response;
|
|
110
|
+
});
|