@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.
- package/LICENSE +22 -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_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 +10923 -0
- package/dist/core.cjs.map +1 -0
- package/dist/core.min.mjs +1 -0
- package/dist/core.mjs +10819 -0
- package/dist/core.mjs.map +1 -0
- package/dist/core.prod.cjs +5181 -0
- package/dist/core.prod.mjs +6025 -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 +9145 -0
- package/dist/optimizer.d.ts +707 -0
- package/dist/optimizer.mjs +9709 -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 +8942 -0
- package/dist/server.d.ts +404 -0
- package/dist/server.mjs +8877 -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 +32425 -0
- package/dist/testing/index.d.ts +140 -0
- package/dist/testing/index.mjs +32389 -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 +20 -12
- package/public.d.ts +68 -0
- package/qwik-cli.cjs +4 -0
- package/server.d.ts +15 -0
- package/testing.d.ts +2 -0
|
@@ -0,0 +1,3895 @@
|
|
|
1
|
+
import * as CSS_2 from 'csstype';
|
|
2
|
+
import type { StreamWriter as StreamWriter_2 } from '.';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Qwik Optimizer marker function.
|
|
6
|
+
*
|
|
7
|
+
* Use `$(...)` to tell Qwik Optimizer to extract the expression in `$(...)` into a lazy-loadable
|
|
8
|
+
* resource referenced by `QRL`.
|
|
9
|
+
*
|
|
10
|
+
* @param expression - Expression which should be lazy loaded
|
|
11
|
+
* @public
|
|
12
|
+
* @see `implicit$FirstArg` for additional `____$(...)` rules.
|
|
13
|
+
*
|
|
14
|
+
* In this example, `$(...)` is used to capture the callback function of `onmousemove` into a
|
|
15
|
+
* lazy-loadable reference. This allows the code to refer to the function without actually
|
|
16
|
+
* loading the function. In this example, the callback function does not get loaded until
|
|
17
|
+
* `mousemove` event fires.
|
|
18
|
+
*
|
|
19
|
+
* ```tsx
|
|
20
|
+
* useOnDocument(
|
|
21
|
+
* 'mousemove',
|
|
22
|
+
* $((event) => console.log('mousemove', event))
|
|
23
|
+
* );
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* In this code, the Qwik Optimizer detects `$(...)` and transforms the code into:
|
|
27
|
+
*
|
|
28
|
+
* ```tsx
|
|
29
|
+
* // FILE: <current file>
|
|
30
|
+
* useOnDocument('mousemove', qrl('./chunk-abc.js', 'onMousemove'));
|
|
31
|
+
*
|
|
32
|
+
* // FILE: chunk-abc.js
|
|
33
|
+
* export const onMousemove = () => console.log('mousemove');
|
|
34
|
+
* ```
|
|
35
|
+
*
|
|
36
|
+
* ## Special Rules
|
|
37
|
+
*
|
|
38
|
+
* The Qwik Optimizer places special rules on functions that can be lazy-loaded.
|
|
39
|
+
*
|
|
40
|
+
* 1. The expression of the `$(expression)` function must be importable by the system.
|
|
41
|
+
* (expression shows up in `import` or has `export`)
|
|
42
|
+
* 2. If inlined function, then all lexically captured values must be:
|
|
43
|
+
* - importable (vars show up in `import`s or `export`s)
|
|
44
|
+
* - const (The capturing process differs from JS capturing in that writing to captured
|
|
45
|
+
* variables does not update them, and therefore writes are forbidden. The best practice is that
|
|
46
|
+
* all captured variables are constants.)
|
|
47
|
+
* - Must be runtime serializable.
|
|
48
|
+
*
|
|
49
|
+
* ```tsx
|
|
50
|
+
*
|
|
51
|
+
* import { createContextId, useContext, useContextProvider } from './use/use-context';
|
|
52
|
+
* import { Resource } from './use/use-resource';
|
|
53
|
+
* import { useResource$ } from './use/use-resource-dollar';
|
|
54
|
+
* import { useSignal } from './use/use-signal';
|
|
55
|
+
*
|
|
56
|
+
* export const greet = () => console.log('greet');
|
|
57
|
+
* function topLevelFn() {}
|
|
58
|
+
*
|
|
59
|
+
* function myCode() {
|
|
60
|
+
* const store = useStore({});
|
|
61
|
+
* function localFn() {}
|
|
62
|
+
* // Valid Examples
|
|
63
|
+
* $(greet); // greet is importable
|
|
64
|
+
* $(() => greet()); // greet is importable;
|
|
65
|
+
* $(() => console.log(store)); // store is serializable.
|
|
66
|
+
*
|
|
67
|
+
* // Compile time errors
|
|
68
|
+
* $(topLevelFn); // ERROR: `topLevelFn` not importable
|
|
69
|
+
* $(() => topLevelFn()); // ERROR: `topLevelFn` not importable
|
|
70
|
+
*
|
|
71
|
+
* // Runtime errors
|
|
72
|
+
* $(localFn); // ERROR: `localFn` fails serialization
|
|
73
|
+
* $(() => localFn()); // ERROR: `localFn` fails serialization
|
|
74
|
+
* }
|
|
75
|
+
*
|
|
76
|
+
* ```
|
|
77
|
+
*/
|
|
78
|
+
export declare const $: <T>(expression: T) => QRL<T>;
|
|
79
|
+
|
|
80
|
+
declare type AllEventKeys = keyof AllEventsMap;
|
|
81
|
+
|
|
82
|
+
declare type AllEventMapRaw = HTMLElementEventMap & DocumentEventMap & WindowEventHandlersEventMap & {
|
|
83
|
+
qidle: QwikIdleEvent;
|
|
84
|
+
qinit: QwikInitEvent;
|
|
85
|
+
qsymbol: QwikSymbolEvent;
|
|
86
|
+
qvisible: QwikVisibleEvent;
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
declare type AllEventsMap = Omit<AllEventMapRaw, keyof EventCorrectionMap> & EventCorrectionMap;
|
|
90
|
+
|
|
91
|
+
declare type _AllowPlainQrl<Q> = QRLEventHandlerMulti<any, any> extends Q ? Q extends QRLEventHandlerMulti<infer EV, infer EL> ? Q | (EL extends Element ? EventHandler<EV, EL> : never) : Q : Q extends QRL<infer U> ? Q | U : NonNullable<Q> extends never ? Q : QRL<Q> | Q;
|
|
92
|
+
|
|
93
|
+
declare type AllPascalEventMaps = PascalMap<AllEventsMap>;
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* TS defines these with the React syntax which is not compatible with Qwik. E.g. `ariaAtomic`
|
|
97
|
+
* instead of `aria-atomic`.
|
|
98
|
+
*
|
|
99
|
+
* @public
|
|
100
|
+
*/
|
|
101
|
+
declare interface AriaAttributes {
|
|
102
|
+
/**
|
|
103
|
+
* Identifies the currently active element when DOM focus is on a composite widget, textbox,
|
|
104
|
+
* group, or application.
|
|
105
|
+
*/
|
|
106
|
+
'aria-activedescendant'?: string | undefined;
|
|
107
|
+
/**
|
|
108
|
+
* Indicates whether assistive technologies will present all, or only parts of, the changed region
|
|
109
|
+
* based on the change notifications defined by the aria-relevant attribute.
|
|
110
|
+
*/
|
|
111
|
+
'aria-atomic'?: Booleanish | undefined;
|
|
112
|
+
/**
|
|
113
|
+
* Indicates whether inputting text could trigger display of one or more predictions of the user's
|
|
114
|
+
* intended value for an input and specifies how predictions would be presented if they are made.
|
|
115
|
+
*/
|
|
116
|
+
'aria-autocomplete'?: 'none' | 'inline' | 'list' | 'both' | undefined;
|
|
117
|
+
/**
|
|
118
|
+
* Indicates an element is being modified and that assistive technologies MAY want to wait until
|
|
119
|
+
* the modifications are complete before exposing them to the user.
|
|
120
|
+
*/
|
|
121
|
+
'aria-busy'?: Booleanish | undefined;
|
|
122
|
+
/**
|
|
123
|
+
* Indicates the current "checked" state of checkboxes, radio buttons, and other widgets.
|
|
124
|
+
*
|
|
125
|
+
* @see aria-pressed @see aria-selected.
|
|
126
|
+
*/
|
|
127
|
+
'aria-checked'?: boolean | 'false' | 'mixed' | 'true' | undefined;
|
|
128
|
+
/**
|
|
129
|
+
* Defines the total number of columns in a table, grid, or treegrid.
|
|
130
|
+
*
|
|
131
|
+
* @see aria-colindex.
|
|
132
|
+
*/
|
|
133
|
+
'aria-colcount'?: number | undefined;
|
|
134
|
+
/**
|
|
135
|
+
* Defines an element's column index or position with respect to the total number of columns
|
|
136
|
+
* within a table, grid, or treegrid.
|
|
137
|
+
*
|
|
138
|
+
* @see aria-colcount @see aria-colspan.
|
|
139
|
+
*/
|
|
140
|
+
'aria-colindex'?: number | undefined;
|
|
141
|
+
/**
|
|
142
|
+
* Defines the number of columns spanned by a cell or gridcell within a table, grid, or treegrid.
|
|
143
|
+
*
|
|
144
|
+
* @see aria-colindex @see aria-rowspan.
|
|
145
|
+
*/
|
|
146
|
+
'aria-colspan'?: number | undefined;
|
|
147
|
+
/**
|
|
148
|
+
* Identifies the element (or elements) whose contents or presence are controlled by the current
|
|
149
|
+
* element.
|
|
150
|
+
*
|
|
151
|
+
* @see aria-owns.
|
|
152
|
+
*/
|
|
153
|
+
'aria-controls'?: string | undefined;
|
|
154
|
+
/**
|
|
155
|
+
* Indicates the element that represents the current item within a container or set of related
|
|
156
|
+
* elements.
|
|
157
|
+
*/
|
|
158
|
+
'aria-current'?: boolean | 'false' | 'true' | 'page' | 'step' | 'location' | 'date' | 'time' | undefined;
|
|
159
|
+
/**
|
|
160
|
+
* Identifies the element (or elements) that describes the object.
|
|
161
|
+
*
|
|
162
|
+
* @see aria-labelledby
|
|
163
|
+
*/
|
|
164
|
+
'aria-describedby'?: string | undefined;
|
|
165
|
+
/**
|
|
166
|
+
* Identifies the element that provides a detailed, extended description for the object.
|
|
167
|
+
*
|
|
168
|
+
* @see aria-describedby.
|
|
169
|
+
*/
|
|
170
|
+
'aria-details'?: string | undefined;
|
|
171
|
+
/**
|
|
172
|
+
* Indicates that the element is perceivable but disabled, so it is not editable or otherwise
|
|
173
|
+
* operable.
|
|
174
|
+
*
|
|
175
|
+
* @see aria-hidden @see aria-readonly.
|
|
176
|
+
*/
|
|
177
|
+
'aria-disabled'?: Booleanish | undefined;
|
|
178
|
+
/**
|
|
179
|
+
* Indicates what functions can be performed when a dragged object is released on the drop target.
|
|
180
|
+
*
|
|
181
|
+
* @deprecated In ARIA 1.1
|
|
182
|
+
*/
|
|
183
|
+
'aria-dropeffect'?: 'none' | 'copy' | 'execute' | 'link' | 'move' | 'popup' | undefined;
|
|
184
|
+
/**
|
|
185
|
+
* Identifies the element that provides an error message for the object.
|
|
186
|
+
*
|
|
187
|
+
* @see aria-invalid @see aria-describedby.
|
|
188
|
+
*/
|
|
189
|
+
'aria-errormessage'?: string | undefined;
|
|
190
|
+
/**
|
|
191
|
+
* Indicates whether the element, or another grouping element it controls, is currently expanded
|
|
192
|
+
* or collapsed.
|
|
193
|
+
*/
|
|
194
|
+
'aria-expanded'?: Booleanish | undefined;
|
|
195
|
+
/**
|
|
196
|
+
* Identifies the next element (or elements) in an alternate reading order of content which, at
|
|
197
|
+
* the user's discretion, allows assistive technology to override the general default of reading
|
|
198
|
+
* in document source order.
|
|
199
|
+
*/
|
|
200
|
+
'aria-flowto'?: string | undefined;
|
|
201
|
+
/**
|
|
202
|
+
* Indicates an element's "grabbed" state in a drag-and-drop operation.
|
|
203
|
+
*
|
|
204
|
+
* @deprecated In ARIA 1.1
|
|
205
|
+
*/
|
|
206
|
+
'aria-grabbed'?: Booleanish | undefined;
|
|
207
|
+
/**
|
|
208
|
+
* Indicates the availability and type of interactive popup element, such as menu or dialog, that
|
|
209
|
+
* can be triggered by an element.
|
|
210
|
+
*/
|
|
211
|
+
'aria-haspopup'?: boolean | 'false' | 'true' | 'menu' | 'listbox' | 'tree' | 'grid' | 'dialog' | undefined;
|
|
212
|
+
/**
|
|
213
|
+
* Indicates whether the element is exposed to an accessibility API.
|
|
214
|
+
*
|
|
215
|
+
* @see aria-disabled.
|
|
216
|
+
*/
|
|
217
|
+
'aria-hidden'?: Booleanish | undefined;
|
|
218
|
+
/**
|
|
219
|
+
* Indicates the entered value does not conform to the format expected by the application.
|
|
220
|
+
*
|
|
221
|
+
* @see aria-errormessage.
|
|
222
|
+
*/
|
|
223
|
+
'aria-invalid'?: boolean | 'false' | 'true' | 'grammar' | 'spelling' | undefined;
|
|
224
|
+
/**
|
|
225
|
+
* Indicates keyboard shortcuts that an author has implemented to activate or give focus to an
|
|
226
|
+
* element.
|
|
227
|
+
*/
|
|
228
|
+
'aria-keyshortcuts'?: string | undefined;
|
|
229
|
+
/**
|
|
230
|
+
* Defines a string value that labels the current element.
|
|
231
|
+
*
|
|
232
|
+
* @see aria-labelledby.
|
|
233
|
+
*/
|
|
234
|
+
'aria-label'?: string | undefined;
|
|
235
|
+
/**
|
|
236
|
+
* Identifies the element (or elements) that labels the current element.
|
|
237
|
+
*
|
|
238
|
+
* @see aria-describedby.
|
|
239
|
+
*/
|
|
240
|
+
'aria-labelledby'?: string | undefined;
|
|
241
|
+
/** Defines the hierarchical level of an element within a structure. */
|
|
242
|
+
'aria-level'?: number | undefined;
|
|
243
|
+
/**
|
|
244
|
+
* Indicates that an element will be updated, and describes the types of updates the user agents,
|
|
245
|
+
* assistive technologies, and user can expect from the live region.
|
|
246
|
+
*/
|
|
247
|
+
'aria-live'?: 'off' | 'assertive' | 'polite' | undefined;
|
|
248
|
+
/** Indicates whether an element is modal when displayed. */
|
|
249
|
+
'aria-modal'?: Booleanish | undefined;
|
|
250
|
+
/** Indicates whether a text box accepts multiple lines of input or only a single line. */
|
|
251
|
+
'aria-multiline'?: Booleanish | undefined;
|
|
252
|
+
/** Indicates that the user may select more than one item from the current selectable descendants. */
|
|
253
|
+
'aria-multiselectable'?: Booleanish | undefined;
|
|
254
|
+
/** Indicates whether the element's orientation is horizontal, vertical, or unknown/ambiguous. */
|
|
255
|
+
'aria-orientation'?: 'horizontal' | 'vertical' | undefined;
|
|
256
|
+
/**
|
|
257
|
+
* Identifies an element (or elements) in order to define a visual, functional, or contextual
|
|
258
|
+
* parent/child relationship between DOM elements where the DOM hierarchy cannot be used to
|
|
259
|
+
* represent the relationship.
|
|
260
|
+
*
|
|
261
|
+
* @see aria-controls.
|
|
262
|
+
*/
|
|
263
|
+
'aria-owns'?: string | undefined;
|
|
264
|
+
/**
|
|
265
|
+
* Defines a short hint (a word or short phrase) intended to aid the user with data entry when the
|
|
266
|
+
* control has no value. A hint could be a sample value or a brief description of the expected
|
|
267
|
+
* format.
|
|
268
|
+
*/
|
|
269
|
+
'aria-placeholder'?: string | undefined;
|
|
270
|
+
/**
|
|
271
|
+
* Defines an element's number or position in the current set of listitems or treeitems. Not
|
|
272
|
+
* required if all elements in the set are present in the DOM.
|
|
273
|
+
*
|
|
274
|
+
* @see aria-setsize.
|
|
275
|
+
*/
|
|
276
|
+
'aria-posinset'?: number | undefined;
|
|
277
|
+
/**
|
|
278
|
+
* Indicates the current "pressed" state of toggle buttons.
|
|
279
|
+
*
|
|
280
|
+
* @see aria-checked @see aria-selected.
|
|
281
|
+
*/
|
|
282
|
+
'aria-pressed'?: boolean | 'false' | 'mixed' | 'true' | undefined;
|
|
283
|
+
/**
|
|
284
|
+
* Indicates that the element is not editable, but is otherwise operable.
|
|
285
|
+
*
|
|
286
|
+
* @see aria-disabled.
|
|
287
|
+
*/
|
|
288
|
+
'aria-readonly'?: Booleanish | undefined;
|
|
289
|
+
/**
|
|
290
|
+
* Indicates what notifications the user agent will trigger when the accessibility tree within a
|
|
291
|
+
* live region is modified.
|
|
292
|
+
*
|
|
293
|
+
* @see aria-atomic.
|
|
294
|
+
*/
|
|
295
|
+
'aria-relevant'?: 'additions' | 'additions removals' | 'additions text' | 'all' | 'removals' | 'removals additions' | 'removals text' | 'text' | 'text additions' | 'text removals' | undefined;
|
|
296
|
+
/** Indicates that user input is required on the element before a form may be submitted. */
|
|
297
|
+
'aria-required'?: Booleanish | undefined;
|
|
298
|
+
/** Defines a human-readable, author-localized description for the role of an element. */
|
|
299
|
+
'aria-roledescription'?: string | undefined;
|
|
300
|
+
/**
|
|
301
|
+
* Defines the total number of rows in a table, grid, or treegrid.
|
|
302
|
+
*
|
|
303
|
+
* @see aria-rowindex.
|
|
304
|
+
*/
|
|
305
|
+
'aria-rowcount'?: number | undefined;
|
|
306
|
+
/**
|
|
307
|
+
* Defines an element's row index or position with respect to the total number of rows within a
|
|
308
|
+
* table, grid, or treegrid.
|
|
309
|
+
*
|
|
310
|
+
* @see aria-rowcount @see aria-rowspan.
|
|
311
|
+
*/
|
|
312
|
+
'aria-rowindex'?: number | undefined;
|
|
313
|
+
/**
|
|
314
|
+
* Defines the number of rows spanned by a cell or gridcell within a table, grid, or treegrid.
|
|
315
|
+
*
|
|
316
|
+
* @see aria-rowindex @see aria-colspan.
|
|
317
|
+
*/
|
|
318
|
+
'aria-rowspan'?: number | undefined;
|
|
319
|
+
/**
|
|
320
|
+
* Indicates the current "selected" state of various widgets.
|
|
321
|
+
*
|
|
322
|
+
* @see aria-checked @see aria-pressed.
|
|
323
|
+
*/
|
|
324
|
+
'aria-selected'?: Booleanish | undefined;
|
|
325
|
+
/**
|
|
326
|
+
* Defines the number of items in the current set of listitems or treeitems. Not required if all
|
|
327
|
+
* elements in the set are present in the DOM.
|
|
328
|
+
*
|
|
329
|
+
* @see aria-posinset.
|
|
330
|
+
*/
|
|
331
|
+
'aria-setsize'?: number | undefined;
|
|
332
|
+
/** Indicates if items in a table or grid are sorted in ascending or descending order. */
|
|
333
|
+
'aria-sort'?: 'none' | 'ascending' | 'descending' | 'other' | undefined;
|
|
334
|
+
/** Defines the maximum allowed value for a range widget. */
|
|
335
|
+
'aria-valuemax'?: number | undefined;
|
|
336
|
+
/** Defines the minimum allowed value for a range widget. */
|
|
337
|
+
'aria-valuemin'?: number | undefined;
|
|
338
|
+
/**
|
|
339
|
+
* Defines the current value for a range widget.
|
|
340
|
+
*
|
|
341
|
+
* @see aria-valuetext.
|
|
342
|
+
*/
|
|
343
|
+
'aria-valuenow'?: number | undefined;
|
|
344
|
+
/** Defines the human readable text alternative of aria-valuenow for a range widget. */
|
|
345
|
+
'aria-valuetext'?: string | undefined;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
/** @public */
|
|
349
|
+
declare type AriaRole = 'alert' | 'alertdialog' | 'application' | 'article' | 'banner' | 'button' | 'cell' | 'checkbox' | 'columnheader' | 'combobox' | 'complementary' | 'contentinfo' | 'definition' | 'dialog' | 'directory' | 'document' | 'feed' | 'figure' | 'form' | 'grid' | 'gridcell' | 'group' | 'heading' | 'img' | 'link' | 'list' | 'listbox' | 'listitem' | 'log' | 'main' | 'marquee' | 'math' | 'menu' | 'menubar' | 'menuitem' | 'menuitemcheckbox' | 'menuitemradio' | 'navigation' | 'none' | 'note' | 'option' | 'presentation' | 'progressbar' | 'radio' | 'radiogroup' | 'region' | 'row' | 'rowgroup' | 'rowheader' | 'scrollbar' | 'search' | 'searchbox' | 'separator' | 'slider' | 'spinbutton' | 'status' | 'switch' | 'tab' | 'table' | 'tablist' | 'tabpanel' | 'term' | 'textbox' | 'timer' | 'toolbar' | 'tooltip' | 'tree' | 'treegrid' | 'treeitem' | (string & {});
|
|
350
|
+
|
|
351
|
+
/**
|
|
352
|
+
* Replace given element's props with custom types and return all props specific to the element. Use
|
|
353
|
+
* this for known props that are incorrect or missing.
|
|
354
|
+
*
|
|
355
|
+
* Uses Prettify so we see the special props for each element in editor hover
|
|
356
|
+
*/
|
|
357
|
+
declare type Augmented<E, A = {}> = Prettify<Filtered<E, A> & A>;
|
|
358
|
+
|
|
359
|
+
declare type BivariantQrlFn<ARGS extends any[], RETURN> = {
|
|
360
|
+
/**
|
|
361
|
+
* Resolve the QRL of closure and invoke it.
|
|
362
|
+
*
|
|
363
|
+
* @param args - Closure arguments.
|
|
364
|
+
* @returns A promise of the return value of the closure.
|
|
365
|
+
*/
|
|
366
|
+
bivarianceHack(...args: ARGS): Promise<RETURN>;
|
|
367
|
+
}['bivarianceHack'];
|
|
368
|
+
|
|
369
|
+
/** @public */
|
|
370
|
+
declare type Booleanish = boolean | `${boolean}`;
|
|
371
|
+
|
|
372
|
+
declare const enum ChoreType {
|
|
373
|
+
MACRO = 112,
|
|
374
|
+
MICRO = 15,
|
|
375
|
+
/** Ensure tha the QRL promise is resolved before processing next chores in the queue */
|
|
376
|
+
QRL_RESOLVE = 1,
|
|
377
|
+
RESOURCE = 2,
|
|
378
|
+
TASK = 3,
|
|
379
|
+
NODE_DIFF = 4,
|
|
380
|
+
NODE_PROP = 5,
|
|
381
|
+
COMPONENT_SSR = 6,
|
|
382
|
+
COMPONENT = 7,
|
|
383
|
+
WAIT_FOR_COMPONENTS = 16,
|
|
384
|
+
JOURNAL_FLUSH = 48,
|
|
385
|
+
VISIBLE = 64,
|
|
386
|
+
CLEANUP_VISIBLE = 80,
|
|
387
|
+
WAIT_FOR_ALL = 127
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
/**
|
|
391
|
+
* A class list can be a string, a boolean, an array, or an object.
|
|
392
|
+
*
|
|
393
|
+
* If it's an array, each item is a class list and they are all added.
|
|
394
|
+
*
|
|
395
|
+
* If it's an object, then the keys are class name strings, and the values are booleans that
|
|
396
|
+
* determine if the class name string should be added or not.
|
|
397
|
+
*
|
|
398
|
+
* @public
|
|
399
|
+
*/
|
|
400
|
+
export declare type ClassList = string | undefined | null | false | Record<string, boolean | string | number | null | undefined> | ClassList[];
|
|
401
|
+
|
|
402
|
+
/** @internal */
|
|
403
|
+
export declare interface ClientContainer extends Container {
|
|
404
|
+
document: _QDocument;
|
|
405
|
+
element: _ContainerElement;
|
|
406
|
+
qContainer: string;
|
|
407
|
+
qBase: string;
|
|
408
|
+
$locale$: string;
|
|
409
|
+
qManifestHash: string;
|
|
410
|
+
rootVNode: _ElementVNode;
|
|
411
|
+
$journal$: VNodeJournal;
|
|
412
|
+
renderDone: Promise<void> | null;
|
|
413
|
+
parseQRL<T = unknown>(qrl: string): QRL<T>;
|
|
414
|
+
$setRawState$(id: number, vParent: _ElementVNode | _VirtualVNode): void;
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
/**
|
|
418
|
+
* Declare a Qwik component that can be used to create UI.
|
|
419
|
+
*
|
|
420
|
+
* Use `component$` to declare a Qwik component. A Qwik component is a special kind of component
|
|
421
|
+
* that allows the Qwik framework to lazy load and execute the component independently of other Qwik
|
|
422
|
+
* components as well as lazy load the component's life-cycle hooks and event handlers.
|
|
423
|
+
*
|
|
424
|
+
* Side note: You can also declare regular (standard JSX) components that will have standard
|
|
425
|
+
* synchronous behavior.
|
|
426
|
+
*
|
|
427
|
+
* Qwik component is a facade that describes how the component should be used without forcing the
|
|
428
|
+
* implementation of the component to be eagerly loaded. A minimum Qwik definition consists of:
|
|
429
|
+
*
|
|
430
|
+
* ### Example
|
|
431
|
+
*
|
|
432
|
+
* An example showing how to create a counter component:
|
|
433
|
+
*
|
|
434
|
+
* ```tsx
|
|
435
|
+
* export interface CounterProps {
|
|
436
|
+
* initialValue?: number;
|
|
437
|
+
* step?: number;
|
|
438
|
+
* }
|
|
439
|
+
* export const Counter = component$((props: CounterProps) => {
|
|
440
|
+
* const state = useStore({ count: props.initialValue || 0 });
|
|
441
|
+
* return (
|
|
442
|
+
* <div>
|
|
443
|
+
* <span>{state.count}</span>
|
|
444
|
+
* <button onClick$={() => (state.count += props.step || 1)}>+</button>
|
|
445
|
+
* </div>
|
|
446
|
+
* );
|
|
447
|
+
* });
|
|
448
|
+
* ```
|
|
449
|
+
*
|
|
450
|
+
* - `component$` is how a component gets declared.
|
|
451
|
+
* - `{ value?: number; step?: number }` declares the public (props) interface of the component.
|
|
452
|
+
* - `{ count: number }` declares the private (state) interface of the component.
|
|
453
|
+
*
|
|
454
|
+
* The above can then be used like so:
|
|
455
|
+
*
|
|
456
|
+
* ```tsx
|
|
457
|
+
* export const OtherComponent = component$(() => {
|
|
458
|
+
* return <Counter initialValue={100} />;
|
|
459
|
+
* });
|
|
460
|
+
* ```
|
|
461
|
+
*
|
|
462
|
+
* See also: `component`, `useCleanup`, `onResume`, `onPause`, `useOn`, `useOnDocument`,
|
|
463
|
+
* `useOnWindow`, `useStyles`
|
|
464
|
+
*
|
|
465
|
+
* @public
|
|
466
|
+
*/
|
|
467
|
+
export declare const component$: <PROPS = unknown>(onMount: OnRenderFn<PROPS>) => Component<PROPS>;
|
|
468
|
+
|
|
469
|
+
/**
|
|
470
|
+
* Type representing the Qwik component.
|
|
471
|
+
*
|
|
472
|
+
* `Component` is the type returned by invoking `component$`.
|
|
473
|
+
*
|
|
474
|
+
* ```tsx
|
|
475
|
+
* interface MyComponentProps {
|
|
476
|
+
* someProp: string;
|
|
477
|
+
* }
|
|
478
|
+
* const MyComponent: Component<MyComponentProps> = component$((props: MyComponentProps) => {
|
|
479
|
+
* return <span>{props.someProp}</span>;
|
|
480
|
+
* });
|
|
481
|
+
* ```
|
|
482
|
+
*
|
|
483
|
+
* @public
|
|
484
|
+
*/
|
|
485
|
+
export declare type Component<PROPS = unknown> = FunctionComponent<PublicProps<PROPS>>;
|
|
486
|
+
|
|
487
|
+
/** @public */
|
|
488
|
+
export declare interface ComponentBaseProps {
|
|
489
|
+
key?: string | number | null | undefined;
|
|
490
|
+
'q:slot'?: string;
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
declare type ComponentChildren<PROPS> = PROPS extends {
|
|
494
|
+
children: any;
|
|
495
|
+
} ? never : {
|
|
496
|
+
children?: JSXChildren;
|
|
497
|
+
};
|
|
498
|
+
|
|
499
|
+
/** @internal */
|
|
500
|
+
export declare const componentQrl: <PROPS extends Record<any, any>>(componentQrl: QRL<OnRenderFn<PROPS>>) => Component<PROPS>;
|
|
501
|
+
|
|
502
|
+
declare const ComputedEvent = "qComputed";
|
|
503
|
+
|
|
504
|
+
/** @public */
|
|
505
|
+
export declare type ComputedFn<T> = () => T;
|
|
506
|
+
|
|
507
|
+
/**
|
|
508
|
+
* A computed signal is a signal which is calculated from other signals. When the signals change,
|
|
509
|
+
* the computed signal is recalculated, and if the result changed, all tasks which are tracking the
|
|
510
|
+
* signal will be re-run and all components that read the signal will be re-rendered.
|
|
511
|
+
*
|
|
512
|
+
* @public
|
|
513
|
+
*/
|
|
514
|
+
export declare interface ComputedSignal<T> extends ReadonlySignal<T> {
|
|
515
|
+
/**
|
|
516
|
+
* Use this to force recalculation and running subscribers, for example when the calculated value
|
|
517
|
+
* mutates but remains the same object. Useful for third-party libraries.
|
|
518
|
+
*/
|
|
519
|
+
force(): void;
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
/** @internal */
|
|
523
|
+
export declare const _CONST_PROPS: unique symbol;
|
|
524
|
+
|
|
525
|
+
declare interface Container {
|
|
526
|
+
readonly $version$: string;
|
|
527
|
+
readonly $scheduler$: Scheduler;
|
|
528
|
+
readonly $storeProxyMap$: ObjToProxyMap;
|
|
529
|
+
readonly $locale$: string;
|
|
530
|
+
readonly $getObjectById$: (id: number | string) => any;
|
|
531
|
+
readonly $serverData$: Record<string, any>;
|
|
532
|
+
$currentUniqueId$: number;
|
|
533
|
+
processJsx(host: HostElement, jsx: JSXOutput): ValueOrPromise<void>;
|
|
534
|
+
handleError(err: any, $host$: HostElement): void;
|
|
535
|
+
getParentHost(host: HostElement): HostElement | null;
|
|
536
|
+
setContext<T>(host: HostElement, context: ContextId<T>, value: T): void;
|
|
537
|
+
resolveContext<T>(host: HostElement, contextId: ContextId<T>): T | undefined;
|
|
538
|
+
setHostProp<T>(host: HostElement, name: string, value: T): void;
|
|
539
|
+
getHostProp<T>(host: HostElement, name: string): T | null;
|
|
540
|
+
$appendStyle$(content: string, styleId: string, host: HostElement, scoped: boolean): void;
|
|
541
|
+
/**
|
|
542
|
+
* When component is about to be executed, it may add/remove children. This can cause problems
|
|
543
|
+
* with the projection because deleting content will prevent the projection references from
|
|
544
|
+
* looking up vnodes. Therefore before we execute the component we need to ensure that all of its
|
|
545
|
+
* references to vnode are resolved.
|
|
546
|
+
*
|
|
547
|
+
* @param renderHost - Host element to ensure projection is resolved.
|
|
548
|
+
*/
|
|
549
|
+
ensureProjectionResolved(host: HostElement): void;
|
|
550
|
+
serializationCtxFactory(NodeConstructor: {
|
|
551
|
+
new (...rest: any[]): {
|
|
552
|
+
nodeType: number;
|
|
553
|
+
id: string;
|
|
554
|
+
};
|
|
555
|
+
} | null, symbolToChunkResolver: SymbolToChunkResolver, writer?: StreamWriter): SerializationContext;
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
/** @internal */
|
|
559
|
+
export declare interface _ContainerElement extends HTMLElement {
|
|
560
|
+
qContainer?: ClientContainer;
|
|
561
|
+
/**
|
|
562
|
+
* Map of element ID to Element. If VNodeData has a reference to an element, then it is added to
|
|
563
|
+
* this map for later retrieval.
|
|
564
|
+
*
|
|
565
|
+
* Once retrieved the element is replaced with its VNode.
|
|
566
|
+
*
|
|
567
|
+
* NOTE: This map leaks memory! Once the application is resumed we don't know which element IDs
|
|
568
|
+
* are still in the deserialized state. we will probably need a GC cycle. Some process running in
|
|
569
|
+
* the idle time which processes few elements at a time to see if they are still referenced and
|
|
570
|
+
* removes them from the map if they are not.
|
|
571
|
+
*/
|
|
572
|
+
qVNodeRefs?: Map<number, Element | _ElementVNode>;
|
|
573
|
+
/** String from `<script type="qwik/vnode">` tag. */
|
|
574
|
+
qVnodeData?: string;
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
/**
|
|
578
|
+
* ContextId is a typesafe ID for your context.
|
|
579
|
+
*
|
|
580
|
+
* Context is a way to pass stores to the child components without prop-drilling.
|
|
581
|
+
*
|
|
582
|
+
* Use `createContextId()` to create a `ContextId`. A `ContextId` is just a serializable identifier
|
|
583
|
+
* for the context. It is not the context value itself. See `useContextProvider()` and
|
|
584
|
+
* `useContext()` for the values. Qwik needs a serializable ID for the context so that the it can
|
|
585
|
+
* track context providers and consumers in a way that survives resumability.
|
|
586
|
+
*
|
|
587
|
+
* ### Example
|
|
588
|
+
*
|
|
589
|
+
* ```tsx
|
|
590
|
+
* // Declare the Context type.
|
|
591
|
+
* interface TodosStore {
|
|
592
|
+
* items: string[];
|
|
593
|
+
* }
|
|
594
|
+
* // Create a Context ID (no data is saved here.)
|
|
595
|
+
* // You will use this ID to both create and retrieve the Context.
|
|
596
|
+
* export const TodosContext = createContextId<TodosStore>('Todos');
|
|
597
|
+
*
|
|
598
|
+
* // Example of providing context to child components.
|
|
599
|
+
* export const App = component$(() => {
|
|
600
|
+
* useContextProvider(
|
|
601
|
+
* TodosContext,
|
|
602
|
+
* useStore<TodosStore>({
|
|
603
|
+
* items: ['Learn Qwik', 'Build Qwik app', 'Profit'],
|
|
604
|
+
* })
|
|
605
|
+
* );
|
|
606
|
+
*
|
|
607
|
+
* return <Items />;
|
|
608
|
+
* });
|
|
609
|
+
*
|
|
610
|
+
* // Example of retrieving the context provided by a parent component.
|
|
611
|
+
* export const Items = component$(() => {
|
|
612
|
+
* const todos = useContext(TodosContext);
|
|
613
|
+
* return (
|
|
614
|
+
* <ul>
|
|
615
|
+
* {todos.items.map((item) => (
|
|
616
|
+
* <li>{item}</li>
|
|
617
|
+
* ))}
|
|
618
|
+
* </ul>
|
|
619
|
+
* );
|
|
620
|
+
* });
|
|
621
|
+
*
|
|
622
|
+
* ```
|
|
623
|
+
*
|
|
624
|
+
* @public
|
|
625
|
+
*/
|
|
626
|
+
export declare interface ContextId<STATE> {
|
|
627
|
+
/** Design-time property to store type information for the context. */
|
|
628
|
+
readonly __brand_context_type__: STATE;
|
|
629
|
+
/** A unique ID for the context. */
|
|
630
|
+
readonly id: string;
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
/**
|
|
634
|
+
* Low-level API for platform abstraction.
|
|
635
|
+
*
|
|
636
|
+
* Different platforms (browser, node, service workers) may have different ways of handling things
|
|
637
|
+
* such as `requestAnimationFrame` and imports. To make Qwik platform-independent Qwik uses the
|
|
638
|
+
* `CorePlatform` API to access the platform API.
|
|
639
|
+
*
|
|
640
|
+
* `CorePlatform` also is responsible for importing symbols. The import map is different on the
|
|
641
|
+
* client (browser) then on the server. For this reason, the server has a manifest that is used to
|
|
642
|
+
* map symbols to javascript chunks. The manifest is encapsulated in `CorePlatform`, for this
|
|
643
|
+
* reason, the `CorePlatform` can't be global as there may be multiple applications running at
|
|
644
|
+
* server concurrently.
|
|
645
|
+
*
|
|
646
|
+
* This is a low-level API and there should not be a need for you to access this.
|
|
647
|
+
*
|
|
648
|
+
* @public
|
|
649
|
+
*/
|
|
650
|
+
export declare interface CorePlatform {
|
|
651
|
+
/**
|
|
652
|
+
* True of running on the server platform.
|
|
653
|
+
*
|
|
654
|
+
* @returns True if we are running on the server (not the browser.)
|
|
655
|
+
*/
|
|
656
|
+
isServer: boolean;
|
|
657
|
+
/**
|
|
658
|
+
* Retrieve a symbol value from QRL.
|
|
659
|
+
*
|
|
660
|
+
* Qwik needs to lazy load data and closures. For this Qwik uses QRLs that are serializable
|
|
661
|
+
* references of resources that are needed. The QRLs contain all the information necessary to
|
|
662
|
+
* retrieve the reference using `importSymbol`.
|
|
663
|
+
*
|
|
664
|
+
* Why not use `import()`? Because `import()` is relative to the current file, and the current
|
|
665
|
+
* file is always the Qwik framework. So QRLs have additional information that allows them to
|
|
666
|
+
* serialize imports relative to application base rather than the Qwik framework file.
|
|
667
|
+
*
|
|
668
|
+
* @param element - The element against which the `url` is resolved. Used to locate the container
|
|
669
|
+
* root and `q:base` attribute.
|
|
670
|
+
* @param url - Relative URL retrieved from the attribute that needs to be resolved against the
|
|
671
|
+
* container `q:base` attribute.
|
|
672
|
+
* @param symbol - The name of the symbol to import.
|
|
673
|
+
* @returns A promise that resolves to the imported symbol.
|
|
674
|
+
*/
|
|
675
|
+
importSymbol: (containerEl: Element | undefined, url: string | URL | undefined | null, symbol: string) => ValueOrPromise<any>;
|
|
676
|
+
/**
|
|
677
|
+
* Perform operation on next request-animation-frame.
|
|
678
|
+
*
|
|
679
|
+
* @param fn - The function to call when the next animation frame is ready.
|
|
680
|
+
*/
|
|
681
|
+
raf: (fn: () => any) => Promise<any>;
|
|
682
|
+
/**
|
|
683
|
+
* Perform operation on next tick.
|
|
684
|
+
*
|
|
685
|
+
* @param fn - The function to call when the tick is ready.
|
|
686
|
+
*/
|
|
687
|
+
nextTick: (fn: () => any) => Promise<any>;
|
|
688
|
+
/**
|
|
689
|
+
* Retrieve chunk name for the symbol.
|
|
690
|
+
*
|
|
691
|
+
* When the application is running on the server the symbols may be imported from different files
|
|
692
|
+
* (as server build is typically a single javascript chunk.) For this reason, it is necessary to
|
|
693
|
+
* convert the chunks from server format to client (browser) format. This is done by looking up
|
|
694
|
+
* symbols (which are globally unique) in the manifest. (Manifest is the mapping of symbols to the
|
|
695
|
+
* client chunk names.)
|
|
696
|
+
*
|
|
697
|
+
* @param symbolName - Resolve `symbolName` against the manifest and return the chunk that
|
|
698
|
+
* contains the symbol.
|
|
699
|
+
*/
|
|
700
|
+
chunkForSymbol: (symbolName: string, chunk: string | null, parent?: string) => readonly [symbol: string, chunk: string] | undefined;
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
/** This corrects the TS definition for ToggleEvent @public */
|
|
704
|
+
export declare interface CorrectedToggleEvent extends Event {
|
|
705
|
+
readonly newState: 'open' | 'closed';
|
|
706
|
+
readonly prevState: 'open' | 'closed';
|
|
707
|
+
}
|
|
708
|
+
|
|
709
|
+
/**
|
|
710
|
+
* Create a computed signal which is calculated from the given QRL. A computed signal is a signal
|
|
711
|
+
* which is calculated from other signals. When the signals change, the computed signal is
|
|
712
|
+
* recalculated.
|
|
713
|
+
*
|
|
714
|
+
* The QRL must be a function which returns the value of the signal. The function must not have side
|
|
715
|
+
* effects, and it mus be synchronous.
|
|
716
|
+
*
|
|
717
|
+
* If you need the function to be async, use `useSignal` and `useTask$` instead.
|
|
718
|
+
*
|
|
719
|
+
* @public
|
|
720
|
+
*/
|
|
721
|
+
export declare const createComputed$: <T>(qrl: () => T) => T extends Promise<any> ? never : ComputedSignal<T>;
|
|
722
|
+
|
|
723
|
+
/** @internal */
|
|
724
|
+
export declare const createComputedQrl: <T>(qrl: QRL<() => T>) => T extends Promise<any> ? never : ComputedSignal<T>;
|
|
725
|
+
|
|
726
|
+
/**
|
|
727
|
+
* Create a context ID to be used in your application. The name should be written with no spaces.
|
|
728
|
+
*
|
|
729
|
+
* Context is a way to pass stores to the child components without prop-drilling.
|
|
730
|
+
*
|
|
731
|
+
* Use `createContextId()` to create a `ContextId`. A `ContextId` is just a serializable identifier
|
|
732
|
+
* for the context. It is not the context value itself. See `useContextProvider()` and
|
|
733
|
+
* `useContext()` for the values. Qwik needs a serializable ID for the context so that the it can
|
|
734
|
+
* track context providers and consumers in a way that survives resumability.
|
|
735
|
+
*
|
|
736
|
+
* ### Example
|
|
737
|
+
*
|
|
738
|
+
* ```tsx
|
|
739
|
+
* // Declare the Context type.
|
|
740
|
+
* interface TodosStore {
|
|
741
|
+
* items: string[];
|
|
742
|
+
* }
|
|
743
|
+
* // Create a Context ID (no data is saved here.)
|
|
744
|
+
* // You will use this ID to both create and retrieve the Context.
|
|
745
|
+
* export const TodosContext = createContextId<TodosStore>('Todos');
|
|
746
|
+
*
|
|
747
|
+
* // Example of providing context to child components.
|
|
748
|
+
* export const App = component$(() => {
|
|
749
|
+
* useContextProvider(
|
|
750
|
+
* TodosContext,
|
|
751
|
+
* useStore<TodosStore>({
|
|
752
|
+
* items: ['Learn Qwik', 'Build Qwik app', 'Profit'],
|
|
753
|
+
* })
|
|
754
|
+
* );
|
|
755
|
+
*
|
|
756
|
+
* return <Items />;
|
|
757
|
+
* });
|
|
758
|
+
*
|
|
759
|
+
* // Example of retrieving the context provided by a parent component.
|
|
760
|
+
* export const Items = component$(() => {
|
|
761
|
+
* const todos = useContext(TodosContext);
|
|
762
|
+
* return (
|
|
763
|
+
* <ul>
|
|
764
|
+
* {todos.items.map((item) => (
|
|
765
|
+
* <li>{item}</li>
|
|
766
|
+
* ))}
|
|
767
|
+
* </ul>
|
|
768
|
+
* );
|
|
769
|
+
* });
|
|
770
|
+
*
|
|
771
|
+
* ```
|
|
772
|
+
*
|
|
773
|
+
* @param name - The name of the context.
|
|
774
|
+
* @public
|
|
775
|
+
*/
|
|
776
|
+
export declare const createContextId: <STATE = unknown>(name: string) => ContextId<STATE>;
|
|
777
|
+
|
|
778
|
+
declare const createScheduler: (container: Container, scheduleDrain: () => void, journalFlush: () => void) => {
|
|
779
|
+
(type: ChoreType.QRL_RESOLVE, ignore: null, target: QRLInternal<(...args: unknown[]) => unknown>): ValueOrPromise<void>;
|
|
780
|
+
(type: ChoreType.JOURNAL_FLUSH): ValueOrPromise<void>;
|
|
781
|
+
(type: ChoreType.WAIT_FOR_ALL): ValueOrPromise<void>;
|
|
782
|
+
(type: ChoreType.WAIT_FOR_COMPONENTS): ValueOrPromise<void>;
|
|
783
|
+
(type: ChoreType.TASK | ChoreType.VISIBLE | ChoreType.RESOURCE, task: Task): ValueOrPromise<void>;
|
|
784
|
+
(type: ChoreType.COMPONENT, host: HostElement, qrl: QRLInternal<OnRenderFn<unknown>>, props: Props | null): ValueOrPromise<JSXOutput>;
|
|
785
|
+
(type: ChoreType.COMPONENT_SSR, host: HostElement, qrl: QRLInternal<OnRenderFn<unknown>>, props: Props | null): ValueOrPromise<JSXOutput>;
|
|
786
|
+
(type: ChoreType.NODE_DIFF, host: HostElement, target: HostElement, value: JSXOutput | Signal): ValueOrPromise<void>;
|
|
787
|
+
(type: ChoreType.NODE_PROP, host: HostElement, prop: string, value: any): ValueOrPromise<void>;
|
|
788
|
+
(type: ChoreType.CLEANUP_VISIBLE, task: Task): ValueOrPromise<JSXOutput>;
|
|
789
|
+
};
|
|
790
|
+
|
|
791
|
+
/**
|
|
792
|
+
* Creates a Signal with the given value. If no value is given, the signal is created with
|
|
793
|
+
* `undefined`.
|
|
794
|
+
*
|
|
795
|
+
* @public
|
|
796
|
+
*/
|
|
797
|
+
export declare const createSignal: {
|
|
798
|
+
<T>(): Signal<T | undefined>;
|
|
799
|
+
<T>(value: T): Signal<T>;
|
|
800
|
+
};
|
|
801
|
+
|
|
802
|
+
/** @public */
|
|
803
|
+
declare interface CSSProperties extends CSS_2.Properties<string | number>, CSS_2.PropertiesHyphen<string | number> {
|
|
804
|
+
/**
|
|
805
|
+
* The index signature was removed to enable closed typing for style using CSSType. You're able to
|
|
806
|
+
* use type assertion or module augmentation to add properties or an index signature of your own.
|
|
807
|
+
*
|
|
808
|
+
* For examples and more information, visit:
|
|
809
|
+
* https://github.com/frenic/csstype#what-should-i-do-when-i-get-type-errors
|
|
810
|
+
*/
|
|
811
|
+
[v: `--${string}`]: string | number | undefined;
|
|
812
|
+
}
|
|
813
|
+
|
|
814
|
+
/** @public */
|
|
815
|
+
declare interface DescriptorBase<T = unknown, B = unknown> extends Subscriber {
|
|
816
|
+
$flags$: number;
|
|
817
|
+
$index$: number;
|
|
818
|
+
$el$: HostElement;
|
|
819
|
+
$qrl$: QRLInternal<T>;
|
|
820
|
+
$state$: B | undefined;
|
|
821
|
+
$destroy$: NoSerialize<() => void> | null;
|
|
822
|
+
}
|
|
823
|
+
|
|
824
|
+
/**
|
|
825
|
+
* Deserialize data from string to an array of objects.
|
|
826
|
+
*
|
|
827
|
+
* @param rawStateData - Data to deserialize
|
|
828
|
+
* @param element - Container element
|
|
829
|
+
* @internal
|
|
830
|
+
*/
|
|
831
|
+
export declare function _deserialize(rawStateData: string | null, element?: unknown): unknown[];
|
|
832
|
+
|
|
833
|
+
/** @public */
|
|
834
|
+
export declare interface DevJSX {
|
|
835
|
+
fileName: string;
|
|
836
|
+
lineNumber: number;
|
|
837
|
+
columnNumber: number;
|
|
838
|
+
stack?: string;
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
/** The Qwik-specific attributes that DOM elements accept @public */
|
|
842
|
+
export declare interface DOMAttributes<EL extends Element> extends DOMAttributesBase<EL>, QwikEvents<EL> {
|
|
843
|
+
class?: ClassList | Signal<ClassList> | undefined;
|
|
844
|
+
}
|
|
845
|
+
|
|
846
|
+
declare interface DOMAttributesBase<EL extends Element> extends QwikIntrinsicAttributes, PreventDefault, StopPropagation, RefAttr<EL> {
|
|
847
|
+
dangerouslySetInnerHTML?: string | undefined;
|
|
848
|
+
}
|
|
849
|
+
|
|
850
|
+
/** @internal */
|
|
851
|
+
declare class DomContainer extends _SharedContainer implements ClientContainer {
|
|
852
|
+
element: _ContainerElement;
|
|
853
|
+
qContainer: string;
|
|
854
|
+
qBase: string;
|
|
855
|
+
qManifestHash: string;
|
|
856
|
+
rootVNode: _ElementVNode;
|
|
857
|
+
document: _QDocument;
|
|
858
|
+
$journal$: VNodeJournal;
|
|
859
|
+
renderDone: Promise<void> | null;
|
|
860
|
+
$rawStateData$: unknown[];
|
|
861
|
+
$storeProxyMap$: ObjToProxyMap;
|
|
862
|
+
$qFuncs$: Array<(...args: unknown[]) => unknown>;
|
|
863
|
+
$instanceHash$: string;
|
|
864
|
+
private stateData;
|
|
865
|
+
private $styleIds$;
|
|
866
|
+
private $vnodeLocate$;
|
|
867
|
+
private $renderCount$;
|
|
868
|
+
constructor(element: _ContainerElement);
|
|
869
|
+
$setRawState$(id: number, vParent: _ElementVNode | _VirtualVNode): void;
|
|
870
|
+
parseQRL<T = unknown>(qrl: string): QRL<T>;
|
|
871
|
+
processJsx(host: HostElement, jsx: JSXOutput): ValueOrPromise<void>;
|
|
872
|
+
handleError(err: any, host: HostElement): void;
|
|
873
|
+
setContext<T>(host: HostElement, context: ContextId<T>, value: T): void;
|
|
874
|
+
resolveContext<T>(host: HostElement, contextId: ContextId<T>): T | undefined;
|
|
875
|
+
getParentHost(host: HostElement): HostElement | null;
|
|
876
|
+
setHostProp<T>(host: HostElement, name: string, value: T): void;
|
|
877
|
+
getHostProp<T>(host: HostElement, name: string): T | null;
|
|
878
|
+
scheduleRender(): Promise<void>;
|
|
879
|
+
private processChores;
|
|
880
|
+
ensureProjectionResolved(vNode: _VirtualVNode): void;
|
|
881
|
+
$getObjectById$: (id: number | string) => unknown;
|
|
882
|
+
getSyncFn(id: number): (...args: unknown[]) => unknown;
|
|
883
|
+
$appendStyle$(content: string, styleId: string, host: _VirtualVNode, scoped: boolean): void;
|
|
884
|
+
}
|
|
885
|
+
export { DomContainer }
|
|
886
|
+
export { DomContainer as _DomContainer }
|
|
887
|
+
|
|
888
|
+
/** @public */
|
|
889
|
+
export declare type EagernessOptions = 'visible' | 'load' | 'idle';
|
|
890
|
+
|
|
891
|
+
/**
|
|
892
|
+
* Effect is something which needs to happen (side-effect) due to signal value change.
|
|
893
|
+
*
|
|
894
|
+
* There are three types of effects:
|
|
895
|
+
*
|
|
896
|
+
* - `Task`: `useTask`, `useVisibleTask`, `useResource`
|
|
897
|
+
* - `VNode` and `ISsrNode`: Either a component or `<Signal>`
|
|
898
|
+
* - `Signal2`: A derived signal which contains a computation function.
|
|
899
|
+
*/
|
|
900
|
+
declare type Effect = Task | _VNode | ISsrNode | Signal_2;
|
|
901
|
+
|
|
902
|
+
/** @internal */
|
|
903
|
+
export declare class _EffectData<T extends Record<string, any> = Record<string, any>> {
|
|
904
|
+
data: T;
|
|
905
|
+
constructor(data: T);
|
|
906
|
+
}
|
|
907
|
+
|
|
908
|
+
/**
|
|
909
|
+
* An effect plus a list of subscriptions effect depends on.
|
|
910
|
+
*
|
|
911
|
+
* An effect can be trigger by one or more of signal inputs. The first step of re-running an effect
|
|
912
|
+
* is to clear its subscriptions so that the effect can re add new set of subscriptions. In order to
|
|
913
|
+
* clear the subscriptions we need to store them here.
|
|
914
|
+
*
|
|
915
|
+
* Imagine you have effect such as:
|
|
916
|
+
*
|
|
917
|
+
* ```
|
|
918
|
+
* function effect1() {
|
|
919
|
+
* console.log(signalA.value ? signalB.value : 'default');
|
|
920
|
+
* }
|
|
921
|
+
* ```
|
|
922
|
+
*
|
|
923
|
+
* In the above case the `signalB` needs to be unsubscribed when `signalA` is falsy. We do this by
|
|
924
|
+
* always clearing all of the subscriptions
|
|
925
|
+
*
|
|
926
|
+
* The `EffectSubscriptions` stores
|
|
927
|
+
*
|
|
928
|
+
* ```
|
|
929
|
+
* subscription1 = [effect1, signalA, signalB];
|
|
930
|
+
* ```
|
|
931
|
+
*
|
|
932
|
+
* The `signal1` and `signal2` back references are needed to "clear" existing subscriptions.
|
|
933
|
+
*
|
|
934
|
+
* Both `signalA` as well as `signalB` will have a reference to `subscription` to the so that the
|
|
935
|
+
* effect can be scheduled if either `signalA` or `signalB` triggers. The `subscription1` is shared
|
|
936
|
+
* between the signals.
|
|
937
|
+
*
|
|
938
|
+
* The second position `string|boolean` store the property name of the effect.
|
|
939
|
+
*
|
|
940
|
+
* - Property name of the VNode
|
|
941
|
+
* - `EffectProperty.COMPONENT` if component
|
|
942
|
+
* - `EffectProperty.VNODE` if VNode
|
|
943
|
+
*/
|
|
944
|
+
declare type EffectSubscriptions = [
|
|
945
|
+
...[
|
|
946
|
+
Effect,
|
|
947
|
+
string
|
|
948
|
+
],
|
|
949
|
+
...(_EffectData | string | Signal_2 | TargetType)[]
|
|
950
|
+
];
|
|
951
|
+
|
|
952
|
+
/** @internal */
|
|
953
|
+
export declare type _ElementVNode = [
|
|
954
|
+
_VNodeFlags.Element,
|
|
955
|
+
////////////// 0 - Flags
|
|
956
|
+
_VNode | null,
|
|
957
|
+
/////////////// 1 - Parent
|
|
958
|
+
_VNode | null,
|
|
959
|
+
/////////////// 2 - Previous sibling
|
|
960
|
+
_VNode | null,
|
|
961
|
+
/////////////// 3 - Next sibling
|
|
962
|
+
_VNode | null | undefined,
|
|
963
|
+
/// 4 - First child - undefined if children need to be materialize
|
|
964
|
+
_VNode | null | undefined,
|
|
965
|
+
Element,
|
|
966
|
+
//////////////////// 6 - Element
|
|
967
|
+
string | undefined,
|
|
968
|
+
...(string | null)[]
|
|
969
|
+
] & {
|
|
970
|
+
__brand__: 'ElementVNode';
|
|
971
|
+
};
|
|
972
|
+
|
|
973
|
+
/** @internal */
|
|
974
|
+
export declare const _EMPTY_ARRAY: any[];
|
|
975
|
+
|
|
976
|
+
/** @public */
|
|
977
|
+
export declare interface ErrorBoundaryStore {
|
|
978
|
+
error: any | undefined;
|
|
979
|
+
}
|
|
980
|
+
|
|
981
|
+
/** @public */
|
|
982
|
+
export declare const event$: <T>(qrl: T) => QRL<T>;
|
|
983
|
+
|
|
984
|
+
declare type EventCorrectionMap = {
|
|
985
|
+
auxclick: PointerEvent;
|
|
986
|
+
beforetoggle: CorrectedToggleEvent;
|
|
987
|
+
click: PointerEvent;
|
|
988
|
+
dblclick: PointerEvent;
|
|
989
|
+
input: InputEvent;
|
|
990
|
+
toggle: CorrectedToggleEvent;
|
|
991
|
+
};
|
|
992
|
+
|
|
993
|
+
declare type EventFromName<T extends string> = LcEvent<T>;
|
|
994
|
+
|
|
995
|
+
/**
|
|
996
|
+
* A DOM event handler
|
|
997
|
+
*
|
|
998
|
+
* @public
|
|
999
|
+
*/
|
|
1000
|
+
export declare type EventHandler<EV = Event, EL = Element> = {
|
|
1001
|
+
bivarianceHack(event: EV, element: EL): any;
|
|
1002
|
+
}['bivarianceHack'];
|
|
1003
|
+
|
|
1004
|
+
declare type EventQRL<T extends string = AllEventKeys> = QRL<EventHandler<EventFromName<T>, Element>> | undefined;
|
|
1005
|
+
|
|
1006
|
+
/** @internal */
|
|
1007
|
+
export declare const eventQrl: <T>(qrl: QRL<T>) => QRL<T>;
|
|
1008
|
+
|
|
1009
|
+
declare type FilterBase<T> = {
|
|
1010
|
+
[K in keyof T as K extends string ? K extends Uppercase<K> ? never : any extends T[K] ? never : false extends IsAcceptableDOMValue<T[K]> ? never : IsReadOnlyKey<T, K> extends true ? never : K extends UnwantedKeys ? never : K : never]?: T[K];
|
|
1011
|
+
};
|
|
1012
|
+
|
|
1013
|
+
/** Only keep props that are specific to the element and make partial */
|
|
1014
|
+
declare type Filtered<T, A = {}> = {
|
|
1015
|
+
[K in keyof Omit<FilterBase<T>, keyof HTMLAttributes<any> | keyof A>]?: T[K];
|
|
1016
|
+
};
|
|
1017
|
+
|
|
1018
|
+
/** @internal */
|
|
1019
|
+
export declare const _fnSignal: <T extends (...args: any) => any>(fn: T, args: Parameters<T>, fnStr?: string) => WrappedSignal<any>;
|
|
1020
|
+
|
|
1021
|
+
/** @public */
|
|
1022
|
+
export declare const Fragment: FunctionComponent<{
|
|
1023
|
+
children?: any;
|
|
1024
|
+
key?: string | number | null;
|
|
1025
|
+
}>;
|
|
1026
|
+
|
|
1027
|
+
/**
|
|
1028
|
+
* Any function taking a props object that returns JSXOutput.
|
|
1029
|
+
*
|
|
1030
|
+
* The `key`, `flags` and `dev` parameters are for internal use.
|
|
1031
|
+
*
|
|
1032
|
+
* @public
|
|
1033
|
+
*/
|
|
1034
|
+
export declare type FunctionComponent<P = unknown> = {
|
|
1035
|
+
renderFn(props: P, key: string | null, flags: number, dev?: DevJSX): JSXOutput;
|
|
1036
|
+
}['renderFn'];
|
|
1037
|
+
|
|
1038
|
+
/** @internal */
|
|
1039
|
+
export declare const _getContextElement: () => unknown;
|
|
1040
|
+
|
|
1041
|
+
/** @internal */
|
|
1042
|
+
export declare const _getContextEvent: () => unknown;
|
|
1043
|
+
|
|
1044
|
+
/** @public */
|
|
1045
|
+
declare function getDomContainer(element: Element | _VNode): ClientContainer;
|
|
1046
|
+
export { getDomContainer as _getDomContainer }
|
|
1047
|
+
export { getDomContainer }
|
|
1048
|
+
|
|
1049
|
+
/**
|
|
1050
|
+
* Retrieve the current locale.
|
|
1051
|
+
*
|
|
1052
|
+
* If no current locale and there is no `defaultLocale` the function throws an error.
|
|
1053
|
+
*
|
|
1054
|
+
* @returns The locale.
|
|
1055
|
+
* @public
|
|
1056
|
+
*/
|
|
1057
|
+
export declare function getLocale(defaultLocale?: string): string;
|
|
1058
|
+
|
|
1059
|
+
/**
|
|
1060
|
+
* Retrieve the `CorePlatform`.
|
|
1061
|
+
*
|
|
1062
|
+
* The `CorePlatform` is also responsible for retrieving the Manifest, that contains mappings from
|
|
1063
|
+
* symbols to javascript import chunks. For this reason, `CorePlatform` can't be global, but is
|
|
1064
|
+
* specific to the application currently running. On server it is possible that many different
|
|
1065
|
+
* applications are running in a single server instance, and for this reason the `CorePlatform` is
|
|
1066
|
+
* associated with the application document.
|
|
1067
|
+
*
|
|
1068
|
+
* @param docOrNode - The document (or node) of the application for which the platform is needed.
|
|
1069
|
+
* @public
|
|
1070
|
+
*/
|
|
1071
|
+
export declare const getPlatform: () => CorePlatform;
|
|
1072
|
+
|
|
1073
|
+
/** @internal */
|
|
1074
|
+
export declare function _getQContainerElement(element: Element | _VNode): Element | null;
|
|
1075
|
+
|
|
1076
|
+
/**
|
|
1077
|
+
* The legacy transform, used in special cases like `<div {...props} key="key" />`. Note that the
|
|
1078
|
+
* children are spread arguments, instead of a prop like in jsx() calls.
|
|
1079
|
+
*
|
|
1080
|
+
* Also note that this disables optimizations.
|
|
1081
|
+
*
|
|
1082
|
+
* @public
|
|
1083
|
+
*/
|
|
1084
|
+
declare function h<TYPE extends string | FunctionComponent<PROPS>, PROPS extends {} = {}>(type: TYPE, props?: PROPS | null, ...children: any[]): JSXNode<TYPE>;
|
|
1085
|
+
export { h as createElement }
|
|
1086
|
+
export { h }
|
|
1087
|
+
|
|
1088
|
+
declare type HostElement = _VNode | ISsrNode;
|
|
1089
|
+
|
|
1090
|
+
/** @public */
|
|
1091
|
+
declare type HTMLAttributeAnchorTarget = '_self' | '_blank' | '_parent' | '_top' | (string & {});
|
|
1092
|
+
|
|
1093
|
+
/** @public */
|
|
1094
|
+
declare type HTMLAttributeReferrerPolicy = ReferrerPolicy;
|
|
1095
|
+
|
|
1096
|
+
/** @public */
|
|
1097
|
+
declare interface HTMLAttributes<E extends Element> extends HTMLElementAttrs, DOMAttributes<E> {
|
|
1098
|
+
}
|
|
1099
|
+
|
|
1100
|
+
declare interface HTMLAttributesBase extends AriaAttributes {
|
|
1101
|
+
/** @deprecated Use `class` instead */
|
|
1102
|
+
className?: ClassList | undefined;
|
|
1103
|
+
contentEditable?: 'true' | 'false' | 'inherit' | undefined;
|
|
1104
|
+
style?: CSSProperties | string | undefined;
|
|
1105
|
+
role?: AriaRole | undefined;
|
|
1106
|
+
about?: string | undefined;
|
|
1107
|
+
datatype?: string | undefined;
|
|
1108
|
+
inlist?: any;
|
|
1109
|
+
property?: string | undefined;
|
|
1110
|
+
resource?: string | undefined;
|
|
1111
|
+
typeof?: string | undefined;
|
|
1112
|
+
vocab?: string | undefined;
|
|
1113
|
+
autoCapitalize?: 'none' | 'off' | 'sentences' | 'on' | 'words' | 'characters' | undefined;
|
|
1114
|
+
autoCorrect?: string | undefined;
|
|
1115
|
+
autoFocus?: boolean | undefined;
|
|
1116
|
+
autoSave?: string | undefined;
|
|
1117
|
+
hidden?: boolean | 'hidden' | 'until-found' | undefined;
|
|
1118
|
+
itemProp?: string | undefined;
|
|
1119
|
+
itemScope?: boolean | undefined;
|
|
1120
|
+
itemType?: string | undefined;
|
|
1121
|
+
itemID?: string | undefined;
|
|
1122
|
+
itemRef?: string | undefined;
|
|
1123
|
+
results?: number | undefined;
|
|
1124
|
+
translate?: 'yes' | 'no' | undefined;
|
|
1125
|
+
security?: string | undefined;
|
|
1126
|
+
unselectable?: 'on' | 'off' | undefined;
|
|
1127
|
+
/**
|
|
1128
|
+
* Hints at the type of data that might be entered by the user while editing the element or its
|
|
1129
|
+
* contents
|
|
1130
|
+
*
|
|
1131
|
+
* @see https://html.spec.whatwg.org/multipage/interaction.html#input-modalities:-the-inputmode-attribute
|
|
1132
|
+
*/
|
|
1133
|
+
inputMode?: 'none' | 'text' | 'tel' | 'url' | 'email' | 'numeric' | 'decimal' | 'search' | undefined;
|
|
1134
|
+
/**
|
|
1135
|
+
* Specify that a standard HTML element should behave like a defined custom built-in element
|
|
1136
|
+
*
|
|
1137
|
+
* @see https://html.spec.whatwg.org/multipage/custom-elements.html#attr-is
|
|
1138
|
+
*/
|
|
1139
|
+
is?: string | undefined;
|
|
1140
|
+
popover?: 'manual' | 'auto' | undefined;
|
|
1141
|
+
}
|
|
1142
|
+
|
|
1143
|
+
/** @public */
|
|
1144
|
+
declare type HTMLCrossOriginAttribute = 'anonymous' | 'use-credentials' | '' | undefined;
|
|
1145
|
+
|
|
1146
|
+
/** @public */
|
|
1147
|
+
declare interface HTMLElementAttrs extends HTMLAttributesBase, FilterBase<HTMLElement> {
|
|
1148
|
+
}
|
|
1149
|
+
|
|
1150
|
+
/** @public */
|
|
1151
|
+
declare type HTMLInputAutocompleteAttribute = 'on' | 'off' | 'billing' | 'shipping' | 'name' | 'honorific-prefix' | 'given-name' | 'additional-name' | 'family-name' | 'honorific-suffix' | 'nickname' | 'username' | 'new-password' | 'current-password' | 'one-time-code' | 'organization-title' | 'organization' | 'street-address' | 'address-line1' | 'address-line2' | 'address-line3' | 'address-level4' | 'address-level3' | 'address-level2' | 'address-level1' | 'country' | 'country-name' | 'postal-code' | 'cc-name' | 'cc-given-name' | 'cc-additional-name' | 'cc-family-name' | 'cc-number' | 'cc-exp' | 'cc-exp-month' | 'cc-exp-year' | 'cc-csc' | 'cc-type' | 'transaction-currency' | 'transaction-amount' | 'language' | 'bday' | 'bday-day' | 'bday-month' | 'bday-year' | 'sex' | 'url' | 'photo';
|
|
1152
|
+
|
|
1153
|
+
/** @public */
|
|
1154
|
+
declare type HTMLInputTypeAttribute = 'button' | 'checkbox' | 'color' | 'date' | 'datetime-local' | 'email' | 'file' | 'hidden' | 'image' | 'month' | 'number' | 'password' | 'radio' | 'range' | 'reset' | 'search' | 'submit' | 'tel' | 'text' | 'time' | 'url' | 'week' | (string & {});
|
|
1155
|
+
|
|
1156
|
+
/**
|
|
1157
|
+
* Low-level API used by the Optimizer to process `useTask$()` API. This method is not intended to
|
|
1158
|
+
* be used by developers.
|
|
1159
|
+
*
|
|
1160
|
+
* @internal
|
|
1161
|
+
*/
|
|
1162
|
+
export declare const _hW: () => void;
|
|
1163
|
+
|
|
1164
|
+
declare type IfEquals<X, Y, A, B> = (<T>() => T extends X ? 1 : 2) extends <T>() => T extends Y ? 1 : 2 ? A : B;
|
|
1165
|
+
|
|
1166
|
+
/** @internal @deprecated v1 compat */
|
|
1167
|
+
export declare const _IMMUTABLE: unique symbol;
|
|
1168
|
+
|
|
1169
|
+
/**
|
|
1170
|
+
* Create a `____$(...)` convenience method from `___(...)`.
|
|
1171
|
+
*
|
|
1172
|
+
* It is very common for functions to take a lazy-loadable resource as a first argument. For this
|
|
1173
|
+
* reason, the Qwik Optimizer automatically extracts the first argument from any function which ends
|
|
1174
|
+
* in `$`.
|
|
1175
|
+
*
|
|
1176
|
+
* This means that `foo$(arg0)` and `foo($(arg0))` are equivalent with respect to Qwik Optimizer.
|
|
1177
|
+
* The former is just a shorthand for the latter.
|
|
1178
|
+
*
|
|
1179
|
+
* For example, these function calls are equivalent:
|
|
1180
|
+
*
|
|
1181
|
+
* - `component$(() => {...})` is same as `component($(() => {...}))`
|
|
1182
|
+
*
|
|
1183
|
+
* ```tsx
|
|
1184
|
+
* export function myApi(callback: QRL<() => void>): void {
|
|
1185
|
+
* // ...
|
|
1186
|
+
* }
|
|
1187
|
+
*
|
|
1188
|
+
* export const myApi$ = implicit$FirstArg(myApi);
|
|
1189
|
+
* // type of myApi$: (callback: () => void): void
|
|
1190
|
+
*
|
|
1191
|
+
* // can be used as:
|
|
1192
|
+
* myApi$(() => console.log('callback'));
|
|
1193
|
+
*
|
|
1194
|
+
* // will be transpiled to:
|
|
1195
|
+
* // FILE: <current file>
|
|
1196
|
+
* myApi(qrl('./chunk-abc.js', 'callback'));
|
|
1197
|
+
*
|
|
1198
|
+
* // FILE: chunk-abc.js
|
|
1199
|
+
* export const callback = () => console.log('callback');
|
|
1200
|
+
* ```
|
|
1201
|
+
*
|
|
1202
|
+
* @param fn - A function that should have its first argument automatically `$`.
|
|
1203
|
+
* @public
|
|
1204
|
+
*/
|
|
1205
|
+
export declare const implicit$FirstArg: <FIRST, REST extends any[], RET>(fn: (qrl: QRL<FIRST>, ...rest: REST) => RET) => ((qrl: FIRST, ...rest: REST) => RET);
|
|
1206
|
+
|
|
1207
|
+
/** @internal */
|
|
1208
|
+
export declare const inlinedQrl: <T>(symbol: T, symbolName: string, lexicalScopeCapture?: any[]) => QRL<T>;
|
|
1209
|
+
|
|
1210
|
+
/** @internal */
|
|
1211
|
+
export declare const inlinedQrlDEV: <T = any>(symbol: T, symbolName: string, opts: QRLDev, lexicalScopeCapture?: any[]) => QRL<T>;
|
|
1212
|
+
|
|
1213
|
+
/**
|
|
1214
|
+
* These are the HTML tags with handlers allowing plain callbacks, to be used for the JSX interface
|
|
1215
|
+
*
|
|
1216
|
+
* @public
|
|
1217
|
+
*/
|
|
1218
|
+
declare type IntrinsicHTMLElements = {
|
|
1219
|
+
[key in keyof HTMLElementTagNameMap]: Augmented<HTMLElementTagNameMap[key], SpecialAttrs[key]> & HTMLAttributes<HTMLElementTagNameMap[key]>;
|
|
1220
|
+
} & {
|
|
1221
|
+
/** For unknown tags we allow all props */
|
|
1222
|
+
[unknownTag: string]: {
|
|
1223
|
+
[prop: string]: any;
|
|
1224
|
+
} & HTMLElementAttrs & HTMLAttributes<any>;
|
|
1225
|
+
};
|
|
1226
|
+
|
|
1227
|
+
/**
|
|
1228
|
+
* These are the SVG tags with handlers allowing plain callbacks, to be used for the JSX interface
|
|
1229
|
+
*
|
|
1230
|
+
* @public
|
|
1231
|
+
*/
|
|
1232
|
+
declare type IntrinsicSVGElements = {
|
|
1233
|
+
[K in keyof Omit<SVGElementTagNameMap, keyof HTMLElementTagNameMap>]: LenientSVGProps<SVGElementTagNameMap[K]>;
|
|
1234
|
+
};
|
|
1235
|
+
|
|
1236
|
+
/** The shared state during an invoke() call */
|
|
1237
|
+
declare interface InvokeContext {
|
|
1238
|
+
$url$: URL | undefined;
|
|
1239
|
+
/** The next available index for the sequentialScope array */
|
|
1240
|
+
$i$: number;
|
|
1241
|
+
/** The Virtual parent component for the current component code */
|
|
1242
|
+
$hostElement$: HostElement | undefined;
|
|
1243
|
+
/** The current DOM element */
|
|
1244
|
+
$element$: Element | undefined;
|
|
1245
|
+
/** The event we're currently handling */
|
|
1246
|
+
$event$: PossibleEvents | undefined;
|
|
1247
|
+
/** The QRL function we're currently executing */
|
|
1248
|
+
$qrl$: QRL | undefined;
|
|
1249
|
+
$effectSubscriber$: EffectSubscriptions | undefined;
|
|
1250
|
+
$locale$: string | undefined;
|
|
1251
|
+
$container$: Container | undefined;
|
|
1252
|
+
}
|
|
1253
|
+
|
|
1254
|
+
declare type InvokeTuple = [Element, Event, URL?];
|
|
1255
|
+
|
|
1256
|
+
declare type IsAcceptableDOMValue<T> = T extends boolean | number | string | null | undefined ? ((...args: any[]) => any) extends T ? false : true : false;
|
|
1257
|
+
|
|
1258
|
+
declare type IsAny<T> = 0 extends T & 1 ? true : false;
|
|
1259
|
+
|
|
1260
|
+
/** @internal */
|
|
1261
|
+
export declare const _isJSXNode: <T>(n: unknown) => n is JSXNodeInternal<T>;
|
|
1262
|
+
|
|
1263
|
+
declare type IsReadOnlyKey<T, K extends keyof T> = IfEquals<{
|
|
1264
|
+
[Q in K]: T[K];
|
|
1265
|
+
}, {
|
|
1266
|
+
-readonly [Q in K]: T[K];
|
|
1267
|
+
}, false, true>;
|
|
1268
|
+
|
|
1269
|
+
/** @public */
|
|
1270
|
+
export declare const isSignal: (value: any) => value is Signal<unknown>;
|
|
1271
|
+
|
|
1272
|
+
/** @internal */
|
|
1273
|
+
export declare interface ISsrComponentFrame {
|
|
1274
|
+
componentNode: ISsrNode;
|
|
1275
|
+
scopedStyleIds: Set<string>;
|
|
1276
|
+
projectionScopedStyle: string | null;
|
|
1277
|
+
projectionComponentFrame: ISsrComponentFrame | null;
|
|
1278
|
+
projectionDepth: number;
|
|
1279
|
+
releaseUnclaimedProjections(unclaimedProjections: (ISsrComponentFrame | JSXChildren | string)[]): void;
|
|
1280
|
+
consumeChildrenForSlot(projectionNode: ISsrNode, slotName: string): JSXChildren | null;
|
|
1281
|
+
distributeChildrenIntoSlots(children: JSXChildren, parentScopedStyle: string | null, parentComponentFrame: ISsrComponentFrame | null): void;
|
|
1282
|
+
hasSlot(slotName: string): boolean;
|
|
1283
|
+
}
|
|
1284
|
+
|
|
1285
|
+
declare interface ISsrNode {
|
|
1286
|
+
id: string;
|
|
1287
|
+
currentComponentNode: ISsrNode | null;
|
|
1288
|
+
vnodeData?: VNodeData;
|
|
1289
|
+
setProp(name: string, value: any): void;
|
|
1290
|
+
getProp(name: string): any;
|
|
1291
|
+
removeProp(name: string): void;
|
|
1292
|
+
addChildVNodeData(child: VNodeData): void;
|
|
1293
|
+
}
|
|
1294
|
+
|
|
1295
|
+
/** @internal */
|
|
1296
|
+
export declare function _isStringifiable(value: unknown): value is _Stringifiable;
|
|
1297
|
+
|
|
1298
|
+
/**
|
|
1299
|
+
* @public
|
|
1300
|
+
* Used by the JSX transpilers to create a JSXNode.
|
|
1301
|
+
* Note that the optimizer will not use this, instead using _jsxSplit and _jsxSorted directly.
|
|
1302
|
+
*/
|
|
1303
|
+
declare const jsx: <T extends string | FunctionComponent<any>>(type: T, props: T extends FunctionComponent<infer PROPS> ? PROPS : Props, key?: string | number | null) => JSXNode<T>;
|
|
1304
|
+
export { jsx }
|
|
1305
|
+
export { jsx as jsxs }
|
|
1306
|
+
|
|
1307
|
+
/** @internal */
|
|
1308
|
+
export declare const _jsxBranch: <T>(input?: T) => T | undefined;
|
|
1309
|
+
|
|
1310
|
+
/** @internal @deprecated v1 compat */
|
|
1311
|
+
export declare const _jsxC: (type: any, mutable: any, _flags: any, key: any) => JSXNode<any>;
|
|
1312
|
+
|
|
1313
|
+
/** @public */
|
|
1314
|
+
export declare type JSXChildren = string | number | boolean | null | undefined | Function | RegExp | JSXChildren[] | Promise<JSXChildren> | Signal<JSXChildren> | JSXNode;
|
|
1315
|
+
|
|
1316
|
+
/** @public */
|
|
1317
|
+
export declare const jsxDEV: <T extends string | FunctionComponent<Props>>(type: T, props: T extends FunctionComponent<infer PROPS> ? PROPS : Props, key: string | number | null | undefined, _isStatic: boolean, opts: JsxDevOpts, _ctx: unknown) => JSXNode<T>;
|
|
1318
|
+
|
|
1319
|
+
declare interface JsxDevOpts {
|
|
1320
|
+
fileName: string;
|
|
1321
|
+
lineNumber: number;
|
|
1322
|
+
columnNumber: number;
|
|
1323
|
+
}
|
|
1324
|
+
|
|
1325
|
+
/**
|
|
1326
|
+
* A JSX Node, an internal structure. You probably want to use `JSXOutput` instead.
|
|
1327
|
+
*
|
|
1328
|
+
* @public
|
|
1329
|
+
*/
|
|
1330
|
+
export declare interface JSXNode<T extends string | FunctionComponent | unknown = unknown> {
|
|
1331
|
+
type: T;
|
|
1332
|
+
props: T extends FunctionComponent<infer P> ? P : Record<any, unknown>;
|
|
1333
|
+
children: JSXChildren | null;
|
|
1334
|
+
key: string | null;
|
|
1335
|
+
dev?: DevJSX;
|
|
1336
|
+
}
|
|
1337
|
+
|
|
1338
|
+
/**
|
|
1339
|
+
* The internal representation of a JSX Node.
|
|
1340
|
+
*
|
|
1341
|
+
* @internal
|
|
1342
|
+
*/
|
|
1343
|
+
export declare interface JSXNodeInternal<T extends string | FunctionComponent | unknown = unknown> extends JSXNode<T> {
|
|
1344
|
+
varProps: Record<any, unknown>;
|
|
1345
|
+
constProps: Record<any, unknown> | null;
|
|
1346
|
+
flags: number;
|
|
1347
|
+
}
|
|
1348
|
+
|
|
1349
|
+
/**
|
|
1350
|
+
* Any valid output for a component
|
|
1351
|
+
*
|
|
1352
|
+
* @public
|
|
1353
|
+
*/
|
|
1354
|
+
export declare type JSXOutput = JSXNode | string | number | boolean | null | undefined | JSXOutput[];
|
|
1355
|
+
|
|
1356
|
+
/** @internal @deprecated v1 compat */
|
|
1357
|
+
export declare const _jsxQ: (type: any, mutable: any, immutable: any, children: any, _flags: any, key: any) => JSXNode<any>;
|
|
1358
|
+
|
|
1359
|
+
/** @internal @deprecated v1 compat */
|
|
1360
|
+
export declare const _jsxS: (type: any, mutable: any, immutable: any, _flags: any, key: any) => JSXNode<any>;
|
|
1361
|
+
|
|
1362
|
+
/**
|
|
1363
|
+
* Create a JSXNode with the properties fully split into variable and constant parts, and children
|
|
1364
|
+
* separated out. Furthermore, the varProps must be a sorted object, that is, the keys must be
|
|
1365
|
+
* sorted in ascending utf-8 value order.
|
|
1366
|
+
*
|
|
1367
|
+
* The constant parts are expected to be the same on every render, and are not checked for changes.
|
|
1368
|
+
* This means that they are constant scalars or refs. When the ref is a signal or a store, it can
|
|
1369
|
+
* still update the attribute on the vnode.
|
|
1370
|
+
*
|
|
1371
|
+
* @param type - The JSX type
|
|
1372
|
+
* @param varProps - The properties of the tag, sorted, excluding children, excluding any constProps
|
|
1373
|
+
* @param constProps - The properties of the tag that are known to be constant references and don't
|
|
1374
|
+
* need checking for changes on re-render
|
|
1375
|
+
* @param children - JSX children. Any `children` in the props objects are ignored.
|
|
1376
|
+
* @internal
|
|
1377
|
+
*/
|
|
1378
|
+
export declare const _jsxSorted: <T>(type: T, varProps: Props | null, constProps: Props | null, children: JSXChildren | null, flags: number, key: string | number | null | undefined, dev?: DevJSX) => JSXNodeInternal<T>;
|
|
1379
|
+
|
|
1380
|
+
/**
|
|
1381
|
+
* Create a JSXNode, with the properties split into variable and constant parts, but the variable
|
|
1382
|
+
* parts could include keys from constProps, as well as `key` and `children`.
|
|
1383
|
+
*
|
|
1384
|
+
* The constant parts are expected to be the same on every render, and are not checked for changes.
|
|
1385
|
+
* This means that they are constant scalars or refs. When the ref is a signal or a store, it can
|
|
1386
|
+
* still update the attribute on the vnode.
|
|
1387
|
+
*
|
|
1388
|
+
* If `children` is defined, any `children` in the props will be ignored.
|
|
1389
|
+
*
|
|
1390
|
+
* @param type - The tag type
|
|
1391
|
+
* @param varProps - The properties of the tag that could change, including children
|
|
1392
|
+
* @param constProps - The properties of the tag that are known to be static and don't need checking
|
|
1393
|
+
* for changes on re-render
|
|
1394
|
+
* @internal
|
|
1395
|
+
*/
|
|
1396
|
+
export declare const _jsxSplit: <T extends string | FunctionComponent<any>>(type: T, varProps: Props | null, constProps: Props | null, children: JSXChildren | null | undefined, flags: number, key: string | number | null, dev?: DevJSX) => JSXNodeInternal<T>;
|
|
1397
|
+
|
|
1398
|
+
/** @public */
|
|
1399
|
+
export declare type JSXTagName = keyof HTMLElementTagNameMap | Omit<string, keyof HTMLElementTagNameMap>;
|
|
1400
|
+
|
|
1401
|
+
/**
|
|
1402
|
+
* The names of events that Qwik knows about. They are all lowercase, but on the JSX side, they are
|
|
1403
|
+
* PascalCase for nicer DX. (`onAuxClick$` vs `onauxclick$`)
|
|
1404
|
+
*
|
|
1405
|
+
* @public
|
|
1406
|
+
*/
|
|
1407
|
+
export declare type KnownEventNames = LiteralUnion<AllEventKeys, string>;
|
|
1408
|
+
|
|
1409
|
+
declare type LcEvent<T extends string, C extends string = Lowercase<T>> = C extends keyof AllEventsMap ? AllEventsMap[C] : Event;
|
|
1410
|
+
|
|
1411
|
+
declare type LcEventNameMap = {
|
|
1412
|
+
[name in PascalCaseNames as Lowercase<name>]: name;
|
|
1413
|
+
};
|
|
1414
|
+
|
|
1415
|
+
/**
|
|
1416
|
+
* These definitions are for the JSX namespace, they allow passing plain event handlers instead of
|
|
1417
|
+
* QRLs
|
|
1418
|
+
*/
|
|
1419
|
+
declare interface LenientQwikElements extends IntrinsicHTMLElements, IntrinsicSVGElements {
|
|
1420
|
+
}
|
|
1421
|
+
|
|
1422
|
+
/** @public */
|
|
1423
|
+
declare interface LenientSVGProps<T extends Element> extends SVGAttributes, DOMAttributes<T> {
|
|
1424
|
+
}
|
|
1425
|
+
|
|
1426
|
+
/**
|
|
1427
|
+
* Allows creating a union type by combining primitive types and literal types without sacrificing
|
|
1428
|
+
* auto-completion in IDEs for the literal type part of the union.
|
|
1429
|
+
*
|
|
1430
|
+
* This type is a workaround for Microsoft/TypeScript#29729. It will be removed as soon as it's not
|
|
1431
|
+
* needed anymore.
|
|
1432
|
+
*
|
|
1433
|
+
* Example:
|
|
1434
|
+
*
|
|
1435
|
+
* ```ts
|
|
1436
|
+
* // Before
|
|
1437
|
+
* type Pet = 'dog' | 'cat' | string;
|
|
1438
|
+
*
|
|
1439
|
+
* const pet: Pet = '';
|
|
1440
|
+
* // Start typing in your TypeScript-enabled IDE.
|
|
1441
|
+
* // You **will not** get auto-completion for `dog` and `cat` literals.
|
|
1442
|
+
*
|
|
1443
|
+
* // After
|
|
1444
|
+
* type Pet2 = LiteralUnion<'dog' | 'cat', string>;
|
|
1445
|
+
*
|
|
1446
|
+
* const pet: Pet2 = '';
|
|
1447
|
+
* // You **will** get auto-completion for `dog` and `cat` literals.
|
|
1448
|
+
* ```
|
|
1449
|
+
*/
|
|
1450
|
+
declare type LiteralUnion<LiteralType, BaseType extends Primitive> = LiteralType | (BaseType & Record<never, never>);
|
|
1451
|
+
|
|
1452
|
+
declare type MediaSpecialAttrs = {
|
|
1453
|
+
crossOrigin?: HTMLCrossOriginAttribute;
|
|
1454
|
+
};
|
|
1455
|
+
|
|
1456
|
+
/** @public @deprecated Use `AnimationEvent` and use the second argument to the handler function for the current event target */
|
|
1457
|
+
export declare type NativeAnimationEvent = AnimationEvent;
|
|
1458
|
+
|
|
1459
|
+
/** @public @deprecated Use `ClipboardEvent` and use the second argument to the handler function for the current event target */
|
|
1460
|
+
export declare type NativeClipboardEvent = ClipboardEvent;
|
|
1461
|
+
|
|
1462
|
+
/** @public @deprecated Use `CompositionEvent` and use the second argument to the handler function for the current event target */
|
|
1463
|
+
export declare type NativeCompositionEvent = CompositionEvent;
|
|
1464
|
+
|
|
1465
|
+
/** @public @deprecated Use `DragEvent` and use the second argument to the handler function for the current event target */
|
|
1466
|
+
export declare type NativeDragEvent = DragEvent;
|
|
1467
|
+
|
|
1468
|
+
/** @public @deprecated Use `FocusEvent` and use the second argument to the handler function for the current event target */
|
|
1469
|
+
export declare type NativeFocusEvent = FocusEvent;
|
|
1470
|
+
|
|
1471
|
+
/** @public @deprecated Use `KeyboardEvent` and use the second argument to the handler function for the current event target */
|
|
1472
|
+
export declare type NativeKeyboardEvent = KeyboardEvent;
|
|
1473
|
+
|
|
1474
|
+
/** @public @deprecated Use `MouseEvent` and use the second argument to the handler function for the current event target */
|
|
1475
|
+
export declare type NativeMouseEvent = MouseEvent;
|
|
1476
|
+
|
|
1477
|
+
/** @public @deprecated Use `PointerEvent` and use the second argument to the handler function for the current event target */
|
|
1478
|
+
export declare type NativePointerEvent = PointerEvent;
|
|
1479
|
+
|
|
1480
|
+
/** @public @deprecated Use `TouchEvent` and use the second argument to the handler function for the current event target */
|
|
1481
|
+
export declare type NativeTouchEvent = TouchEvent;
|
|
1482
|
+
|
|
1483
|
+
/** @public @deprecated Use `TransitionEvent` and use the second argument to the handler function for the current event target */
|
|
1484
|
+
export declare type NativeTransitionEvent = TransitionEvent;
|
|
1485
|
+
|
|
1486
|
+
/** @public @deprecated Use `UIEvent` and use the second argument to the handler function for the current event target */
|
|
1487
|
+
export declare type NativeUIEvent = UIEvent;
|
|
1488
|
+
|
|
1489
|
+
/** @public @deprecated Use `WheelEvent` and use the second argument to the handler function for the current event target */
|
|
1490
|
+
export declare type NativeWheelEvent = WheelEvent;
|
|
1491
|
+
|
|
1492
|
+
/** @internal */
|
|
1493
|
+
export declare const _noopQrl: <T>(symbolName: string, lexicalScopeCapture?: any[]) => QRL<T>;
|
|
1494
|
+
|
|
1495
|
+
/** @internal */
|
|
1496
|
+
export declare const _noopQrlDEV: <T>(symbolName: string, opts: QRLDev, lexicalScopeCapture?: any[]) => QRL<T>;
|
|
1497
|
+
|
|
1498
|
+
/**
|
|
1499
|
+
* Returned type of the `noSerialize()` function. It will be TYPE or undefined.
|
|
1500
|
+
*
|
|
1501
|
+
* @public
|
|
1502
|
+
* @see noSerialize
|
|
1503
|
+
*/
|
|
1504
|
+
export declare type NoSerialize<T> = (T & {
|
|
1505
|
+
__no_serialize__: true;
|
|
1506
|
+
}) | undefined;
|
|
1507
|
+
|
|
1508
|
+
/**
|
|
1509
|
+
* Marks a property on a store as non-serializable.
|
|
1510
|
+
*
|
|
1511
|
+
* At times it is necessary to store values on a store that are non-serializable. Normally this is a
|
|
1512
|
+
* runtime error as Store wants to eagerly report when a non-serializable property is assigned to
|
|
1513
|
+
* it.
|
|
1514
|
+
*
|
|
1515
|
+
* You can use `noSerialize()` to mark a value as non-serializable. The value is persisted in the
|
|
1516
|
+
* Store but does not survive serialization. The implication is that when your application is
|
|
1517
|
+
* resumed, the value of this object will be `undefined`. You will be responsible for recovering
|
|
1518
|
+
* from this.
|
|
1519
|
+
*
|
|
1520
|
+
* See: [noSerialize Tutorial](http://qwik.dev/tutorial/store/no-serialize)
|
|
1521
|
+
*
|
|
1522
|
+
* @public
|
|
1523
|
+
*/
|
|
1524
|
+
export declare const noSerialize: <T extends object | undefined>(input: T) => NoSerialize<T>;
|
|
1525
|
+
|
|
1526
|
+
/** @public */
|
|
1527
|
+
declare type Numberish = number | `${number}`;
|
|
1528
|
+
|
|
1529
|
+
declare type ObjectProps<T> = IsAny<T> extends true ? any : unknown extends T ? never : T extends Record<any, any> ? T : never;
|
|
1530
|
+
|
|
1531
|
+
declare type ObjToProxyMap = WeakMap<any, any>;
|
|
1532
|
+
|
|
1533
|
+
declare type _Only$<P> = {
|
|
1534
|
+
[K in keyof P as K extends `${string}$` ? K : never]: _AllowPlainQrl<P[K]>;
|
|
1535
|
+
};
|
|
1536
|
+
|
|
1537
|
+
/** @public */
|
|
1538
|
+
export declare type OnRenderFn<PROPS> = (props: PROPS) => JSXOutput;
|
|
1539
|
+
|
|
1540
|
+
/** @public */
|
|
1541
|
+
export declare interface OnVisibleTaskOptions {
|
|
1542
|
+
/**
|
|
1543
|
+
* The strategy to use to determine when the "VisibleTask" should first execute.
|
|
1544
|
+
*
|
|
1545
|
+
* - `intersection-observer`: the task will first execute when the element is visible in the
|
|
1546
|
+
* viewport, under the hood it uses the IntersectionObserver API.
|
|
1547
|
+
* - `document-ready`: the task will first execute when the document is ready, under the hood it
|
|
1548
|
+
* uses the document `load` event.
|
|
1549
|
+
* - `document-idle`: the task will first execute when the document is idle, under the hood it uses
|
|
1550
|
+
* the requestIdleCallback API.
|
|
1551
|
+
*/
|
|
1552
|
+
strategy?: VisibleTaskStrategy;
|
|
1553
|
+
}
|
|
1554
|
+
|
|
1555
|
+
/**
|
|
1556
|
+
* Capitalized multi-word names of some known events so we have nicer qwik attributes. For example,
|
|
1557
|
+
* instead of `oncompositionEnd$` we can use `onCompositionEnd$`. Note that any capitalization
|
|
1558
|
+
* works, so `oncompositionend$` is also valid. This is just for DX.
|
|
1559
|
+
*
|
|
1560
|
+
* Add any multi-word event names to this list. Single word events are automatically converted.
|
|
1561
|
+
*/
|
|
1562
|
+
declare type PascalCaseNames = 'AnimationEnd' | 'AnimationIteration' | 'AnimationStart' | 'AuxClick' | 'BeforeToggle' | 'CanPlay' | 'CanPlayThrough' | 'CompositionEnd' | 'CompositionStart' | 'CompositionUpdate' | 'ContextMenu' | 'DblClick' | 'DragEnd' | 'DragEnter' | 'DragExit' | 'DragLeave' | 'DragOver' | 'DragStart' | 'DurationChange' | 'FocusIn' | 'FocusOut' | 'FullscreenChange' | 'FullscreenError' | 'GotPointerCapture' | 'KeyDown' | 'KeyPress' | 'KeyUp' | 'LoadedData' | 'LoadedMetadata' | 'LoadEnd' | 'LoadStart' | 'LostPointerCapture' | 'MouseDown' | 'MouseEnter' | 'MouseLeave' | 'MouseMove' | 'MouseOut' | 'MouseOver' | 'MouseUp' | 'PointerCancel' | 'PointerDown' | 'PointerEnter' | 'PointerLeave' | 'PointerMove' | 'PointerOut' | 'PointerOver' | 'PointerUp' | 'QIdle' | 'QInit' | 'QSymbol' | 'QVisible' | 'RateChange' | 'RateChange' | 'SecurityPolicyViolation' | 'SelectionChange' | 'SelectStart' | 'TimeUpdate' | 'TouchCancel' | 'TouchEnd' | 'TouchMove' | 'TouchStart' | 'TransitionCancel' | 'TransitionEnd' | 'TransitionRun' | 'TransitionStart' | 'VisibilityChange' | 'VolumeChange';
|
|
1563
|
+
|
|
1564
|
+
/**
|
|
1565
|
+
* Convert an event map to PascalCase. For example, `HTMLElementEventMap` contains lowercase keys,
|
|
1566
|
+
* so this will capitalize them, and use the `LcEventNameMap` for multi-word events names.
|
|
1567
|
+
*/
|
|
1568
|
+
declare type PascalMap<M> = {
|
|
1569
|
+
[K in Extract<keyof M, string> as K extends keyof LcEventNameMap ? LcEventNameMap[K] : Capitalize<K>]: M[K];
|
|
1570
|
+
};
|
|
1571
|
+
|
|
1572
|
+
declare type PopoverTargetAction = 'hide' | 'show' | 'toggle';
|
|
1573
|
+
|
|
1574
|
+
declare type PossibleEvents = Event | SimplifiedServerRequestEvent | typeof TaskEvent | typeof RenderEvent | typeof ComputedEvent | typeof ResourceEvent;
|
|
1575
|
+
|
|
1576
|
+
/**
|
|
1577
|
+
* Load the prefetch graph for the container.
|
|
1578
|
+
*
|
|
1579
|
+
* Each Qwik container needs to include its own prefetch graph.
|
|
1580
|
+
*
|
|
1581
|
+
* @param opts - Options for the loading prefetch graph.
|
|
1582
|
+
*
|
|
1583
|
+
* - `base` - Base of the graph. For a default installation this will default to the q:base value
|
|
1584
|
+
* `/build/`. But if more than one MFE is installed on the page, then each MFE needs to have
|
|
1585
|
+
* its own base.
|
|
1586
|
+
* - `manifestHash` - Hash of the manifest file to load. If not provided the hash will be extracted
|
|
1587
|
+
* from the container attribute `q:manifest-hash` and assume the default build file
|
|
1588
|
+
* `${base}/q-bundle-graph-${manifestHash}.json`.
|
|
1589
|
+
* - `manifestURL` - URL of the manifest file to load if non-standard bundle graph location name.
|
|
1590
|
+
*
|
|
1591
|
+
* @beta
|
|
1592
|
+
*/
|
|
1593
|
+
export declare const PrefetchGraph: (opts?: {
|
|
1594
|
+
base?: string;
|
|
1595
|
+
manifestHash?: string;
|
|
1596
|
+
manifestURL?: string;
|
|
1597
|
+
nonce?: string;
|
|
1598
|
+
}) => JSXOutput;
|
|
1599
|
+
|
|
1600
|
+
/** @public */
|
|
1601
|
+
declare interface PrefetchResource {
|
|
1602
|
+
url: string;
|
|
1603
|
+
imports: PrefetchResource[];
|
|
1604
|
+
}
|
|
1605
|
+
|
|
1606
|
+
/**
|
|
1607
|
+
* Install a service worker which will prefetch the bundles.
|
|
1608
|
+
*
|
|
1609
|
+
* There can only be one service worker per page. Because there can be many separate Qwik Containers
|
|
1610
|
+
* on the page each container needs to load its prefetch graph using `PrefetchGraph` component.
|
|
1611
|
+
*
|
|
1612
|
+
* @param opts - Options for the prefetch service worker.
|
|
1613
|
+
*
|
|
1614
|
+
* - `base` - Base URL for the service worker. Default is `import.meta.env.BASE_URL`, which is defined
|
|
1615
|
+
* by Vite's `config.base` and defaults to `/`.
|
|
1616
|
+
* - `scope` - Base URL for when the service-worker will activate. Default is `/`
|
|
1617
|
+
* - `path` - Path to the service worker. Default is `qwik-prefetch-service-worker.js` unless you pass
|
|
1618
|
+
* a path that starts with a `/` then the base is ignored. Default is
|
|
1619
|
+
* `qwik-prefetch-service-worker.js`
|
|
1620
|
+
* - `verbose` - Verbose logging for the service worker installation. Default is `false`
|
|
1621
|
+
* - `nonce` - Optional nonce value for security purposes, defaults to `undefined`.
|
|
1622
|
+
*
|
|
1623
|
+
* @beta
|
|
1624
|
+
*/
|
|
1625
|
+
export declare const PrefetchServiceWorker: (opts: {
|
|
1626
|
+
base?: string;
|
|
1627
|
+
scope?: string;
|
|
1628
|
+
path?: string;
|
|
1629
|
+
verbose?: boolean;
|
|
1630
|
+
fetchBundleGraph?: boolean;
|
|
1631
|
+
nonce?: string;
|
|
1632
|
+
}) => JSXOutput;
|
|
1633
|
+
|
|
1634
|
+
declare type Prettify<T> = {} & {
|
|
1635
|
+
[K in keyof T]: T[K];
|
|
1636
|
+
};
|
|
1637
|
+
|
|
1638
|
+
declare type PreventDefault = {
|
|
1639
|
+
[K in keyof HTMLElementEventMap as `preventdefault:${K}`]?: boolean;
|
|
1640
|
+
};
|
|
1641
|
+
|
|
1642
|
+
/** Matches any primitive value. */
|
|
1643
|
+
declare type Primitive = null | undefined | string | number | boolean | symbol | bigint;
|
|
1644
|
+
|
|
1645
|
+
/**
|
|
1646
|
+
* Alias for `QRL<T>`. Of historic relevance only.
|
|
1647
|
+
*
|
|
1648
|
+
* @public
|
|
1649
|
+
*/
|
|
1650
|
+
export declare type PropFunction<T> = QRL<T>;
|
|
1651
|
+
|
|
1652
|
+
declare type Props = Record<string, unknown>;
|
|
1653
|
+
|
|
1654
|
+
/**
|
|
1655
|
+
* Infers `Props` from the component or tag.
|
|
1656
|
+
*
|
|
1657
|
+
* @example
|
|
1658
|
+
*
|
|
1659
|
+
* ```tsx
|
|
1660
|
+
* const Desc = component$(({desc, ...props}: { desc: string } & PropsOf<'div'>) => {
|
|
1661
|
+
* return <div {...props}>{desc}</div>;
|
|
1662
|
+
* });
|
|
1663
|
+
*
|
|
1664
|
+
* const TitleBox = component$(({title, ...props}: { title: string } & PropsOf<Box>) => {
|
|
1665
|
+
* return <Box {...props}><h1>{title}</h1></Box>;
|
|
1666
|
+
* });
|
|
1667
|
+
* ```
|
|
1668
|
+
*
|
|
1669
|
+
* @public
|
|
1670
|
+
*/
|
|
1671
|
+
export declare type PropsOf<COMP> = COMP extends string ? COMP extends keyof QwikIntrinsicElements ? QwikIntrinsicElements[COMP] : QwikIntrinsicElements['span'] : NonNullable<COMP> extends never ? never : COMP extends FunctionComponent<infer PROPS> ? PROPS extends Record<any, infer V> ? IsAny<V> extends true ? never : ObjectProps<PROPS> : COMP extends Component<infer OrigProps> ? ObjectProps<OrigProps> : PROPS : never;
|
|
1672
|
+
|
|
1673
|
+
/**
|
|
1674
|
+
* Extends the defined component PROPS, adding the default ones (children and q:slot) and allowing
|
|
1675
|
+
* plain functions to QRL arguments.
|
|
1676
|
+
*
|
|
1677
|
+
* @public
|
|
1678
|
+
*/
|
|
1679
|
+
export declare type PublicProps<PROPS> = (PROPS extends Record<any, any> ? Omit<PROPS, `${string}$`> & _Only$<PROPS> : unknown extends PROPS ? {} : PROPS) & ComponentBaseProps & ComponentChildren<PROPS>;
|
|
1680
|
+
|
|
1681
|
+
/** @internal */
|
|
1682
|
+
export declare interface _QDocument extends Document {
|
|
1683
|
+
qVNodeData: WeakMap<Element, string>;
|
|
1684
|
+
}
|
|
1685
|
+
|
|
1686
|
+
/**
|
|
1687
|
+
* The `QRL` type represents a lazy-loadable AND serializable resource.
|
|
1688
|
+
*
|
|
1689
|
+
* QRL stands for Qwik URL.
|
|
1690
|
+
*
|
|
1691
|
+
* Use `QRL` when you want to refer to a lazy-loaded resource. `QRL`s are most often used for code
|
|
1692
|
+
* (functions) but can also be used for other resources such as `string`s in the case of styles.
|
|
1693
|
+
*
|
|
1694
|
+
* `QRL` is an opaque token that is generated by the Qwik Optimizer. (Do not rely on any properties
|
|
1695
|
+
* in `QRL` as it may change between versions.)
|
|
1696
|
+
*
|
|
1697
|
+
* ## Creating `QRL` references
|
|
1698
|
+
*
|
|
1699
|
+
* Creating `QRL` is done using `$(...)` function. `$(...)` is a special marker for the Qwik
|
|
1700
|
+
* Optimizer that marks that the code should be extracted into a lazy-loaded symbol.
|
|
1701
|
+
*
|
|
1702
|
+
* ```tsx
|
|
1703
|
+
* useOnDocument(
|
|
1704
|
+
* 'mousemove',
|
|
1705
|
+
* $((event) => console.log('mousemove', event))
|
|
1706
|
+
* );
|
|
1707
|
+
* ```
|
|
1708
|
+
*
|
|
1709
|
+
* In the above code, the Qwik Optimizer detects `$(...)` and transforms the code as shown below:
|
|
1710
|
+
*
|
|
1711
|
+
* ```tsx
|
|
1712
|
+
* // FILE: <current file>
|
|
1713
|
+
* useOnDocument('mousemove', qrl('./chunk-abc.js', 'onMousemove'));
|
|
1714
|
+
*
|
|
1715
|
+
* // FILE: chunk-abc.js
|
|
1716
|
+
* export const onMousemove = () => console.log('mousemove');
|
|
1717
|
+
* ```
|
|
1718
|
+
*
|
|
1719
|
+
* NOTE: `qrl(...)` is a result of Qwik Optimizer transformation. You should never have to invoke
|
|
1720
|
+
* this function directly in your application. The `qrl(...)` function should be invoked only after
|
|
1721
|
+
* the Qwik Optimizer transformation.
|
|
1722
|
+
*
|
|
1723
|
+
* ## Using `QRL`s
|
|
1724
|
+
*
|
|
1725
|
+
* Use `QRL` type in your application when you want to get a lazy-loadable reference to a resource
|
|
1726
|
+
* (most likely a function).
|
|
1727
|
+
*
|
|
1728
|
+
* ```tsx
|
|
1729
|
+
* // Example of declaring a custom functions which takes callback as QRL.
|
|
1730
|
+
* export function useMyFunction(callback: QRL<() => void>) {
|
|
1731
|
+
* doExtraStuff();
|
|
1732
|
+
* // The callback passed to `onDocument` requires `QRL`.
|
|
1733
|
+
* useOnDocument('mousemove', callback);
|
|
1734
|
+
* }
|
|
1735
|
+
* ```
|
|
1736
|
+
*
|
|
1737
|
+
* In the above example, the way to think about the code is that you are not asking for a callback
|
|
1738
|
+
* function but rather a reference to a lazy-loadable callback function. Specifically, the function
|
|
1739
|
+
* loading should be delayed until it is actually needed. In the above example, the function would
|
|
1740
|
+
* not load until after a `mousemove` event on `document` fires.
|
|
1741
|
+
*
|
|
1742
|
+
* ## Resolving `QRL` references
|
|
1743
|
+
*
|
|
1744
|
+
* At times it may be necessary to resolve a `QRL` reference to the actual value. This can be
|
|
1745
|
+
* performed using `QRL.resolve(..)` function.
|
|
1746
|
+
*
|
|
1747
|
+
* ```tsx
|
|
1748
|
+
* // Assume you have QRL reference to a greet function
|
|
1749
|
+
* const lazyGreet: QRL<() => void> = $(() => console.log('Hello World!'));
|
|
1750
|
+
*
|
|
1751
|
+
* // Use `qrlImport` to load / resolve the reference.
|
|
1752
|
+
* const greet: () => void = await lazyGreet.resolve();
|
|
1753
|
+
*
|
|
1754
|
+
* // Invoke it
|
|
1755
|
+
* greet();
|
|
1756
|
+
* ```
|
|
1757
|
+
*
|
|
1758
|
+
* NOTE: `element` is needed because `QRL`s are relative and need a base location to resolve
|
|
1759
|
+
* against. The base location is encoded in the HTML in the form of `<div q:base="/url">`.
|
|
1760
|
+
*
|
|
1761
|
+
* ## `QRL.resolved`
|
|
1762
|
+
*
|
|
1763
|
+
* Once `QRL.resolve()` returns, the value is stored under `QRL.resolved`. This allows the value to
|
|
1764
|
+
* be used without having to await `QRL.resolve()` again.
|
|
1765
|
+
*
|
|
1766
|
+
* ## Question: Why not just use `import()`?
|
|
1767
|
+
*
|
|
1768
|
+
* At first glance, `QRL` serves the same purpose as `import()`. However, there are three subtle
|
|
1769
|
+
* differences that need to be taken into account.
|
|
1770
|
+
*
|
|
1771
|
+
* 1. `QRL`s must be serializable into HTML.
|
|
1772
|
+
* 2. `QRL`s must be resolved by framework relative to `q:base`.
|
|
1773
|
+
* 3. `QRL`s must be able to capture lexically scoped variables.
|
|
1774
|
+
* 4. `QRL`s encapsulate the difference between running with and without Qwik Optimizer.
|
|
1775
|
+
* 5. `QRL`s allow expressing lazy-loaded boundaries without thinking about chunk and symbol names.
|
|
1776
|
+
*
|
|
1777
|
+
* Let's assume that you intend to write code such as this:
|
|
1778
|
+
*
|
|
1779
|
+
* ```tsx
|
|
1780
|
+
* return <button onClick={() => (await import('./chunk-abc.js')).onClick}>
|
|
1781
|
+
* ```
|
|
1782
|
+
*
|
|
1783
|
+
* The above code needs to be serialized into DOM such as:
|
|
1784
|
+
*
|
|
1785
|
+
* ```
|
|
1786
|
+
* <div q:base="/build/">
|
|
1787
|
+
* <button on:click="./chunk-abc.js#onClick">...</button>
|
|
1788
|
+
* </div>
|
|
1789
|
+
* ```
|
|
1790
|
+
*
|
|
1791
|
+
* 1. Notice there is no easy way to extract chunk (`./chunk-abc.js`) and symbol (`onClick`) into HTML.
|
|
1792
|
+
* 2. Notice that even if you could extract it, the `import('./chunk-abc.js')` would become relative to
|
|
1793
|
+
* where the `import()` file is declared. Because it is our framework doing the load, the
|
|
1794
|
+
* `./chunk-abc.js` would become relative to the framework file. This is not correct, as it
|
|
1795
|
+
* should be relative to the original file generated by the bundler.
|
|
1796
|
+
* 3. Next, the framework needs to resolve the `./chunk-abc.js` and needs a base location that is
|
|
1797
|
+
* encoded in the HTML.
|
|
1798
|
+
* 4. The QRL needs to be able to capture lexically scoped variables. (`import()` only allows loading
|
|
1799
|
+
* top-level symbols which don't capture variables.)
|
|
1800
|
+
* 5. As a developer, you don't want to think about `import` and naming the chunks and symbols. You
|
|
1801
|
+
* just want to say: "this should be lazy."
|
|
1802
|
+
*
|
|
1803
|
+
* These are the main reasons why Qwik introduces its own concept of `QRL`.
|
|
1804
|
+
*
|
|
1805
|
+
* @public
|
|
1806
|
+
* @see `$`
|
|
1807
|
+
*/
|
|
1808
|
+
export declare type QRL<TYPE = unknown> = {
|
|
1809
|
+
__qwik_serializable__?: any;
|
|
1810
|
+
__brand__QRL__: TYPE;
|
|
1811
|
+
/** Resolve the QRL and return the actual value. */
|
|
1812
|
+
resolve(): Promise<TYPE>;
|
|
1813
|
+
/** The resolved value, once `resolve()` returns. */
|
|
1814
|
+
resolved: undefined | TYPE;
|
|
1815
|
+
getCaptured(): unknown[] | null;
|
|
1816
|
+
getSymbol(): string;
|
|
1817
|
+
getHash(): string;
|
|
1818
|
+
dev: QRLDev | null;
|
|
1819
|
+
} & BivariantQrlFn<QrlArgs<TYPE>, QrlReturn<TYPE>>;
|
|
1820
|
+
|
|
1821
|
+
/**
|
|
1822
|
+
* Used by Qwik Optimizer to point to lazy-loaded resources.
|
|
1823
|
+
*
|
|
1824
|
+
* This function should be used by the Qwik Optimizer only. The function should not be directly
|
|
1825
|
+
* referred to in the source code of the application.
|
|
1826
|
+
*
|
|
1827
|
+
* @param chunkOrFn - Chunk name (or function which is stringified to extract chunk name)
|
|
1828
|
+
* @param symbol - Symbol to lazy load
|
|
1829
|
+
* @param lexicalScopeCapture - A set of lexically scoped variables to capture.
|
|
1830
|
+
* @public
|
|
1831
|
+
* @see `QRL`, `$(...)`
|
|
1832
|
+
*/
|
|
1833
|
+
export declare const qrl: <T = any>(chunkOrFn: string | (() => Promise<any>), symbol: string, lexicalScopeCapture?: any[], stackOffset?: number) => QRL<T>;
|
|
1834
|
+
|
|
1835
|
+
declare type QrlArgs<T> = T extends (...args: infer ARGS) => any ? ARGS : unknown[];
|
|
1836
|
+
|
|
1837
|
+
/** @public */
|
|
1838
|
+
declare interface QRLDev {
|
|
1839
|
+
file: string;
|
|
1840
|
+
lo: number;
|
|
1841
|
+
hi: number;
|
|
1842
|
+
}
|
|
1843
|
+
|
|
1844
|
+
/** @internal */
|
|
1845
|
+
export declare const qrlDEV: <T = any>(chunkOrFn: string | (() => Promise<any>), symbol: string, opts: QRLDev, lexicalScopeCapture?: any[]) => QRL<T>;
|
|
1846
|
+
|
|
1847
|
+
/**
|
|
1848
|
+
* An event handler for Qwik events, can be a handler QRL or an array of handler QRLs.
|
|
1849
|
+
*
|
|
1850
|
+
* @public
|
|
1851
|
+
*/
|
|
1852
|
+
export declare type QRLEventHandlerMulti<EV extends Event, EL> = QRL<EventHandler<EV, EL>> | undefined | null | QRLEventHandlerMulti<EV, EL>[] | EventHandler<EV, EL>;
|
|
1853
|
+
|
|
1854
|
+
declare type QRLInternal<TYPE = unknown> = QRL<TYPE> & QRLInternalMethods<TYPE>;
|
|
1855
|
+
|
|
1856
|
+
declare type QRLInternalMethods<TYPE> = {
|
|
1857
|
+
readonly $chunk$: string | null;
|
|
1858
|
+
readonly $symbol$: string;
|
|
1859
|
+
readonly $refSymbol$: string | null;
|
|
1860
|
+
readonly $hash$: string;
|
|
1861
|
+
$capture$: string[] | null;
|
|
1862
|
+
$captureRef$: unknown[] | null;
|
|
1863
|
+
dev: QRLDev | null;
|
|
1864
|
+
resolved: undefined | TYPE;
|
|
1865
|
+
resolve(): Promise<TYPE>;
|
|
1866
|
+
getSymbol(): string;
|
|
1867
|
+
getHash(): string;
|
|
1868
|
+
getCaptured(): unknown[] | null;
|
|
1869
|
+
getFn(currentCtx?: InvokeContext | InvokeTuple, beforeFn?: () => void): TYPE extends (...args: any) => any ? (...args: Parameters<TYPE>) => ValueOrPromise<ReturnType<TYPE>> : unknown;
|
|
1870
|
+
$setContainer$(containerEl: Element | undefined): Element | undefined;
|
|
1871
|
+
$resolveLazy$(containerEl?: Element): ValueOrPromise<TYPE>;
|
|
1872
|
+
};
|
|
1873
|
+
|
|
1874
|
+
declare type QrlReturn<T> = T extends (...args: any) => infer R ? Awaited<R> : unknown;
|
|
1875
|
+
|
|
1876
|
+
/**
|
|
1877
|
+
* Extract function into a synchronously loadable QRL.
|
|
1878
|
+
*
|
|
1879
|
+
* NOTE: Synchronous QRLs functions can't close over any variables, including exports.
|
|
1880
|
+
*
|
|
1881
|
+
* @param fn - Extracted function
|
|
1882
|
+
* @param serializedFn - Serialized function in string form.
|
|
1883
|
+
* @returns
|
|
1884
|
+
* @internal
|
|
1885
|
+
*/
|
|
1886
|
+
export declare const _qrlSync: <TYPE extends Function>(fn: TYPE, serializedFn?: string) => SyncQRL<TYPE>;
|
|
1887
|
+
|
|
1888
|
+
/** @public @deprecated Use `AnimationEvent` and use the second argument to the handler function for the current event target */
|
|
1889
|
+
export declare type QwikAnimationEvent<T = Element> = NativeAnimationEvent;
|
|
1890
|
+
|
|
1891
|
+
/** The Qwik DOM attributes without plain handlers, for use as function parameters @public */
|
|
1892
|
+
export declare interface QwikAttributes<EL extends Element> extends DOMAttributesBase<EL>, QwikEvents<EL, false> {
|
|
1893
|
+
class?: ClassList | undefined;
|
|
1894
|
+
}
|
|
1895
|
+
|
|
1896
|
+
/** @public @deprecated Use `Event` and use the second argument to the handler function for the current event target. Also note that in Qwik, onInput$ with the InputEvent is the event that behaves like onChange in React. */
|
|
1897
|
+
export declare type QwikChangeEvent<T = Element> = Event;
|
|
1898
|
+
|
|
1899
|
+
/** @public @deprecated Use `ClipboardEvent` and use the second argument to the handler function for the current event target */
|
|
1900
|
+
export declare type QwikClipboardEvent<T = Element> = NativeClipboardEvent;
|
|
1901
|
+
|
|
1902
|
+
/** @public @deprecated Use `CompositionEvent` and use the second argument to the handler function for the current event target */
|
|
1903
|
+
export declare type QwikCompositionEvent<T = Element> = NativeCompositionEvent;
|
|
1904
|
+
|
|
1905
|
+
declare type QwikCustomEvents<EL> = {};
|
|
1906
|
+
|
|
1907
|
+
declare type QwikCustomEventsPlain<EL> = {
|
|
1908
|
+
/** The handler */
|
|
1909
|
+
[key: `${'document:' | 'window:' | ''}on${string}$`]: QRLEventHandlerMulti<Event, EL> | EventHandler<Event, EL>;
|
|
1910
|
+
};
|
|
1911
|
+
|
|
1912
|
+
/** @public */
|
|
1913
|
+
export declare interface QwikDOMAttributes extends DOMAttributes<Element> {
|
|
1914
|
+
}
|
|
1915
|
+
|
|
1916
|
+
/** @public @deprecated Use `DragEvent` and use the second argument to the handler function for the current event target */
|
|
1917
|
+
export declare type QwikDragEvent<T = Element> = NativeDragEvent;
|
|
1918
|
+
|
|
1919
|
+
/** @public */
|
|
1920
|
+
declare type QwikEvents<EL, Plain extends boolean = true> = Plain extends true ? QwikKnownEventsPlain<EL> & QwikCustomEventsPlain<EL> : QwikKnownEvents<EL> & QwikCustomEvents<EL>;
|
|
1921
|
+
|
|
1922
|
+
/** @public @deprecated Use `FocusEvent` and use the second argument to the handler function for the current event target */
|
|
1923
|
+
export declare type QwikFocusEvent<T = Element> = NativeFocusEvent;
|
|
1924
|
+
|
|
1925
|
+
/**
|
|
1926
|
+
* The DOM props without plain handlers, for use inside functions
|
|
1927
|
+
*
|
|
1928
|
+
* @public
|
|
1929
|
+
*/
|
|
1930
|
+
export declare type QwikHTMLElements = {
|
|
1931
|
+
[tag in keyof HTMLElementTagNameMap]: Augmented<HTMLElementTagNameMap[tag], SpecialAttrs[tag]> & HTMLElementAttrs & QwikAttributes<HTMLElementTagNameMap[tag]>;
|
|
1932
|
+
};
|
|
1933
|
+
|
|
1934
|
+
/** Emitted by qwik-loader on document when the document first becomes idle @public */
|
|
1935
|
+
export declare type QwikIdleEvent = CustomEvent<{}>;
|
|
1936
|
+
|
|
1937
|
+
/** Emitted by qwik-loader on document when the document first becomes interactive @public */
|
|
1938
|
+
export declare type QwikInitEvent = CustomEvent<{}>;
|
|
1939
|
+
|
|
1940
|
+
/** @public */
|
|
1941
|
+
declare interface QwikIntrinsicAttributes {
|
|
1942
|
+
key?: string | number | null | undefined;
|
|
1943
|
+
children?: JSXChildren;
|
|
1944
|
+
/** Corresponding slot name used to project the element into. */
|
|
1945
|
+
'q:slot'?: string;
|
|
1946
|
+
'q:shadowRoot'?: boolean;
|
|
1947
|
+
fetchPriority?: 'auto' | 'high' | 'low';
|
|
1948
|
+
}
|
|
1949
|
+
|
|
1950
|
+
/**
|
|
1951
|
+
* The interface holds available attributes of both native DOM elements and custom Qwik elements. An
|
|
1952
|
+
* example showing how to define a customizable wrapper component:
|
|
1953
|
+
*
|
|
1954
|
+
* ```tsx
|
|
1955
|
+
* import { component$, Slot, type QwikIntrinsicElements } from "@qwik.dev/core";
|
|
1956
|
+
*
|
|
1957
|
+
* type WrapperProps = {
|
|
1958
|
+
* attributes?: QwikIntrinsicElements["div"];
|
|
1959
|
+
* };
|
|
1960
|
+
*
|
|
1961
|
+
* export default component$<WrapperProps>(({ attributes }) => {
|
|
1962
|
+
* return (
|
|
1963
|
+
* <div {...attributes} class="p-2">
|
|
1964
|
+
* <Slot />
|
|
1965
|
+
* </div>
|
|
1966
|
+
* );
|
|
1967
|
+
* });
|
|
1968
|
+
* ```
|
|
1969
|
+
*
|
|
1970
|
+
* Note: It is shorter to use `PropsOf<'div'>`
|
|
1971
|
+
*
|
|
1972
|
+
* @public
|
|
1973
|
+
*/
|
|
1974
|
+
export declare interface QwikIntrinsicElements extends QwikHTMLElements, QwikSVGElements {
|
|
1975
|
+
}
|
|
1976
|
+
|
|
1977
|
+
/** @public @deprecated Use `Event` and use the second argument to the handler function for the current event target */
|
|
1978
|
+
export declare type QwikInvalidEvent<T = Element> = Event;
|
|
1979
|
+
|
|
1980
|
+
/** @public */
|
|
1981
|
+
declare namespace QwikJSX {
|
|
1982
|
+
type Element = JSXOutput;
|
|
1983
|
+
type ElementType = string | FunctionComponent<Record<any, any>>;
|
|
1984
|
+
interface IntrinsicAttributes extends QwikIntrinsicAttributes {
|
|
1985
|
+
}
|
|
1986
|
+
interface ElementChildrenAttribute {
|
|
1987
|
+
children: JSXChildren;
|
|
1988
|
+
}
|
|
1989
|
+
interface IntrinsicElements extends LenientQwikElements {
|
|
1990
|
+
}
|
|
1991
|
+
}
|
|
1992
|
+
export { QwikJSX as JSX }
|
|
1993
|
+
export { QwikJSX }
|
|
1994
|
+
|
|
1995
|
+
/** @public @deprecated Use `KeyboardEvent` and use the second argument to the handler function for the current event target */
|
|
1996
|
+
export declare type QwikKeyboardEvent<T = Element> = NativeKeyboardEvent;
|
|
1997
|
+
|
|
1998
|
+
declare type QwikKnownEvents<EL> = {
|
|
1999
|
+
[K in keyof AllPascalEventMaps as `${'document:' | 'window:' | ''}on${K}$`]?: QRLEventHandlerMulti<AllPascalEventMaps[K], EL>;
|
|
2000
|
+
};
|
|
2001
|
+
|
|
2002
|
+
declare type QwikKnownEventsPlain<EL> = {
|
|
2003
|
+
[K in keyof AllPascalEventMaps as `${'document:' | 'window:' | ''}on${K}$`]?: QRLEventHandlerMulti<AllPascalEventMaps[K], EL> | EventHandler<AllPascalEventMaps[K], EL>;
|
|
2004
|
+
};
|
|
2005
|
+
|
|
2006
|
+
/** @public @deprecated Use `MouseEvent` and use the second argument to the handler function for the current event target */
|
|
2007
|
+
export declare type QwikMouseEvent<T = Element, E = NativeMouseEvent> = E;
|
|
2008
|
+
|
|
2009
|
+
/** @public @deprecated Use `PointerEvent` and use the second argument to the handler function for the current event target */
|
|
2010
|
+
export declare type QwikPointerEvent<T = Element> = NativePointerEvent;
|
|
2011
|
+
|
|
2012
|
+
/** @public @deprecated Use `SubmitEvent` and use the second argument to the handler function for the current event target */
|
|
2013
|
+
export declare type QwikSubmitEvent<T = Element> = SubmitEvent;
|
|
2014
|
+
|
|
2015
|
+
/**
|
|
2016
|
+
* The SVG props without plain handlers, for use inside functions
|
|
2017
|
+
*
|
|
2018
|
+
* @public
|
|
2019
|
+
*/
|
|
2020
|
+
export declare type QwikSVGElements = {
|
|
2021
|
+
[K in keyof Omit<SVGElementTagNameMap, keyof HTMLElementTagNameMap>]: SVGProps<SVGElementTagNameMap[K]>;
|
|
2022
|
+
};
|
|
2023
|
+
|
|
2024
|
+
/** Emitted by qwik-loader when a module was lazily loaded @public */
|
|
2025
|
+
export declare type QwikSymbolEvent = CustomEvent<{
|
|
2026
|
+
qBase: string;
|
|
2027
|
+
qManifest: string;
|
|
2028
|
+
qVersion: string;
|
|
2029
|
+
href: string;
|
|
2030
|
+
symbol: string;
|
|
2031
|
+
element: Element;
|
|
2032
|
+
reqTime: number;
|
|
2033
|
+
}>;
|
|
2034
|
+
|
|
2035
|
+
/** @public @deprecated Use `TouchEvent` and use the second argument to the handler function for the current event target */
|
|
2036
|
+
export declare type QwikTouchEvent<T = Element> = NativeTouchEvent;
|
|
2037
|
+
|
|
2038
|
+
/** @public @deprecated Use `TransitionEvent` and use the second argument to the handler function for the current event target */
|
|
2039
|
+
export declare type QwikTransitionEvent<T = Element> = NativeTransitionEvent;
|
|
2040
|
+
|
|
2041
|
+
/** @public @deprecated Use `UIEvent` and use the second argument to the handler function for the current event target */
|
|
2042
|
+
export declare type QwikUIEvent<T = Element> = NativeUIEvent;
|
|
2043
|
+
|
|
2044
|
+
/** Emitted by qwik-loader when an element becomes visible. Used by `useVisibleTask$` @public */
|
|
2045
|
+
export declare type QwikVisibleEvent = CustomEvent<IntersectionObserverEntry>;
|
|
2046
|
+
|
|
2047
|
+
/** @public @deprecated Use `WheelEvent` and use the second argument to the handler function for the current event target */
|
|
2048
|
+
export declare type QwikWheelEvent<T = Element> = NativeWheelEvent;
|
|
2049
|
+
|
|
2050
|
+
/** @public */
|
|
2051
|
+
export declare interface ReadonlySignal<T = unknown> {
|
|
2052
|
+
readonly value: T;
|
|
2053
|
+
}
|
|
2054
|
+
|
|
2055
|
+
/**
|
|
2056
|
+
* A ref can be either a signal or a function. Note that the type of Signal is Element so that it
|
|
2057
|
+
* can accept more specialized elements too
|
|
2058
|
+
*
|
|
2059
|
+
* @public
|
|
2060
|
+
*/
|
|
2061
|
+
declare type Ref<EL extends Element = Element> = Signal<Element | undefined> | RefFnInterface<EL>;
|
|
2062
|
+
|
|
2063
|
+
declare interface RefAttr<EL extends Element> {
|
|
2064
|
+
ref?: Ref<EL> | undefined;
|
|
2065
|
+
}
|
|
2066
|
+
|
|
2067
|
+
declare type RefFnInterface<EL> = {
|
|
2068
|
+
(el: EL): void;
|
|
2069
|
+
};
|
|
2070
|
+
|
|
2071
|
+
/** @internal */
|
|
2072
|
+
export declare const _regSymbol: (symbol: any, hash: string) => any;
|
|
2073
|
+
|
|
2074
|
+
/**
|
|
2075
|
+
* Render JSX.
|
|
2076
|
+
*
|
|
2077
|
+
* Use this method to render JSX. This function does reconciling which means it always tries to
|
|
2078
|
+
* reuse what is already in the DOM (rather then destroy and recreate content.) It returns a cleanup
|
|
2079
|
+
* function you could use for cleaning up subscriptions.
|
|
2080
|
+
*
|
|
2081
|
+
* @param parent - Element which will act as a parent to `jsxNode`. When possible the rendering will
|
|
2082
|
+
* try to reuse existing nodes.
|
|
2083
|
+
* @param jsxNode - JSX to render
|
|
2084
|
+
* @returns An object containing a cleanup function.
|
|
2085
|
+
* @public
|
|
2086
|
+
*/
|
|
2087
|
+
export declare const render: (parent: Element | Document, jsxNode: JSXOutput | FunctionComponent<any>, opts?: RenderOptions) => Promise<RenderResult>;
|
|
2088
|
+
|
|
2089
|
+
declare const RenderEvent = "qRender";
|
|
2090
|
+
|
|
2091
|
+
/** @public */
|
|
2092
|
+
export declare const RenderOnce: FunctionComponent<{
|
|
2093
|
+
children?: unknown;
|
|
2094
|
+
key?: string | number | null | undefined;
|
|
2095
|
+
}>;
|
|
2096
|
+
|
|
2097
|
+
/** @public */
|
|
2098
|
+
export declare interface RenderOptions {
|
|
2099
|
+
serverData?: Record<string, any>;
|
|
2100
|
+
}
|
|
2101
|
+
|
|
2102
|
+
/** @public */
|
|
2103
|
+
export declare interface RenderResult {
|
|
2104
|
+
cleanup(): void;
|
|
2105
|
+
}
|
|
2106
|
+
|
|
2107
|
+
/** @public */
|
|
2108
|
+
export declare interface RenderSSROptions {
|
|
2109
|
+
containerTagName: string;
|
|
2110
|
+
containerAttributes: Record<string, string>;
|
|
2111
|
+
stream: StreamWriter;
|
|
2112
|
+
base?: string;
|
|
2113
|
+
serverData?: Record<string, any>;
|
|
2114
|
+
manifestHash: string;
|
|
2115
|
+
}
|
|
2116
|
+
|
|
2117
|
+
/**
|
|
2118
|
+
* This method works like an async memoized function that runs whenever some tracked value changes
|
|
2119
|
+
* and returns some data.
|
|
2120
|
+
*
|
|
2121
|
+
* `useResource` however returns immediate a `ResourceReturn` object that contains the data and a
|
|
2122
|
+
* state that indicates if the data is available or not.
|
|
2123
|
+
*
|
|
2124
|
+
* The status can be one of the following:
|
|
2125
|
+
*
|
|
2126
|
+
* - `pending` - the data is not yet available.
|
|
2127
|
+
* - `resolved` - the data is available.
|
|
2128
|
+
* - `rejected` - the data is not available due to an error or timeout.
|
|
2129
|
+
*
|
|
2130
|
+
* Be careful when using a `try/catch` statement in `useResource$`. If you catch the error and don't
|
|
2131
|
+
* re-throw it (or a new Error), the resource status will never be `rejected`.
|
|
2132
|
+
*
|
|
2133
|
+
* ### Example
|
|
2134
|
+
*
|
|
2135
|
+
* Example showing how `useResource` to perform a fetch to request the weather, whenever the input
|
|
2136
|
+
* city name changes.
|
|
2137
|
+
*
|
|
2138
|
+
* ```tsx
|
|
2139
|
+
* const Cmp = component$(() => {
|
|
2140
|
+
* const cityS = useSignal('');
|
|
2141
|
+
*
|
|
2142
|
+
* const weatherResource = useResource$(async ({ track, cleanup }) => {
|
|
2143
|
+
* const cityName = track(cityS);
|
|
2144
|
+
* const abortController = new AbortController();
|
|
2145
|
+
* cleanup(() => abortController.abort('cleanup'));
|
|
2146
|
+
* const res = await fetch(`http://weatherdata.com?city=${cityName}`, {
|
|
2147
|
+
* signal: abortController.signal,
|
|
2148
|
+
* });
|
|
2149
|
+
* const data = await res.json();
|
|
2150
|
+
* return data as { temp: number };
|
|
2151
|
+
* });
|
|
2152
|
+
*
|
|
2153
|
+
* return (
|
|
2154
|
+
* <div>
|
|
2155
|
+
* <input name="city" bind:value={cityS} />
|
|
2156
|
+
* <Resource
|
|
2157
|
+
* value={weatherResource}
|
|
2158
|
+
* onResolved={(weather) => {
|
|
2159
|
+
* return <div>Temperature: {weather.temp}</div>;
|
|
2160
|
+
* }}
|
|
2161
|
+
* />
|
|
2162
|
+
* </div>
|
|
2163
|
+
* );
|
|
2164
|
+
* });
|
|
2165
|
+
* ```
|
|
2166
|
+
*
|
|
2167
|
+
* @public
|
|
2168
|
+
* @see Resource
|
|
2169
|
+
* @see ResourceReturn
|
|
2170
|
+
*/
|
|
2171
|
+
export declare const Resource: <T>(props: ResourceProps<T>) => JSXOutput;
|
|
2172
|
+
|
|
2173
|
+
/** @public */
|
|
2174
|
+
export declare interface ResourceCtx<T> {
|
|
2175
|
+
readonly track: Tracker;
|
|
2176
|
+
cleanup(callback: () => void): void;
|
|
2177
|
+
cache(policyOrMilliseconds: number | 'immutable'): void;
|
|
2178
|
+
readonly previous: T | undefined;
|
|
2179
|
+
}
|
|
2180
|
+
|
|
2181
|
+
declare const ResourceEvent = "qResource";
|
|
2182
|
+
|
|
2183
|
+
/** @public */
|
|
2184
|
+
export declare type ResourceFn<T> = (ctx: ResourceCtx<unknown>) => ValueOrPromise<T>;
|
|
2185
|
+
|
|
2186
|
+
/**
|
|
2187
|
+
* Options to pass to `useResource$()`
|
|
2188
|
+
*
|
|
2189
|
+
* @public
|
|
2190
|
+
* @see useResource
|
|
2191
|
+
*/
|
|
2192
|
+
export declare interface ResourceOptions {
|
|
2193
|
+
/**
|
|
2194
|
+
* Timeout in milliseconds. If the resource takes more than the specified millisecond, it will
|
|
2195
|
+
* timeout. Resulting on a rejected resource.
|
|
2196
|
+
*/
|
|
2197
|
+
timeout?: number;
|
|
2198
|
+
}
|
|
2199
|
+
|
|
2200
|
+
/** @public */
|
|
2201
|
+
export declare interface ResourcePending<T> {
|
|
2202
|
+
readonly value: Promise<T>;
|
|
2203
|
+
readonly loading: boolean;
|
|
2204
|
+
}
|
|
2205
|
+
|
|
2206
|
+
/** @public */
|
|
2207
|
+
export declare interface ResourceProps<T> {
|
|
2208
|
+
readonly value: ResourceReturn<T> | Signal<Promise<T> | T> | Promise<T>;
|
|
2209
|
+
onResolved: (value: T) => JSXOutput;
|
|
2210
|
+
onPending?: () => JSXOutput;
|
|
2211
|
+
onRejected?: (reason: Error) => JSXOutput;
|
|
2212
|
+
}
|
|
2213
|
+
|
|
2214
|
+
/** @public */
|
|
2215
|
+
export declare interface ResourceRejected<T> {
|
|
2216
|
+
readonly value: Promise<T>;
|
|
2217
|
+
readonly loading: boolean;
|
|
2218
|
+
}
|
|
2219
|
+
|
|
2220
|
+
/** @public */
|
|
2221
|
+
export declare interface ResourceResolved<T> {
|
|
2222
|
+
readonly value: Promise<T>;
|
|
2223
|
+
readonly loading: boolean;
|
|
2224
|
+
}
|
|
2225
|
+
|
|
2226
|
+
/** @public */
|
|
2227
|
+
export declare type ResourceReturn<T> = ResourcePending<T> | ResourceResolved<T> | ResourceRejected<T>;
|
|
2228
|
+
|
|
2229
|
+
declare interface ResourceReturnInternal<T> {
|
|
2230
|
+
__brand: 'resource';
|
|
2231
|
+
_state: 'pending' | 'resolved' | 'rejected';
|
|
2232
|
+
_resolved: T | undefined;
|
|
2233
|
+
_error: Error | undefined;
|
|
2234
|
+
_cache: number;
|
|
2235
|
+
_timeout: number;
|
|
2236
|
+
value: Promise<T>;
|
|
2237
|
+
loading: boolean;
|
|
2238
|
+
}
|
|
2239
|
+
|
|
2240
|
+
/** @internal */
|
|
2241
|
+
export declare const _restProps: (props: Record<string, any>, omit: string[], target?: {}) => {};
|
|
2242
|
+
|
|
2243
|
+
declare type Scheduler = ReturnType<typeof createScheduler>;
|
|
2244
|
+
|
|
2245
|
+
declare interface SerializationContext {
|
|
2246
|
+
$serialize$: () => void;
|
|
2247
|
+
$symbolToChunkResolver$: SymbolToChunkResolver;
|
|
2248
|
+
/**
|
|
2249
|
+
* Map from object to root index.
|
|
2250
|
+
*
|
|
2251
|
+
* If object is found in `objMap` will return the index of the object in the `objRoots` or
|
|
2252
|
+
* `secondaryObjRoots`.
|
|
2253
|
+
*
|
|
2254
|
+
* `objMap` return:
|
|
2255
|
+
*
|
|
2256
|
+
* - `>=0` - index of the object in `objRoots`.
|
|
2257
|
+
* - `-1` - object has been seen, only once, and therefore does not need to be promoted into a root
|
|
2258
|
+
* yet.
|
|
2259
|
+
*/
|
|
2260
|
+
$wasSeen$: (obj: unknown) => number | undefined;
|
|
2261
|
+
$hasRootId$: (obj: unknown) => number | undefined;
|
|
2262
|
+
/**
|
|
2263
|
+
* Root objects which need to be serialized.
|
|
2264
|
+
*
|
|
2265
|
+
* Roots are entry points into the object graph. Typically the roots are held by the listeners.
|
|
2266
|
+
*/
|
|
2267
|
+
$addRoot$: (obj: unknown) => number;
|
|
2268
|
+
/**
|
|
2269
|
+
* Get root index of the object without create a new root.
|
|
2270
|
+
*
|
|
2271
|
+
* This is used during serialization, as new roots can't be created during serialization.
|
|
2272
|
+
*
|
|
2273
|
+
* The function throws if the root was not found.
|
|
2274
|
+
*/
|
|
2275
|
+
$getRootId$: (obj: unknown) => number;
|
|
2276
|
+
$seen$: (obj: unknown) => void;
|
|
2277
|
+
$roots$: unknown[];
|
|
2278
|
+
$addSyncFn$($funcStr$: string | null, argsCount: number, fn: Function): number;
|
|
2279
|
+
$breakCircularDepsAndAwaitPromises$: () => ValueOrPromise<void>;
|
|
2280
|
+
$isSsrNode$: (obj: unknown) => obj is SsrNode;
|
|
2281
|
+
$writer$: StreamWriter_2;
|
|
2282
|
+
$syncFns$: string[];
|
|
2283
|
+
$eventQrls$: Set<QRL>;
|
|
2284
|
+
$eventNames$: Set<string>;
|
|
2285
|
+
$resources$: Set<ResourceReturnInternal<unknown>>;
|
|
2286
|
+
$renderSymbols$: Set<string>;
|
|
2287
|
+
$storeProxyMap$: ObjToProxyMap;
|
|
2288
|
+
$getProp$: (obj: any, prop: string) => any;
|
|
2289
|
+
$setProp$: (obj: any, prop: string, value: any) => void;
|
|
2290
|
+
$prepVNodeData$?: (vNodeData: VNodeData) => void;
|
|
2291
|
+
}
|
|
2292
|
+
|
|
2293
|
+
/**
|
|
2294
|
+
* Serialize data to string using SerializationContext.
|
|
2295
|
+
*
|
|
2296
|
+
* @param data - Data to serialize
|
|
2297
|
+
* @internal
|
|
2298
|
+
*/
|
|
2299
|
+
export declare function _serialize(data: unknown[]): Promise<string>;
|
|
2300
|
+
|
|
2301
|
+
/**
|
|
2302
|
+
* Sets the `CorePlatform`.
|
|
2303
|
+
*
|
|
2304
|
+
* This is useful to override the platform in tests to change the behavior of,
|
|
2305
|
+
* `requestAnimationFrame`, and import resolution.
|
|
2306
|
+
*
|
|
2307
|
+
* @param doc - The document of the application for which the platform is needed.
|
|
2308
|
+
* @param platform - The platform to use.
|
|
2309
|
+
* @public
|
|
2310
|
+
*/
|
|
2311
|
+
export declare const setPlatform: (plt: CorePlatform) => CorePlatform;
|
|
2312
|
+
|
|
2313
|
+
/** @internal */
|
|
2314
|
+
export declare abstract class _SharedContainer implements Container {
|
|
2315
|
+
readonly $version$: string;
|
|
2316
|
+
readonly $scheduler$: Scheduler;
|
|
2317
|
+
readonly $storeProxyMap$: ObjToProxyMap;
|
|
2318
|
+
readonly $locale$: string;
|
|
2319
|
+
readonly $getObjectById$: (id: number | string) => any;
|
|
2320
|
+
$serverData$: Record<string, any>;
|
|
2321
|
+
$currentUniqueId$: number;
|
|
2322
|
+
$instanceHash$: string | null;
|
|
2323
|
+
constructor(scheduleDrain: () => void, journalFlush: () => void, serverData: Record<string, any>, locale: string);
|
|
2324
|
+
trackSignalValue<T>(signal: Signal, subscriber: Effect, property: string, data: _EffectData): T;
|
|
2325
|
+
serializationCtxFactory(NodeConstructor: {
|
|
2326
|
+
new (...rest: any[]): {
|
|
2327
|
+
nodeType: number;
|
|
2328
|
+
id: string;
|
|
2329
|
+
};
|
|
2330
|
+
} | null, symbolToChunkResolver: SymbolToChunkResolver, writer?: StreamWriter, prepVNodeData?: (vNode: any) => void): SerializationContext;
|
|
2331
|
+
abstract ensureProjectionResolved(host: HostElement): void;
|
|
2332
|
+
abstract processJsx(host: HostElement, jsx: JSXOutput): ValueOrPromise<void>;
|
|
2333
|
+
abstract handleError(err: any, $host$: HostElement): void;
|
|
2334
|
+
abstract getParentHost(host: HostElement): HostElement | null;
|
|
2335
|
+
abstract setContext<T>(host: HostElement, context: ContextId<T>, value: T): void;
|
|
2336
|
+
abstract resolveContext<T>(host: HostElement, contextId: ContextId<T>): T | undefined;
|
|
2337
|
+
abstract setHostProp<T>(host: HostElement, name: string, value: T): void;
|
|
2338
|
+
abstract getHostProp<T>(host: HostElement, name: string): T | null;
|
|
2339
|
+
abstract $appendStyle$(content: string, styleId: string, host: HostElement, scoped: boolean): void;
|
|
2340
|
+
}
|
|
2341
|
+
|
|
2342
|
+
/**
|
|
2343
|
+
* A signal is a reactive value which can be read and written. When the signal is written, all tasks
|
|
2344
|
+
* which are tracking the signal will be re-run and all components that read the signal will be
|
|
2345
|
+
* re-rendered.
|
|
2346
|
+
*
|
|
2347
|
+
* Furthermore, when a signal value is passed as a prop to a component, the optimizer will
|
|
2348
|
+
* automatically forward the signal. This means that `return <div title={signal.value}>hi</div>`
|
|
2349
|
+
* will update the `title` attribute when the signal changes without having to re-render the
|
|
2350
|
+
* component.
|
|
2351
|
+
*
|
|
2352
|
+
* @public
|
|
2353
|
+
*/
|
|
2354
|
+
export declare interface Signal<T = any> extends ReadonlySignal<T> {
|
|
2355
|
+
value: T;
|
|
2356
|
+
}
|
|
2357
|
+
|
|
2358
|
+
declare class Signal_2<T = any> implements Signal<T> {
|
|
2359
|
+
$untrackedValue$: T;
|
|
2360
|
+
/** Store a list of effects which are dependent on this signal. */
|
|
2361
|
+
$effects$: null | EffectSubscriptions[];
|
|
2362
|
+
$container$: Container | null;
|
|
2363
|
+
constructor(container: Container | null, value: T);
|
|
2364
|
+
get untrackedValue(): T;
|
|
2365
|
+
set untrackedValue(value: T);
|
|
2366
|
+
get value(): T;
|
|
2367
|
+
set value(value: T);
|
|
2368
|
+
valueOf(): undefined;
|
|
2369
|
+
toString(): string;
|
|
2370
|
+
toJSON(): {
|
|
2371
|
+
value: T;
|
|
2372
|
+
};
|
|
2373
|
+
}
|
|
2374
|
+
|
|
2375
|
+
declare interface SimplifiedServerRequestEvent<T = unknown> {
|
|
2376
|
+
url: URL;
|
|
2377
|
+
locale: string | undefined;
|
|
2378
|
+
request: Request;
|
|
2379
|
+
}
|
|
2380
|
+
|
|
2381
|
+
/** @public */
|
|
2382
|
+
declare type Size = number | string;
|
|
2383
|
+
|
|
2384
|
+
/** @public */
|
|
2385
|
+
export declare const SkipRender: JSXNode;
|
|
2386
|
+
|
|
2387
|
+
/**
|
|
2388
|
+
* Allows to project the children of the current component. <Slot/> can only be used within the
|
|
2389
|
+
* context of a component defined with `component$`.
|
|
2390
|
+
*
|
|
2391
|
+
* @public
|
|
2392
|
+
*/
|
|
2393
|
+
export declare const Slot: FunctionComponent<{
|
|
2394
|
+
name?: string;
|
|
2395
|
+
children?: JSXChildren;
|
|
2396
|
+
}>;
|
|
2397
|
+
|
|
2398
|
+
/** @public */
|
|
2399
|
+
export declare interface SnapshotListener {
|
|
2400
|
+
key: string;
|
|
2401
|
+
qrl: QRL<any>;
|
|
2402
|
+
el: Element;
|
|
2403
|
+
}
|
|
2404
|
+
|
|
2405
|
+
/** @public */
|
|
2406
|
+
export declare type SnapshotMeta = Record<string, SnapshotMetaValue>;
|
|
2407
|
+
|
|
2408
|
+
/** @public */
|
|
2409
|
+
export declare interface SnapshotMetaValue {
|
|
2410
|
+
w?: string;
|
|
2411
|
+
s?: string;
|
|
2412
|
+
h?: string;
|
|
2413
|
+
c?: string;
|
|
2414
|
+
}
|
|
2415
|
+
|
|
2416
|
+
/** @public */
|
|
2417
|
+
export declare interface SnapshotResult {
|
|
2418
|
+
/** @deprecated Not longer used in v2 */
|
|
2419
|
+
state?: SnapshotState;
|
|
2420
|
+
funcs: string[];
|
|
2421
|
+
qrls: QRL[];
|
|
2422
|
+
/** @deprecated Not longer used in v2 */
|
|
2423
|
+
objs?: any[];
|
|
2424
|
+
resources: ResourceReturnInternal<any>[];
|
|
2425
|
+
mode: 'render' | 'listeners' | 'static';
|
|
2426
|
+
}
|
|
2427
|
+
|
|
2428
|
+
/** @public @deprecated not longer used in v2 */
|
|
2429
|
+
export declare interface SnapshotState {
|
|
2430
|
+
ctx: SnapshotMeta;
|
|
2431
|
+
refs: Record<string, string>;
|
|
2432
|
+
objs: any[];
|
|
2433
|
+
subs: any[];
|
|
2434
|
+
}
|
|
2435
|
+
|
|
2436
|
+
declare type SpecialAttrs = {
|
|
2437
|
+
a: {
|
|
2438
|
+
download?: any;
|
|
2439
|
+
target?: HTMLAttributeAnchorTarget | undefined;
|
|
2440
|
+
referrerPolicy?: HTMLAttributeReferrerPolicy | undefined;
|
|
2441
|
+
};
|
|
2442
|
+
area: {
|
|
2443
|
+
referrerPolicy?: HTMLAttributeReferrerPolicy | undefined;
|
|
2444
|
+
children?: undefined;
|
|
2445
|
+
};
|
|
2446
|
+
audio: MediaSpecialAttrs;
|
|
2447
|
+
base: {
|
|
2448
|
+
children?: undefined;
|
|
2449
|
+
};
|
|
2450
|
+
button: {
|
|
2451
|
+
form?: string | undefined;
|
|
2452
|
+
value?: string | ReadonlyArray<string> | number | undefined;
|
|
2453
|
+
popovertarget?: string | undefined;
|
|
2454
|
+
popovertargetaction?: PopoverTargetAction | undefined;
|
|
2455
|
+
};
|
|
2456
|
+
canvas: {
|
|
2457
|
+
height?: Size | undefined;
|
|
2458
|
+
width?: Size | undefined;
|
|
2459
|
+
};
|
|
2460
|
+
col: {
|
|
2461
|
+
width?: Size | undefined;
|
|
2462
|
+
children?: undefined;
|
|
2463
|
+
};
|
|
2464
|
+
data: {
|
|
2465
|
+
value?: string | ReadonlyArray<string> | number | undefined;
|
|
2466
|
+
};
|
|
2467
|
+
embed: {
|
|
2468
|
+
height?: Size | undefined;
|
|
2469
|
+
width?: Size | undefined;
|
|
2470
|
+
children?: undefined;
|
|
2471
|
+
};
|
|
2472
|
+
fieldset: {
|
|
2473
|
+
form?: string | undefined;
|
|
2474
|
+
};
|
|
2475
|
+
hr: {
|
|
2476
|
+
children?: undefined;
|
|
2477
|
+
};
|
|
2478
|
+
iframe: {
|
|
2479
|
+
allowTransparency?: boolean | undefined;
|
|
2480
|
+
/** @deprecated Deprecated */
|
|
2481
|
+
frameBorder?: number | string | undefined;
|
|
2482
|
+
height?: Size | undefined;
|
|
2483
|
+
loading?: 'eager' | 'lazy' | undefined;
|
|
2484
|
+
sandbox?: string | undefined;
|
|
2485
|
+
seamless?: boolean | undefined;
|
|
2486
|
+
width?: Size | undefined;
|
|
2487
|
+
children?: undefined;
|
|
2488
|
+
};
|
|
2489
|
+
img: {
|
|
2490
|
+
crossOrigin?: HTMLCrossOriginAttribute;
|
|
2491
|
+
/** Intrinsic height of the image in pixels. */
|
|
2492
|
+
height?: Numberish | undefined;
|
|
2493
|
+
referrerPolicy?: HTMLAttributeReferrerPolicy | undefined;
|
|
2494
|
+
/** Intrinsic width of the image in pixels. */
|
|
2495
|
+
width?: Numberish | undefined;
|
|
2496
|
+
children?: undefined;
|
|
2497
|
+
};
|
|
2498
|
+
input: {
|
|
2499
|
+
/**
|
|
2500
|
+
* For type: HTMLInputTypeAttribute, excluding 'button' | 'color' | 'file' | 'hidden' | 'image'|
|
|
2501
|
+
* 'range' | 'reset' | 'submit' | 'checkbox' | 'radio'
|
|
2502
|
+
*/
|
|
2503
|
+
autoComplete?: HTMLInputAutocompleteAttribute | Omit<HTMLInputAutocompleteAttribute, string> | undefined;
|
|
2504
|
+
/** For type: 'checkbox' | 'radio' */
|
|
2505
|
+
'bind:checked'?: Signal<boolean | undefined>;
|
|
2506
|
+
/**
|
|
2507
|
+
* For type: HTMLInputTypeAttribute, excluding 'button' | 'reset' | 'submit' | 'checkbox' |
|
|
2508
|
+
* 'radio'
|
|
2509
|
+
*/
|
|
2510
|
+
'bind:value'?: Signal<string | undefined>;
|
|
2511
|
+
enterKeyHint?: 'enter' | 'done' | 'go' | 'next' | 'previous' | 'search' | 'send' | undefined;
|
|
2512
|
+
height?: Size | undefined;
|
|
2513
|
+
max?: number | string | undefined;
|
|
2514
|
+
maxLength?: number | undefined;
|
|
2515
|
+
min?: number | string | undefined;
|
|
2516
|
+
minLength?: number | undefined;
|
|
2517
|
+
step?: number | string | undefined;
|
|
2518
|
+
type?: HTMLInputTypeAttribute | undefined;
|
|
2519
|
+
value?: string | ReadonlyArray<string> | number | undefined | null | FormDataEntryValue;
|
|
2520
|
+
width?: Size | undefined;
|
|
2521
|
+
children?: undefined;
|
|
2522
|
+
/** For type: 'button' */
|
|
2523
|
+
popovertarget?: string | undefined;
|
|
2524
|
+
popovertargetaction?: PopoverTargetAction | undefined;
|
|
2525
|
+
};
|
|
2526
|
+
label: {
|
|
2527
|
+
form?: string | undefined;
|
|
2528
|
+
for?: string | undefined;
|
|
2529
|
+
/** @deprecated Use `for` */
|
|
2530
|
+
htmlFor?: string | undefined;
|
|
2531
|
+
};
|
|
2532
|
+
li: {
|
|
2533
|
+
value?: string | ReadonlyArray<string> | number | undefined;
|
|
2534
|
+
};
|
|
2535
|
+
link: {
|
|
2536
|
+
crossOrigin?: HTMLCrossOriginAttribute;
|
|
2537
|
+
referrerPolicy?: HTMLAttributeReferrerPolicy | undefined;
|
|
2538
|
+
sizes?: string | undefined;
|
|
2539
|
+
type?: string | undefined;
|
|
2540
|
+
/** @deprecated Use `charset` instead */
|
|
2541
|
+
charSet?: string | undefined;
|
|
2542
|
+
charset?: string | undefined;
|
|
2543
|
+
children?: undefined;
|
|
2544
|
+
};
|
|
2545
|
+
meta: {
|
|
2546
|
+
/** @deprecated Use `charset` instead */
|
|
2547
|
+
charSet?: 'utf-8' | undefined;
|
|
2548
|
+
/** Qwik only supports utf-8 */
|
|
2549
|
+
charset?: 'utf-8' | undefined;
|
|
2550
|
+
children?: undefined;
|
|
2551
|
+
};
|
|
2552
|
+
meter: {
|
|
2553
|
+
form?: string | undefined;
|
|
2554
|
+
value?: string | ReadonlyArray<string> | number | undefined;
|
|
2555
|
+
};
|
|
2556
|
+
object: {
|
|
2557
|
+
classID?: string | undefined;
|
|
2558
|
+
form?: string | undefined;
|
|
2559
|
+
height?: Size | undefined;
|
|
2560
|
+
width?: Size | undefined;
|
|
2561
|
+
wmode?: string | undefined;
|
|
2562
|
+
};
|
|
2563
|
+
ol: {
|
|
2564
|
+
type?: '1' | 'a' | 'A' | 'i' | 'I' | undefined;
|
|
2565
|
+
};
|
|
2566
|
+
optgroup: {
|
|
2567
|
+
disabled?: boolean | undefined;
|
|
2568
|
+
label?: string | undefined;
|
|
2569
|
+
};
|
|
2570
|
+
option: {
|
|
2571
|
+
value?: string | ReadonlyArray<string> | number | undefined;
|
|
2572
|
+
children?: string;
|
|
2573
|
+
};
|
|
2574
|
+
output: {
|
|
2575
|
+
form?: string | undefined;
|
|
2576
|
+
for?: string | undefined;
|
|
2577
|
+
/** @deprecated Use `for` instead */
|
|
2578
|
+
htmlFor?: string | undefined;
|
|
2579
|
+
};
|
|
2580
|
+
param: {
|
|
2581
|
+
value?: string | ReadonlyArray<string> | number | undefined;
|
|
2582
|
+
children?: undefined;
|
|
2583
|
+
};
|
|
2584
|
+
progress: {
|
|
2585
|
+
max?: number | string | undefined;
|
|
2586
|
+
value?: string | ReadonlyArray<string> | number | undefined;
|
|
2587
|
+
};
|
|
2588
|
+
script: {
|
|
2589
|
+
crossOrigin?: HTMLCrossOriginAttribute;
|
|
2590
|
+
referrerPolicy?: HTMLAttributeReferrerPolicy | undefined;
|
|
2591
|
+
};
|
|
2592
|
+
select: {
|
|
2593
|
+
form?: string | undefined;
|
|
2594
|
+
value?: string | ReadonlyArray<string> | number | undefined;
|
|
2595
|
+
'bind:value'?: Signal<string | undefined>;
|
|
2596
|
+
};
|
|
2597
|
+
source: {
|
|
2598
|
+
/** Allowed if the parent is a `picture` element */
|
|
2599
|
+
height?: Size | undefined;
|
|
2600
|
+
/** Allowed if the parent is a `picture` element */
|
|
2601
|
+
width?: Size | undefined;
|
|
2602
|
+
children?: undefined;
|
|
2603
|
+
};
|
|
2604
|
+
style: {
|
|
2605
|
+
scoped?: boolean | undefined;
|
|
2606
|
+
children?: string;
|
|
2607
|
+
};
|
|
2608
|
+
table: {
|
|
2609
|
+
cellPadding?: number | string | undefined;
|
|
2610
|
+
cellSpacing?: number | string | undefined;
|
|
2611
|
+
width?: Size | undefined;
|
|
2612
|
+
};
|
|
2613
|
+
td: TableCellSpecialAttrs;
|
|
2614
|
+
th: TableCellSpecialAttrs;
|
|
2615
|
+
title: {
|
|
2616
|
+
children?: string;
|
|
2617
|
+
};
|
|
2618
|
+
textarea: {
|
|
2619
|
+
enterKeyHint?: 'enter' | 'done' | 'go' | 'next' | 'previous' | 'search' | 'send' | undefined;
|
|
2620
|
+
form?: string | undefined;
|
|
2621
|
+
value?: string | ReadonlyArray<string> | number | undefined;
|
|
2622
|
+
'bind:value'?: Signal<string | undefined>;
|
|
2623
|
+
children?: string;
|
|
2624
|
+
};
|
|
2625
|
+
track: {
|
|
2626
|
+
children?: undefined;
|
|
2627
|
+
};
|
|
2628
|
+
video: MediaSpecialAttrs & {
|
|
2629
|
+
height?: Numberish | undefined;
|
|
2630
|
+
width?: Numberish | undefined;
|
|
2631
|
+
disablePictureInPicture?: boolean | undefined;
|
|
2632
|
+
disableRemotePlayback?: boolean | undefined;
|
|
2633
|
+
};
|
|
2634
|
+
} & {
|
|
2635
|
+
[key: string]: {};
|
|
2636
|
+
};
|
|
2637
|
+
|
|
2638
|
+
declare type SsrAttrKey = string;
|
|
2639
|
+
|
|
2640
|
+
declare type SsrAttrs = Array<SsrAttrKey | SsrAttrValue>;
|
|
2641
|
+
|
|
2642
|
+
declare type SsrAttrValue = string | Signal<any> | boolean | object | null;
|
|
2643
|
+
|
|
2644
|
+
/** @public */
|
|
2645
|
+
export declare const SSRComment: FunctionComponent<{
|
|
2646
|
+
data: string;
|
|
2647
|
+
}>;
|
|
2648
|
+
|
|
2649
|
+
declare interface SSRContainer extends Container {
|
|
2650
|
+
readonly tag: string;
|
|
2651
|
+
readonly writer: StreamWriter;
|
|
2652
|
+
readonly prefetchResources: PrefetchResource[];
|
|
2653
|
+
readonly serializationCtx: SerializationContext;
|
|
2654
|
+
readonly symbolToChunkResolver: SymbolToChunkResolver;
|
|
2655
|
+
readonly buildBase: string;
|
|
2656
|
+
additionalHeadNodes: Array<JSXNodeInternal>;
|
|
2657
|
+
additionalBodyNodes: Array<JSXNodeInternal>;
|
|
2658
|
+
unclaimedProjectionComponentFrameQueue: ISsrComponentFrame[];
|
|
2659
|
+
openContainer(): void;
|
|
2660
|
+
closeContainer(): ValueOrPromise<void>;
|
|
2661
|
+
openElement(elementName: string, varAttrs: SsrAttrs | null, constAttrs?: SsrAttrs | null, currentFile?: string | null): string | undefined;
|
|
2662
|
+
closeElement(): ValueOrPromise<void>;
|
|
2663
|
+
openFragment(attrs: SsrAttrs): void;
|
|
2664
|
+
closeFragment(): void;
|
|
2665
|
+
addCurrentElementFrameAsComponentChild(): void;
|
|
2666
|
+
openProjection(attrs: SsrAttrs): void;
|
|
2667
|
+
closeProjection(): void;
|
|
2668
|
+
openComponent(attrs: SsrAttrs): void;
|
|
2669
|
+
getComponentFrame(projectionDepth: number): ISsrComponentFrame | null;
|
|
2670
|
+
getParentComponentFrame(): ISsrComponentFrame | null;
|
|
2671
|
+
closeComponent(): void;
|
|
2672
|
+
textNode(text: string): void;
|
|
2673
|
+
htmlNode(rawHtml: string): void;
|
|
2674
|
+
commentNode(text: string): void;
|
|
2675
|
+
addRoot(obj: any): number | undefined;
|
|
2676
|
+
getLastNode(): ISsrNode;
|
|
2677
|
+
addUnclaimedProjection(frame: ISsrComponentFrame, name: string, children: JSXChildren): void;
|
|
2678
|
+
isStatic(): boolean;
|
|
2679
|
+
render(jsx: JSXOutput): Promise<void>;
|
|
2680
|
+
emitQwikLoaderAtTopIfNeeded(): void;
|
|
2681
|
+
}
|
|
2682
|
+
|
|
2683
|
+
/** @public */
|
|
2684
|
+
export declare type SSRHintProps = {
|
|
2685
|
+
dynamic?: boolean;
|
|
2686
|
+
};
|
|
2687
|
+
|
|
2688
|
+
/** A selection of attributes of the real thing */
|
|
2689
|
+
declare type SsrNode = {
|
|
2690
|
+
nodeType: number;
|
|
2691
|
+
id: string;
|
|
2692
|
+
childrenVNodeData: VNodeData[] | null;
|
|
2693
|
+
vnodeData: VNodeData;
|
|
2694
|
+
};
|
|
2695
|
+
|
|
2696
|
+
/** @public */
|
|
2697
|
+
export declare const SSRRaw: FunctionComponent<{
|
|
2698
|
+
data: string;
|
|
2699
|
+
}>;
|
|
2700
|
+
|
|
2701
|
+
/** @public */
|
|
2702
|
+
export declare const SSRStream: FunctionComponent<SSRStreamProps>;
|
|
2703
|
+
|
|
2704
|
+
/** @public */
|
|
2705
|
+
export declare const SSRStreamBlock: FunctionComponent<{
|
|
2706
|
+
children?: JSXOutput;
|
|
2707
|
+
}>;
|
|
2708
|
+
|
|
2709
|
+
/** @public */
|
|
2710
|
+
export declare type SSRStreamChildren = AsyncGenerator<JSXChildren, void, any> | ((stream: StreamWriter) => Promise<void>) | (() => AsyncGenerator<JSXChildren, void, any>);
|
|
2711
|
+
|
|
2712
|
+
/** @public */
|
|
2713
|
+
export declare type SSRStreamProps = {
|
|
2714
|
+
children: SSRStreamChildren;
|
|
2715
|
+
};
|
|
2716
|
+
|
|
2717
|
+
declare type StopPropagation = {
|
|
2718
|
+
[K in keyof HTMLElementEventMap as `stoppropagation:${K}`]?: boolean;
|
|
2719
|
+
};
|
|
2720
|
+
|
|
2721
|
+
/** @internal */
|
|
2722
|
+
export declare interface StreamWriter {
|
|
2723
|
+
write(chunk: string): void;
|
|
2724
|
+
}
|
|
2725
|
+
|
|
2726
|
+
/** @file Shared types */
|
|
2727
|
+
/** @internal */
|
|
2728
|
+
export declare type _Stringifiable = string | boolean | number | null;
|
|
2729
|
+
|
|
2730
|
+
declare abstract class Subscriber {
|
|
2731
|
+
$effectDependencies$: Subscriber[] | null;
|
|
2732
|
+
}
|
|
2733
|
+
|
|
2734
|
+
/**
|
|
2735
|
+
* The TS types don't include the SVG attributes so we have to define them ourselves
|
|
2736
|
+
*
|
|
2737
|
+
* NOTE: These props are probably not complete
|
|
2738
|
+
*
|
|
2739
|
+
* @public
|
|
2740
|
+
*/
|
|
2741
|
+
declare interface SVGAttributes<T extends Element = Element> extends AriaAttributes {
|
|
2742
|
+
color?: string | undefined;
|
|
2743
|
+
height?: Size | undefined;
|
|
2744
|
+
id?: string | undefined;
|
|
2745
|
+
lang?: string | undefined;
|
|
2746
|
+
max?: number | string | undefined;
|
|
2747
|
+
media?: string | undefined;
|
|
2748
|
+
method?: string | undefined;
|
|
2749
|
+
min?: number | string | undefined;
|
|
2750
|
+
name?: string | undefined;
|
|
2751
|
+
style?: CSSProperties | string | undefined;
|
|
2752
|
+
target?: string | undefined;
|
|
2753
|
+
type?: string | undefined;
|
|
2754
|
+
width?: Size | undefined;
|
|
2755
|
+
role?: string | undefined;
|
|
2756
|
+
tabindex?: number | undefined;
|
|
2757
|
+
crossOrigin?: HTMLCrossOriginAttribute;
|
|
2758
|
+
'accent-height'?: number | string | undefined;
|
|
2759
|
+
accumulate?: 'none' | 'sum' | undefined;
|
|
2760
|
+
additive?: 'replace' | 'sum' | undefined;
|
|
2761
|
+
'alignment-baseline'?: 'auto' | 'baseline' | 'before-edge' | 'text-before-edge' | 'middle' | 'central' | 'after-edge' | 'text-after-edge' | 'ideographic' | 'alphabetic' | 'hanging' | 'mathematical' | 'inherit' | undefined;
|
|
2762
|
+
allowReorder?: 'no' | 'yes' | undefined;
|
|
2763
|
+
alphabetic?: number | string | undefined;
|
|
2764
|
+
amplitude?: number | string | undefined;
|
|
2765
|
+
'arabic-form'?: 'initial' | 'medial' | 'terminal' | 'isolated' | undefined;
|
|
2766
|
+
ascent?: number | string | undefined;
|
|
2767
|
+
attributeName?: string | undefined;
|
|
2768
|
+
attributeType?: string | undefined;
|
|
2769
|
+
autoReverse?: Booleanish | undefined;
|
|
2770
|
+
azimuth?: number | string | undefined;
|
|
2771
|
+
baseFrequency?: number | string | undefined;
|
|
2772
|
+
'baseline-shift'?: number | string | undefined;
|
|
2773
|
+
baseProfile?: number | string | undefined;
|
|
2774
|
+
bbox?: number | string | undefined;
|
|
2775
|
+
begin?: number | string | undefined;
|
|
2776
|
+
bias?: number | string | undefined;
|
|
2777
|
+
by?: number | string | undefined;
|
|
2778
|
+
calcMode?: number | string | undefined;
|
|
2779
|
+
'cap-height'?: number | string | undefined;
|
|
2780
|
+
clip?: number | string | undefined;
|
|
2781
|
+
'clip-path'?: string | undefined;
|
|
2782
|
+
clipPathUnits?: number | string | undefined;
|
|
2783
|
+
'clip-rule'?: number | string | undefined;
|
|
2784
|
+
'color-interpolation'?: number | string | undefined;
|
|
2785
|
+
'color-interpolation-filters'?: 'auto' | 's-rGB' | 'linear-rGB' | 'inherit' | undefined;
|
|
2786
|
+
'color-profile'?: number | string | undefined;
|
|
2787
|
+
'color-rendering'?: number | string | undefined;
|
|
2788
|
+
contentScriptType?: number | string | undefined;
|
|
2789
|
+
contentStyleType?: number | string | undefined;
|
|
2790
|
+
cursor?: number | string;
|
|
2791
|
+
cx?: number | string | undefined;
|
|
2792
|
+
cy?: number | string | undefined;
|
|
2793
|
+
d?: string | undefined;
|
|
2794
|
+
decelerate?: number | string | undefined;
|
|
2795
|
+
descent?: number | string | undefined;
|
|
2796
|
+
diffuseConstant?: number | string | undefined;
|
|
2797
|
+
direction?: number | string | undefined;
|
|
2798
|
+
display?: number | string | undefined;
|
|
2799
|
+
divisor?: number | string | undefined;
|
|
2800
|
+
'dominant-baseline'?: number | string | undefined;
|
|
2801
|
+
dur?: number | string | undefined;
|
|
2802
|
+
dx?: number | string | undefined;
|
|
2803
|
+
dy?: number | string | undefined;
|
|
2804
|
+
'edge-mode'?: number | string | undefined;
|
|
2805
|
+
elevation?: number | string | undefined;
|
|
2806
|
+
'enable-background'?: number | string | undefined;
|
|
2807
|
+
end?: number | string | undefined;
|
|
2808
|
+
exponent?: number | string | undefined;
|
|
2809
|
+
externalResourcesRequired?: number | string | undefined;
|
|
2810
|
+
fill?: string | undefined;
|
|
2811
|
+
'fill-opacity'?: number | string | undefined;
|
|
2812
|
+
'fill-rule'?: 'nonzero' | 'evenodd' | 'inherit' | undefined;
|
|
2813
|
+
filter?: string | undefined;
|
|
2814
|
+
filterRes?: number | string | undefined;
|
|
2815
|
+
filterUnits?: number | string | undefined;
|
|
2816
|
+
'flood-color'?: number | string | undefined;
|
|
2817
|
+
'flood-opacity'?: number | string | undefined;
|
|
2818
|
+
focusable?: number | string | undefined;
|
|
2819
|
+
'font-family'?: string | undefined;
|
|
2820
|
+
'font-size'?: number | string | undefined;
|
|
2821
|
+
'font-size-adjust'?: number | string | undefined;
|
|
2822
|
+
'font-stretch'?: number | string | undefined;
|
|
2823
|
+
'font-style'?: number | string | undefined;
|
|
2824
|
+
'font-variant'?: number | string | undefined;
|
|
2825
|
+
'font-weight'?: number | string | undefined;
|
|
2826
|
+
format?: number | string | undefined;
|
|
2827
|
+
fr?: number | string | undefined;
|
|
2828
|
+
from?: number | string | undefined;
|
|
2829
|
+
fx?: number | string | undefined;
|
|
2830
|
+
fy?: number | string | undefined;
|
|
2831
|
+
g1?: number | string | undefined;
|
|
2832
|
+
g2?: number | string | undefined;
|
|
2833
|
+
'glyph-name'?: number | string | undefined;
|
|
2834
|
+
'glyph-orientation-horizontal'?: number | string | undefined;
|
|
2835
|
+
'glyph-orientation-vertical'?: number | string | undefined;
|
|
2836
|
+
glyphRef?: number | string | undefined;
|
|
2837
|
+
gradientTransform?: string | undefined;
|
|
2838
|
+
gradientUnits?: string | undefined;
|
|
2839
|
+
hanging?: number | string | undefined;
|
|
2840
|
+
'horiz-adv-x'?: number | string | undefined;
|
|
2841
|
+
'horiz-origin-x'?: number | string | undefined;
|
|
2842
|
+
href?: string | undefined;
|
|
2843
|
+
ideographic?: number | string | undefined;
|
|
2844
|
+
'image-rendering'?: number | string | undefined;
|
|
2845
|
+
in2?: number | string | undefined;
|
|
2846
|
+
in?: string | undefined;
|
|
2847
|
+
intercept?: number | string | undefined;
|
|
2848
|
+
k1?: number | string | undefined;
|
|
2849
|
+
k2?: number | string | undefined;
|
|
2850
|
+
k3?: number | string | undefined;
|
|
2851
|
+
k4?: number | string | undefined;
|
|
2852
|
+
k?: number | string | undefined;
|
|
2853
|
+
kernelMatrix?: number | string | undefined;
|
|
2854
|
+
kernelUnitLength?: number | string | undefined;
|
|
2855
|
+
kerning?: number | string | undefined;
|
|
2856
|
+
keyPoints?: number | string | undefined;
|
|
2857
|
+
keySplines?: number | string | undefined;
|
|
2858
|
+
keyTimes?: number | string | undefined;
|
|
2859
|
+
lengthAdjust?: number | string | undefined;
|
|
2860
|
+
'letter-spacing'?: number | string | undefined;
|
|
2861
|
+
'lighting-color'?: number | string | undefined;
|
|
2862
|
+
limitingConeAngle?: number | string | undefined;
|
|
2863
|
+
local?: number | string | undefined;
|
|
2864
|
+
'marker-end'?: string | undefined;
|
|
2865
|
+
markerHeight?: number | string | undefined;
|
|
2866
|
+
'marker-mid'?: string | undefined;
|
|
2867
|
+
'marker-start'?: string | undefined;
|
|
2868
|
+
markerUnits?: number | string | undefined;
|
|
2869
|
+
markerWidth?: number | string | undefined;
|
|
2870
|
+
mask?: string | undefined;
|
|
2871
|
+
maskContentUnits?: number | string | undefined;
|
|
2872
|
+
maskUnits?: number | string | undefined;
|
|
2873
|
+
mathematical?: number | string | undefined;
|
|
2874
|
+
mode?: number | string | undefined;
|
|
2875
|
+
numOctaves?: number | string | undefined;
|
|
2876
|
+
offset?: number | string | undefined;
|
|
2877
|
+
opacity?: number | string | undefined;
|
|
2878
|
+
operator?: number | string | undefined;
|
|
2879
|
+
order?: number | string | undefined;
|
|
2880
|
+
orient?: number | string | undefined;
|
|
2881
|
+
orientation?: number | string | undefined;
|
|
2882
|
+
origin?: number | string | undefined;
|
|
2883
|
+
overflow?: number | string | undefined;
|
|
2884
|
+
'overline-position'?: number | string | undefined;
|
|
2885
|
+
'overline-thickness'?: number | string | undefined;
|
|
2886
|
+
'paint-order'?: number | string | undefined;
|
|
2887
|
+
panose1?: number | string | undefined;
|
|
2888
|
+
path?: string | undefined;
|
|
2889
|
+
pathLength?: number | string | undefined;
|
|
2890
|
+
patternContentUnits?: string | undefined;
|
|
2891
|
+
patternTransform?: number | string | undefined;
|
|
2892
|
+
patternUnits?: string | undefined;
|
|
2893
|
+
'pointer-events'?: number | string | undefined;
|
|
2894
|
+
points?: string | undefined;
|
|
2895
|
+
pointsAtX?: number | string | undefined;
|
|
2896
|
+
pointsAtY?: number | string | undefined;
|
|
2897
|
+
pointsAtZ?: number | string | undefined;
|
|
2898
|
+
preserveAlpha?: number | string | undefined;
|
|
2899
|
+
preserveAspectRatio?: string | undefined;
|
|
2900
|
+
primitiveUnits?: number | string | undefined;
|
|
2901
|
+
r?: number | string | undefined;
|
|
2902
|
+
radius?: number | string | undefined;
|
|
2903
|
+
refX?: number | string | undefined;
|
|
2904
|
+
refY?: number | string | undefined;
|
|
2905
|
+
'rendering-intent'?: number | string | undefined;
|
|
2906
|
+
repeatCount?: number | string | undefined;
|
|
2907
|
+
repeatDur?: number | string | undefined;
|
|
2908
|
+
requiredextensions?: number | string | undefined;
|
|
2909
|
+
requiredFeatures?: number | string | undefined;
|
|
2910
|
+
restart?: number | string | undefined;
|
|
2911
|
+
result?: string | undefined;
|
|
2912
|
+
rotate?: number | string | undefined;
|
|
2913
|
+
rx?: number | string | undefined;
|
|
2914
|
+
ry?: number | string | undefined;
|
|
2915
|
+
scale?: number | string | undefined;
|
|
2916
|
+
seed?: number | string | undefined;
|
|
2917
|
+
'shape-rendering'?: number | string | undefined;
|
|
2918
|
+
slope?: number | string | undefined;
|
|
2919
|
+
spacing?: number | string | undefined;
|
|
2920
|
+
specularConstant?: number | string | undefined;
|
|
2921
|
+
specularExponent?: number | string | undefined;
|
|
2922
|
+
speed?: number | string | undefined;
|
|
2923
|
+
spreadMethod?: string | undefined;
|
|
2924
|
+
startOffset?: number | string | undefined;
|
|
2925
|
+
stdDeviation?: number | string | undefined;
|
|
2926
|
+
stemh?: number | string | undefined;
|
|
2927
|
+
stemv?: number | string | undefined;
|
|
2928
|
+
stitchTiles?: number | string | undefined;
|
|
2929
|
+
'stop-color'?: string | undefined;
|
|
2930
|
+
'stop-opacity'?: number | string | undefined;
|
|
2931
|
+
'strikethrough-position'?: number | string | undefined;
|
|
2932
|
+
'strikethrough-thickness'?: number | string | undefined;
|
|
2933
|
+
string?: number | string | undefined;
|
|
2934
|
+
stroke?: string | undefined;
|
|
2935
|
+
'stroke-dasharray'?: string | number | undefined;
|
|
2936
|
+
'stroke-dashoffset'?: string | number | undefined;
|
|
2937
|
+
'stroke-linecap'?: 'butt' | 'round' | 'square' | 'inherit' | undefined;
|
|
2938
|
+
'stroke-linejoin'?: 'miter' | 'round' | 'bevel' | 'inherit' | undefined;
|
|
2939
|
+
'stroke-miterlimit'?: string | undefined;
|
|
2940
|
+
'stroke-opacity'?: number | string | undefined;
|
|
2941
|
+
'stroke-width'?: number | string | undefined;
|
|
2942
|
+
surfaceScale?: number | string | undefined;
|
|
2943
|
+
systemLanguage?: number | string | undefined;
|
|
2944
|
+
tableValues?: number | string | undefined;
|
|
2945
|
+
targetX?: number | string | undefined;
|
|
2946
|
+
targetY?: number | string | undefined;
|
|
2947
|
+
'text-anchor'?: string | undefined;
|
|
2948
|
+
'text-decoration'?: number | string | undefined;
|
|
2949
|
+
textLength?: number | string | undefined;
|
|
2950
|
+
'text-rendering'?: number | string | undefined;
|
|
2951
|
+
to?: number | string | undefined;
|
|
2952
|
+
transform?: string | undefined;
|
|
2953
|
+
u1?: number | string | undefined;
|
|
2954
|
+
u2?: number | string | undefined;
|
|
2955
|
+
'underline-position'?: number | string | undefined;
|
|
2956
|
+
'underline-thickness'?: number | string | undefined;
|
|
2957
|
+
unicode?: number | string | undefined;
|
|
2958
|
+
'unicode-bidi'?: number | string | undefined;
|
|
2959
|
+
'unicode-range'?: number | string | undefined;
|
|
2960
|
+
'units-per-em'?: number | string | undefined;
|
|
2961
|
+
'v-alphabetic'?: number | string | undefined;
|
|
2962
|
+
values?: string | undefined;
|
|
2963
|
+
'vector-effect'?: number | string | undefined;
|
|
2964
|
+
version?: string | undefined;
|
|
2965
|
+
'vert-adv-y'?: number | string | undefined;
|
|
2966
|
+
'vert-origin-x'?: number | string | undefined;
|
|
2967
|
+
'vert-origin-y'?: number | string | undefined;
|
|
2968
|
+
'v-hanging'?: number | string | undefined;
|
|
2969
|
+
'v-ideographic'?: number | string | undefined;
|
|
2970
|
+
viewBox?: string | undefined;
|
|
2971
|
+
viewTarget?: number | string | undefined;
|
|
2972
|
+
visibility?: number | string | undefined;
|
|
2973
|
+
'v-mathematical'?: number | string | undefined;
|
|
2974
|
+
widths?: number | string | undefined;
|
|
2975
|
+
'word-spacing'?: number | string | undefined;
|
|
2976
|
+
'writing-mode'?: number | string | undefined;
|
|
2977
|
+
x1?: number | string | undefined;
|
|
2978
|
+
x2?: number | string | undefined;
|
|
2979
|
+
x?: number | string | undefined;
|
|
2980
|
+
'x-channel-selector'?: string | undefined;
|
|
2981
|
+
'x-height'?: number | string | undefined;
|
|
2982
|
+
'xlink:actuate'?: string | undefined;
|
|
2983
|
+
'xlink:arcrole'?: string | undefined;
|
|
2984
|
+
'xlink:href'?: string | undefined;
|
|
2985
|
+
'xlink:role'?: string | undefined;
|
|
2986
|
+
'xlink:show'?: string | undefined;
|
|
2987
|
+
'xlink:title'?: string | undefined;
|
|
2988
|
+
'xlink:type'?: string | undefined;
|
|
2989
|
+
'xml:base'?: string | undefined;
|
|
2990
|
+
'xml:lang'?: string | undefined;
|
|
2991
|
+
'xml:space'?: string | undefined;
|
|
2992
|
+
xmlns?: string | undefined;
|
|
2993
|
+
'xmlns:xlink'?: string | undefined;
|
|
2994
|
+
y1?: number | string | undefined;
|
|
2995
|
+
y2?: number | string | undefined;
|
|
2996
|
+
y?: number | string | undefined;
|
|
2997
|
+
yChannelSelector?: string | undefined;
|
|
2998
|
+
z?: number | string | undefined;
|
|
2999
|
+
zoomAndPan?: string | undefined;
|
|
3000
|
+
}
|
|
3001
|
+
|
|
3002
|
+
/** @public */
|
|
3003
|
+
declare interface SVGProps<T extends Element> extends SVGAttributes, QwikAttributes<T> {
|
|
3004
|
+
}
|
|
3005
|
+
|
|
3006
|
+
declare type SymbolToChunkResolver = (symbol: string) => string;
|
|
3007
|
+
|
|
3008
|
+
/**
|
|
3009
|
+
* Extract function into a synchronously loadable QRL.
|
|
3010
|
+
*
|
|
3011
|
+
* NOTE: Synchronous QRLs functions can't close over any variables, including exports.
|
|
3012
|
+
*
|
|
3013
|
+
* @param fn - Function to extract.
|
|
3014
|
+
* @returns
|
|
3015
|
+
* @public
|
|
3016
|
+
*/
|
|
3017
|
+
export declare const sync$: <T extends Function>(fn: T) => SyncQRL<T>;
|
|
3018
|
+
|
|
3019
|
+
/** @public */
|
|
3020
|
+
export declare interface SyncQRL<TYPE extends Function = any> extends QRL<TYPE> {
|
|
3021
|
+
__brand__SyncQRL__: TYPE;
|
|
3022
|
+
/**
|
|
3023
|
+
* Resolve the QRL of closure and invoke it.
|
|
3024
|
+
*
|
|
3025
|
+
* @param args - Closure arguments.
|
|
3026
|
+
* @returns A return value of the closure.
|
|
3027
|
+
*/
|
|
3028
|
+
(...args: TYPE extends (...args: infer ARGS) => any ? ARGS : never): TYPE extends (...args: any[]) => infer RETURN ? RETURN : never;
|
|
3029
|
+
resolved: TYPE;
|
|
3030
|
+
dev: QRLDev | null;
|
|
3031
|
+
}
|
|
3032
|
+
|
|
3033
|
+
declare type TableCellSpecialAttrs = {
|
|
3034
|
+
align?: 'left' | 'center' | 'right' | 'justify' | 'char' | undefined;
|
|
3035
|
+
height?: Size | undefined;
|
|
3036
|
+
width?: Size | undefined;
|
|
3037
|
+
valign?: 'top' | 'middle' | 'bottom' | 'baseline' | undefined;
|
|
3038
|
+
};
|
|
3039
|
+
|
|
3040
|
+
declare type TargetType = Record<string | symbol, any>;
|
|
3041
|
+
|
|
3042
|
+
declare class Task<T = unknown, B = T> extends Subscriber implements DescriptorBase<unknown, Signal<B> | ResourceReturnInternal<B>> {
|
|
3043
|
+
$flags$: number;
|
|
3044
|
+
$index$: number;
|
|
3045
|
+
$el$: HostElement;
|
|
3046
|
+
$qrl$: QRLInternal<T>;
|
|
3047
|
+
$state$: Signal<B> | ResourceReturnInternal<B> | undefined;
|
|
3048
|
+
$destroy$: NoSerialize<() => void> | null;
|
|
3049
|
+
constructor($flags$: number, $index$: number, $el$: HostElement, $qrl$: QRLInternal<T>, $state$: Signal<B> | ResourceReturnInternal<B> | undefined, $destroy$: NoSerialize<() => void> | null);
|
|
3050
|
+
}
|
|
3051
|
+
|
|
3052
|
+
/** @public */
|
|
3053
|
+
export declare interface TaskCtx {
|
|
3054
|
+
track: Tracker;
|
|
3055
|
+
cleanup(callback: () => void): void;
|
|
3056
|
+
}
|
|
3057
|
+
|
|
3058
|
+
declare const TaskEvent = "qTask";
|
|
3059
|
+
|
|
3060
|
+
/** @public */
|
|
3061
|
+
export declare type TaskFn = (ctx: TaskCtx) => ValueOrPromise<void | (() => void)>;
|
|
3062
|
+
|
|
3063
|
+
/** @internal */
|
|
3064
|
+
export declare type _TextVNode = [
|
|
3065
|
+
_VNodeFlags.Text | _VNodeFlags.Inflated,
|
|
3066
|
+
// 0 - Flags
|
|
3067
|
+
_VNode | null,
|
|
3068
|
+
///////////////// 1 - Parent
|
|
3069
|
+
_VNode | null,
|
|
3070
|
+
///////////////// 2 - Previous sibling
|
|
3071
|
+
_VNode | null,
|
|
3072
|
+
///////////////// 3 - Next sibling
|
|
3073
|
+
Text | null | undefined,
|
|
3074
|
+
string
|
|
3075
|
+
] & {
|
|
3076
|
+
__brand__: 'TextVNode';
|
|
3077
|
+
};
|
|
3078
|
+
|
|
3079
|
+
/**
|
|
3080
|
+
* Used to signal to Qwik which state should be watched for changes.
|
|
3081
|
+
*
|
|
3082
|
+
* The `Tracker` is passed into the `taskFn` of `useTask`. It is intended to be used to wrap state
|
|
3083
|
+
* objects in a read proxy which signals to Qwik which properties should be watched for changes. A
|
|
3084
|
+
* change to any of the properties causes the `taskFn` to rerun.
|
|
3085
|
+
*
|
|
3086
|
+
* ### Example
|
|
3087
|
+
*
|
|
3088
|
+
* The `obs` passed into the `taskFn` is used to mark `state.count` as a property of interest. Any
|
|
3089
|
+
* changes to the `state.count` property will cause the `taskFn` to rerun.
|
|
3090
|
+
*
|
|
3091
|
+
* ```tsx
|
|
3092
|
+
* const Cmp = component$(() => {
|
|
3093
|
+
* const store = useStore({ count: 0, doubleCount: 0 });
|
|
3094
|
+
* const signal = useSignal(0);
|
|
3095
|
+
* useTask$(({ track }) => {
|
|
3096
|
+
* // Any signals or stores accessed inside the task will be tracked
|
|
3097
|
+
* const count = track(() => store.count);
|
|
3098
|
+
* // You can also pass a signal to track() directly
|
|
3099
|
+
* const signalCount = track(signal);
|
|
3100
|
+
* store.doubleCount = count + signalCount;
|
|
3101
|
+
* });
|
|
3102
|
+
* return (
|
|
3103
|
+
* <div>
|
|
3104
|
+
* <span>
|
|
3105
|
+
* {store.count} / {store.doubleCount}
|
|
3106
|
+
* </span>
|
|
3107
|
+
* <button
|
|
3108
|
+
* onClick$={() => {
|
|
3109
|
+
* store.count++;
|
|
3110
|
+
* signal.value++;
|
|
3111
|
+
* }}
|
|
3112
|
+
* >
|
|
3113
|
+
* +
|
|
3114
|
+
* </button>
|
|
3115
|
+
* </div>
|
|
3116
|
+
* );
|
|
3117
|
+
* });
|
|
3118
|
+
* ```
|
|
3119
|
+
*
|
|
3120
|
+
* @public
|
|
3121
|
+
* @see `useTask`
|
|
3122
|
+
*/
|
|
3123
|
+
export declare interface Tracker {
|
|
3124
|
+
/**
|
|
3125
|
+
* Include the expression using stores / signals to track:
|
|
3126
|
+
*
|
|
3127
|
+
* ```tsx
|
|
3128
|
+
* track(() => store.count);
|
|
3129
|
+
* ```
|
|
3130
|
+
*
|
|
3131
|
+
* The `track()` function also returns the value of the scoped expression:
|
|
3132
|
+
*
|
|
3133
|
+
* ```tsx
|
|
3134
|
+
* const count = track(() => store.count);
|
|
3135
|
+
* ```
|
|
3136
|
+
*/
|
|
3137
|
+
<T>(fn: () => T): T;
|
|
3138
|
+
/**
|
|
3139
|
+
* Used to track the whole object. If any property of the passed store changes, the task will be
|
|
3140
|
+
* scheduled to run. Also accepts signals.
|
|
3141
|
+
*
|
|
3142
|
+
* Note that the change tracking is not deep. If you want to track changes to nested properties,
|
|
3143
|
+
* you need to use `track` on each of them.
|
|
3144
|
+
*
|
|
3145
|
+
* ```tsx
|
|
3146
|
+
* track(store); // returns store
|
|
3147
|
+
* track(signal); // returns signal.value
|
|
3148
|
+
* ```
|
|
3149
|
+
*/
|
|
3150
|
+
<T extends object>(obj: T): T extends Signal<infer U> ? U : T;
|
|
3151
|
+
/**
|
|
3152
|
+
* Used to track to track a specific property of an object.
|
|
3153
|
+
*
|
|
3154
|
+
* Note that the change tracking is not deep. If you want to track changes to nested properties,
|
|
3155
|
+
* you need to use `track` on each of them.
|
|
3156
|
+
*
|
|
3157
|
+
* ```tsx
|
|
3158
|
+
* track(store, 'propA'); // returns store.propA
|
|
3159
|
+
* ```
|
|
3160
|
+
*/
|
|
3161
|
+
<T extends object, P extends keyof T>(obj: T, prop: P): T[P];
|
|
3162
|
+
}
|
|
3163
|
+
|
|
3164
|
+
/**
|
|
3165
|
+
* Don't track listeners for this callback
|
|
3166
|
+
*
|
|
3167
|
+
* @public
|
|
3168
|
+
*/
|
|
3169
|
+
export declare const untrack: <T>(fn: () => T) => T;
|
|
3170
|
+
|
|
3171
|
+
declare type UnwantedKeys = keyof HTMLAttributesBase | keyof DOMAttributes<any> | keyof ARIAMixin | keyof GlobalEventHandlers | 'enterKeyHint' | 'innerText' | 'innerHTML' | 'outerHTML' | 'inputMode' | 'outerText' | 'nodeValue' | 'textContent';
|
|
3172
|
+
|
|
3173
|
+
/**
|
|
3174
|
+
* Get the original object that was wrapped by the store. Useful if you want to clone a store
|
|
3175
|
+
* (structuredClone, IndexedDB,...)
|
|
3176
|
+
*
|
|
3177
|
+
* @public
|
|
3178
|
+
*/
|
|
3179
|
+
export declare const unwrapStore: <T>(value: T) => T;
|
|
3180
|
+
|
|
3181
|
+
/**
|
|
3182
|
+
* Creates a computed signal which is calculated from the given function. A computed signal is a
|
|
3183
|
+
* signal which is calculated from other signals. When the signals change, the computed signal is
|
|
3184
|
+
* recalculated, and if the result changed, all tasks which are tracking the signal will be re-run
|
|
3185
|
+
* and all components that read the signal will be re-rendered.
|
|
3186
|
+
*
|
|
3187
|
+
* The function must be synchronous and must not have any side effects.
|
|
3188
|
+
*
|
|
3189
|
+
* @public
|
|
3190
|
+
*/
|
|
3191
|
+
export declare const useComputed$: <T>(qrl: ComputedFn<T>) => T extends Promise<any> ? never : ReadonlySignal<T>;
|
|
3192
|
+
|
|
3193
|
+
/** @internal */
|
|
3194
|
+
export declare const useComputedQrl: <T>(qrl: QRL<ComputedFn<T>>) => T extends Promise<any> ? never : ReadonlySignal<T>;
|
|
3195
|
+
|
|
3196
|
+
/**
|
|
3197
|
+
* Stores a value which is retained for the lifetime of the component. Subsequent calls to
|
|
3198
|
+
* `useConstant` will always return the first value given.
|
|
3199
|
+
*
|
|
3200
|
+
* If the value is a function, the function is invoked once to calculate the actual value.
|
|
3201
|
+
*
|
|
3202
|
+
* @public
|
|
3203
|
+
*/
|
|
3204
|
+
export declare const useConstant: <T>(value: (() => T) | T) => T;
|
|
3205
|
+
|
|
3206
|
+
declare interface UseContext {
|
|
3207
|
+
<STATE, T>(context: ContextId<STATE>, transformer: (value: STATE) => T): T;
|
|
3208
|
+
<STATE, T>(context: ContextId<STATE>, defaultValue: T): STATE | T;
|
|
3209
|
+
<STATE>(context: ContextId<STATE>): STATE;
|
|
3210
|
+
}
|
|
3211
|
+
|
|
3212
|
+
/**
|
|
3213
|
+
* Retrieve Context value.
|
|
3214
|
+
*
|
|
3215
|
+
* Use `useContext()` to retrieve the value of context in a component. To retrieve a value a parent
|
|
3216
|
+
* component needs to invoke `useContextProvider()` to assign a value.
|
|
3217
|
+
*
|
|
3218
|
+
* ### Example
|
|
3219
|
+
*
|
|
3220
|
+
* ```tsx
|
|
3221
|
+
* // Declare the Context type.
|
|
3222
|
+
* interface TodosStore {
|
|
3223
|
+
* items: string[];
|
|
3224
|
+
* }
|
|
3225
|
+
* // Create a Context ID (no data is saved here.)
|
|
3226
|
+
* // You will use this ID to both create and retrieve the Context.
|
|
3227
|
+
* export const TodosContext = createContextId<TodosStore>('Todos');
|
|
3228
|
+
*
|
|
3229
|
+
* // Example of providing context to child components.
|
|
3230
|
+
* export const App = component$(() => {
|
|
3231
|
+
* useContextProvider(
|
|
3232
|
+
* TodosContext,
|
|
3233
|
+
* useStore<TodosStore>({
|
|
3234
|
+
* items: ['Learn Qwik', 'Build Qwik app', 'Profit'],
|
|
3235
|
+
* })
|
|
3236
|
+
* );
|
|
3237
|
+
*
|
|
3238
|
+
* return <Items />;
|
|
3239
|
+
* });
|
|
3240
|
+
*
|
|
3241
|
+
* // Example of retrieving the context provided by a parent component.
|
|
3242
|
+
* export const Items = component$(() => {
|
|
3243
|
+
* const todos = useContext(TodosContext);
|
|
3244
|
+
* return (
|
|
3245
|
+
* <ul>
|
|
3246
|
+
* {todos.items.map((item) => (
|
|
3247
|
+
* <li>{item}</li>
|
|
3248
|
+
* ))}
|
|
3249
|
+
* </ul>
|
|
3250
|
+
* );
|
|
3251
|
+
* });
|
|
3252
|
+
*
|
|
3253
|
+
* ```
|
|
3254
|
+
*
|
|
3255
|
+
* @param context - The context to retrieve a value from.
|
|
3256
|
+
* @public
|
|
3257
|
+
*/
|
|
3258
|
+
export declare const useContext: UseContext;
|
|
3259
|
+
|
|
3260
|
+
/**
|
|
3261
|
+
* Assign a value to a Context.
|
|
3262
|
+
*
|
|
3263
|
+
* Use `useContextProvider()` to assign a value to a context. The assignment happens in the
|
|
3264
|
+
* component's function. Once assigned, use `useContext()` in any child component to retrieve the
|
|
3265
|
+
* value.
|
|
3266
|
+
*
|
|
3267
|
+
* Context is a way to pass stores to the child components without prop-drilling. Note that scalar
|
|
3268
|
+
* values are allowed, but for reactivity you need signals or stores.
|
|
3269
|
+
*
|
|
3270
|
+
* ### Example
|
|
3271
|
+
*
|
|
3272
|
+
* ```tsx
|
|
3273
|
+
* // Declare the Context type.
|
|
3274
|
+
* interface TodosStore {
|
|
3275
|
+
* items: string[];
|
|
3276
|
+
* }
|
|
3277
|
+
* // Create a Context ID (no data is saved here.)
|
|
3278
|
+
* // You will use this ID to both create and retrieve the Context.
|
|
3279
|
+
* export const TodosContext = createContextId<TodosStore>('Todos');
|
|
3280
|
+
*
|
|
3281
|
+
* // Example of providing context to child components.
|
|
3282
|
+
* export const App = component$(() => {
|
|
3283
|
+
* useContextProvider(
|
|
3284
|
+
* TodosContext,
|
|
3285
|
+
* useStore<TodosStore>({
|
|
3286
|
+
* items: ['Learn Qwik', 'Build Qwik app', 'Profit'],
|
|
3287
|
+
* })
|
|
3288
|
+
* );
|
|
3289
|
+
*
|
|
3290
|
+
* return <Items />;
|
|
3291
|
+
* });
|
|
3292
|
+
*
|
|
3293
|
+
* // Example of retrieving the context provided by a parent component.
|
|
3294
|
+
* export const Items = component$(() => {
|
|
3295
|
+
* const todos = useContext(TodosContext);
|
|
3296
|
+
* return (
|
|
3297
|
+
* <ul>
|
|
3298
|
+
* {todos.items.map((item) => (
|
|
3299
|
+
* <li>{item}</li>
|
|
3300
|
+
* ))}
|
|
3301
|
+
* </ul>
|
|
3302
|
+
* );
|
|
3303
|
+
* });
|
|
3304
|
+
*
|
|
3305
|
+
* ```
|
|
3306
|
+
*
|
|
3307
|
+
* @param context - The context to assign a value to.
|
|
3308
|
+
* @param value - The value to assign to the context.
|
|
3309
|
+
* @public
|
|
3310
|
+
*/
|
|
3311
|
+
export declare const useContextProvider: <STATE>(context: ContextId<STATE>, newValue: STATE) => void;
|
|
3312
|
+
|
|
3313
|
+
/** @public */
|
|
3314
|
+
export declare const useErrorBoundary: () => Readonly<ErrorBoundaryStore>;
|
|
3315
|
+
|
|
3316
|
+
/** @public */
|
|
3317
|
+
export declare const useId: () => string;
|
|
3318
|
+
|
|
3319
|
+
/**
|
|
3320
|
+
* Used by the Qwik Optimizer to restore the lexically scoped variables.
|
|
3321
|
+
*
|
|
3322
|
+
* This method should not be present in the application source code.
|
|
3323
|
+
*
|
|
3324
|
+
* NOTE: `useLexicalScope` method can only be used in the synchronous portion of the callback
|
|
3325
|
+
* (before any `await` statements.)
|
|
3326
|
+
*
|
|
3327
|
+
* @internal
|
|
3328
|
+
*/
|
|
3329
|
+
export declare const useLexicalScope: <VARS extends any[]>() => VARS;
|
|
3330
|
+
|
|
3331
|
+
/**
|
|
3332
|
+
* Register a listener on the current component's host element.
|
|
3333
|
+
*
|
|
3334
|
+
* Used to programmatically add event listeners. Useful from custom `use*` methods, which do not
|
|
3335
|
+
* have access to the JSX. Otherwise, it's adding a JSX listener in the `<div>` is a better idea.
|
|
3336
|
+
*
|
|
3337
|
+
* @public
|
|
3338
|
+
* @see `useOn`, `useOnWindow`, `useOnDocument`.
|
|
3339
|
+
*/
|
|
3340
|
+
export declare const useOn: <T extends KnownEventNames>(event: T | T[], eventQrl: EventQRL<T>) => void;
|
|
3341
|
+
|
|
3342
|
+
/**
|
|
3343
|
+
* Register a listener on `document`.
|
|
3344
|
+
*
|
|
3345
|
+
* Used to programmatically add event listeners. Useful from custom `use*` methods, which do not
|
|
3346
|
+
* have access to the JSX.
|
|
3347
|
+
*
|
|
3348
|
+
* @public
|
|
3349
|
+
* @see `useOn`, `useOnWindow`, `useOnDocument`.
|
|
3350
|
+
*
|
|
3351
|
+
* ```tsx
|
|
3352
|
+
* function useScroll() {
|
|
3353
|
+
* useOnDocument(
|
|
3354
|
+
* 'scroll',
|
|
3355
|
+
* $((event) => {
|
|
3356
|
+
* console.log('body scrolled', event);
|
|
3357
|
+
* })
|
|
3358
|
+
* );
|
|
3359
|
+
* }
|
|
3360
|
+
*
|
|
3361
|
+
* const Cmp = component$(() => {
|
|
3362
|
+
* useScroll();
|
|
3363
|
+
* return <div>Profit!</div>;
|
|
3364
|
+
* });
|
|
3365
|
+
* ```
|
|
3366
|
+
*/
|
|
3367
|
+
export declare const useOnDocument: <T extends KnownEventNames>(event: T | T[], eventQrl: EventQRL<T>) => void;
|
|
3368
|
+
|
|
3369
|
+
/**
|
|
3370
|
+
* Register a listener on `window`.
|
|
3371
|
+
*
|
|
3372
|
+
* Used to programmatically add event listeners. Useful from custom `use*` methods, which do not
|
|
3373
|
+
* have access to the JSX.
|
|
3374
|
+
*
|
|
3375
|
+
* @public
|
|
3376
|
+
* @see `useOn`, `useOnWindow`, `useOnDocument`.
|
|
3377
|
+
*
|
|
3378
|
+
* ```tsx
|
|
3379
|
+
* function useAnalytics() {
|
|
3380
|
+
* useOnWindow(
|
|
3381
|
+
* 'popstate',
|
|
3382
|
+
* $((event) => {
|
|
3383
|
+
* console.log('navigation happened', event);
|
|
3384
|
+
* // report to analytics
|
|
3385
|
+
* })
|
|
3386
|
+
* );
|
|
3387
|
+
* }
|
|
3388
|
+
*
|
|
3389
|
+
* const Cmp = component$(() => {
|
|
3390
|
+
* useAnalytics();
|
|
3391
|
+
* return <div>Profit!</div>;
|
|
3392
|
+
* });
|
|
3393
|
+
* ```
|
|
3394
|
+
*/
|
|
3395
|
+
export declare const useOnWindow: <T extends KnownEventNames>(event: T | T[], eventQrl: EventQRL<T>) => void;
|
|
3396
|
+
|
|
3397
|
+
/**
|
|
3398
|
+
* This method works like an async memoized function that runs whenever some tracked value changes
|
|
3399
|
+
* and returns some data.
|
|
3400
|
+
*
|
|
3401
|
+
* `useResource` however returns immediate a `ResourceReturn` object that contains the data and a
|
|
3402
|
+
* state that indicates if the data is available or not.
|
|
3403
|
+
*
|
|
3404
|
+
* The status can be one of the following:
|
|
3405
|
+
*
|
|
3406
|
+
* - `pending` - the data is not yet available.
|
|
3407
|
+
* - `resolved` - the data is available.
|
|
3408
|
+
* - `rejected` - the data is not available due to an error or timeout.
|
|
3409
|
+
*
|
|
3410
|
+
* Be careful when using a `try/catch` statement in `useResource$`. If you catch the error and don't
|
|
3411
|
+
* re-throw it (or a new Error), the resource status will never be `rejected`.
|
|
3412
|
+
*
|
|
3413
|
+
* ### Example
|
|
3414
|
+
*
|
|
3415
|
+
* Example showing how `useResource` to perform a fetch to request the weather, whenever the input
|
|
3416
|
+
* city name changes.
|
|
3417
|
+
*
|
|
3418
|
+
* ```tsx
|
|
3419
|
+
* const Cmp = component$(() => {
|
|
3420
|
+
* const cityS = useSignal('');
|
|
3421
|
+
*
|
|
3422
|
+
* const weatherResource = useResource$(async ({ track, cleanup }) => {
|
|
3423
|
+
* const cityName = track(cityS);
|
|
3424
|
+
* const abortController = new AbortController();
|
|
3425
|
+
* cleanup(() => abortController.abort('cleanup'));
|
|
3426
|
+
* const res = await fetch(`http://weatherdata.com?city=${cityName}`, {
|
|
3427
|
+
* signal: abortController.signal,
|
|
3428
|
+
* });
|
|
3429
|
+
* const data = await res.json();
|
|
3430
|
+
* return data as { temp: number };
|
|
3431
|
+
* });
|
|
3432
|
+
*
|
|
3433
|
+
* return (
|
|
3434
|
+
* <div>
|
|
3435
|
+
* <input name="city" bind:value={cityS} />
|
|
3436
|
+
* <Resource
|
|
3437
|
+
* value={weatherResource}
|
|
3438
|
+
* onResolved={(weather) => {
|
|
3439
|
+
* return <div>Temperature: {weather.temp}</div>;
|
|
3440
|
+
* }}
|
|
3441
|
+
* />
|
|
3442
|
+
* </div>
|
|
3443
|
+
* );
|
|
3444
|
+
* });
|
|
3445
|
+
* ```
|
|
3446
|
+
*
|
|
3447
|
+
* @public
|
|
3448
|
+
* @see Resource
|
|
3449
|
+
* @see ResourceReturn
|
|
3450
|
+
*/
|
|
3451
|
+
export declare const useResource$: <T>(generatorFn: ResourceFn<T>, opts?: ResourceOptions) => ResourceReturn<T>;
|
|
3452
|
+
|
|
3453
|
+
/** @internal */
|
|
3454
|
+
export declare const useResourceQrl: <T>(qrl: QRL<ResourceFn<T>>, opts?: ResourceOptions) => ResourceReturn<T>;
|
|
3455
|
+
|
|
3456
|
+
/** @public */
|
|
3457
|
+
export declare function useServerData<T>(key: string): T | undefined;
|
|
3458
|
+
|
|
3459
|
+
/** @public */
|
|
3460
|
+
export declare function useServerData<T, B = T>(key: string, defaultValue: B): T | B;
|
|
3461
|
+
|
|
3462
|
+
/** @public */
|
|
3463
|
+
export declare interface UseSignal {
|
|
3464
|
+
<T>(): Signal<T | undefined>;
|
|
3465
|
+
<T>(value: T | (() => T)): Signal<T>;
|
|
3466
|
+
}
|
|
3467
|
+
|
|
3468
|
+
/** @public */
|
|
3469
|
+
export declare const useSignal: UseSignal;
|
|
3470
|
+
|
|
3471
|
+
/**
|
|
3472
|
+
* Creates an object that Qwik can track across serializations.
|
|
3473
|
+
*
|
|
3474
|
+
* Use `useStore` to create a state for your application. The returned object is a proxy that has a
|
|
3475
|
+
* unique ID. The ID of the object is used in the `QRL`s to refer to the store.
|
|
3476
|
+
*
|
|
3477
|
+
* ### Example
|
|
3478
|
+
*
|
|
3479
|
+
* Example showing how `useStore` is used in Counter example to keep track of the count.
|
|
3480
|
+
*
|
|
3481
|
+
* ```tsx
|
|
3482
|
+
* const Stores = component$(() => {
|
|
3483
|
+
* const counter = useCounter(1);
|
|
3484
|
+
*
|
|
3485
|
+
* // Reactivity happens even for nested objects and arrays
|
|
3486
|
+
* const userData = useStore({
|
|
3487
|
+
* name: 'Manu',
|
|
3488
|
+
* address: {
|
|
3489
|
+
* address: '',
|
|
3490
|
+
* city: '',
|
|
3491
|
+
* },
|
|
3492
|
+
* orgs: [],
|
|
3493
|
+
* });
|
|
3494
|
+
*
|
|
3495
|
+
* // useStore() can also accept a function to calculate the initial value
|
|
3496
|
+
* const state = useStore(() => {
|
|
3497
|
+
* return {
|
|
3498
|
+
* value: expensiveInitialValue(),
|
|
3499
|
+
* };
|
|
3500
|
+
* });
|
|
3501
|
+
*
|
|
3502
|
+
* return (
|
|
3503
|
+
* <div>
|
|
3504
|
+
* <div>Counter: {counter.value}</div>
|
|
3505
|
+
* <Child userData={userData} state={state} />
|
|
3506
|
+
* </div>
|
|
3507
|
+
* );
|
|
3508
|
+
* });
|
|
3509
|
+
*
|
|
3510
|
+
* function useCounter(step: number) {
|
|
3511
|
+
* // Multiple stores can be created in custom hooks for convenience and composability
|
|
3512
|
+
* const counterStore = useStore({
|
|
3513
|
+
* value: 0,
|
|
3514
|
+
* });
|
|
3515
|
+
* useVisibleTask$(() => {
|
|
3516
|
+
* // Only runs in the client
|
|
3517
|
+
* const timer = setInterval(() => {
|
|
3518
|
+
* counterStore.value += step;
|
|
3519
|
+
* }, 500);
|
|
3520
|
+
* return () => {
|
|
3521
|
+
* clearInterval(timer);
|
|
3522
|
+
* };
|
|
3523
|
+
* });
|
|
3524
|
+
* return counterStore;
|
|
3525
|
+
* }
|
|
3526
|
+
* ```
|
|
3527
|
+
*
|
|
3528
|
+
* @public
|
|
3529
|
+
*/
|
|
3530
|
+
export declare const useStore: <STATE extends object>(initialState: STATE | (() => STATE), opts?: UseStoreOptions) => STATE;
|
|
3531
|
+
|
|
3532
|
+
/** @public */
|
|
3533
|
+
export declare interface UseStoreOptions {
|
|
3534
|
+
/** If `true` then all nested objects and arrays will be tracked as well. Default is `true`. */
|
|
3535
|
+
deep?: boolean;
|
|
3536
|
+
/** If `false` then the object will not be tracked for changes. Default is `true`. */
|
|
3537
|
+
reactive?: boolean;
|
|
3538
|
+
}
|
|
3539
|
+
|
|
3540
|
+
/**
|
|
3541
|
+
* A lazy-loadable reference to a component's styles.
|
|
3542
|
+
*
|
|
3543
|
+
* Component styles allow Qwik to lazy load the style information for the component only when
|
|
3544
|
+
* needed. (And avoid double loading it in case of SSR hydration.)
|
|
3545
|
+
*
|
|
3546
|
+
* ```tsx
|
|
3547
|
+
* import styles from './code-block.css?inline';
|
|
3548
|
+
*
|
|
3549
|
+
* export const CmpStyles = component$(() => {
|
|
3550
|
+
* useStyles$(styles);
|
|
3551
|
+
*
|
|
3552
|
+
* return <div>Some text</div>;
|
|
3553
|
+
* });
|
|
3554
|
+
* ```
|
|
3555
|
+
*
|
|
3556
|
+
* @public
|
|
3557
|
+
* @see `useStylesScoped`
|
|
3558
|
+
*/
|
|
3559
|
+
export declare const useStyles$: (qrl: string) => UseStyles;
|
|
3560
|
+
|
|
3561
|
+
/** @public */
|
|
3562
|
+
declare interface UseStyles {
|
|
3563
|
+
styleId: string;
|
|
3564
|
+
}
|
|
3565
|
+
|
|
3566
|
+
/** @internal */
|
|
3567
|
+
export declare const useStylesQrl: (styles: QRL<string>) => UseStyles;
|
|
3568
|
+
|
|
3569
|
+
/**
|
|
3570
|
+
* A lazy-loadable reference to a component's styles, that is scoped to the component.
|
|
3571
|
+
*
|
|
3572
|
+
* Component styles allow Qwik to lazy load the style information for the component only when
|
|
3573
|
+
* needed. (And avoid double loading it in case of SSR hydration.)
|
|
3574
|
+
*
|
|
3575
|
+
* ```tsx
|
|
3576
|
+
* import scoped from './code-block.css?inline';
|
|
3577
|
+
*
|
|
3578
|
+
* export const CmpScopedStyles = component$(() => {
|
|
3579
|
+
* useStylesScoped$(scoped);
|
|
3580
|
+
*
|
|
3581
|
+
* return <div>Some text</div>;
|
|
3582
|
+
* });
|
|
3583
|
+
* ```
|
|
3584
|
+
*
|
|
3585
|
+
* @public
|
|
3586
|
+
* @see `useStyles`
|
|
3587
|
+
*/
|
|
3588
|
+
export declare const useStylesScoped$: (qrl: string) => UseStylesScoped;
|
|
3589
|
+
|
|
3590
|
+
/** @public */
|
|
3591
|
+
export declare interface UseStylesScoped {
|
|
3592
|
+
scopeId: string;
|
|
3593
|
+
}
|
|
3594
|
+
|
|
3595
|
+
/** @internal */
|
|
3596
|
+
export declare const useStylesScopedQrl: (styles: QRL<string>) => UseStylesScoped;
|
|
3597
|
+
|
|
3598
|
+
/**
|
|
3599
|
+
* Reruns the `taskFn` when the observed inputs change.
|
|
3600
|
+
*
|
|
3601
|
+
* Use `useTask` to observe changes on a set of inputs, and then re-execute the `taskFn` when those
|
|
3602
|
+
* inputs change.
|
|
3603
|
+
*
|
|
3604
|
+
* The `taskFn` only executes if the observed inputs change. To observe the inputs, use the `obs`
|
|
3605
|
+
* function to wrap property reads. This creates subscriptions that will trigger the `taskFn` to
|
|
3606
|
+
* rerun.
|
|
3607
|
+
*
|
|
3608
|
+
* @param task - Function which should be re-executed when changes to the inputs are detected
|
|
3609
|
+
* @public
|
|
3610
|
+
*
|
|
3611
|
+
* ### Example
|
|
3612
|
+
*
|
|
3613
|
+
* The `useTask` function is used to observe the `store.count` property. Any changes to the
|
|
3614
|
+
* `store.count` cause the `taskFn` to execute which in turn updates the `store.doubleCount` to
|
|
3615
|
+
* the double of `store.count`.
|
|
3616
|
+
*
|
|
3617
|
+
* ```tsx
|
|
3618
|
+
* const Cmp = component$(() => {
|
|
3619
|
+
* const store = useStore({
|
|
3620
|
+
* count: 0,
|
|
3621
|
+
* doubleCount: 0,
|
|
3622
|
+
* debounced: 0,
|
|
3623
|
+
* });
|
|
3624
|
+
*
|
|
3625
|
+
* // Double count task
|
|
3626
|
+
* useTask$(({ track }) => {
|
|
3627
|
+
* const count = track(() => store.count);
|
|
3628
|
+
* store.doubleCount = 2 * count;
|
|
3629
|
+
* });
|
|
3630
|
+
*
|
|
3631
|
+
* // Debouncer task
|
|
3632
|
+
* useTask$(({ track }) => {
|
|
3633
|
+
* const doubleCount = track(() => store.doubleCount);
|
|
3634
|
+
* const timer = setTimeout(() => {
|
|
3635
|
+
* store.debounced = doubleCount;
|
|
3636
|
+
* }, 2000);
|
|
3637
|
+
* return () => {
|
|
3638
|
+
* clearTimeout(timer);
|
|
3639
|
+
* };
|
|
3640
|
+
* });
|
|
3641
|
+
* return (
|
|
3642
|
+
* <div>
|
|
3643
|
+
* <div>
|
|
3644
|
+
* {store.count} / {store.doubleCount}
|
|
3645
|
+
* </div>
|
|
3646
|
+
* <div>{store.debounced}</div>
|
|
3647
|
+
* </div>
|
|
3648
|
+
* );
|
|
3649
|
+
* });
|
|
3650
|
+
* ```
|
|
3651
|
+
*
|
|
3652
|
+
* @public
|
|
3653
|
+
* @see `Tracker`
|
|
3654
|
+
*/
|
|
3655
|
+
export declare const useTask$: (qrl: TaskFn, opts?: UseTaskOptions | undefined) => void;
|
|
3656
|
+
|
|
3657
|
+
/** @public */
|
|
3658
|
+
export declare interface UseTaskOptions {
|
|
3659
|
+
/**
|
|
3660
|
+
* - `visible`: run the effect when the element is visible.
|
|
3661
|
+
* - `load`: eagerly run the effect when the application resumes.
|
|
3662
|
+
*/
|
|
3663
|
+
eagerness?: EagernessOptions;
|
|
3664
|
+
}
|
|
3665
|
+
|
|
3666
|
+
/** @internal */
|
|
3667
|
+
export declare const useTaskQrl: (qrl: QRL<TaskFn>, opts?: UseTaskOptions) => void;
|
|
3668
|
+
|
|
3669
|
+
/**
|
|
3670
|
+
* ```tsx
|
|
3671
|
+
* const Timer = component$(() => {
|
|
3672
|
+
* const store = useStore({
|
|
3673
|
+
* count: 0,
|
|
3674
|
+
* });
|
|
3675
|
+
*
|
|
3676
|
+
* useVisibleTask$(() => {
|
|
3677
|
+
* // Only runs in the client
|
|
3678
|
+
* const timer = setInterval(() => {
|
|
3679
|
+
* store.count++;
|
|
3680
|
+
* }, 500);
|
|
3681
|
+
* return () => {
|
|
3682
|
+
* clearInterval(timer);
|
|
3683
|
+
* };
|
|
3684
|
+
* });
|
|
3685
|
+
*
|
|
3686
|
+
* return <div>{store.count}</div>;
|
|
3687
|
+
* });
|
|
3688
|
+
* ```
|
|
3689
|
+
*
|
|
3690
|
+
* @public
|
|
3691
|
+
*/
|
|
3692
|
+
export declare const useVisibleTask$: (qrl: TaskFn, opts?: OnVisibleTaskOptions | undefined) => void;
|
|
3693
|
+
|
|
3694
|
+
/** @internal */
|
|
3695
|
+
export declare const useVisibleTaskQrl: (qrl: QRL<TaskFn>, opts?: OnVisibleTaskOptions) => void;
|
|
3696
|
+
|
|
3697
|
+
/**
|
|
3698
|
+
* Type representing a value which is either resolve or a promise.
|
|
3699
|
+
*
|
|
3700
|
+
* @public
|
|
3701
|
+
*/
|
|
3702
|
+
export declare type ValueOrPromise<T> = T | Promise<T>;
|
|
3703
|
+
|
|
3704
|
+
/** @internal */
|
|
3705
|
+
export declare const _VAR_PROPS: unique symbol;
|
|
3706
|
+
|
|
3707
|
+
/** @internal */
|
|
3708
|
+
export declare const _verifySerializable: <T>(value: T, preMessage?: string) => T;
|
|
3709
|
+
|
|
3710
|
+
/**
|
|
3711
|
+
* 2.0.0-alpha.0-dev+dd93926
|
|
3712
|
+
*
|
|
3713
|
+
* @public
|
|
3714
|
+
*/
|
|
3715
|
+
export declare const version: string;
|
|
3716
|
+
|
|
3717
|
+
/** @internal */
|
|
3718
|
+
export declare type _VirtualVNode = [
|
|
3719
|
+
_VNodeFlags.Virtual,
|
|
3720
|
+
///////////// 0 - Flags
|
|
3721
|
+
_VNode | null,
|
|
3722
|
+
/////////////// 1 - Parent
|
|
3723
|
+
_VNode | null,
|
|
3724
|
+
/////////////// 2 - Previous sibling
|
|
3725
|
+
_VNode | null,
|
|
3726
|
+
/////////////// 3 - Next sibling
|
|
3727
|
+
_VNode | null,
|
|
3728
|
+
/////////////// 4 - First child
|
|
3729
|
+
_VNode | null,
|
|
3730
|
+
...(string | null | boolean)[]
|
|
3731
|
+
] & {
|
|
3732
|
+
__brand__: 'FragmentNode' & 'HostElement';
|
|
3733
|
+
};
|
|
3734
|
+
|
|
3735
|
+
/** @public */
|
|
3736
|
+
export declare type VisibleTaskStrategy = 'intersection-observer' | 'document-ready' | 'document-idle';
|
|
3737
|
+
|
|
3738
|
+
/** @internal */
|
|
3739
|
+
export declare type _VNode = _ElementVNode | _TextVNode | _VirtualVNode;
|
|
3740
|
+
|
|
3741
|
+
/**
|
|
3742
|
+
* Array of numbers which describes virtual nodes in the tree.
|
|
3743
|
+
*
|
|
3744
|
+
* HTML can't account for:
|
|
3745
|
+
*
|
|
3746
|
+
* - Multiple text nodes in a row. (it treats it as a single text node)
|
|
3747
|
+
* - Empty text nodes. (it ignores them)
|
|
3748
|
+
* - And virtual nodes such as `<Fragment/>` or `<MyComponent/>`
|
|
3749
|
+
*
|
|
3750
|
+
* So we need to encode all of that information into the VNodeData.
|
|
3751
|
+
*
|
|
3752
|
+
* Encoding:
|
|
3753
|
+
*
|
|
3754
|
+
* - First position is special and encodes state information and stores VNodeDataFlag.
|
|
3755
|
+
* - Positive numbers are text node lengths. (0 is a special case for empty text node)
|
|
3756
|
+
* - Negative numbers are element counts.
|
|
3757
|
+
* - `OPEN_FRAGMENT` is start of virtual node.
|
|
3758
|
+
*
|
|
3759
|
+
* - If `OPEN_FRAGMENT` than the previous node is an `Array` which contains the props (see
|
|
3760
|
+
* `SsrAttrs`). NOTE: The array is never going to be the last item in the VNodeData, so we can
|
|
3761
|
+
* always assume that the last item in `vNodeData` is a number.
|
|
3762
|
+
* - `CLOSE_FRAGMENT` is end of virtual node.
|
|
3763
|
+
*
|
|
3764
|
+
* NOTE: This is how we store the information during the SSR streaming, once the SSR is complete
|
|
3765
|
+
* this data needs to be serialized into a string and stored in the DOM as a script tag which has
|
|
3766
|
+
* deferent serialization format.
|
|
3767
|
+
*/
|
|
3768
|
+
declare type VNodeData = [VNodeDataFlag, ...(SsrAttrs | number)[]];
|
|
3769
|
+
|
|
3770
|
+
declare const enum VNodeDataFlag {
|
|
3771
|
+
NONE = 0,
|
|
3772
|
+
TEXT_DATA = 1,
|
|
3773
|
+
VIRTUAL_NODE = 2,
|
|
3774
|
+
REFERENCE = 4,
|
|
3775
|
+
SERIALIZE = 8
|
|
3776
|
+
}
|
|
3777
|
+
|
|
3778
|
+
/**
|
|
3779
|
+
* Flags for VNode.
|
|
3780
|
+
*
|
|
3781
|
+
* # Materialize vs Inflation
|
|
3782
|
+
*
|
|
3783
|
+
* - Materialized: The node has all of its children. Specifically `firstChild`/`lastChild` are NOT
|
|
3784
|
+
* `undefined`. Materialization creates lazy instantiation of the children. NOTE: Only
|
|
3785
|
+
* ElementVNode need to be materialized.
|
|
3786
|
+
* - Inflation:
|
|
3787
|
+
*
|
|
3788
|
+
* - If Text: It means that it is safe to write to the node. When Text nodes are first Deserialized
|
|
3789
|
+
* multiple text nodes can share the same DOM node. On write the sibling text nodes need to be
|
|
3790
|
+
* converted into separate text nodes.
|
|
3791
|
+
* - If Element: It means that the element tag attributes have not yet been read from the DOM.
|
|
3792
|
+
*
|
|
3793
|
+
* Inflation and materialization are not the same, they are two independent things.
|
|
3794
|
+
*
|
|
3795
|
+
* @internal
|
|
3796
|
+
*/
|
|
3797
|
+
export declare const enum _VNodeFlags {
|
|
3798
|
+
Element = 1,
|
|
3799
|
+
Virtual = 2,
|
|
3800
|
+
ELEMENT_OR_VIRTUAL_MASK = 3,
|
|
3801
|
+
ELEMENT_OR_TEXT_MASK = 5,
|
|
3802
|
+
TYPE_MASK = 7,
|
|
3803
|
+
INFLATED_TYPE_MASK = 15,
|
|
3804
|
+
Text = 4,
|
|
3805
|
+
Inflated = 8,
|
|
3806
|
+
Resolved = 16,
|
|
3807
|
+
Deleted = 32,
|
|
3808
|
+
NAMESPACE_MASK = 192,
|
|
3809
|
+
NEGATED_NAMESPACE_MASK = -193,
|
|
3810
|
+
NS_html = 0,// http://www.w3.org/1999/xhtml
|
|
3811
|
+
NS_svg = 64,// http://www.w3.org/2000/svg
|
|
3812
|
+
NS_math = 128
|
|
3813
|
+
}
|
|
3814
|
+
|
|
3815
|
+
declare type VNodeJournal = Array<VNodeJournalOpCode | Document | Element | Text | string | boolean | null>;
|
|
3816
|
+
|
|
3817
|
+
/**
|
|
3818
|
+
* Fundamental DOM operations are:
|
|
3819
|
+
*
|
|
3820
|
+
* - Insert new DOM element/text
|
|
3821
|
+
* - Remove DOM element/text
|
|
3822
|
+
* - Set DOM element attributes
|
|
3823
|
+
* - Set text node value
|
|
3824
|
+
*/
|
|
3825
|
+
declare const enum VNodeJournalOpCode {
|
|
3826
|
+
SetText = 1,// ------ [SetAttribute, target, text]
|
|
3827
|
+
SetAttribute = 2,// - [SetAttribute, target, ...(key, values)]]
|
|
3828
|
+
HoistStyles = 3,// -- [HoistStyles, document]
|
|
3829
|
+
Remove = 4,// ------- [Insert, target(parent), ...nodes]
|
|
3830
|
+
Insert = 5
|
|
3831
|
+
}
|
|
3832
|
+
|
|
3833
|
+
/** @internal */
|
|
3834
|
+
export declare const _waitUntilRendered: (elm: Element) => Promise<void>;
|
|
3835
|
+
|
|
3836
|
+
/** @internal */
|
|
3837
|
+
export declare function _walkJSX(ssr: SSRContainer, value: JSXOutput, options: {
|
|
3838
|
+
allowPromises: true;
|
|
3839
|
+
currentStyleScoped: string | null;
|
|
3840
|
+
parentComponentFrame: ISsrComponentFrame | null;
|
|
3841
|
+
}): ValueOrPromise<void>;
|
|
3842
|
+
|
|
3843
|
+
/** @internal */
|
|
3844
|
+
export declare function _walkJSX(ssr: SSRContainer, value: JSXOutput, options: {
|
|
3845
|
+
allowPromises: false;
|
|
3846
|
+
currentStyleScoped: string | null;
|
|
3847
|
+
parentComponentFrame: ISsrComponentFrame | null;
|
|
3848
|
+
}): false;
|
|
3849
|
+
|
|
3850
|
+
/** @internal */
|
|
3851
|
+
export declare const _weakSerialize: <T extends object>(input: T) => Partial<T>;
|
|
3852
|
+
|
|
3853
|
+
/**
|
|
3854
|
+
* Override the `getLocale` with `lang` within the `fn` execution.
|
|
3855
|
+
*
|
|
3856
|
+
* @public
|
|
3857
|
+
*/
|
|
3858
|
+
export declare function withLocale<T>(locale: string, fn: () => T): T;
|
|
3859
|
+
|
|
3860
|
+
declare class WrappedSignal<T> extends Signal_2<T> implements Subscriber {
|
|
3861
|
+
$args$: any[];
|
|
3862
|
+
$func$: (...args: any[]) => T;
|
|
3863
|
+
$funcStr$: string | null;
|
|
3864
|
+
$invalid$: boolean;
|
|
3865
|
+
$effectDependencies$: Subscriber[] | null;
|
|
3866
|
+
constructor(container: Container | null, fn: (...args: any[]) => T, args: any[], fnStr: string | null);
|
|
3867
|
+
$invalidate$(): void;
|
|
3868
|
+
/**
|
|
3869
|
+
* Use this to force running subscribers, for example when the calculated value has mutated but
|
|
3870
|
+
* remained the same object
|
|
3871
|
+
*/
|
|
3872
|
+
force(): void;
|
|
3873
|
+
get untrackedValue(): T;
|
|
3874
|
+
private $computeIfNeeded$;
|
|
3875
|
+
get value(): any;
|
|
3876
|
+
set value(_: any);
|
|
3877
|
+
}
|
|
3878
|
+
|
|
3879
|
+
/**
|
|
3880
|
+
* This wraps a property access of a possible Signal/Store into a WrappedSignal. The optimizer does
|
|
3881
|
+
* this automatically when a prop is only used as a prop on JSX.
|
|
3882
|
+
*
|
|
3883
|
+
* When a WrappedSignal is read via the PropsProxy, it will be unwrapped. This allows forwarding the
|
|
3884
|
+
* reactivity of a prop to the point of actual use.
|
|
3885
|
+
*
|
|
3886
|
+
* For efficiency, if you pass only one argument, the property is 'value'.
|
|
3887
|
+
*
|
|
3888
|
+
* @internal
|
|
3889
|
+
*/
|
|
3890
|
+
export declare const _wrapProp: <T extends Record<any, any>, P extends keyof T>(args_0: T, args_1?: P | undefined) => any;
|
|
3891
|
+
|
|
3892
|
+
/** @internal @deprecated v1 compat */
|
|
3893
|
+
export declare const _wrapSignal: <T extends Record<any, any>, P extends keyof T>(obj: T, prop: P) => any;
|
|
3894
|
+
|
|
3895
|
+
export { }
|