@qwik.dev/core 2.0.0-beta.4 → 2.0.0-beta.40
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/dist/backpatch/index.d.ts +2 -0
- package/dist/backpatch/index.mjs +5 -0
- package/dist/backpatch/package.json +8 -0
- package/dist/backpatch-executor.debug.js +59 -0
- package/dist/backpatch-executor.js +1 -0
- package/dist/build/package.json +1 -1
- package/dist/cli.mjs +12974 -0
- package/dist/core-internal.d.ts +1615 -810
- package/dist/core.min.mjs +9 -1
- package/dist/core.mjs +14792 -9192
- package/dist/core.mjs.map +1 -1
- package/dist/core.prod.mjs +10482 -5382
- package/dist/insights/index.qwik.mjs +82 -71
- package/dist/insights/vite/index.mjs +79 -81
- package/dist/loader/index.mjs +2 -2
- package/dist/loader/package.json +1 -1
- package/dist/optimizer.d.ts +77 -288
- package/dist/optimizer.mjs +2966 -4088
- package/dist/out-of-order-executor.debug.js +140 -0
- package/dist/out-of-order-executor.js +1 -0
- package/dist/preloader.mjs +172 -192
- package/dist/qwikloader.debug.js +403 -244
- package/dist/qwikloader.js +1 -1
- package/dist/server-modules.d.ts +1 -0
- package/dist/server.d.ts +54 -249
- package/dist/server.mjs +2332 -1407
- package/dist/server.prod.mjs +3844 -0
- package/dist/starters/adapters/aws-lambda/adapters/aws-lambda/{vite.config.mts → vite.config.ts} +3 -3
- package/dist/starters/adapters/aws-lambda/package.json +3 -2
- package/dist/starters/adapters/aws-lambda/src/entry_aws-lambda.tsx +2 -6
- package/dist/starters/adapters/azure-swa/adapters/azure-swa/{vite.config.mts → vite.config.ts} +3 -3
- package/dist/starters/adapters/azure-swa/package.json +3 -2
- package/dist/starters/adapters/azure-swa/src/entry.azure-swa.tsx +2 -3
- package/dist/starters/adapters/bun/adapters/bun/{vite.config.mts → vite.config.ts} +4 -4
- package/dist/starters/adapters/bun/package.json +3 -2
- package/dist/starters/adapters/bun/src/entry.bun.ts +37 -10
- package/dist/starters/adapters/cloud-run/adapters/cloud-run/{vite.config.mts → vite.config.ts} +3 -3
- package/dist/starters/adapters/cloud-run/package.json +3 -2
- package/dist/starters/adapters/cloud-run/src/entry.cloud-run.tsx +23 -7
- package/dist/starters/adapters/cloudflare-pages/adapters/cloudflare-pages/{vite.config.mts → vite.config.ts} +3 -3
- package/dist/starters/adapters/cloudflare-pages/package.json +3 -2
- package/dist/starters/adapters/cloudflare-pages/src/entry.cloudflare-pages.tsx +2 -3
- package/dist/starters/adapters/cloudflare-workers/README.md +52 -0
- package/dist/starters/adapters/cloudflare-workers/adapters/cloudflare-workers/vite.config.ts +15 -0
- package/dist/starters/adapters/cloudflare-workers/gitignore +3 -0
- package/dist/starters/adapters/cloudflare-workers/package.json +31 -0
- package/dist/starters/adapters/cloudflare-workers/public/.assetsignore +4 -0
- package/dist/starters/adapters/cloudflare-workers/public/_headers +11 -0
- package/dist/starters/adapters/cloudflare-workers/public/_redirects +1 -0
- package/dist/starters/adapters/cloudflare-workers/src/entry.cloudflare-pages.tsx +23 -0
- package/dist/starters/adapters/cloudflare-workers/worker-configuration.d.ts +5 -0
- package/dist/starters/adapters/cloudflare-workers/wrangler.jsonc +41 -0
- package/dist/starters/adapters/deno/adapters/deno/{vite.config.mts → vite.config.ts} +3 -3
- package/dist/starters/adapters/deno/package.json +3 -2
- package/dist/starters/adapters/deno/src/entry.deno.ts +43 -10
- package/dist/starters/adapters/express/adapters/express/{vite.config.mts → vite.config.ts} +3 -3
- package/dist/starters/adapters/express/package.json +4 -3
- package/dist/starters/adapters/express/src/entry.express.tsx +22 -7
- package/dist/starters/adapters/fastify/adapters/fastify/{vite.config.mts → vite.config.ts} +3 -3
- package/dist/starters/adapters/fastify/package.json +5 -4
- package/dist/starters/adapters/fastify/src/entry.fastify.tsx +21 -1
- package/dist/starters/adapters/fastify/src/plugins/fastify-qwik.ts +11 -4
- package/dist/starters/adapters/firebase/adapters/firebase/{vite.config.mts → vite.config.ts} +3 -3
- package/dist/starters/adapters/firebase/package.json +3 -2
- package/dist/starters/adapters/firebase/src/entry-firebase.tsx +2 -3
- package/dist/starters/adapters/netlify-edge/adapters/netlify-edge/{vite.config.mts → vite.config.ts} +3 -3
- package/dist/starters/adapters/netlify-edge/package.json +5 -4
- package/dist/starters/adapters/netlify-edge/src/entry.netlify-edge.tsx +2 -3
- package/dist/starters/adapters/node-server/adapters/node-server/{vite.config.mts → vite.config.ts} +3 -3
- package/dist/starters/adapters/node-server/package.json +3 -2
- package/dist/starters/adapters/node-server/src/entry.node-server.tsx +22 -6
- package/dist/starters/adapters/{static/adapters/static/vite.config.mts → ssg/adapters/ssg/vite.config.ts} +4 -4
- package/dist/starters/adapters/ssg/package.json +20 -0
- package/dist/starters/adapters/vercel-edge/README.md +2 -2
- package/dist/starters/adapters/vercel-edge/adapters/vercel-edge/{vite.config.mts → vite.config.ts} +3 -3
- package/dist/starters/adapters/vercel-edge/package.json +3 -2
- package/dist/starters/adapters/vercel-edge/src/entry.vercel-edge.tsx +2 -3
- package/dist/starters/adapters/vercel-edge/vercel.json +1 -1
- package/dist/starters/features/auth/package.json +1 -1
- package/dist/starters/features/compiled-i18n/package.json +37 -0
- package/dist/starters/features/compiled-i18n/src/components/locale-selector/locale-selector.tsx +30 -0
- package/dist/starters/features/compiled-i18n/src/entry.ssr.tsx +31 -0
- package/dist/starters/features/compiled-i18n/src/routes/plugin@compiled-i18n.ts +28 -0
- package/dist/starters/features/csr/index.html +27 -0
- package/dist/starters/features/csr/package.json +29 -0
- package/dist/starters/features/csr/src/root.tsx +15 -0
- package/dist/starters/features/csr/vite.config.ts +13 -0
- package/dist/starters/features/cypress/src/actions/example.action.ts +5 -0
- package/dist/starters/features/cypress/src/components/example/example.cy.tsx +50 -8
- package/dist/starters/features/cypress/src/components/example/example.tsx +13 -3
- package/dist/starters/features/cypress/src/loaders/example.loader.ts +5 -0
- package/dist/starters/features/drizzle/package.json +1 -1
- package/dist/starters/features/pandacss/package.json +1 -1
- package/dist/starters/features/postcss/postcss.config.js +1 -1
- package/dist/starters/features/storybook/.storybook/tsconfig.json +0 -1
- package/dist/starters/features/styled-vanilla-extract/package.json +2 -1
- package/dist/starters/features/tailwind/package.json +2 -2
- package/dist/starters/features/tailwind/prettier.config.js +10 -0
- package/dist/starters/features/tailwind-v3/package.json +1 -1
- package/dist/starters/features/tailwind-v3/prettier.config.js +10 -0
- package/dist/starters/features/vitest/package.json +1 -1
- package/dist/testing/index.d.ts +1000 -7
- package/dist/testing/index.mjs +16487 -11656
- package/dist/testing/package.json +1 -1
- package/dist/worker/index.d.mts +21 -0
- package/dist/worker/index.mjs +251 -0
- package/dist/worker/package.json +9 -0
- package/dist/worker/worker.js +13 -0
- package/dist/worker/worker.node.js +15 -0
- package/dist/worker/worker.shared.js +63 -0
- package/handlers.mjs +21 -1
- package/package.json +40 -56
- package/public.d.ts +14 -2
- package/{qwik-cli.cjs → qwik-cli.mjs} +1 -1
- package/server.d.ts +2 -0
- package/worker.d.ts +2 -0
- package/bindings/qwik.darwin-arm64.node +0 -0
- package/bindings/qwik.darwin-x64.node +0 -0
- package/bindings/qwik.linux-x64-gnu.node +0 -0
- package/bindings/qwik.wasm.cjs +0 -471
- package/bindings/qwik.wasm.mjs +0 -464
- package/bindings/qwik.win32-x64-msvc.node +0 -0
- package/bindings/qwik_wasm_bg.wasm +0 -0
- package/dist/build/index.cjs +0 -35
- package/dist/build/index.cjs.map +0 -7
- package/dist/build/index.dev.cjs +0 -37
- package/dist/build/index.dev.cjs.map +0 -7
- package/dist/build/index.prod.cjs +0 -37
- package/dist/build/index.prod.cjs.map +0 -7
- package/dist/cli.cjs +0 -5545
- package/dist/core.cjs +0 -11870
- package/dist/core.cjs.map +0 -1
- package/dist/core.prod.cjs +0 -5723
- package/dist/insights/index.qwik.cjs +0 -1
- package/dist/insights/vite/index.cjs +0 -1
- package/dist/loader/index.cjs +0 -4
- package/dist/optimizer.cjs +0 -4020
- package/dist/preloader.cjs +0 -269
- package/dist/server.cjs +0 -3040
- package/dist/starters/adapters/static/package.json +0 -19
- package/dist/starters/features/localize/package.json +0 -37
- package/dist/starters/features/localize/src/entry.ssr.tsx +0 -30
- package/dist/starters/features/localize/src/locales/message.en.json +0 -8
- package/dist/starters/features/localize/src/locales/message.it.json +0 -8
- package/dist/starters/features/localize/src/routes/[locale]/i18n-utils.ts +0 -94
- package/dist/starters/features/localize/src/routes/[locale]/index.tsx +0 -52
- package/dist/starters/features/localize/src/routes/[locale]/layout.tsx +0 -12
- package/dist/starters/features/playwright/playwright-report/index.html +0 -22026
- package/dist/starters/features/tailwind/.prettierrc.js +0 -3
- package/dist/testing/index.cjs +0 -33388
- /package/dist/starters/adapters/{static → ssg}/README.md +0 -0
package/dist/core-internal.d.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import * as CSS_2 from 'csstype';
|
|
1
|
+
import type { AsyncLocalStorage } from 'node:async_hooks';
|
|
2
|
+
import type * as CSS_2 from 'csstype';
|
|
3
3
|
import { isBrowser } from './build';
|
|
4
4
|
import { isDev } from './build';
|
|
5
5
|
import { isServer } from './build';
|
|
6
|
-
import {
|
|
7
|
-
import type {
|
|
8
|
-
import { ValueOrPromise as ValueOrPromise_2 } from '..';
|
|
6
|
+
import { ResolvedManifest } from './optimizer';
|
|
7
|
+
import type { ServerQwikManifest } from './optimizer';
|
|
9
8
|
|
|
10
9
|
/**
|
|
11
10
|
* Qwik Optimizer marker function.
|
|
@@ -83,23 +82,33 @@ import { ValueOrPromise as ValueOrPromise_2 } from '..';
|
|
|
83
82
|
*/
|
|
84
83
|
export declare const $: <T>(expression: T) => QRL<T>;
|
|
85
84
|
|
|
85
|
+
/**
|
|
86
|
+
* Register an external projection on a parent component VNode.
|
|
87
|
+
*
|
|
88
|
+
* Creates a new VirtualVNode that will render the given component QRL with the given props. The
|
|
89
|
+
* VNode is stored as a projection on the parent, and a low-priority cursor is added so the cursor
|
|
90
|
+
* walker will process it.
|
|
91
|
+
*
|
|
92
|
+
* Use `_setProjectionTarget` to set the DOM target element before the cursor fires.
|
|
93
|
+
*
|
|
94
|
+
* @internal
|
|
95
|
+
*/
|
|
96
|
+
export declare function _addProjection(container: _Container, parentVNode: _VirtualVNode, componentQRL: QRL<any>, props: Record<string, unknown>, slotName: string): _VirtualVNode;
|
|
97
|
+
|
|
98
|
+
declare interface AddRootFn {
|
|
99
|
+
(obj: unknown, returnRef?: never): number;
|
|
100
|
+
(obj: unknown, returnRef: true): SeenRef;
|
|
101
|
+
}
|
|
102
|
+
|
|
86
103
|
declare type AllEventKeys = keyof AllEventsMap;
|
|
87
104
|
|
|
88
|
-
declare type AllEventMapRaw =
|
|
89
|
-
qidle: QwikIdleEvent;
|
|
90
|
-
qinit: QwikInitEvent;
|
|
91
|
-
qsymbol: QwikSymbolEvent;
|
|
92
|
-
qvisible: QwikVisibleEvent;
|
|
93
|
-
qviewtransition: QwikViewTransitionEvent;
|
|
94
|
-
};
|
|
105
|
+
declare type AllEventMapRaw = QwikHTMLElementEventMap & QwikDocumentEventMap & QwikWindowEventMap;
|
|
95
106
|
|
|
96
107
|
declare type AllEventsMap = Omit<AllEventMapRaw, keyof EventCorrectionMap> & EventCorrectionMap;
|
|
97
108
|
|
|
98
109
|
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;
|
|
99
110
|
|
|
100
|
-
declare type
|
|
101
|
-
|
|
102
|
-
declare type AllSignalFlags = SignalFlags | WrappedSignalFlags | ComputedSignalFlags;
|
|
111
|
+
declare type AllSignalFlags = ComputedSignalFlags | SerializationSignalFlags | AsyncSignalFlags;
|
|
103
112
|
|
|
104
113
|
/**
|
|
105
114
|
* TS defines these with the React syntax which is not compatible with Qwik. E.g. `ariaAtomic`
|
|
@@ -357,53 +366,77 @@ declare interface AriaAttributes {
|
|
|
357
366
|
/** @public */
|
|
358
367
|
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 & {});
|
|
359
368
|
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
369
|
+
/**
|
|
370
|
+
* Note, we don't pass the generic type to ComputeCtx because it causes TypeScript to not infer the
|
|
371
|
+
* type of the resource correctly. The type is only used for the `previous` property, which is not
|
|
372
|
+
* commonly used, and can be easily cast if needed.
|
|
373
|
+
*
|
|
374
|
+
* @deprecated Use `useComputed$` with an async function instead.
|
|
375
|
+
* @public
|
|
376
|
+
*/
|
|
377
|
+
export declare type AsyncFn<T> = (ctx: ComputeCtx) => ValueOrPromise<T>;
|
|
364
378
|
|
|
365
|
-
/** @
|
|
366
|
-
|
|
379
|
+
/** @deprecated Use `ComputeQRL` instead. */
|
|
380
|
+
declare type AsyncQRL<T> = _QRLInternal<AsyncFn<T>>;
|
|
367
381
|
|
|
368
|
-
/**
|
|
369
|
-
|
|
382
|
+
/**
|
|
383
|
+
* An AsyncSignal holds the result of the given async function. If the function uses `track()` to
|
|
384
|
+
* track reactive state, and that state changes, the AsyncSignal is recalculated, and if the result
|
|
385
|
+
* changed, all tasks which are tracking the AsyncSignal will be re-run and all subscribers
|
|
386
|
+
* (components, tasks etc) that read the AsyncSignal will be updated.
|
|
387
|
+
*
|
|
388
|
+
* If the async function throws an error, the AsyncSignal will capture the error and set the `error`
|
|
389
|
+
* property. The error can be cleared by re-running the async function successfully.
|
|
390
|
+
*
|
|
391
|
+
* While the async function is running, the `.loading` property will be set to `true`. Once the
|
|
392
|
+
* function completes, `loading` will be set to `false`.
|
|
393
|
+
*
|
|
394
|
+
* If the value has not yet been resolved, reading the AsyncSignal will throw a Promise, which will
|
|
395
|
+
* retry the component or task once the value resolves.
|
|
396
|
+
*
|
|
397
|
+
* If the value has been resolved, but the async function is re-running, reading the AsyncSignal
|
|
398
|
+
* will subscribe to it and return the last resolved value until the new value is ready. As soon as
|
|
399
|
+
* the new value is ready, the subscribers will be updated.
|
|
400
|
+
*
|
|
401
|
+
* If the async function threw an error, reading the `.value` will throw that same error. Read from
|
|
402
|
+
* `.error` to check if there was an error.
|
|
403
|
+
*
|
|
404
|
+
* @deprecated Use `ComputedSignal` instead, it has async support now.
|
|
405
|
+
* @public
|
|
406
|
+
*/
|
|
407
|
+
export declare type AsyncSignal<T = unknown> = ComputedSignal<T>;
|
|
408
|
+
|
|
409
|
+
declare const enum AsyncSignalFlags {
|
|
410
|
+
EAGER_CLEANUP = 32,
|
|
411
|
+
CLIENT_ONLY = 64,
|
|
412
|
+
/** The compute fn is async: the async engine (jobs, loading, error) is active */
|
|
413
|
+
ASYNC_MODE = 512,
|
|
414
|
+
/** Invoke the compute fn AsyncSignal-style: pass the ComputeCtx argument, no auto-tracking */
|
|
415
|
+
CTX_ARG = 1024
|
|
370
416
|
}
|
|
371
417
|
|
|
372
|
-
/** @public */
|
|
373
|
-
export declare type AsyncComputedReturnType<T> = T extends Promise<infer T> ? AsyncComputedReadonlySignal<T> : AsyncComputedReadonlySignal<T>;
|
|
374
|
-
|
|
375
418
|
/**
|
|
376
419
|
* # ================================
|
|
377
420
|
*
|
|
378
|
-
*
|
|
421
|
+
* AsyncSignalImpl
|
|
379
422
|
*
|
|
380
423
|
* # ================================
|
|
424
|
+
*
|
|
425
|
+
* The async engine (jobs, loading, error) lives in ComputedSignalImpl; this subclass configures it
|
|
426
|
+
* from options and switches the compute invocation to CTX_ARG mode: the compute fn receives the
|
|
427
|
+
* ComputeCtx argument and tracks only via its explicit `track()` (no auto-tracking).
|
|
428
|
+
*
|
|
429
|
+
* @internal
|
|
381
430
|
*/
|
|
382
|
-
declare class
|
|
383
|
-
|
|
384
|
-
$untrackedError$: Error | null;
|
|
385
|
-
$loadingEffects$: null | Set<EffectSubscription>;
|
|
386
|
-
$errorEffects$: null | Set<EffectSubscription>;
|
|
387
|
-
$destroy$: NoSerialize<() => void> | null;
|
|
388
|
-
private $promiseValue$;
|
|
389
|
-
[_EFFECT_BACK_REF]: Map<EffectProperty | string, EffectSubscription> | null;
|
|
390
|
-
constructor(container: Container | null, fn: AsyncComputeQRL<T>, flags?: SignalFlags | ComputedSignalFlags);
|
|
391
|
-
/**
|
|
392
|
-
* Loading is true if the signal is still waiting for the promise to resolve, false if the promise
|
|
393
|
-
* has resolved or rejected.
|
|
394
|
-
*/
|
|
395
|
-
get loading(): boolean;
|
|
396
|
-
set untrackedLoading(value: boolean);
|
|
397
|
-
get untrackedLoading(): boolean;
|
|
398
|
-
/** The error that occurred when the signal was resolved. */
|
|
399
|
-
get error(): Error | null;
|
|
400
|
-
set untrackedError(value: Error | null);
|
|
401
|
-
get untrackedError(): Error | null;
|
|
402
|
-
invalidate(): void;
|
|
403
|
-
$computeIfNeeded$(): boolean;
|
|
431
|
+
export declare class _AsyncSignalImpl<T> extends ComputedSignalImpl<T, AsyncQRL<T>> implements AsyncSignal<T> {
|
|
432
|
+
constructor(container: _Container | null, fn: AsyncQRL<T>, flags?: number, options?: AsyncSignalOptions<T>);
|
|
404
433
|
}
|
|
405
434
|
|
|
406
|
-
|
|
435
|
+
/**
|
|
436
|
+
* @deprecated Use `ComputedOptions` instead.
|
|
437
|
+
* @public
|
|
438
|
+
*/
|
|
439
|
+
export declare type AsyncSignalOptions<T> = ComputedOptions<T>;
|
|
407
440
|
|
|
408
441
|
/**
|
|
409
442
|
* Replace given element's props with custom types and return all props specific to the element. Use
|
|
@@ -415,7 +448,7 @@ declare type Augmented<E, A = {}> = Prettify<Filtered<E, A> & A>;
|
|
|
415
448
|
|
|
416
449
|
/** Class for back reference to the EffectSubscription */
|
|
417
450
|
declare abstract class BackRef {
|
|
418
|
-
[_EFFECT_BACK_REF]: Map<
|
|
451
|
+
[_EFFECT_BACK_REF]: Map<any, any> | undefined;
|
|
419
452
|
}
|
|
420
453
|
|
|
421
454
|
declare type BivariantQrlFn<ARGS extends any[], RETURN> = {
|
|
@@ -431,21 +464,39 @@ declare type BivariantQrlFn<ARGS extends any[], RETURN> = {
|
|
|
431
464
|
/** @public */
|
|
432
465
|
declare type Booleanish = boolean | `${boolean}`;
|
|
433
466
|
|
|
434
|
-
declare
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
467
|
+
declare type Capture = {
|
|
468
|
+
[K in keyof HTMLElementEventMap as `capture:${K}`]?: boolean;
|
|
469
|
+
};
|
|
470
|
+
|
|
471
|
+
/**
|
|
472
|
+
* The current captured scope during QRL invocation. This is used to provide the lexical scope for
|
|
473
|
+
* QRL functions. It is used one time per invocation, synchronously, so it is safe to store it in
|
|
474
|
+
* module scope.
|
|
475
|
+
*
|
|
476
|
+
* @internal
|
|
477
|
+
*/
|
|
478
|
+
export declare let _captures: Readonly<unknown[]> | null;
|
|
479
|
+
|
|
480
|
+
/**
|
|
481
|
+
* Handles events for bind:checked
|
|
482
|
+
*
|
|
483
|
+
* @internal
|
|
484
|
+
*/
|
|
485
|
+
export declare function _chk(this: string | undefined, _: any, element: HTMLInputElement): void | Promise<void>;
|
|
486
|
+
|
|
487
|
+
declare const enum ChoreBits {
|
|
488
|
+
NONE = 0,
|
|
489
|
+
TASKS = 1,
|
|
490
|
+
NODE_DIFF = 2,
|
|
491
|
+
COMPONENT = 4,
|
|
492
|
+
INLINE_COMPONENT = 8,
|
|
493
|
+
NODE_PROPS = 16,
|
|
494
|
+
COMPUTE = 32,
|
|
495
|
+
CHILDREN = 64,
|
|
496
|
+
CLEANUP = 128,
|
|
497
|
+
RECONCILE = 256,
|
|
498
|
+
ERROR_WRAP = 512,
|
|
499
|
+
DIRTY_MASK = 1023
|
|
449
500
|
}
|
|
450
501
|
|
|
451
502
|
/**
|
|
@@ -461,18 +512,17 @@ declare const enum ChoreType {
|
|
|
461
512
|
export declare type ClassList = string | undefined | null | false | Record<string, boolean | string | number | null | undefined> | ClassList[];
|
|
462
513
|
|
|
463
514
|
/** @internal */
|
|
464
|
-
export declare interface ClientContainer extends
|
|
515
|
+
export declare interface ClientContainer extends _Container {
|
|
465
516
|
document: _QDocument;
|
|
466
517
|
element: _ContainerElement;
|
|
467
518
|
qContainer: string;
|
|
468
519
|
$locale$: string;
|
|
469
520
|
qManifestHash: string;
|
|
470
521
|
rootVNode: _ElementVNode;
|
|
471
|
-
$
|
|
472
|
-
|
|
473
|
-
$forwardRefs$: Array<number> | null;
|
|
474
|
-
$initialQRLsIndexes$: Array<number> | null;
|
|
522
|
+
$forwardRefs$: Array<number | string> | null;
|
|
523
|
+
vNodeLocate(id: string | Element): _VNode;
|
|
475
524
|
parseQRL<T = unknown>(qrl: string): QRL<T>;
|
|
525
|
+
$getForwardRef$(id: number): number | string | undefined;
|
|
476
526
|
$setRawState$(id: number, vParent: _ElementVNode | _VirtualVNode): void;
|
|
477
527
|
}
|
|
478
528
|
|
|
@@ -499,11 +549,11 @@ export declare interface ClientContainer extends Container {
|
|
|
499
549
|
* step?: number;
|
|
500
550
|
* }
|
|
501
551
|
* export const Counter = component$((props: CounterProps) => {
|
|
502
|
-
* const state =
|
|
552
|
+
* const state = useSignal(props.initialValue || 0);
|
|
503
553
|
* return (
|
|
504
554
|
* <div>
|
|
505
|
-
* <span>{state.
|
|
506
|
-
* <button onClick$={() => (state.
|
|
555
|
+
* <span>{state.value}</span>
|
|
556
|
+
* <button onClick$={() => (state.value += props.step || 1)}>+</button>
|
|
507
557
|
* </div>
|
|
508
558
|
* );
|
|
509
559
|
* });
|
|
@@ -558,26 +608,84 @@ declare type ComponentChildren<PROPS> = PROPS extends {
|
|
|
558
608
|
children?: JSXChildren;
|
|
559
609
|
};
|
|
560
610
|
|
|
561
|
-
/** @public */
|
|
562
|
-
declare interface ComponentEntryStrategy {
|
|
563
|
-
type: 'component';
|
|
564
|
-
manual?: Record<string, string>;
|
|
565
|
-
}
|
|
566
|
-
|
|
567
611
|
/** @internal */
|
|
568
612
|
export declare const componentQrl: <PROPS extends Record<any, any>>(componentQrl: QRL<OnRenderFn<PROPS>>) => Component<PROPS>;
|
|
569
613
|
|
|
570
|
-
|
|
571
|
-
|
|
614
|
+
declare type ComputeCtx<T = unknown> = {
|
|
615
|
+
/**
|
|
616
|
+
* Track reactive reads so the computation re-runs when they change. Computed functions track
|
|
617
|
+
* synchronous reads automatically, but after the first `await` the tracking context is lost, so
|
|
618
|
+
* later reads must go through `track()`.
|
|
619
|
+
*/
|
|
620
|
+
readonly track: Tracker;
|
|
621
|
+
/**
|
|
622
|
+
* Register a cleanup callback to be called when the async computation is aborted or completed.
|
|
623
|
+
* The next invocation will await the previous cleanup. If you do not want this, do not return a
|
|
624
|
+
* Promise.
|
|
625
|
+
*/
|
|
626
|
+
cleanup: (callback: () => void | Promise<void>) => void;
|
|
627
|
+
/**
|
|
628
|
+
* A lazily created AbortSignal, for interrupting the async computation when needed, e.g. when the
|
|
629
|
+
* component is unmounted or the computation is invalidated. Pass it to `fetch` or other APIs that
|
|
630
|
+
* support it to ensure that unnecessary work is not performed.
|
|
631
|
+
*/
|
|
632
|
+
readonly abortSignal: AbortSignal;
|
|
633
|
+
/** The result of the previous computation, if any */
|
|
634
|
+
readonly previous: T | undefined;
|
|
635
|
+
/** Extra info passed to `invalidate(info)` for this computation, if any. */
|
|
636
|
+
readonly info?: unknown;
|
|
637
|
+
};
|
|
638
|
+
|
|
639
|
+
/**
|
|
640
|
+
* The compute function. The context provides `track()`, `previous` (the last computed value),
|
|
641
|
+
* `info` (the argument of the `invalidate(info)` call that triggered this computation), `cleanup()`
|
|
642
|
+
* and `abortSignal`. Synchronous reactive state reads are tracked automatically, use `untrack()` to
|
|
643
|
+
* read signals without tracking. Return a `Promise` (or use an `async` function) for async values.
|
|
644
|
+
* After the first `await`, reads are no longer tracked automatically and must use `track()`.
|
|
645
|
+
*
|
|
646
|
+
* @public
|
|
647
|
+
*/
|
|
648
|
+
export declare type ComputedFn<T> = (ctx: ComputeCtx) => ValueOrPromise<T>;
|
|
572
649
|
|
|
573
650
|
/** @public */
|
|
574
|
-
export declare interface ComputedOptions {
|
|
651
|
+
export declare interface ComputedOptions<T = unknown> {
|
|
575
652
|
serializationStrategy?: SerializationStrategy;
|
|
576
|
-
container?:
|
|
653
|
+
container?: _Container;
|
|
654
|
+
/** Like useSignal's `initial`; prevents the throw on first read when uninitialized */
|
|
655
|
+
initial?: Awaited<T> | (() => Awaited<T>);
|
|
656
|
+
/**
|
|
657
|
+
* Maximum number of concurrent computations. Use `0` for unlimited.
|
|
658
|
+
*
|
|
659
|
+
* Defaults to `1`.
|
|
660
|
+
*/
|
|
661
|
+
concurrency?: number;
|
|
662
|
+
/**
|
|
663
|
+
* When subscribers drop to 0, run cleanup in the next tick, instead of waiting for the function
|
|
664
|
+
* inputs to change.
|
|
665
|
+
*
|
|
666
|
+
* Defaults to `false`, meaning cleanup happens only when inputs change.
|
|
667
|
+
*/
|
|
668
|
+
eagerCleanup?: boolean;
|
|
669
|
+
/**
|
|
670
|
+
* When true, the async computation is postponed to the browser. On SSR, the signal remains
|
|
671
|
+
* INVALID and does not execute the function. On the client, it will compute on first read.
|
|
672
|
+
*
|
|
673
|
+
* Defaults to `false`.
|
|
674
|
+
*/
|
|
675
|
+
clientOnly?: boolean;
|
|
676
|
+
/**
|
|
677
|
+
* Maximum time in milliseconds to wait for the async computation to complete. If exceeded, the
|
|
678
|
+
* computation is aborted and an error is thrown.
|
|
679
|
+
*
|
|
680
|
+
* If `0`, no timeout is applied.
|
|
681
|
+
*
|
|
682
|
+
* Defaults to `0`.
|
|
683
|
+
*/
|
|
684
|
+
timeout?: number;
|
|
577
685
|
}
|
|
578
686
|
|
|
579
687
|
/** @public */
|
|
580
|
-
export declare type ComputedReturnType<T> =
|
|
688
|
+
export declare type ComputedReturnType<T> = ComputedSignal<Awaited<T>>;
|
|
581
689
|
|
|
582
690
|
/**
|
|
583
691
|
* A computed signal is a signal which is calculated from other signals. When the signals change,
|
|
@@ -586,54 +694,182 @@ export declare type ComputedReturnType<T> = T extends Promise<any> ? never : Com
|
|
|
586
694
|
*
|
|
587
695
|
* @public
|
|
588
696
|
*/
|
|
589
|
-
export declare interface ComputedSignal<T> extends
|
|
697
|
+
export declare interface ComputedSignal<T> extends Signal<T> {
|
|
698
|
+
/** @deprecated Use `trigger()` instead */
|
|
699
|
+
force(): void;
|
|
700
|
+
/** Use this to force recalculation. */
|
|
701
|
+
invalidate(): void;
|
|
590
702
|
/**
|
|
591
|
-
*
|
|
592
|
-
*
|
|
703
|
+
* Clear the value and recompute. Unlike `invalidate()`, readers see the loading state (reads
|
|
704
|
+
* throw the computation promise) instead of the stale value while the new value computes.
|
|
593
705
|
*/
|
|
594
|
-
|
|
706
|
+
clear(): void;
|
|
595
707
|
/**
|
|
596
|
-
*
|
|
597
|
-
*
|
|
708
|
+
* Whether the signal is currently loading. This will trigger lazy computation of the signal, so
|
|
709
|
+
* you can use it like this:
|
|
710
|
+
*
|
|
711
|
+
* ```tsx
|
|
712
|
+
* signal.pending ? <Loading /> : signal.error ? <Error /> : <Component
|
|
713
|
+
* value={signal.value} />
|
|
714
|
+
* ```
|
|
598
715
|
*/
|
|
599
|
-
|
|
716
|
+
pending: boolean;
|
|
717
|
+
/**
|
|
718
|
+
* Lets you read the pending state without subscribing to `.pending` updates. It also triggers
|
|
719
|
+
* lazy computation of the signal.
|
|
720
|
+
*
|
|
721
|
+
* Setting it will trigger listeners for `.pending`.
|
|
722
|
+
*/
|
|
723
|
+
untrackedPending: boolean;
|
|
724
|
+
/** @deprecated Use `pending` instead */
|
|
725
|
+
loading: boolean;
|
|
726
|
+
/** @deprecated Use `untrackedPending` instead */
|
|
727
|
+
untrackedLoading: boolean;
|
|
728
|
+
/**
|
|
729
|
+
* The error that occurred while computing the signal, if any, including synchronous throws. This
|
|
730
|
+
* will be cleared when the signal is successfully computed. It also triggers lazy computation of
|
|
731
|
+
* the signal. While the error is set, reading `.value` throws it.
|
|
732
|
+
*/
|
|
733
|
+
error: Error | undefined;
|
|
734
|
+
/**
|
|
735
|
+
* Lets you read the error state without subscribing to `.error` updates. It also triggers lazy
|
|
736
|
+
* computation of the signal.
|
|
737
|
+
*
|
|
738
|
+
* Setting it will trigger listeners for `.error`.
|
|
739
|
+
*/
|
|
740
|
+
untrackedError: Error | undefined;
|
|
741
|
+
/** A promise that resolves when the value is computed or rejected. */
|
|
742
|
+
promise(): Promise<void>;
|
|
743
|
+
/** Abort the current computation and run cleanups if needed. */
|
|
744
|
+
abort(reason?: any): void;
|
|
745
|
+
/**
|
|
746
|
+
* Use this to force recalculation. If you pass `info`, it will be provided to the calculation
|
|
747
|
+
* function.
|
|
748
|
+
*/
|
|
749
|
+
invalidate(info?: unknown): void;
|
|
600
750
|
}
|
|
601
751
|
|
|
602
752
|
declare const enum ComputedSignalFlags {
|
|
603
|
-
|
|
604
|
-
|
|
753
|
+
INVALID = 1,
|
|
754
|
+
RUN_EFFECTS = 2,
|
|
755
|
+
PRESERVE_ON_SEQ_CLEANUP = 4
|
|
605
756
|
}
|
|
606
757
|
|
|
607
758
|
/**
|
|
608
759
|
* A signal which is computed from other signals.
|
|
609
760
|
*
|
|
610
|
-
*
|
|
761
|
+
* Sync compute functions resolve synchronously and every read they perform is auto-tracked. When
|
|
762
|
+
* the compute function turns out to be async (it returned a promise), the signal lazily switches on
|
|
763
|
+
* the async engine — jobs, `loading`, `error` — giving it the same API as an AsyncSignal.
|
|
764
|
+
* Auto-tracking only covers reads before the first await point (the invoke context is lost after
|
|
765
|
+
* it); later reads must use the ComputeCtx `track()`.
|
|
611
766
|
*/
|
|
612
|
-
declare class ComputedSignalImpl<T, S extends
|
|
767
|
+
declare class ComputedSignalImpl<T, S extends _QRLInternal = ComputeQRL<T>> extends SignalImpl<T> implements BackRef {
|
|
613
768
|
/**
|
|
614
769
|
* The compute function is stored here.
|
|
615
770
|
*
|
|
616
|
-
*
|
|
617
|
-
* resolve the QRL during the mark dirty phase so that any call to it will be synchronous).
|
|
771
|
+
* Sync computed functions must be executed synchronously (because of this we need to eagerly
|
|
772
|
+
* resolve the QRL during the mark dirty phase so that any call to it will be synchronous).
|
|
618
773
|
*/
|
|
619
774
|
$computeQrl$: S;
|
|
620
|
-
$flags$:
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
775
|
+
$flags$: number;
|
|
776
|
+
[_EFFECT_BACK_REF]: Map<_EffectProperty | string, EffectSubscription> | undefined;
|
|
777
|
+
$untrackedPending$: boolean | undefined;
|
|
778
|
+
$untrackedError$: Error | undefined;
|
|
779
|
+
$current$: Job<T> | null | undefined;
|
|
780
|
+
$jobs$: Job<T>[] | undefined;
|
|
781
|
+
$concurrency$: number | undefined;
|
|
782
|
+
$timeoutMs$: number | undefined;
|
|
783
|
+
$loadingEffects$: undefined | Set<EffectSubscription>;
|
|
784
|
+
$errorEffects$: undefined | Set<EffectSubscription>;
|
|
785
|
+
$computationTimeoutId$: ReturnType<typeof setTimeout> | undefined;
|
|
786
|
+
$info$: unknown | undefined;
|
|
787
|
+
$infoVersion$: number | undefined;
|
|
788
|
+
constructor(container: _Container | null, fn: S, flags?: number, options?: ComputedOptions<T>);
|
|
789
|
+
/** Clear the value so readers see the loading state, then recompute. */
|
|
790
|
+
clear(): void;
|
|
791
|
+
invalidate(info?: unknown): void;
|
|
625
792
|
/**
|
|
626
|
-
*
|
|
627
|
-
*
|
|
793
|
+
* Read the value, subscribing if in a tracking context. Triggers computation if needed.
|
|
794
|
+
*
|
|
795
|
+
* Setting the value will mark the signal as not loading and clear any error, and prevent any
|
|
796
|
+
* pending computations from writing their results.
|
|
797
|
+
*
|
|
798
|
+
* If you want to set the value without affecting loading or error state, set `untrackedValue`
|
|
799
|
+
* instead and make sure to trigger effects manually if needed.
|
|
800
|
+
*
|
|
801
|
+
* If you want to abort pending computations when setting, you have to call `abort()` manually.
|
|
628
802
|
*/
|
|
629
|
-
|
|
803
|
+
get value(): T;
|
|
804
|
+
set value(value: T);
|
|
630
805
|
get untrackedValue(): T;
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
806
|
+
set untrackedValue(value: T);
|
|
807
|
+
/**
|
|
808
|
+
* Loading is true if the signal is still waiting for the promise to resolve, false if the promise
|
|
809
|
+
* has resolved or rejected (or the compute function is synchronous).
|
|
810
|
+
*
|
|
811
|
+
* Accessing `.pending` will trigger computation if needed, since it's often used like
|
|
812
|
+
*
|
|
813
|
+
* ```ts
|
|
814
|
+
* signal.pending ? <Loading /> : signal.value
|
|
815
|
+
* ```
|
|
816
|
+
*/
|
|
817
|
+
get pending(): boolean;
|
|
818
|
+
set untrackedPending(value: boolean);
|
|
819
|
+
get untrackedPending(): boolean;
|
|
820
|
+
/** @deprecated Use `pending` instead */
|
|
821
|
+
get loading(): boolean;
|
|
822
|
+
/** @deprecated Use `untrackedPending` instead */
|
|
823
|
+
get untrackedLoading(): boolean;
|
|
824
|
+
set untrackedLoading(value: boolean);
|
|
825
|
+
/**
|
|
826
|
+
* The error the compute function threw or rejected with.
|
|
827
|
+
*
|
|
828
|
+
* Accessing .error will trigger computation if needed, since it's often used like
|
|
829
|
+
*
|
|
830
|
+
* ```ts
|
|
831
|
+
* signal.error ? <Failed /> : signal.value
|
|
832
|
+
* ```
|
|
833
|
+
*/
|
|
834
|
+
get error(): Error | undefined;
|
|
835
|
+
set untrackedError(value: Error | undefined);
|
|
836
|
+
get untrackedError(): Error | undefined;
|
|
837
|
+
$setInvalid$(allowRecalc: boolean): void;
|
|
838
|
+
/** Abort the current computation and run cleanups if needed. */
|
|
839
|
+
abort(reason?: any): void;
|
|
840
|
+
/** Schedule eager cleanup on next macro task if no subscribers remain. */
|
|
841
|
+
$scheduleEagerCleanup$(): void;
|
|
842
|
+
/** Returns a promise resolves when the signal finished computing. */
|
|
843
|
+
promise(): Promise<void>;
|
|
844
|
+
/** Run the computation if needed */
|
|
845
|
+
$computeIfNeeded$(): void;
|
|
846
|
+
/**
|
|
847
|
+
* Invoke the compute fn with the ComputeCtx argument. CTX_ARG signals (useAsync$, useResource$)
|
|
848
|
+
* only track via its explicit track(). Computeds auto-track every synchronous read instead; after
|
|
849
|
+
* the first await they must use the explicit track() too.
|
|
850
|
+
*/
|
|
851
|
+
$invokeComputeFn$(fn: Function, job: Job<T>): T | Promise<T>;
|
|
852
|
+
/** Start an async computation (the async engine; assumes the INVALID flag is set) */
|
|
853
|
+
$computeAsync$(): void;
|
|
854
|
+
$runComputation$(running: Job<T>): Promise<void>;
|
|
855
|
+
/** Await the computation and publish its result, error, and loading transitions. */
|
|
856
|
+
$settleComputation$(running: Job<T>, compute: () => ValueOrPromise<T>): Promise<void>;
|
|
857
|
+
/**
|
|
858
|
+
* Sets the error from the given job. We only accept errors from the current job and we ignore
|
|
859
|
+
* AbortErrors.
|
|
860
|
+
*/
|
|
861
|
+
$setError$(job: Job<T>, error: Error): void;
|
|
862
|
+
/** Called after SSR/unmount */
|
|
863
|
+
$destroy$(): Promise<void>;
|
|
864
|
+
private $hasSubscribers$;
|
|
865
|
+
$requestCleanups$(job: Job<T>, reason?: any): void;
|
|
866
|
+
/** Run a job's cleanup callbacks, returning a promise when any of them are async. */
|
|
867
|
+
$runCleanupCallbacks$(job: Job<T>): Promise<void> | undefined;
|
|
868
|
+
/** Clean up and trigger signal compute once complete */
|
|
869
|
+
$runCleanups$(job: Job<T>): Promise<void> | undefined;
|
|
634
870
|
}
|
|
635
871
|
|
|
636
|
-
declare type ComputeQRL<T> =
|
|
872
|
+
declare type ComputeQRL<T> = _QRLInternal<ComputedFn<T>>;
|
|
637
873
|
|
|
638
874
|
/** @internal */
|
|
639
875
|
export declare const _CONST_PROPS: unique symbol;
|
|
@@ -647,24 +883,31 @@ export declare const _CONST_PROPS: unique symbol;
|
|
|
647
883
|
* - `VNode` and `ISsrNode`: Either a component or `<Signal>`
|
|
648
884
|
* - `Signal2`: A derived signal which contains a computation function.
|
|
649
885
|
*/
|
|
650
|
-
declare type Consumer =
|
|
886
|
+
declare type Consumer = _Task | _VNode | SignalImpl | ISsrNode;
|
|
651
887
|
|
|
652
|
-
|
|
888
|
+
/** @internal */
|
|
889
|
+
export declare interface _Container {
|
|
653
890
|
readonly $version$: string;
|
|
654
|
-
readonly $scheduler$: Scheduler;
|
|
655
891
|
readonly $storeProxyMap$: ObjToProxyMap;
|
|
892
|
+
$rootContainer$: _Container | null;
|
|
893
|
+
$isOutOfOrderSegment$: boolean;
|
|
656
894
|
readonly $locale$: string;
|
|
657
895
|
readonly $getObjectById$: (id: number | string) => any;
|
|
658
896
|
readonly $serverData$: Record<string, any>;
|
|
897
|
+
readonly $instanceHash$: string | null;
|
|
659
898
|
$currentUniqueId$: number;
|
|
660
899
|
$buildBase$: string | null;
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
900
|
+
$renderPromise$: Promise<void> | null;
|
|
901
|
+
$resolveRenderPromise$: (() => void) | null;
|
|
902
|
+
$pendingCount$: number;
|
|
903
|
+
$checkPendingCount$(): void;
|
|
904
|
+
handleError(err: any, $host$: _HostElement | null): void;
|
|
905
|
+
getParentHost(host: _HostElement): _HostElement | null;
|
|
906
|
+
setContext<T>(host: _HostElement, context: ContextId<T>, value: T): void;
|
|
907
|
+
resolveContext<T>(host: _HostElement, contextId: ContextId<T>): T | undefined;
|
|
908
|
+
setHostProp<T>(host: _HostElement, name: string, value: T): void;
|
|
909
|
+
getHostProp<T>(host: _HostElement, name: string): T | null;
|
|
910
|
+
$appendStyle$(content: string, styleId: string, host: _HostElement, scoped: boolean): void;
|
|
668
911
|
/**
|
|
669
912
|
* When component is about to be executed, it may add/remove children. This can cause problems
|
|
670
913
|
* with the projection because deleting content will prevent the projection references from
|
|
@@ -673,7 +916,7 @@ declare interface Container {
|
|
|
673
916
|
*
|
|
674
917
|
* @param renderHost - Host element to ensure projection is resolved.
|
|
675
918
|
*/
|
|
676
|
-
ensureProjectionResolved(host:
|
|
919
|
+
ensureProjectionResolved(host: _HostElement): void;
|
|
677
920
|
serializationCtxFactory(NodeConstructor: {
|
|
678
921
|
new (...rest: any[]): {
|
|
679
922
|
__brand__: 'SsrNode';
|
|
@@ -685,6 +928,13 @@ declare interface Container {
|
|
|
685
928
|
} | null, symbolToChunkResolver: SymbolToChunkResolver, writer?: StreamWriter): SerializationContext;
|
|
686
929
|
}
|
|
687
930
|
|
|
931
|
+
declare const enum ContainerDataProcessState {
|
|
932
|
+
NotStarted = 0,
|
|
933
|
+
ProcessingVNode = 1,
|
|
934
|
+
ProcessingState = 2,
|
|
935
|
+
ProcessingStateDone = 3
|
|
936
|
+
}
|
|
937
|
+
|
|
688
938
|
/** @internal */
|
|
689
939
|
export declare interface _ContainerElement extends HTMLElement {
|
|
690
940
|
qContainer?: ClientContainer;
|
|
@@ -702,6 +952,9 @@ export declare interface _ContainerElement extends HTMLElement {
|
|
|
702
952
|
qVNodeRefs?: Map<number, Element | _ElementVNode>;
|
|
703
953
|
/** String from `<script type="qwik/vnode">` tag. */
|
|
704
954
|
qVnodeData?: string;
|
|
955
|
+
qDestroy?: () => void;
|
|
956
|
+
/** Segment-local strings from `<script type="qwik/vnode" q:r="...">` tags. */
|
|
957
|
+
qSegmentVnodeData?: Map<string, string>;
|
|
705
958
|
}
|
|
706
959
|
|
|
707
960
|
/**
|
|
@@ -802,19 +1055,13 @@ export declare interface CorePlatform {
|
|
|
802
1055
|
* @param symbol - The name of the symbol to import.
|
|
803
1056
|
* @returns A promise that resolves to the imported symbol.
|
|
804
1057
|
*/
|
|
805
|
-
importSymbol: (containerEl: Element | undefined, url: string | URL | undefined | null, symbol: string) => ValueOrPromise<
|
|
1058
|
+
importSymbol: (containerEl: Element | undefined, url: string | URL | undefined | null, symbol: string) => ValueOrPromise<unknown>;
|
|
806
1059
|
/**
|
|
807
1060
|
* Perform operation on next request-animation-frame.
|
|
808
1061
|
*
|
|
809
1062
|
* @param fn - The function to call when the next animation frame is ready.
|
|
810
1063
|
*/
|
|
811
1064
|
raf: (fn: () => any) => Promise<any>;
|
|
812
|
-
/**
|
|
813
|
-
* Perform operation on next tick.
|
|
814
|
-
*
|
|
815
|
-
* @param fn - The function to call when the tick is ready.
|
|
816
|
-
*/
|
|
817
|
-
nextTick: (fn: () => any) => Promise<any>;
|
|
818
1065
|
/**
|
|
819
1066
|
* Retrieve chunk name for the symbol.
|
|
820
1067
|
*
|
|
@@ -837,19 +1084,16 @@ export declare interface CorrectedToggleEvent extends Event {
|
|
|
837
1084
|
}
|
|
838
1085
|
|
|
839
1086
|
/**
|
|
840
|
-
* Create
|
|
841
|
-
*
|
|
842
|
-
* computed signal is recalculated.
|
|
843
|
-
*
|
|
844
|
-
* The QRL must be a function which returns the value of the signal. The function must not have side
|
|
845
|
-
* effects, and it can be async.
|
|
1087
|
+
* Create a signal holding a `.value` which is calculated from the given async function (QRL). The
|
|
1088
|
+
* standalone version of `useAsync$`.
|
|
846
1089
|
*
|
|
1090
|
+
* @deprecated Use `createComputed$` instead, it has async support now.
|
|
847
1091
|
* @public
|
|
848
1092
|
*/
|
|
849
|
-
export declare const
|
|
1093
|
+
export declare const createAsync$: <T>(qrl: (arg: ComputeCtx<T>) => Promise<T>, options?: AsyncSignalOptions<T>) => AsyncSignal<T>;
|
|
850
1094
|
|
|
851
1095
|
/** @internal */
|
|
852
|
-
export declare const
|
|
1096
|
+
export declare const createAsyncQrl: <T>(qrl: QRL<AsyncFn<T>>, options?: AsyncSignalOptions<T>) => _AsyncSignalImpl<T>;
|
|
853
1097
|
|
|
854
1098
|
/**
|
|
855
1099
|
* Create a computed signal which is calculated from the given QRL. A computed signal is a signal
|
|
@@ -857,16 +1101,17 @@ export declare const createAsyncComputedQrl: <T>(qrl: QRL<(ctx: AsyncComputedCtx
|
|
|
857
1101
|
* recalculated.
|
|
858
1102
|
*
|
|
859
1103
|
* The QRL must be a function which returns the value of the signal. The function must not have side
|
|
860
|
-
* effects
|
|
861
|
-
*
|
|
862
|
-
*
|
|
1104
|
+
* effects. Every synchronous signal or store read is tracked automatically; reads after the first
|
|
1105
|
+
* `await` must use the `track()` provided on the context argument. When the function is async, the
|
|
1106
|
+
* returned signal exposes the async API (`.pending`, `.error`, `.promise()`), and reading an
|
|
1107
|
+
* unresolved `.value` throws the computation promise.
|
|
863
1108
|
*
|
|
864
1109
|
* @public
|
|
865
1110
|
*/
|
|
866
|
-
export declare const createComputed$: <T>(qrl: () => T
|
|
1111
|
+
export declare const createComputed$: <T>(qrl: (ctx: ComputeCtx) => ValueOrPromise<T>, options?: ComputedOptions<T>) => ComputedReturnType<T>;
|
|
867
1112
|
|
|
868
1113
|
/** @internal */
|
|
869
|
-
export declare const createComputedQrl: <T>(qrl: QRL<
|
|
1114
|
+
export declare const createComputedQrl: <T>(qrl: QRL<ComputedFn<T>>, options?: ComputedOptions<T>) => ComputedSignalImpl<T>;
|
|
870
1115
|
|
|
871
1116
|
/**
|
|
872
1117
|
* Create a context ID to be used in your application. The name should be written with no spaces.
|
|
@@ -920,18 +1165,23 @@ export declare const createComputedQrl: <T>(qrl: QRL<() => T>, options?: Compute
|
|
|
920
1165
|
*/
|
|
921
1166
|
export declare const createContextId: <STATE = unknown>(name: string) => ContextId<STATE>;
|
|
922
1167
|
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
1168
|
+
/** @internal */
|
|
1169
|
+
export declare function _createDeserializeContainer(stateData: unknown[]): DeserializeContainer;
|
|
1170
|
+
|
|
1171
|
+
/**
|
|
1172
|
+
* Creates a QRL instance to represent a lazily loaded value. Normally this is a function, but it
|
|
1173
|
+
* can be any value.
|
|
1174
|
+
*
|
|
1175
|
+
* When the value is a function, calling the returned qrl will load the underlying code when
|
|
1176
|
+
* invoked, and call it with the captured scope. This always returns a promise since the code may
|
|
1177
|
+
* not be loaded yet.
|
|
1178
|
+
*
|
|
1179
|
+
* To get the underlying function without invoking it, await `qrl.resolve()` and then `qrl.resolved`
|
|
1180
|
+
* holds the loaded function, wrapped with the captured scope.
|
|
1181
|
+
*
|
|
1182
|
+
* @internal
|
|
1183
|
+
*/
|
|
1184
|
+
export declare const _createQRL: <TYPE>(chunk: string | null, symbol: string, symbolRef?: null | ValueOrPromise<TYPE>, symbolFn?: null | (() => Promise<Record<string, TYPE>>), captures?: QrlCaptures, container?: _Container) => _QRLInternal<TYPE>;
|
|
935
1185
|
|
|
936
1186
|
/**
|
|
937
1187
|
* Create a signal that holds a custom serializable value. See {@link useSerializer$} for more
|
|
@@ -959,6 +1209,9 @@ export declare const createSignal: {
|
|
|
959
1209
|
<T>(value: T): Signal<T>;
|
|
960
1210
|
};
|
|
961
1211
|
|
|
1212
|
+
/** @internal */
|
|
1213
|
+
export declare function _createStore<T extends object>(container: _Container | null | undefined, obj: T, flags: _StoreFlags): T;
|
|
1214
|
+
|
|
962
1215
|
/** @public */
|
|
963
1216
|
export declare interface CSSProperties extends CSS_2.Properties<string | number>, CSS_2.PropertiesHyphen<string | number> {
|
|
964
1217
|
/**
|
|
@@ -971,34 +1224,34 @@ export declare interface CSSProperties extends CSS_2.Properties<string | number>
|
|
|
971
1224
|
[v: `--${string}`]: string | number | undefined;
|
|
972
1225
|
}
|
|
973
1226
|
|
|
974
|
-
/** @
|
|
975
|
-
declare
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
$state$: B | undefined;
|
|
981
|
-
$destroy$: NoSerialize<() => void> | null;
|
|
1227
|
+
/** @internal */
|
|
1228
|
+
export declare const _delay: (timeout: number) => Promise<unknown>;
|
|
1229
|
+
|
|
1230
|
+
declare class DeleteOperation {
|
|
1231
|
+
target: Element | Text;
|
|
1232
|
+
constructor(target: Element | Text);
|
|
982
1233
|
}
|
|
983
1234
|
|
|
984
1235
|
/**
|
|
985
|
-
* Deserialize data from string
|
|
1236
|
+
* Deserialize data from string.
|
|
986
1237
|
*
|
|
987
1238
|
* @param rawStateData - Data to deserialize
|
|
988
|
-
* @param element - Container element
|
|
989
1239
|
* @internal
|
|
990
1240
|
*/
|
|
991
|
-
export declare function _deserialize(rawStateData: string
|
|
1241
|
+
export declare function _deserialize<T>(rawStateData: string): Promise<T>;
|
|
992
1242
|
|
|
993
1243
|
declare interface DeserializeContainer {
|
|
994
1244
|
$getObjectById$: (id: number | string) => unknown;
|
|
1245
|
+
$getForwardRef$: (id: number) => number | string | undefined;
|
|
1246
|
+
$pendingStoreTargets$?: Map<object, {
|
|
1247
|
+
t: number;
|
|
1248
|
+
v: unknown;
|
|
1249
|
+
}>;
|
|
995
1250
|
element: HTMLElement | null;
|
|
996
1251
|
getSyncFn: (id: number) => (...args: unknown[]) => unknown;
|
|
997
1252
|
$state$?: unknown[];
|
|
998
1253
|
$storeProxyMap$: ObjToProxyMap;
|
|
999
|
-
$forwardRefs$: Array<number> | null;
|
|
1000
|
-
$initialQRLsIndexes$: Array<number> | null;
|
|
1001
|
-
readonly $scheduler$: Scheduler | null;
|
|
1254
|
+
$forwardRefs$: Array<number | string> | null;
|
|
1002
1255
|
}
|
|
1003
1256
|
|
|
1004
1257
|
/** @public */
|
|
@@ -1014,7 +1267,7 @@ export declare interface DOMAttributes<EL extends Element> extends DOMAttributes
|
|
|
1014
1267
|
class?: ClassList | Signal<ClassList> | undefined;
|
|
1015
1268
|
}
|
|
1016
1269
|
|
|
1017
|
-
declare interface DOMAttributesBase<EL extends Element> extends QwikIntrinsicAttributes, PreventDefault, StopPropagation, RefAttr<EL> {
|
|
1270
|
+
declare interface DOMAttributesBase<EL extends Element> extends QwikIntrinsicAttributes, PreventDefault, StopPropagation, Capture, Passive, RefAttr<EL> {
|
|
1018
1271
|
dangerouslySetInnerHTML?: string | undefined;
|
|
1019
1272
|
}
|
|
1020
1273
|
|
|
@@ -1025,68 +1278,81 @@ declare class DomContainer extends _SharedContainer implements ClientContainer {
|
|
|
1025
1278
|
qManifestHash: string;
|
|
1026
1279
|
rootVNode: _ElementVNode;
|
|
1027
1280
|
document: _QDocument;
|
|
1028
|
-
$journal$: VNodeJournal;
|
|
1029
|
-
renderDone: Promise<void> | null;
|
|
1030
|
-
$rawStateData$: unknown[];
|
|
1031
1281
|
$storeProxyMap$: ObjToProxyMap;
|
|
1032
1282
|
$qFuncs$: Array<(...args: unknown[]) => unknown>;
|
|
1033
1283
|
$instanceHash$: string;
|
|
1034
|
-
$forwardRefs$: Array<number> | null;
|
|
1035
|
-
$initialQRLsIndexes$: Array<number> | null;
|
|
1284
|
+
$forwardRefs$: Array<number | string> | null;
|
|
1036
1285
|
vNodeLocate: (id: string | Element) => _VNode;
|
|
1286
|
+
$containerDataProcessState$: ContainerDataProcessState;
|
|
1287
|
+
$containerStateReadyCallbacks$: Array<() => void> | undefined;
|
|
1288
|
+
$containerStateDataState$: unknown;
|
|
1289
|
+
private $rawStateData$;
|
|
1037
1290
|
private $stateData$;
|
|
1291
|
+
private $rootForwardRefs$;
|
|
1038
1292
|
private $styleIds$;
|
|
1039
|
-
private $renderCount$;
|
|
1040
1293
|
constructor(element: _ContainerElement);
|
|
1041
|
-
$
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1294
|
+
$processContainerData$(): Generator<void, void, void>;
|
|
1295
|
+
/** Tear down this container so stale references fail gracefully. */
|
|
1296
|
+
$destroy$(): void;
|
|
1297
|
+
/**
|
|
1298
|
+
* The first time we render we need to hoist the styles. (Meaning we need to move all styles from
|
|
1299
|
+
* component inline to <head>)
|
|
1300
|
+
*
|
|
1301
|
+
* We bulk move all of the styles, because the expensive part is for the browser to recompute the
|
|
1302
|
+
* styles, (not the actual DOM manipulation.) By moving all of them at once we can minimize the
|
|
1303
|
+
* reflow.
|
|
1304
|
+
*/
|
|
1305
|
+
$hoistStyles$(): void;
|
|
1306
|
+
$setRawState$(id: number, vParent: _VNode): void;
|
|
1307
|
+
parseQRL<T = unknown>(qrlStr: string): QRL<T>;
|
|
1308
|
+
handleError(err: any, host: _VNode | null): void;
|
|
1309
|
+
setContext<T>(host: _VNode, context: ContextId<T>, value: T): void;
|
|
1310
|
+
resolveContext<T>(host: _VNode, contextId: ContextId<T>): T | undefined;
|
|
1311
|
+
getParentHost(host: _VNode): _VNode | null;
|
|
1312
|
+
setHostProp<T>(host: _HostElement, name: string, value: T): void;
|
|
1313
|
+
getHostProp<T>(host: _HostElement, name: string): T | null;
|
|
1051
1314
|
ensureProjectionResolved(vNode: _VirtualVNode): void;
|
|
1052
1315
|
$getObjectById$: (id: number | string) => unknown;
|
|
1316
|
+
$getForwardRef$(id: number): number | string | undefined;
|
|
1053
1317
|
getSyncFn(id: number): (...args: unknown[]) => unknown;
|
|
1054
1318
|
$appendStyle$(content: string, styleId: string, host: _VirtualVNode, scoped: boolean): void;
|
|
1055
1319
|
/** Set the server data for the Qwik Router. */
|
|
1056
1320
|
private $setServerData$;
|
|
1057
|
-
/**
|
|
1058
|
-
* Schedule the initial QRLs to be resolved.
|
|
1059
|
-
*
|
|
1060
|
-
* Schedules the QRLs that are defined in the state data as `PreloadQRL`.
|
|
1061
|
-
*
|
|
1062
|
-
* This is done because when computed and custom serializer QRLs are called they need QRL to work.
|
|
1063
|
-
* If the QRL is not resolved at this point, it will be resolved by throwing a promise and
|
|
1064
|
-
* rerunning the whole wrapping function again. We want to avoid that, because it means that the
|
|
1065
|
-
* function can execute twice.
|
|
1066
|
-
*
|
|
1067
|
-
* ```ts
|
|
1068
|
-
* useVisibleTask$(() => {
|
|
1069
|
-
* runHeavyLogic(); // This will be called again if the QRL of `computedOrCustomSerializer` is not resolved.
|
|
1070
|
-
* console.log(computedOrCustomSerializer.value); // Throw a promise if QRL not resolved and execute visible task again.
|
|
1071
|
-
* });
|
|
1072
|
-
* ```
|
|
1073
|
-
*/
|
|
1074
|
-
private $scheduleInitialQRLs$;
|
|
1075
1321
|
}
|
|
1076
1322
|
export { DomContainer }
|
|
1077
1323
|
export { DomContainer as _DomContainer }
|
|
1078
1324
|
|
|
1079
1325
|
declare type DomRef = {
|
|
1080
|
-
$ssrNode$:
|
|
1326
|
+
$ssrNode$: ISsrNode;
|
|
1081
1327
|
};
|
|
1082
1328
|
|
|
1083
1329
|
/** @internal */
|
|
1084
1330
|
export declare const _dumpState: (state: unknown[], color?: boolean, prefix?: string, limit?: number | null) => string;
|
|
1085
1331
|
|
|
1332
|
+
/** @internal */
|
|
1333
|
+
export declare const _eaC: (props: EachProps<any>) => JSXNode<unknown>;
|
|
1334
|
+
|
|
1335
|
+
/** @public @experimental */
|
|
1336
|
+
export declare const Each: EachComponent;
|
|
1337
|
+
|
|
1338
|
+
declare type EachComponent = <T, ITEM extends JSXOutput = JSXOutput>(props: PublicProps<EachProps<T, ITEM>>, key: string | null, flags: number, dev?: DevJSX) => JSXOutput;
|
|
1339
|
+
|
|
1340
|
+
declare interface EachProps<T, ITEM extends JSXOutput = JSXOutput> {
|
|
1341
|
+
items: readonly T[];
|
|
1342
|
+
item$: QRL<(item: T, index: number) => ITEM>;
|
|
1343
|
+
key$: QRL<(item: T, index: number) => string>;
|
|
1344
|
+
}
|
|
1345
|
+
|
|
1346
|
+
/** @internal */
|
|
1347
|
+
export declare const _eaT: ({ track }: TaskCtx) => Promise<void>;
|
|
1348
|
+
|
|
1086
1349
|
/** @internal */
|
|
1087
1350
|
export declare const _EFFECT_BACK_REF: unique symbol;
|
|
1088
1351
|
|
|
1089
|
-
declare
|
|
1352
|
+
declare type EffectBackRef = SignalImpl | StoreTarget | PropsProxy;
|
|
1353
|
+
|
|
1354
|
+
/** @internal */
|
|
1355
|
+
export declare const enum _EffectProperty {
|
|
1090
1356
|
COMPONENT = ":",
|
|
1091
1357
|
VNODE = "."
|
|
1092
1358
|
}
|
|
@@ -1127,42 +1393,29 @@ declare const enum EffectProperty {
|
|
|
1127
1393
|
* - `EffectProperty.COMPONENT` if component
|
|
1128
1394
|
* - `EffectProperty.VNODE` if VNode
|
|
1129
1395
|
*/
|
|
1130
|
-
declare
|
|
1131
|
-
Consumer
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
Set<
|
|
1136
|
-
|
|
1137
|
-
_SubscriptionData | null
|
|
1138
|
-
];
|
|
1396
|
+
declare class EffectSubscription {
|
|
1397
|
+
consumer: Consumer;
|
|
1398
|
+
property: _EffectProperty | string;
|
|
1399
|
+
backRef: Set<EffectBackRef> | null;
|
|
1400
|
+
data: _SubscriptionData | null;
|
|
1401
|
+
constructor(consumer: Consumer, property: _EffectProperty | string, backRef?: Set<EffectBackRef> | null, data?: _SubscriptionData | null);
|
|
1402
|
+
}
|
|
1139
1403
|
|
|
1140
1404
|
/** @internal */
|
|
1141
|
-
export declare
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
/////////////// 3 - Next sibling
|
|
1150
|
-
_VNode | null | undefined,
|
|
1151
|
-
/// 4 - First child - undefined if children need to be materialize
|
|
1152
|
-
_VNode | null | undefined,
|
|
1153
|
-
Element,
|
|
1154
|
-
//////////////////// 6 - Element
|
|
1155
|
-
string | undefined,
|
|
1156
|
-
(string | null)[]
|
|
1157
|
-
] & {
|
|
1158
|
-
__brand__: 'ElementVNode';
|
|
1159
|
-
};
|
|
1405
|
+
export declare const _ELEMENT_SEQ = "q:seq";
|
|
1406
|
+
|
|
1407
|
+
/** @internal */
|
|
1408
|
+
export declare class _ElementVNode extends _VirtualVNode {
|
|
1409
|
+
node: Element;
|
|
1410
|
+
elementName: string | undefined;
|
|
1411
|
+
constructor(key: string | null, flags: _VNodeFlags, parent: _ElementVNode | _VirtualVNode | null, previousSibling: _VNode | null | undefined, nextSibling: _VNode | null | undefined, props: Props | null, firstChild: _VNode | null | undefined, lastChild: _VNode | null | undefined, node: Element, elementName: string | undefined);
|
|
1412
|
+
}
|
|
1160
1413
|
|
|
1161
1414
|
/** @internal */
|
|
1162
1415
|
export declare const _EMPTY_ARRAY: any[];
|
|
1163
1416
|
|
|
1164
|
-
/** @
|
|
1165
|
-
declare
|
|
1417
|
+
/** @internal */
|
|
1418
|
+
export declare const _EMPTY_OBJ: Record<string, any>;
|
|
1166
1419
|
|
|
1167
1420
|
/** @public */
|
|
1168
1421
|
export declare interface ErrorBoundaryStore {
|
|
@@ -1170,15 +1423,14 @@ export declare interface ErrorBoundaryStore {
|
|
|
1170
1423
|
}
|
|
1171
1424
|
|
|
1172
1425
|
/** @public */
|
|
1173
|
-
export declare const event$: <T>(qrl: T) =>
|
|
1426
|
+
export declare const event$: <T>(qrl: T) => QRL<T>;
|
|
1174
1427
|
|
|
1175
1428
|
declare type EventCorrectionMap = {
|
|
1176
1429
|
auxclick: PointerEvent;
|
|
1177
|
-
beforetoggle: CorrectedToggleEvent;
|
|
1178
1430
|
click: PointerEvent;
|
|
1179
1431
|
dblclick: PointerEvent;
|
|
1180
1432
|
input: InputEvent;
|
|
1181
|
-
|
|
1433
|
+
qvisible: QwikVisibleEvent;
|
|
1182
1434
|
};
|
|
1183
1435
|
|
|
1184
1436
|
declare type EventFromName<T extends string> = LcEvent<T>;
|
|
@@ -1197,6 +1449,9 @@ declare type EventQRL<T extends string = AllEventKeys> = QRL<EventHandler<EventF
|
|
|
1197
1449
|
/** @internal */
|
|
1198
1450
|
export declare const eventQrl: <T>(qrl: QRL<T>) => QRL<T>;
|
|
1199
1451
|
|
|
1452
|
+
/** @internal */
|
|
1453
|
+
export declare function _executeSsrChores(container: SSRContainer, ssrNode: ISsrNode): ValueOrPromise<void>;
|
|
1454
|
+
|
|
1200
1455
|
declare type FilterBase<T> = {
|
|
1201
1456
|
[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];
|
|
1202
1457
|
};
|
|
@@ -1209,6 +1464,13 @@ declare type Filtered<T, A = {}> = {
|
|
|
1209
1464
|
/** @internal */
|
|
1210
1465
|
export declare const _fnSignal: <T extends (...args: any) => any>(fn: T, args: Parameters<T>, fnStr?: string) => WrappedSignalImpl<any>;
|
|
1211
1466
|
|
|
1467
|
+
/**
|
|
1468
|
+
* Force a store to recompute and schedule effects.
|
|
1469
|
+
*
|
|
1470
|
+
* @public
|
|
1471
|
+
*/
|
|
1472
|
+
export declare const forceStoreEffects: (value: StoreTarget, prop: keyof StoreTarget) => void;
|
|
1473
|
+
|
|
1212
1474
|
/** @public */
|
|
1213
1475
|
export declare const Fragment: FunctionComponent<{
|
|
1214
1476
|
children?: any;
|
|
@@ -1227,16 +1489,30 @@ export declare type FunctionComponent<P = unknown> = {
|
|
|
1227
1489
|
}['renderFn'];
|
|
1228
1490
|
|
|
1229
1491
|
/** @internal */
|
|
1230
|
-
export declare const
|
|
1492
|
+
export declare const _getAsyncLocalStorage: () => (new <T>() => AsyncLocalStorage<T>) | undefined;
|
|
1493
|
+
|
|
1494
|
+
/**
|
|
1495
|
+
* Returns the client build manifest, which includes the mappings from symbols to bundles, the
|
|
1496
|
+
* bundlegraph etc.
|
|
1497
|
+
*
|
|
1498
|
+
* @public
|
|
1499
|
+
*/
|
|
1500
|
+
export declare const getClientManifest: () => ServerQwikManifest | undefined;
|
|
1501
|
+
|
|
1502
|
+
/** Used by the optimizer for spread props operations @internal */
|
|
1503
|
+
export declare const _getConstProps: (props: PropsProxy | Record<string, unknown> | null | undefined) => Props | null;
|
|
1231
1504
|
|
|
1232
1505
|
/** @internal */
|
|
1233
|
-
export declare const
|
|
1506
|
+
export declare const _getContextContainer: () => _Container | undefined;
|
|
1234
1507
|
|
|
1235
1508
|
/** @internal */
|
|
1236
1509
|
export declare const _getContextEvent: () => unknown;
|
|
1237
1510
|
|
|
1511
|
+
/** @internal */
|
|
1512
|
+
export declare const _getContextHostElement: () => _HostElement | undefined;
|
|
1513
|
+
|
|
1238
1514
|
/** @public */
|
|
1239
|
-
declare function getDomContainer(element: Element
|
|
1515
|
+
declare function getDomContainer(element: Element): ClientContainer;
|
|
1240
1516
|
export { getDomContainer as _getDomContainer }
|
|
1241
1517
|
export { getDomContainer }
|
|
1242
1518
|
|
|
@@ -1265,22 +1541,17 @@ export declare function getLocale(defaultLocale?: string): string;
|
|
|
1265
1541
|
export declare const getPlatform: () => CorePlatform;
|
|
1266
1542
|
|
|
1267
1543
|
/** @internal */
|
|
1268
|
-
export declare function _getQContainerElement(element: Element
|
|
1544
|
+
export declare function _getQContainerElement(element: Element): Element | null;
|
|
1269
1545
|
|
|
1270
|
-
/** @
|
|
1271
|
-
declare
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
};
|
|
1276
|
-
location: 'head' | 'body';
|
|
1277
|
-
}
|
|
1546
|
+
/** @internal */
|
|
1547
|
+
export declare function _getSubscriber(effect: Consumer, prop: _EffectProperty | string, data?: _SubscriptionData): EffectSubscription;
|
|
1548
|
+
|
|
1549
|
+
/** Used by the optimizer for spread props operations @internal */
|
|
1550
|
+
export declare const _getVarProps: (props: PropsProxy | Record<string, unknown> | null | undefined) => Props | null;
|
|
1278
1551
|
|
|
1279
1552
|
/**
|
|
1280
|
-
* The legacy transform, used
|
|
1281
|
-
*
|
|
1282
|
-
*
|
|
1283
|
-
* Also note that this disables optimizations.
|
|
1553
|
+
* The legacy transform, used by some JSX transpilers. The optimizer normally replaces this with
|
|
1554
|
+
* optimized calls, with the same caveat as `jsx()`.
|
|
1284
1555
|
*
|
|
1285
1556
|
* @public
|
|
1286
1557
|
*/
|
|
@@ -1288,18 +1559,28 @@ declare function h<TYPE extends string | FunctionComponent<PROPS>, PROPS extends
|
|
|
1288
1559
|
export { h as createElement }
|
|
1289
1560
|
export { h }
|
|
1290
1561
|
|
|
1291
|
-
/**
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1562
|
+
/**
|
|
1563
|
+
* @returns True if the store has effects for the given prop
|
|
1564
|
+
* @internal
|
|
1565
|
+
*/
|
|
1566
|
+
export declare const _hasStoreEffects: (value: StoreTarget, prop: keyof StoreTarget) => boolean;
|
|
1295
1567
|
|
|
1296
|
-
/**
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1568
|
+
/**
|
|
1569
|
+
* HMR event handler. The host VNode is captured at registration time via QRL captures.
|
|
1570
|
+
*
|
|
1571
|
+
* When called by the qwikloader or the test dispatch, `this` is the serialized captures string
|
|
1572
|
+
* which we deserialize to get the host VNode. When called through `_qDispatch` (client-rendered),
|
|
1573
|
+
* `_captures` is already set by `ensureQrlCaptures` in the QRL call chain.
|
|
1574
|
+
*
|
|
1575
|
+
* @internal
|
|
1576
|
+
*/
|
|
1577
|
+
export declare const _hmr: (this: string | undefined, event: CustomEvent<{
|
|
1578
|
+
files: string[];
|
|
1579
|
+
t: number;
|
|
1580
|
+
}>, element: Element) => void | Promise<void>;
|
|
1301
1581
|
|
|
1302
|
-
|
|
1582
|
+
/** @internal */
|
|
1583
|
+
export declare type _HostElement = _VNode | ISsrNode;
|
|
1303
1584
|
|
|
1304
1585
|
/** @public */
|
|
1305
1586
|
declare type HTMLAttributeAnchorTarget = '_self' | '_blank' | '_parent' | '_top' | (string & {});
|
|
@@ -1358,7 +1639,7 @@ declare interface HTMLAttributesBase extends AriaAttributes {
|
|
|
1358
1639
|
declare type HTMLCrossOriginAttribute = 'anonymous' | 'use-credentials' | '' | undefined;
|
|
1359
1640
|
|
|
1360
1641
|
/** @public */
|
|
1361
|
-
declare interface HTMLElementAttrs extends HTMLAttributesBase, FilterBase<HTMLElement> {
|
|
1642
|
+
export declare interface HTMLElementAttrs extends HTMLAttributesBase, FilterBase<HTMLElement> {
|
|
1362
1643
|
}
|
|
1363
1644
|
|
|
1364
1645
|
/** @public */
|
|
@@ -1410,17 +1691,47 @@ export declare const _IMMUTABLE: unique symbol;
|
|
|
1410
1691
|
*/
|
|
1411
1692
|
export declare const implicit$FirstArg: <FIRST, REST extends any[], RET>(fn: (qrl: QRL<FIRST>, ...rest: REST) => RET) => ((qrl: FIRST, ...rest: REST) => RET);
|
|
1412
1693
|
|
|
1413
|
-
/**
|
|
1414
|
-
|
|
1694
|
+
/**
|
|
1695
|
+
* Inject a pre-loaded value into a signal while preserving subscriptions. Calls `invalidate({__v})`
|
|
1696
|
+
* so the compute function reads the value from `info`, then triggers an immediate synchronous
|
|
1697
|
+
* compute via the private `$computeIfNeeded$()` method (which is mangled in core builds, so callers
|
|
1698
|
+
* from other packages must go through this helper).
|
|
1699
|
+
*
|
|
1700
|
+
* @internal
|
|
1701
|
+
*/
|
|
1702
|
+
export declare const _injectAsyncSignalValue: (signal: ComputedSignal<unknown>, value: unknown) => void;
|
|
1703
|
+
|
|
1704
|
+
/**
|
|
1705
|
+
* Create an inlined QRL. This is mostly useful on the server side for serialization.
|
|
1706
|
+
*
|
|
1707
|
+
* @param symbol - The object/function to register, or `null` to retrieve a previously registered
|
|
1708
|
+
* one by hash
|
|
1709
|
+
* @param symbolName - The name of the symbol.
|
|
1710
|
+
* @param lexicalScopeCapture - A set of lexically scoped variables to capture.
|
|
1711
|
+
* @public
|
|
1712
|
+
*/
|
|
1713
|
+
export declare const inlinedQrl: <T>(symbol: T | null, symbolName: string, lexicalScopeCapture?: Readonly<unknown[]>) => QRL<T>;
|
|
1415
1714
|
|
|
1416
1715
|
/** @internal */
|
|
1417
|
-
export declare const inlinedQrlDEV: <T = any>(symbol: T, symbolName: string, opts: QRLDev, lexicalScopeCapture?:
|
|
1716
|
+
export declare const inlinedQrlDEV: <T = any>(symbol: T, symbolName: string, opts: QRLDev, lexicalScopeCapture?: Readonly<unknown[]>) => QRL<T>;
|
|
1418
1717
|
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1718
|
+
declare class InsertOrMoveOperation {
|
|
1719
|
+
target: Element | Text;
|
|
1720
|
+
parent: Element;
|
|
1721
|
+
beforeTarget: Element | Text | null;
|
|
1722
|
+
constructor(target: Element | Text, parent: Element, beforeTarget: Element | Text | null);
|
|
1422
1723
|
}
|
|
1423
1724
|
|
|
1725
|
+
/** @internal */
|
|
1726
|
+
declare type InternalServerComponent<PROPS = unknown> = FunctionComponent<PROPS> & {
|
|
1727
|
+
[InternalServerComponentSymbol]: InternalServerComponentHandler;
|
|
1728
|
+
};
|
|
1729
|
+
|
|
1730
|
+
/** @internal */
|
|
1731
|
+
declare type InternalServerComponentHandler = (ssr: SSRContainer, jsx: JSXNodeInternal, options: SSRRenderJSXOptions, enqueue: (value: StackValue) => void) => ValueOrPromise<void>;
|
|
1732
|
+
|
|
1733
|
+
declare const InternalServerComponentSymbol: unique symbol;
|
|
1734
|
+
|
|
1424
1735
|
/**
|
|
1425
1736
|
* These are the HTML tags with handlers allowing plain callbacks, to be used for the JSX interface
|
|
1426
1737
|
*
|
|
@@ -1444,26 +1755,24 @@ declare type IntrinsicSVGElements = {
|
|
|
1444
1755
|
[K in keyof Omit<SVGElementTagNameMap, keyof HTMLElementTagNameMap>]: LenientSVGProps<SVGElementTagNameMap[K]>;
|
|
1445
1756
|
};
|
|
1446
1757
|
|
|
1758
|
+
/**
|
|
1759
|
+
* Call a function with the given InvokeContext and given arguments.
|
|
1760
|
+
*
|
|
1761
|
+
* @internal
|
|
1762
|
+
*/
|
|
1763
|
+
export declare function _invoke<FN extends (...args: any[]) => any>(this: unknown, context: InvokeContext | undefined, fn: FN, ...args: Parameters<FN>): ReturnType<FN>;
|
|
1764
|
+
|
|
1447
1765
|
/** The shared state during an invoke() call */
|
|
1448
1766
|
declare interface InvokeContext {
|
|
1449
|
-
$url$: URL | undefined;
|
|
1450
|
-
/** The next available index for the sequentialScope array */
|
|
1451
|
-
$i$: number;
|
|
1452
1767
|
/** The Virtual parent component for the current component code */
|
|
1453
|
-
$hostElement$:
|
|
1454
|
-
/** The current DOM element */
|
|
1455
|
-
$element$: Element | undefined;
|
|
1768
|
+
$hostElement$: _HostElement | undefined;
|
|
1456
1769
|
/** The event we're currently handling */
|
|
1457
1770
|
$event$: PossibleEvents | undefined;
|
|
1458
|
-
/** The QRL function we're currently executing */
|
|
1459
|
-
$qrl$: QRL | undefined;
|
|
1460
1771
|
$effectSubscriber$: EffectSubscription | undefined;
|
|
1461
1772
|
$locale$: string | undefined;
|
|
1462
|
-
$container$:
|
|
1773
|
+
$container$: _Container | undefined;
|
|
1463
1774
|
}
|
|
1464
1775
|
|
|
1465
|
-
declare type InvokeTuple = [Element, Event, URL?];
|
|
1466
|
-
|
|
1467
1776
|
declare type IsAcceptableDOMValue<T> = T extends boolean | number | string | null | undefined ? ((...args: any[]) => any) extends T ? false : true : false;
|
|
1468
1777
|
|
|
1469
1778
|
declare type IsAny<T> = 0 extends T & 1 ? true : false;
|
|
@@ -1489,11 +1798,11 @@ export declare const isSignal: (value: any) => value is Signal<unknown>;
|
|
|
1489
1798
|
/** @internal */
|
|
1490
1799
|
export declare interface ISsrComponentFrame {
|
|
1491
1800
|
componentNode: ISsrNode;
|
|
1801
|
+
slots: (string | JSXChildren)[];
|
|
1492
1802
|
scopedStyleIds: Set<string>;
|
|
1493
1803
|
projectionScopedStyle: string | null;
|
|
1494
1804
|
projectionComponentFrame: ISsrComponentFrame | null;
|
|
1495
1805
|
projectionDepth: number;
|
|
1496
|
-
releaseUnclaimedProjections(unclaimedProjections: (ISsrComponentFrame | JSXChildren | string)[]): void;
|
|
1497
1806
|
consumeChildrenForSlot(projectionNode: ISsrNode, slotName: string): JSXChildren | null;
|
|
1498
1807
|
distributeChildrenIntoSlots(children: JSXChildren, parentScopedStyle: string | null, parentComponentFrame: ISsrComponentFrame | null): void;
|
|
1499
1808
|
hasSlot(slotName: string): boolean;
|
|
@@ -1501,27 +1810,76 @@ export declare interface ISsrComponentFrame {
|
|
|
1501
1810
|
|
|
1502
1811
|
declare interface ISsrNode {
|
|
1503
1812
|
id: string;
|
|
1504
|
-
|
|
1505
|
-
|
|
1813
|
+
flags: SsrNodeFlags;
|
|
1814
|
+
dirty: ChoreBits;
|
|
1815
|
+
parentComponent: ISsrNode | null;
|
|
1816
|
+
children: ISsrNode[] | null;
|
|
1817
|
+
vnodeData: VNodeData;
|
|
1818
|
+
currentFile: string | null;
|
|
1819
|
+
readonly [_EFFECT_BACK_REF]: Map<_EffectProperty | string, EffectSubscription> | null;
|
|
1506
1820
|
setProp(name: string, value: any): void;
|
|
1507
1821
|
getProp(name: string): any;
|
|
1508
1822
|
removeProp(name: string): void;
|
|
1509
1823
|
addChild(child: ISsrNode): void;
|
|
1824
|
+
setTreeNonUpdatable(): void;
|
|
1510
1825
|
}
|
|
1511
1826
|
|
|
1827
|
+
/** @internal */
|
|
1828
|
+
export declare const _isStore: (value: object) => boolean;
|
|
1829
|
+
|
|
1512
1830
|
/** @internal */
|
|
1513
1831
|
export declare function _isStringifiable(value: unknown): value is _Stringifiable;
|
|
1514
1832
|
|
|
1833
|
+
/** @internal */
|
|
1834
|
+
export declare const _isTask: (value: any) => value is _Task;
|
|
1835
|
+
|
|
1836
|
+
/** @internal */
|
|
1837
|
+
declare interface IStreamHandler {
|
|
1838
|
+
flush(): ValueOrPromise<void>;
|
|
1839
|
+
waitForPendingFlush(): ValueOrPromise<void>;
|
|
1840
|
+
streamBlockStart(): void;
|
|
1841
|
+
streamBlockEnd(): ValueOrPromise<void>;
|
|
1842
|
+
}
|
|
1843
|
+
|
|
1844
|
+
/** Retains job metadata and also serves as the argument for CTX_ARG compute functions */
|
|
1845
|
+
declare class Job<T> implements ComputeCtx<T> {
|
|
1846
|
+
readonly $signal$: ComputedSignalImpl<T, any>;
|
|
1847
|
+
/** First holds the compute promise and then the cleanup promise */
|
|
1848
|
+
$promise$: Promise<void> | null | void;
|
|
1849
|
+
$cleanupRequested$: boolean;
|
|
1850
|
+
$canWrite$: boolean;
|
|
1851
|
+
$track$: Tracker | undefined;
|
|
1852
|
+
$cleanups$: Parameters<ComputeCtx<T>['cleanup']>[0][] | undefined;
|
|
1853
|
+
$abortController$: AbortController | undefined;
|
|
1854
|
+
info: unknown;
|
|
1855
|
+
$infoVersion$: number | undefined;
|
|
1856
|
+
constructor($signal$: ComputedSignalImpl<T, any>, info: unknown, $infoVersion$: number | undefined);
|
|
1857
|
+
get track(): Tracker;
|
|
1858
|
+
get abortSignal(): AbortSignal;
|
|
1859
|
+
/** Backward compatible cache method for resource */
|
|
1860
|
+
cache(): void;
|
|
1861
|
+
get previous(): T | undefined;
|
|
1862
|
+
cleanup(callback: () => void): void;
|
|
1863
|
+
}
|
|
1864
|
+
|
|
1515
1865
|
/**
|
|
1866
|
+
* Used by the JSX transpilers to create a JSXNode. Note that the optimizer will normally not use
|
|
1867
|
+
* this, instead using _jsxSplit and _jsxSorted directly.
|
|
1868
|
+
*
|
|
1869
|
+
* The optimizer will also replace all `jsx()` calls with the more optimized versions.
|
|
1870
|
+
*
|
|
1871
|
+
* The exception is when the props are not a literal object, which can only happen when the `jsx`
|
|
1872
|
+
* call is written directly.
|
|
1873
|
+
*
|
|
1516
1874
|
* @public
|
|
1517
|
-
* Used by the JSX transpilers to create a JSXNode.
|
|
1518
|
-
* Note that the optimizer will not use this, instead using _jsxSplit and _jsxSorted directly.
|
|
1519
1875
|
*/
|
|
1520
|
-
declare const jsx: <T extends string | FunctionComponent<any>>(type: T, props: T extends FunctionComponent<infer PROPS> ? PROPS : Props, key?: string | number | null) => JSXNode<T>;
|
|
1521
|
-
export { jsx }
|
|
1522
|
-
export { jsx as jsxs }
|
|
1876
|
+
export declare const jsx: <T extends string | FunctionComponent<any>>(type: T, props: T extends FunctionComponent<infer PROPS> ? PROPS : Props, key?: string | number | null, _isStatic?: boolean, dev?: JsxDevOpts) => JSXNode<T>;
|
|
1523
1877
|
|
|
1524
|
-
/**
|
|
1878
|
+
/**
|
|
1879
|
+
* @deprecated
|
|
1880
|
+
* @internal
|
|
1881
|
+
* No longer used since v2
|
|
1882
|
+
*/
|
|
1525
1883
|
export declare const _jsxBranch: <T>(input?: T) => T | undefined;
|
|
1526
1884
|
|
|
1527
1885
|
/** @internal @deprecated v1 compat */
|
|
@@ -1530,8 +1888,12 @@ export declare const _jsxC: (type: any, mutable: any, _flags: any, key: any) =>
|
|
|
1530
1888
|
/** @public */
|
|
1531
1889
|
export declare type JSXChildren = string | number | boolean | null | undefined | Function | RegExp | JSXChildren[] | Promise<JSXChildren> | Signal<JSXChildren> | JSXNode;
|
|
1532
1890
|
|
|
1533
|
-
/**
|
|
1534
|
-
|
|
1891
|
+
/**
|
|
1892
|
+
* Alias of `jsx` for development purposes.
|
|
1893
|
+
*
|
|
1894
|
+
* @public
|
|
1895
|
+
*/
|
|
1896
|
+
export declare const jsxDEV: <T extends string | FunctionComponent<any>>(type: T, props: T extends FunctionComponent<infer PROPS> ? PROPS : Props, key?: string | number | null, _isStatic?: boolean, dev?: JsxDevOpts) => JSXNode<T>;
|
|
1535
1897
|
|
|
1536
1898
|
declare interface JsxDevOpts {
|
|
1537
1899
|
fileName: string;
|
|
@@ -1539,6 +1901,14 @@ declare interface JsxDevOpts {
|
|
|
1539
1901
|
columnNumber: number;
|
|
1540
1902
|
}
|
|
1541
1903
|
|
|
1904
|
+
declare type JSXDocumentEvents = {
|
|
1905
|
+
[K in keyof QwikDocumentEventMap as `document:on${PascalCaseName<K>}$`]: QwikDocumentEventMap[K];
|
|
1906
|
+
};
|
|
1907
|
+
|
|
1908
|
+
declare type JSXElementEvents = {
|
|
1909
|
+
[K in keyof QwikHTMLElementEventMap as `on${PascalCaseName<K>}$`]: QwikHTMLElementEventMap[K];
|
|
1910
|
+
};
|
|
1911
|
+
|
|
1542
1912
|
/**
|
|
1543
1913
|
* A JSX Node, an internal structure. You probably want to use `JSXOutput` instead.
|
|
1544
1914
|
*
|
|
@@ -1552,15 +1922,68 @@ export declare interface JSXNode<T extends string | FunctionComponent | unknown
|
|
|
1552
1922
|
dev?: DevJSX;
|
|
1553
1923
|
}
|
|
1554
1924
|
|
|
1925
|
+
declare const enum JSXNodeFlags {
|
|
1926
|
+
None = 0,
|
|
1927
|
+
StaticSubtree = 2,
|
|
1928
|
+
HasCapturedProps = 4
|
|
1929
|
+
}
|
|
1930
|
+
|
|
1931
|
+
declare class JSXNodeImpl<T = unknown> implements JSXNodeInternal<T> {
|
|
1932
|
+
type: T;
|
|
1933
|
+
children: JSXChildren;
|
|
1934
|
+
flags: JSXNodeFlags;
|
|
1935
|
+
toSort: boolean;
|
|
1936
|
+
key: string | null;
|
|
1937
|
+
varProps: Props;
|
|
1938
|
+
constProps: Props | null;
|
|
1939
|
+
dev?: DevJSX & {
|
|
1940
|
+
stack: string | undefined;
|
|
1941
|
+
};
|
|
1942
|
+
_proxy: Props | null;
|
|
1943
|
+
constructor(type: T, varProps: Props | null, constProps: Props | null, children: JSXChildren, flags: JSXNodeFlags, key: string | number | null | undefined, toSort?: boolean, dev?: DevJSX);
|
|
1944
|
+
get props(): T extends FunctionComponent<infer PROPS> ? PROPS : Props;
|
|
1945
|
+
}
|
|
1946
|
+
|
|
1555
1947
|
/**
|
|
1556
1948
|
* The internal representation of a JSX Node.
|
|
1557
1949
|
*
|
|
1558
1950
|
* @internal
|
|
1559
1951
|
*/
|
|
1560
1952
|
export declare interface JSXNodeInternal<T extends string | FunctionComponent | unknown = unknown> extends JSXNode<T> {
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1953
|
+
/** The type of node */
|
|
1954
|
+
type: T;
|
|
1955
|
+
/** Do the varProps need sorting */
|
|
1956
|
+
toSort: boolean;
|
|
1957
|
+
/** The key property */
|
|
1958
|
+
key: string | null;
|
|
1959
|
+
/** Flags */
|
|
1960
|
+
flags: JSXNodeFlags;
|
|
1961
|
+
/**
|
|
1962
|
+
* Props that are not guaranteed shallow equal across runs.
|
|
1963
|
+
*
|
|
1964
|
+
* Any prop that is in `constProps` takes precedence over `varProps`.
|
|
1965
|
+
*
|
|
1966
|
+
* Does not contain `children` or `key`.
|
|
1967
|
+
*
|
|
1968
|
+
* `onEvent$` props are normalized to the html `q-x:event` version
|
|
1969
|
+
*/
|
|
1970
|
+
varProps: Props;
|
|
1971
|
+
/**
|
|
1972
|
+
* Props that will be shallow equal across runs. Does not contain any props that are in varProps.
|
|
1973
|
+
*
|
|
1974
|
+
* Any prop that is in `constProps` takes precedence over `varProps`.
|
|
1975
|
+
*
|
|
1976
|
+
* Does not contain `children` or `key`.
|
|
1977
|
+
*
|
|
1978
|
+
* `onEvent$` props are normalized to the html `q-x:event` version
|
|
1979
|
+
*/
|
|
1980
|
+
constProps: Props | null;
|
|
1981
|
+
/** The children of the node */
|
|
1982
|
+
children: JSXChildren;
|
|
1983
|
+
/** Filename etc for debugging */
|
|
1984
|
+
dev?: DevJSX & {
|
|
1985
|
+
stack: string | undefined;
|
|
1986
|
+
};
|
|
1564
1987
|
}
|
|
1565
1988
|
|
|
1566
1989
|
/**
|
|
@@ -1576,6 +1999,13 @@ export declare const _jsxQ: (type: any, mutable: any, immutable: any, children:
|
|
|
1576
1999
|
/** @internal @deprecated v1 compat */
|
|
1577
2000
|
export declare const _jsxS: (type: any, mutable: any, immutable: any, _flags: any, key: any) => JSXNode<any>;
|
|
1578
2001
|
|
|
2002
|
+
/**
|
|
2003
|
+
* Alias of `jsx` to support JSX syntax.
|
|
2004
|
+
*
|
|
2005
|
+
* @public
|
|
2006
|
+
*/
|
|
2007
|
+
export declare const jsxs: <T extends string | FunctionComponent<any>>(type: T, props: T extends FunctionComponent<infer PROPS> ? PROPS : Props, key?: string | number | null, _isStatic?: boolean, dev?: JsxDevOpts) => JSXNode<T>;
|
|
2008
|
+
|
|
1579
2009
|
/**
|
|
1580
2010
|
* Create a JSXNode with the properties fully split into variable and constant parts, and children
|
|
1581
2011
|
* separated out. Furthermore, the varProps must be a sorted object, that is, the keys must be
|
|
@@ -1586,7 +2016,7 @@ export declare const _jsxS: (type: any, mutable: any, immutable: any, _flags: an
|
|
|
1586
2016
|
* still update the attribute on the vnode.
|
|
1587
2017
|
*
|
|
1588
2018
|
* @param type - The JSX type
|
|
1589
|
-
* @param varProps - The properties of the tag, sorted, excluding children,
|
|
2019
|
+
* @param varProps - The properties of the tag, sorted, excluding children, key and any constProps
|
|
1590
2020
|
* @param constProps - The properties of the tag that are known to be constant references and don't
|
|
1591
2021
|
* need checking for changes on re-render
|
|
1592
2022
|
* @param children - JSX children. Any `children` in the props objects are ignored.
|
|
@@ -1596,13 +2026,13 @@ export declare const _jsxSorted: <T>(type: T, varProps: Props | null, constProps
|
|
|
1596
2026
|
|
|
1597
2027
|
/**
|
|
1598
2028
|
* Create a JSXNode, with the properties split into variable and constant parts, but the variable
|
|
1599
|
-
* parts could include keys from constProps
|
|
2029
|
+
* parts could include keys from `constProps`, as well as `key` and `children`.
|
|
1600
2030
|
*
|
|
1601
|
-
* The constant parts are expected to be the same
|
|
1602
|
-
*
|
|
1603
|
-
* still update the attribute on the vnode.
|
|
2031
|
+
* `constProps` cannot include `key` or `children`. The constant parts are expected to be the same
|
|
2032
|
+
* on every render, and are not checked for changes. This means that they are constant scalars or
|
|
2033
|
+
* refs. When the ref is a signal or a store, it can still update the attribute on the vnode.
|
|
1604
2034
|
*
|
|
1605
|
-
* If `children`
|
|
2035
|
+
* If `children` or `key` are defined, any `children`/`key` in the props will be ignored.
|
|
1606
2036
|
*
|
|
1607
2037
|
* @param type - The tag type
|
|
1608
2038
|
* @param varProps - The properties of the tag that could change, including children
|
|
@@ -1610,11 +2040,15 @@ export declare const _jsxSorted: <T>(type: T, varProps: Props | null, constProps
|
|
|
1610
2040
|
* for changes on re-render
|
|
1611
2041
|
* @internal
|
|
1612
2042
|
*/
|
|
1613
|
-
export declare const _jsxSplit: <T extends string | FunctionComponent<any>>(type: T, varProps: Props | null, constProps: Props | null, children: JSXChildren | null | undefined, flags: number, key
|
|
2043
|
+
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>;
|
|
1614
2044
|
|
|
1615
2045
|
/** @public */
|
|
1616
2046
|
export declare type JSXTagName = keyof HTMLElementTagNameMap | Omit<string, keyof HTMLElementTagNameMap>;
|
|
1617
2047
|
|
|
2048
|
+
declare type JSXWindowEvents = {
|
|
2049
|
+
[K in keyof QwikWindowEventMap as `window:on${PascalCaseName<K>}$`]: QwikWindowEventMap[K];
|
|
2050
|
+
};
|
|
2051
|
+
|
|
1618
2052
|
/**
|
|
1619
2053
|
* The names of events that Qwik knows about. They are all lowercase, but on the JSX side, they are
|
|
1620
2054
|
* PascalCase for nicer DX. (`onAuxClick$` vs `onauxclick$`)
|
|
@@ -1623,6 +2057,27 @@ export declare type JSXTagName = keyof HTMLElementTagNameMap | Omit<string, keyo
|
|
|
1623
2057
|
*/
|
|
1624
2058
|
export declare type KnownEventNames = LiteralUnion<AllEventKeys, string>;
|
|
1625
2059
|
|
|
2060
|
+
/**
|
|
2061
|
+
* Shared lazy-loading reference that holds module loading metadata. Multiple QRLs pointing to the
|
|
2062
|
+
* same chunk+symbol can share a single LazyRef, differing only in their captured scope.
|
|
2063
|
+
*/
|
|
2064
|
+
declare class LazyRef<TYPE = unknown> {
|
|
2065
|
+
readonly $chunk$: string | null;
|
|
2066
|
+
readonly $symbol$: string;
|
|
2067
|
+
readonly $symbolFn$: undefined | null | (() => Promise<Record<string, TYPE>>);
|
|
2068
|
+
$ref$?: (null | ValueOrPromise<TYPE>) | undefined;
|
|
2069
|
+
$container$: _Container | undefined;
|
|
2070
|
+
$hasMovedCaptures$?: boolean;
|
|
2071
|
+
dev?: QRLDev | null | undefined;
|
|
2072
|
+
qrls?: Set<any>;
|
|
2073
|
+
constructor($chunk$: string | null, $symbol$: string, $symbolFn$: undefined | null | (() => Promise<Record<string, TYPE>>), $ref$?: (null | ValueOrPromise<TYPE>) | undefined, container?: _Container | null);
|
|
2074
|
+
/** We don't read hash very often so let's not allocate a string for every QRL */
|
|
2075
|
+
get $hash$(): string;
|
|
2076
|
+
$setRef$(ref: ValueOrPromise<TYPE>): void;
|
|
2077
|
+
/** Load the raw module export without capture binding. */
|
|
2078
|
+
$load$(): ValueOrPromise<TYPE>;
|
|
2079
|
+
}
|
|
2080
|
+
|
|
1626
2081
|
declare type LcEvent<T extends string, C extends string = Lowercase<T>> = C extends keyof AllEventsMap ? AllEventsMap[C] : Event;
|
|
1627
2082
|
|
|
1628
2083
|
declare type LcEventNameMap = {
|
|
@@ -1666,6 +2121,28 @@ declare interface LenientSVGProps<T extends Element> extends SVGAttributes, DOMA
|
|
|
1666
2121
|
*/
|
|
1667
2122
|
declare type LiteralUnion<LiteralType, BaseType extends Primitive> = LiteralType | (BaseType & Record<never, never>);
|
|
1668
2123
|
|
|
2124
|
+
/** @internal */
|
|
2125
|
+
export declare const _mapApp_findIndx: <T>(array: (T | null)[], key: string, start: number) => number;
|
|
2126
|
+
|
|
2127
|
+
/** @internal */
|
|
2128
|
+
export declare const _mapArray_get: <T>(array: (T | null)[], key: string, start: number) => T | null;
|
|
2129
|
+
|
|
2130
|
+
/** @internal */
|
|
2131
|
+
export declare const _mapArray_set: <T>(array: (T | null)[], key: string, value: T | null, start: number, allowNullValue?: boolean) => void;
|
|
2132
|
+
|
|
2133
|
+
/**
|
|
2134
|
+
* Mark this signal as owned outside of the component that read it.
|
|
2135
|
+
*
|
|
2136
|
+
* Externally owned signals are preserved when found in a component's sequential scope during
|
|
2137
|
+
* component cleanup.
|
|
2138
|
+
*
|
|
2139
|
+
* @internal
|
|
2140
|
+
*/
|
|
2141
|
+
export declare const _markSignalAsExternallyOwned: (signal: ComputedSignal<unknown>) => void;
|
|
2142
|
+
|
|
2143
|
+
declare class MaybeAsyncSignal {
|
|
2144
|
+
}
|
|
2145
|
+
|
|
1669
2146
|
declare type MediaSpecialAttrs = {
|
|
1670
2147
|
crossOrigin?: HTMLCrossOriginAttribute;
|
|
1671
2148
|
};
|
|
@@ -1706,16 +2183,19 @@ export declare type NativeUIEvent = UIEvent;
|
|
|
1706
2183
|
/** @public @deprecated Use `WheelEvent` and use the second argument to the handler function for the current event target */
|
|
1707
2184
|
export declare type NativeWheelEvent = WheelEvent;
|
|
1708
2185
|
|
|
2186
|
+
/** @internal */
|
|
2187
|
+
export declare function _newInvokeContext(locale?: string, hostElement?: _HostElement, event?: Exclude<PossibleEvents, typeof RenderEvent>): InvokeContext;
|
|
2188
|
+
|
|
1709
2189
|
declare interface NodePropData {
|
|
1710
2190
|
$scopedStyleIdPrefix$: string | null;
|
|
1711
2191
|
$isConst$: boolean;
|
|
1712
2192
|
}
|
|
1713
2193
|
|
|
1714
2194
|
/** @internal */
|
|
1715
|
-
export declare const _noopQrl: <T>(symbolName: string, lexicalScopeCapture?:
|
|
2195
|
+
export declare const _noopQrl: <T>(symbolName: string, lexicalScopeCapture?: Readonly<unknown[]>) => QRL<T>;
|
|
1716
2196
|
|
|
1717
2197
|
/** @internal */
|
|
1718
|
-
export declare const _noopQrlDEV: <T>(symbolName: string, opts: QRLDev, lexicalScopeCapture?:
|
|
2198
|
+
export declare const _noopQrlDEV: <T>(symbolName: string, opts: QRLDev, lexicalScopeCapture?: Readonly<unknown[]>) => QRL<T>;
|
|
1719
2199
|
|
|
1720
2200
|
/**
|
|
1721
2201
|
* Returned type of the `noSerialize()` function. It will be TYPE or undefined.
|
|
@@ -1782,6 +2262,31 @@ export declare interface OnVisibleTaskOptions {
|
|
|
1782
2262
|
strategy?: VisibleTaskStrategy;
|
|
1783
2263
|
}
|
|
1784
2264
|
|
|
2265
|
+
/** @internal */
|
|
2266
|
+
declare type OutOfOrderRevealBoundary = {
|
|
2267
|
+
attrs: string;
|
|
2268
|
+
showFallback: boolean;
|
|
2269
|
+
resolve: () => void;
|
|
2270
|
+
};
|
|
2271
|
+
|
|
2272
|
+
/** @internal */
|
|
2273
|
+
declare class OutOfOrderRevealCoordinator<ITEM extends RevealItemLike = RevealItemLike> {
|
|
2274
|
+
private id;
|
|
2275
|
+
private collapsed;
|
|
2276
|
+
private count;
|
|
2277
|
+
private pendingItems;
|
|
2278
|
+
private orderCode;
|
|
2279
|
+
constructor(id: number, order: RevealOrder, collapsed: boolean);
|
|
2280
|
+
register(registration: RevealRegistrationLike<ITEM>): OutOfOrderRevealBoundary;
|
|
2281
|
+
canReveal(registration: RevealRegistrationLike<ITEM>): boolean;
|
|
2282
|
+
script(): string;
|
|
2283
|
+
}
|
|
2284
|
+
|
|
2285
|
+
/** @internal */
|
|
2286
|
+
declare const _OWNER: unique symbol;
|
|
2287
|
+
|
|
2288
|
+
declare type PascalCaseName<T extends string> = T extends keyof LcEventNameMap ? LcEventNameMap[T] : Capitalize<T>;
|
|
2289
|
+
|
|
1785
2290
|
/**
|
|
1786
2291
|
* Capitalized multi-word names of some known events so we have nicer qwik attributes. For example,
|
|
1787
2292
|
* instead of `oncompositionEnd$` we can use `onCompositionEnd$`. Note that any capitalization
|
|
@@ -1789,19 +2294,15 @@ export declare interface OnVisibleTaskOptions {
|
|
|
1789
2294
|
*
|
|
1790
2295
|
* Add any multi-word event names to this list. Single word events are automatically converted.
|
|
1791
2296
|
*/
|
|
1792
|
-
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';
|
|
2297
|
+
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' | 'QResume' | 'QSymbol' | 'QVisible' | 'QViewTransition' | 'RateChange' | 'RateChange' | 'SecurityPolicyViolation' | 'SelectionChange' | 'SelectStart' | 'TimeUpdate' | 'TouchCancel' | 'TouchEnd' | 'TouchMove' | 'TouchStart' | 'TransitionCancel' | 'TransitionEnd' | 'TransitionRun' | 'TransitionStart' | 'VisibilityChange' | 'VolumeChange';
|
|
1793
2298
|
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
* so this will capitalize them, and use the `LcEventNameMap` for multi-word events names.
|
|
1797
|
-
*/
|
|
1798
|
-
declare type PascalMap<M> = {
|
|
1799
|
-
[K in Extract<keyof M, string> as K extends keyof LcEventNameMap ? LcEventNameMap[K] : Capitalize<K>]: M[K];
|
|
2299
|
+
declare type Passive = {
|
|
2300
|
+
[K in keyof HTMLElementEventMap as `passive:${K}`]?: boolean;
|
|
1800
2301
|
};
|
|
1801
2302
|
|
|
1802
2303
|
declare type PopoverTargetAction = 'hide' | 'show' | 'toggle';
|
|
1803
2304
|
|
|
1804
|
-
declare type PossibleEvents = Event | SimplifiedServerRequestEvent | typeof TaskEvent | typeof RenderEvent
|
|
2305
|
+
declare type PossibleEvents = Event | SimplifiedServerRequestEvent | typeof TaskEvent | typeof RenderEvent;
|
|
1805
2306
|
|
|
1806
2307
|
/**
|
|
1807
2308
|
* @deprecated This is no longer needed as the preloading happens automatically in qrl-class. You
|
|
@@ -1877,7 +2378,7 @@ export declare const PrefetchServiceWorker: (opts: {
|
|
|
1877
2378
|
* @returns The preprocessed state data
|
|
1878
2379
|
* @internal
|
|
1879
2380
|
*/
|
|
1880
|
-
export declare function _preprocessState(data: unknown[], container: DeserializeContainer): void;
|
|
2381
|
+
export declare function _preprocessState(data: unknown[], container: DeserializeContainer, segmentId?: string, startIndex?: number): void;
|
|
1881
2382
|
|
|
1882
2383
|
declare type Prettify<T> = {} & {
|
|
1883
2384
|
[K in keyof T]: T[K];
|
|
@@ -1899,6 +2400,9 @@ export declare type PropFunction<T> = QRL<T>;
|
|
|
1899
2400
|
|
|
1900
2401
|
declare type Props = Record<string, unknown>;
|
|
1901
2402
|
|
|
2403
|
+
/** @internal */
|
|
2404
|
+
declare const _PROPS_HANDLER: unique symbol;
|
|
2405
|
+
|
|
1902
2406
|
/**
|
|
1903
2407
|
* Infers `Props` from the component or tag.
|
|
1904
2408
|
*
|
|
@@ -1921,7 +2425,24 @@ export declare type PropsOf<COMP> = COMP extends string ? COMP extends keyof Qwi
|
|
|
1921
2425
|
declare type PropsProxy = {
|
|
1922
2426
|
[_VAR_PROPS]: Props;
|
|
1923
2427
|
[_CONST_PROPS]: Props | null;
|
|
1924
|
-
|
|
2428
|
+
[_OWNER]: JSXNodeInternal;
|
|
2429
|
+
[_PROPS_HANDLER]: PropsProxyHandler;
|
|
2430
|
+
} & Record<string | symbol, unknown>;
|
|
2431
|
+
|
|
2432
|
+
declare class PropsProxyHandler implements ProxyHandler<any> {
|
|
2433
|
+
owner: JSXNodeImpl;
|
|
2434
|
+
$effects$: undefined | Map<string | symbol, Set<EffectSubscription>>;
|
|
2435
|
+
$container$: _Container | null;
|
|
2436
|
+
constructor(owner: JSXNodeImpl);
|
|
2437
|
+
get(_: any, prop: string | symbol): any;
|
|
2438
|
+
set(_: any, prop: string | symbol, value: any): boolean;
|
|
2439
|
+
deleteProperty(_: any, prop: string | symbol): boolean;
|
|
2440
|
+
has(_: any, prop: string | symbol): boolean;
|
|
2441
|
+
getOwnPropertyDescriptor(_: any, p: string | symbol): PropertyDescriptor | undefined;
|
|
2442
|
+
ownKeys(): string[];
|
|
2443
|
+
}
|
|
2444
|
+
|
|
2445
|
+
declare type PropType<T extends object, P extends keyof T> = P extends keyof T ? T[P] : 'value' extends keyof T ? T['value'] : never;
|
|
1925
2446
|
|
|
1926
2447
|
/**
|
|
1927
2448
|
* Extends the defined component PROPS, adding the default ones (children and q:slot) and allowing
|
|
@@ -1934,6 +2455,20 @@ export declare type PublicProps<PROPS> = (PROPS extends Record<any, any> ? Omit<
|
|
|
1934
2455
|
/** @internal */
|
|
1935
2456
|
export declare interface _QDocument extends Document {
|
|
1936
2457
|
qVNodeData: WeakMap<Element, string>;
|
|
2458
|
+
/** True once root document VNode data has been scheduled at least once. */
|
|
2459
|
+
qVNodeDataStarted?: boolean;
|
|
2460
|
+
/** True when root, segment, and patch VNode data work is fully drained. */
|
|
2461
|
+
qVNodeDataReady?: boolean;
|
|
2462
|
+
/** Internal yielding state for queued VNode data jobs. */
|
|
2463
|
+
qVNodeDataState?: unknown;
|
|
2464
|
+
/** Callbacks waiting for root, segment, and patch VNode data work to drain. */
|
|
2465
|
+
qVNodeDataCallbacks?: Array<() => void>;
|
|
2466
|
+
/** True once the root document VNode data has been fully processed. */
|
|
2467
|
+
qVNodeDataProcessed?: boolean;
|
|
2468
|
+
/** Processes one vnode patch script. */
|
|
2469
|
+
qProcessVNodeDataPatch?: (script: Element | null) => void;
|
|
2470
|
+
/** Processes an out-of-order Suspense segment after its resolved HTML is swapped in. */
|
|
2471
|
+
qProcessOOOS?: (boundaryId: number, content: Element | null) => void;
|
|
1937
2472
|
}
|
|
1938
2473
|
|
|
1939
2474
|
/**
|
|
@@ -2037,7 +2572,7 @@ export declare interface _QDocument extends Document {
|
|
|
2037
2572
|
*
|
|
2038
2573
|
* ```
|
|
2039
2574
|
* <div q:base="/build/">
|
|
2040
|
-
* <button
|
|
2575
|
+
* <button q-e:click="./chunk-abc.js#onClick">...</button>
|
|
2041
2576
|
* </div>
|
|
2042
2577
|
* ```
|
|
2043
2578
|
*
|
|
@@ -2060,7 +2595,7 @@ export declare interface _QDocument extends Document {
|
|
|
2060
2595
|
*/
|
|
2061
2596
|
export declare type QRL<TYPE = unknown> = {
|
|
2062
2597
|
__qwik_serializable__?: any;
|
|
2063
|
-
__brand__QRL__
|
|
2598
|
+
__brand__QRL__?: TYPE;
|
|
2064
2599
|
/** Resolve the QRL and return the actual value. */
|
|
2065
2600
|
resolve(): Promise<TYPE>;
|
|
2066
2601
|
/** The resolved value, once `resolve()` returns. */
|
|
@@ -2068,7 +2603,7 @@ export declare type QRL<TYPE = unknown> = {
|
|
|
2068
2603
|
getCaptured(): unknown[] | null;
|
|
2069
2604
|
getSymbol(): string;
|
|
2070
2605
|
getHash(): string;
|
|
2071
|
-
dev
|
|
2606
|
+
dev?: QRLDev | null;
|
|
2072
2607
|
} & BivariantQrlFn<QrlArgs<TYPE>, QrlReturn<TYPE>>;
|
|
2073
2608
|
|
|
2074
2609
|
/**
|
|
@@ -2083,10 +2618,12 @@ export declare type QRL<TYPE = unknown> = {
|
|
|
2083
2618
|
* @public
|
|
2084
2619
|
* @see `QRL`, `$(...)`
|
|
2085
2620
|
*/
|
|
2086
|
-
export declare const qrl: <T = any>(chunkOrFn: string | (() => Promise<any>), symbol: string, lexicalScopeCapture?:
|
|
2621
|
+
export declare const qrl: <T = any>(chunkOrFn: string | (() => Promise<any>), symbol: string, lexicalScopeCapture?: Readonly<unknown[]> | null, stackOffset?: number) => QRL<T>;
|
|
2087
2622
|
|
|
2088
2623
|
declare type QrlArgs<T> = T extends (...args: infer ARGS) => any ? ARGS : unknown[];
|
|
2089
2624
|
|
|
2625
|
+
declare type QrlCaptures = Readonly<unknown[]> | string | null;
|
|
2626
|
+
|
|
2090
2627
|
/** @public */
|
|
2091
2628
|
declare interface QRLDev {
|
|
2092
2629
|
file: string;
|
|
@@ -2095,31 +2632,56 @@ declare interface QRLDev {
|
|
|
2095
2632
|
}
|
|
2096
2633
|
|
|
2097
2634
|
/** @internal */
|
|
2098
|
-
export declare const qrlDEV: <T = any>(chunkOrFn: string | (() => Promise<any>), symbol: string, opts: QRLDev, lexicalScopeCapture?:
|
|
2635
|
+
export declare const qrlDEV: <T = any>(chunkOrFn: string | (() => Promise<any>), symbol: string, opts: QRLDev, lexicalScopeCapture?: Readonly<unknown[]>) => QRL<T>;
|
|
2099
2636
|
|
|
2100
2637
|
/**
|
|
2101
2638
|
* An event handler for Qwik events, can be a handler QRL or an array of handler QRLs.
|
|
2102
2639
|
*
|
|
2103
2640
|
* @public
|
|
2104
2641
|
*/
|
|
2105
|
-
export declare type QRLEventHandlerMulti<EV extends Event, EL> = QRL<EventHandler<EV, EL>> | undefined | null | QRLEventHandlerMulti<EV, EL>[]
|
|
2642
|
+
export declare type QRLEventHandlerMulti<EV extends Event, EL> = QRL<EventHandler<EV, EL>> | undefined | null | QRLEventHandlerMulti<EV, EL>[];
|
|
2106
2643
|
|
|
2107
|
-
|
|
2644
|
+
/** @internal */
|
|
2645
|
+
export declare type _QRLInternal<TYPE = unknown> = QRL<TYPE> & QRLInternalMethods<TYPE>;
|
|
2108
2646
|
|
|
2109
2647
|
declare type QRLInternalMethods<TYPE> = {
|
|
2110
2648
|
readonly $chunk$: string | null;
|
|
2111
2649
|
readonly $symbol$: string;
|
|
2112
2650
|
readonly $hash$: string;
|
|
2113
|
-
|
|
2114
|
-
$
|
|
2115
|
-
|
|
2651
|
+
/** Captures are stored lazily after deserialization. */
|
|
2652
|
+
readonly $captures$?: QrlCaptures;
|
|
2653
|
+
readonly $hasMovedCaptures$?: boolean;
|
|
2654
|
+
dev?: QRLDev | null;
|
|
2655
|
+
resolve(container?: _Container): Promise<TYPE>;
|
|
2116
2656
|
resolved: undefined | TYPE;
|
|
2117
|
-
resolve(containerEl?: Element): Promise<TYPE>;
|
|
2118
2657
|
getSymbol(): string;
|
|
2119
2658
|
getHash(): string;
|
|
2120
2659
|
getCaptured(): unknown[] | null;
|
|
2121
|
-
getFn(currentCtx?: InvokeContext
|
|
2122
|
-
|
|
2660
|
+
getFn(currentCtx?: InvokeContext,
|
|
2661
|
+
/** If this returns false, the function execution will be skipped */
|
|
2662
|
+
beforeFn?: () => void | false): TYPE extends (...args: any) => any ? (...args: Parameters<TYPE>) => ValueOrPromise<ReturnType<TYPE> | undefined> : unknown;
|
|
2663
|
+
$callFn$(withThis: unknown, ...args: QrlArgs<TYPE>): ValueOrPromise<QrlReturn<TYPE>>;
|
|
2664
|
+
$setDev$(dev: QRLDev | null): void;
|
|
2665
|
+
/**
|
|
2666
|
+
* "with captures" - Get a new QRL for these captures, reusing the lazy ref. It's an internal
|
|
2667
|
+
* method but we need to have a stable name because it gets called in user code by the optimizer,
|
|
2668
|
+
* after the $name$ props are mangled
|
|
2669
|
+
*/
|
|
2670
|
+
w(captures: QrlCaptures): _QRLInternal<TYPE>;
|
|
2671
|
+
/** Mark that the handler receives captures moved to its element. */
|
|
2672
|
+
m(): _QRLInternal<TYPE>;
|
|
2673
|
+
/**
|
|
2674
|
+
* "set ref" - Set the ref of the QRL. It's an internal method but we need to have a stable name
|
|
2675
|
+
* because it gets called in user code by the optimizer, after the $name$ props are mangled
|
|
2676
|
+
*/
|
|
2677
|
+
s(ref: ValueOrPromise<TYPE>): void;
|
|
2678
|
+
/**
|
|
2679
|
+
* Needed for deserialization and importing. We don't always have the container while creating
|
|
2680
|
+
* qrls in async sections of code
|
|
2681
|
+
*/
|
|
2682
|
+
readonly $container$?: _Container | null;
|
|
2683
|
+
/** The shared lazy-loading reference */
|
|
2684
|
+
readonly $lazy$: LazyRef<TYPE>;
|
|
2123
2685
|
};
|
|
2124
2686
|
|
|
2125
2687
|
declare type QrlReturn<T> = T extends (...args: any) => infer R ? Awaited<R> : unknown;
|
|
@@ -2136,50 +2698,26 @@ declare type QrlReturn<T> = T extends (...args: any) => infer R ? Awaited<R> : u
|
|
|
2136
2698
|
*/
|
|
2137
2699
|
export declare const _qrlSync: <TYPE extends Function>(fn: TYPE, serializedFn?: string) => SyncQRL<TYPE>;
|
|
2138
2700
|
|
|
2701
|
+
/** @internal */
|
|
2702
|
+
export declare function _qrlToString(serializationContext: SerializationContext, qrl: _QRLInternal | SyncQRLInternal): string;
|
|
2703
|
+
|
|
2704
|
+
/** @internal */
|
|
2705
|
+
export declare function _qrlToString(serializationContext: SerializationContext, qrl: _QRLInternal | SyncQRLInternal, raw: true): [string, string, string | null];
|
|
2706
|
+
|
|
2707
|
+
/** @internal */
|
|
2708
|
+
export declare const _qrlWithChunk: <T = any>(chunk: string, importer: () => Promise<any>, symbol: string, lexicalScopeCapture?: Readonly<unknown[]>) => QRL<T>;
|
|
2709
|
+
|
|
2710
|
+
/** @internal */
|
|
2711
|
+
export declare const _qrlWithChunkDEV: <T = any>(chunk: string, importer: () => Promise<any>, symbol: string, opts: QRLDev, lexicalScopeCapture?: Readonly<unknown[]>) => QRL<T>;
|
|
2712
|
+
|
|
2139
2713
|
/** @public @deprecated Use `AnimationEvent` and use the second argument to the handler function for the current event target */
|
|
2140
2714
|
export declare type QwikAnimationEvent<T = Element> = NativeAnimationEvent;
|
|
2141
2715
|
|
|
2142
|
-
/** @public */
|
|
2143
|
-
declare interface QwikAsset {
|
|
2144
|
-
/** Name of the asset */
|
|
2145
|
-
name: string | undefined;
|
|
2146
|
-
/** Size of the asset */
|
|
2147
|
-
size: number;
|
|
2148
|
-
}
|
|
2149
|
-
|
|
2150
2716
|
/** The Qwik DOM attributes without plain handlers, for use as function parameters @public */
|
|
2151
2717
|
export declare interface QwikAttributes<EL extends Element> extends DOMAttributesBase<EL>, QwikEvents<EL, false> {
|
|
2152
2718
|
class?: ClassList | undefined;
|
|
2153
2719
|
}
|
|
2154
2720
|
|
|
2155
|
-
/** @public */
|
|
2156
|
-
declare interface QwikBundle {
|
|
2157
|
-
/** Size of the bundle */
|
|
2158
|
-
size: number;
|
|
2159
|
-
/** Total size of this bundle's static import graph */
|
|
2160
|
-
total: number;
|
|
2161
|
-
/** Interactivity score of the bundle */
|
|
2162
|
-
interactivity?: number;
|
|
2163
|
-
/** Symbols in the bundle */
|
|
2164
|
-
symbols?: string[];
|
|
2165
|
-
/** Direct imports */
|
|
2166
|
-
imports?: string[];
|
|
2167
|
-
/** Dynamic imports */
|
|
2168
|
-
dynamicImports?: string[];
|
|
2169
|
-
/** Source files of the bundle */
|
|
2170
|
-
origins?: string[];
|
|
2171
|
-
}
|
|
2172
|
-
|
|
2173
|
-
/**
|
|
2174
|
-
* Bundle graph.
|
|
2175
|
-
*
|
|
2176
|
-
* Format: [ 'bundle-a.js', 3, 5 // Depends on 'bundle-b.js' and 'bundle-c.js' 'bundle-b.js', 5, //
|
|
2177
|
-
* Depends on 'bundle-c.js' 'bundle-c.js', ]
|
|
2178
|
-
*
|
|
2179
|
-
* @public
|
|
2180
|
-
*/
|
|
2181
|
-
declare type QwikBundleGraph = Array<string | number>;
|
|
2182
|
-
|
|
2183
2721
|
/** @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. */
|
|
2184
2722
|
export declare type QwikChangeEvent<T = Element> = Event;
|
|
2185
2723
|
|
|
@@ -2189,13 +2727,19 @@ export declare type QwikClipboardEvent<T = Element> = NativeClipboardEvent;
|
|
|
2189
2727
|
/** @public @deprecated Use `CompositionEvent` and use the second argument to the handler function for the current event target */
|
|
2190
2728
|
export declare type QwikCompositionEvent<T = Element> = NativeCompositionEvent;
|
|
2191
2729
|
|
|
2192
|
-
declare type QwikCustomEvents<EL> = {};
|
|
2193
|
-
|
|
2194
2730
|
declare type QwikCustomEventsPlain<EL> = {
|
|
2195
2731
|
/** The handler */
|
|
2196
2732
|
[key: `${'document:' | 'window:' | ''}on${string}$`]: QRLEventHandlerMulti<Event, EL> | EventHandler<Event, EL>;
|
|
2197
2733
|
};
|
|
2198
2734
|
|
|
2735
|
+
declare type QwikDocumentEventMap = Omit<DocumentEventMap, keyof QwikHTMLElementEventMap> & Omit<QwikHTMLElementEventMap, 'qvisible' | 'focus' | 'blur'> & {
|
|
2736
|
+
qidle: QwikIdleEvent;
|
|
2737
|
+
qinit: QwikInitEvent;
|
|
2738
|
+
qsymbol: QwikSymbolEvent;
|
|
2739
|
+
qresume: QwikResumeEvent;
|
|
2740
|
+
qviewtransition: QwikViewTransitionEvent;
|
|
2741
|
+
};
|
|
2742
|
+
|
|
2199
2743
|
/** @public */
|
|
2200
2744
|
export declare interface QwikDOMAttributes extends DOMAttributes<Element> {
|
|
2201
2745
|
}
|
|
@@ -2204,11 +2748,13 @@ export declare interface QwikDOMAttributes extends DOMAttributes<Element> {
|
|
|
2204
2748
|
export declare type QwikDragEvent<T = Element> = NativeDragEvent;
|
|
2205
2749
|
|
|
2206
2750
|
/** @public */
|
|
2207
|
-
declare type QwikEvents<EL, Plain extends boolean = true> = Plain extends true ? QwikKnownEventsPlain<EL> & QwikCustomEventsPlain<EL> : QwikKnownEvents<EL
|
|
2751
|
+
declare type QwikEvents<EL, Plain extends boolean = true> = Plain extends true ? QwikKnownEventsPlain<EL> & QwikCustomEventsPlain<EL> : QwikKnownEvents<EL>;
|
|
2208
2752
|
|
|
2209
2753
|
/** @public @deprecated Use `FocusEvent` and use the second argument to the handler function for the current event target */
|
|
2210
2754
|
export declare type QwikFocusEvent<T = Element> = NativeFocusEvent;
|
|
2211
2755
|
|
|
2756
|
+
declare type QwikHTMLElementEventMap = Omit<HTMLElementEventMap, keyof EventCorrectionMap> & EventCorrectionMap;
|
|
2757
|
+
|
|
2212
2758
|
/**
|
|
2213
2759
|
* The DOM props without plain handlers, for use inside functions
|
|
2214
2760
|
*
|
|
@@ -2279,78 +2825,31 @@ declare namespace QwikJSX {
|
|
|
2279
2825
|
export { QwikJSX as JSX }
|
|
2280
2826
|
export { QwikJSX }
|
|
2281
2827
|
|
|
2828
|
+
declare type QwikJSXEvents = JSXElementEvents & JSXDocumentEvents & JSXWindowEvents;
|
|
2829
|
+
|
|
2282
2830
|
/** @public @deprecated Use `KeyboardEvent` and use the second argument to the handler function for the current event target */
|
|
2283
2831
|
export declare type QwikKeyboardEvent<T = Element> = NativeKeyboardEvent;
|
|
2284
2832
|
|
|
2285
2833
|
declare type QwikKnownEvents<EL> = {
|
|
2286
|
-
[K in keyof
|
|
2834
|
+
[K in keyof QwikJSXEvents]?: QRLEventHandlerMulti<QwikJSXEvents[K], EL>;
|
|
2287
2835
|
};
|
|
2288
2836
|
|
|
2289
2837
|
declare type QwikKnownEventsPlain<EL> = {
|
|
2290
|
-
[K in keyof
|
|
2838
|
+
[K in keyof QwikJSXEvents]?: QRLEventHandlerMulti<QwikJSXEvents[K], EL> | EventHandler<QwikJSXEvents[K], EL>;
|
|
2291
2839
|
};
|
|
2292
2840
|
|
|
2293
|
-
/**
|
|
2294
|
-
* The metadata of the build. One of its uses is storing where QRL symbols are located.
|
|
2295
|
-
*
|
|
2296
|
-
* @public
|
|
2297
|
-
*/
|
|
2298
|
-
declare interface QwikManifest {
|
|
2299
|
-
/** Content hash of the manifest, if this changes, the code changed */
|
|
2300
|
-
manifestHash: string;
|
|
2301
|
-
/** QRL symbols */
|
|
2302
|
-
symbols: {
|
|
2303
|
-
[symbolName: string]: QwikSymbol;
|
|
2304
|
-
};
|
|
2305
|
-
/** Where QRLs are located. The key is the symbol name, the value is the bundle fileName */
|
|
2306
|
-
mapping: {
|
|
2307
|
-
[symbolName: string]: string;
|
|
2308
|
-
};
|
|
2309
|
-
/**
|
|
2310
|
-
* All code bundles, used to know the import graph. The key is the bundle fileName relative to
|
|
2311
|
-
* "build/"
|
|
2312
|
-
*/
|
|
2313
|
-
bundles: {
|
|
2314
|
-
[fileName: string]: QwikBundle;
|
|
2315
|
-
};
|
|
2316
|
-
/** All assets. The key is the fileName relative to the rootDir */
|
|
2317
|
-
assets?: {
|
|
2318
|
-
[fileName: string]: QwikAsset;
|
|
2319
|
-
};
|
|
2320
|
-
/** All bundles in a compact graph format with probabilities */
|
|
2321
|
-
bundleGraph?: QwikBundleGraph;
|
|
2322
|
-
/** The bundle graph fileName */
|
|
2323
|
-
bundleGraphAsset?: string;
|
|
2324
|
-
/** The preloader bundle fileName */
|
|
2325
|
-
preloader?: string;
|
|
2326
|
-
/** The Qwik core bundle fileName */
|
|
2327
|
-
core?: string;
|
|
2328
|
-
/** The Qwik loader bundle fileName */
|
|
2329
|
-
qwikLoader?: string;
|
|
2330
|
-
/** CSS etc to inject in the document head */
|
|
2331
|
-
injections?: GlobalInjections[];
|
|
2332
|
-
/** The version of the manifest */
|
|
2333
|
-
version: string;
|
|
2334
|
-
/** The options used to build the manifest */
|
|
2335
|
-
options?: {
|
|
2336
|
-
target?: string;
|
|
2337
|
-
buildMode?: string;
|
|
2338
|
-
entryStrategy?: {
|
|
2339
|
-
type: EntryStrategy['type'];
|
|
2340
|
-
};
|
|
2341
|
-
};
|
|
2342
|
-
/** The platform used to build the manifest */
|
|
2343
|
-
platform?: {
|
|
2344
|
-
[name: string]: string;
|
|
2345
|
-
};
|
|
2346
|
-
}
|
|
2347
|
-
|
|
2348
2841
|
/** @public @deprecated Use `MouseEvent` and use the second argument to the handler function for the current event target */
|
|
2349
2842
|
export declare type QwikMouseEvent<T = Element, E = NativeMouseEvent> = E;
|
|
2350
2843
|
|
|
2351
2844
|
/** @public @deprecated Use `PointerEvent` and use the second argument to the handler function for the current event target */
|
|
2352
2845
|
export declare type QwikPointerEvent<T = Element> = NativePointerEvent;
|
|
2353
2846
|
|
|
2847
|
+
/**
|
|
2848
|
+
* Emitted by qwik-core on the container element when it resumes from a paused state. You cannot put
|
|
2849
|
+
* a Qwik event handler on the container so you must listen on the document instead. @public
|
|
2850
|
+
*/
|
|
2851
|
+
export declare type QwikResumeEvent = CustomEvent<{}>;
|
|
2852
|
+
|
|
2354
2853
|
/** @public @deprecated Use `SubmitEvent` and use the second argument to the handler function for the current event target */
|
|
2355
2854
|
export declare type QwikSubmitEvent<T = Element> = SubmitEvent;
|
|
2356
2855
|
|
|
@@ -2363,32 +2862,12 @@ export declare type QwikSVGElements = {
|
|
|
2363
2862
|
[K in keyof Omit<SVGElementTagNameMap, keyof HTMLElementTagNameMap>]: SVGProps<SVGElementTagNameMap[K]>;
|
|
2364
2863
|
};
|
|
2365
2864
|
|
|
2366
|
-
/** @public */
|
|
2367
|
-
declare interface QwikSymbol {
|
|
2368
|
-
origin: string;
|
|
2369
|
-
displayName: string;
|
|
2370
|
-
hash: string;
|
|
2371
|
-
canonicalFilename: string;
|
|
2372
|
-
ctxKind: 'function' | 'eventHandler';
|
|
2373
|
-
ctxName: string;
|
|
2374
|
-
/** Whether the symbol captures a variable */
|
|
2375
|
-
captures: boolean;
|
|
2376
|
-
parent: string | null;
|
|
2377
|
-
loc: [number, number];
|
|
2378
|
-
/** The parameter names if it's a function with parameters */
|
|
2379
|
-
paramNames?: string[];
|
|
2380
|
-
/** The transformed names of scoped variables, if any */
|
|
2381
|
-
captureNames?: string[];
|
|
2382
|
-
}
|
|
2383
|
-
|
|
2384
|
-
/** Emitted by qwik-loader when a module was lazily loaded @public */
|
|
2865
|
+
/** Emitted by qwik-loader on document when a module was lazily loaded @public */
|
|
2385
2866
|
export declare type QwikSymbolEvent = CustomEvent<{
|
|
2386
2867
|
symbol: string;
|
|
2387
2868
|
element: Element;
|
|
2388
2869
|
reqTime: number;
|
|
2389
2870
|
qBase?: string;
|
|
2390
|
-
qManifest?: string;
|
|
2391
|
-
qVersion?: string;
|
|
2392
2871
|
href?: string;
|
|
2393
2872
|
}>;
|
|
2394
2873
|
|
|
@@ -2402,19 +2881,33 @@ export declare type QwikTransitionEvent<T = Element> = NativeTransitionEvent;
|
|
|
2402
2881
|
export declare type QwikUIEvent<T = Element> = NativeUIEvent;
|
|
2403
2882
|
|
|
2404
2883
|
/** Emitted by qwik-core on document when the a view transition start @public */
|
|
2405
|
-
declare type QwikViewTransitionEvent = CustomEvent<ViewTransition>;
|
|
2884
|
+
export declare type QwikViewTransitionEvent = CustomEvent<ViewTransition>;
|
|
2406
2885
|
|
|
2407
|
-
/**
|
|
2886
|
+
/**
|
|
2887
|
+
* Handled by qwik-loader when an element becomes visible. Used by `useVisibleTask$`. Does not
|
|
2888
|
+
* bubble. @public
|
|
2889
|
+
*/
|
|
2408
2890
|
export declare type QwikVisibleEvent = CustomEvent<IntersectionObserverEntry>;
|
|
2409
2891
|
|
|
2410
2892
|
/** @public @deprecated Use `WheelEvent` and use the second argument to the handler function for the current event target */
|
|
2411
2893
|
export declare type QwikWheelEvent<T = Element> = NativeWheelEvent;
|
|
2412
2894
|
|
|
2413
|
-
|
|
2895
|
+
declare type QwikWindowEventMap = Omit<WindowEventHandlersEventMap, keyof QwikDocumentEventMap> & QwikDocumentEventMap;
|
|
2896
|
+
|
|
2897
|
+
/**
|
|
2898
|
+
* @deprecated Use `Readonly<Signal<T>>` instead.
|
|
2899
|
+
* @public
|
|
2900
|
+
*/
|
|
2414
2901
|
export declare interface ReadonlySignal<T = unknown> {
|
|
2415
2902
|
readonly value: T;
|
|
2416
2903
|
}
|
|
2417
2904
|
|
|
2905
|
+
/** @internal */
|
|
2906
|
+
export declare const _reC: (props: RevealProps) => JSXNodeInternal<InternalServerComponent<SSRRevealSlotProps>> | JSXNodeInternal<FunctionComponent< {
|
|
2907
|
+
name?: string;
|
|
2908
|
+
children?: JSXChildren;
|
|
2909
|
+
}>>;
|
|
2910
|
+
|
|
2418
2911
|
/**
|
|
2419
2912
|
* A ref can be either a signal or a function. Note that the type of Signal is Element so that it
|
|
2420
2913
|
* can accept more specialized elements too
|
|
@@ -2431,9 +2924,26 @@ declare type RefFnInterface<EL> = {
|
|
|
2431
2924
|
(el: EL): void;
|
|
2432
2925
|
};
|
|
2433
2926
|
|
|
2434
|
-
/**
|
|
2927
|
+
/**
|
|
2928
|
+
* Register a QRL symbol globally for lookup by its hash. This is used by the optimizer to register
|
|
2929
|
+
* the names passed in `reg_ctx_name`.
|
|
2930
|
+
*
|
|
2931
|
+
* @internal
|
|
2932
|
+
*/
|
|
2435
2933
|
export declare const _regSymbol: (symbol: any, hash: string) => any;
|
|
2436
2934
|
|
|
2935
|
+
declare class RemoveAllChildrenOperation {
|
|
2936
|
+
target: Element;
|
|
2937
|
+
constructor(target: Element);
|
|
2938
|
+
}
|
|
2939
|
+
|
|
2940
|
+
/**
|
|
2941
|
+
* Remove an external projection from its parent and clean up.
|
|
2942
|
+
*
|
|
2943
|
+
* @internal
|
|
2944
|
+
*/
|
|
2945
|
+
export declare function _removeProjection(container: _Container, parentVNode: _VirtualVNode, vnode: _VirtualVNode, slotName: string): void;
|
|
2946
|
+
|
|
2437
2947
|
/**
|
|
2438
2948
|
* Render JSX.
|
|
2439
2949
|
*
|
|
@@ -2451,19 +2961,14 @@ export declare const render: (parent: Element | Document, jsxNode: JSXOutput | F
|
|
|
2451
2961
|
|
|
2452
2962
|
declare const RenderEvent = "qRender";
|
|
2453
2963
|
|
|
2454
|
-
declare interface RenderInvokeContext extends InvokeContext {
|
|
2455
|
-
$hostElement$: HostElement;
|
|
2456
|
-
$event$: PossibleEvents;
|
|
2457
|
-
$waitOn$: Promise<unknown>[];
|
|
2458
|
-
$container$: Container;
|
|
2459
|
-
}
|
|
2460
|
-
|
|
2461
2964
|
/** @public */
|
|
2462
2965
|
export declare const RenderOnce: FunctionComponent<{
|
|
2463
2966
|
children?: unknown;
|
|
2464
2967
|
key?: string | number | null | undefined;
|
|
2465
2968
|
}>;
|
|
2466
2969
|
|
|
2970
|
+
/** @internal */
|
|
2971
|
+
/** @internal */
|
|
2467
2972
|
/** @public */
|
|
2468
2973
|
export declare interface RenderOptions {
|
|
2469
2974
|
serverData?: Record<string, any>;
|
|
@@ -2484,82 +2989,64 @@ export declare interface RenderSSROptions {
|
|
|
2484
2989
|
manifestHash: string;
|
|
2485
2990
|
}
|
|
2486
2991
|
|
|
2487
|
-
/** @
|
|
2488
|
-
declare
|
|
2489
|
-
mapper: SymbolMapper;
|
|
2490
|
-
manifest: ServerQwikManifest;
|
|
2491
|
-
injections?: GlobalInjections[];
|
|
2492
|
-
bundleGraph?: QwikBundleGraph;
|
|
2493
|
-
}
|
|
2992
|
+
/** @internal */
|
|
2993
|
+
export declare const _reR: () => boolean;
|
|
2494
2994
|
|
|
2495
2995
|
/**
|
|
2496
|
-
*
|
|
2497
|
-
*
|
|
2498
|
-
*
|
|
2499
|
-
* `useResource` however returns immediate a `ResourceReturn` object that contains the data and a
|
|
2500
|
-
* state that indicates if the data is available or not.
|
|
2501
|
-
*
|
|
2502
|
-
* The status can be one of the following:
|
|
2503
|
-
*
|
|
2504
|
-
* - `pending` - the data is not yet available.
|
|
2505
|
-
* - `resolved` - the data is available.
|
|
2506
|
-
* - `rejected` - the data is not available due to an error or timeout.
|
|
2507
|
-
*
|
|
2508
|
-
* Be careful when using a `try/catch` statement in `useResource$`. If you catch the error and don't
|
|
2509
|
-
* re-throw it (or a new Error), the resource status will never be `rejected`.
|
|
2510
|
-
*
|
|
2511
|
-
* ### Example
|
|
2512
|
-
*
|
|
2513
|
-
* Example showing how `useResource` to perform a fetch to request the weather, whenever the input
|
|
2514
|
-
* city name changes.
|
|
2996
|
+
* Resumes selected state (e.g. polling AsyncSignals) by deserializing captures. Used for
|
|
2997
|
+
* document:onQIdle to resume async signals with active polling.
|
|
2515
2998
|
*
|
|
2999
|
+
* @internal
|
|
3000
|
+
*/
|
|
3001
|
+
export declare function _res(this: string | undefined, _: any, element: Element): void | Promise<void>;
|
|
3002
|
+
|
|
3003
|
+
/** @internal */
|
|
3004
|
+
export declare const _resolveContextWithoutSequentialScope: <STATE>(context: ContextId<STATE>) => STATE | undefined;
|
|
3005
|
+
|
|
3006
|
+
/**
|
|
2516
3007
|
* ```tsx
|
|
2517
3008
|
* const Cmp = component$(() => {
|
|
2518
|
-
* const
|
|
3009
|
+
* const city = useSignal('');
|
|
2519
3010
|
*
|
|
2520
|
-
* const
|
|
2521
|
-
* const cityName = track(
|
|
2522
|
-
* const abortController = new AbortController();
|
|
2523
|
-
* cleanup(() => abortController.abort('cleanup'));
|
|
3011
|
+
* const weather = useAsync$(async ({ track, cleanup, abortSignal }) => {
|
|
3012
|
+
* const cityName = track(city);
|
|
2524
3013
|
* const res = await fetch(`http://weatherdata.com?city=${cityName}`, {
|
|
2525
|
-
* signal:
|
|
3014
|
+
* signal: abortSignal,
|
|
2526
3015
|
* });
|
|
2527
|
-
* const
|
|
2528
|
-
* return
|
|
3016
|
+
* const temp = (await res.json()) as { temp: number };
|
|
3017
|
+
* return temp;
|
|
2529
3018
|
* });
|
|
2530
3019
|
*
|
|
2531
3020
|
* return (
|
|
2532
3021
|
* <div>
|
|
2533
|
-
* <input name="city" bind:value={
|
|
2534
|
-
* <
|
|
2535
|
-
*
|
|
2536
|
-
*
|
|
2537
|
-
*
|
|
2538
|
-
*
|
|
2539
|
-
*
|
|
3022
|
+
* <input name="city" bind:value={city} />
|
|
3023
|
+
* <div>
|
|
3024
|
+
* Temperature:{' '}
|
|
3025
|
+
* {weather.loading
|
|
3026
|
+
* ? 'Loading...'
|
|
3027
|
+
* : weather.error
|
|
3028
|
+
* ? `Error: ${weather.error.message}`
|
|
3029
|
+
* : weather.value.temp}
|
|
3030
|
+
* </div>
|
|
2540
3031
|
* </div>
|
|
2541
3032
|
* );
|
|
2542
3033
|
* });
|
|
2543
3034
|
* ```
|
|
2544
3035
|
*
|
|
3036
|
+
* @deprecated Use `useAsync$` instead, which is more efficient, and has a more flexible API. Just
|
|
3037
|
+
* read the `loading` and `error` properties from the returned signal to determine the status.
|
|
2545
3038
|
* @public
|
|
2546
|
-
* @see Resource
|
|
2547
|
-
* @see ResourceReturn
|
|
2548
3039
|
*/
|
|
2549
|
-
export declare const Resource: <T>(
|
|
3040
|
+
export declare const Resource: <T>({ value, onResolved, onPending, onRejected, }: ResourceProps<T>) => JSXOutput;
|
|
2550
3041
|
|
|
2551
3042
|
/** @public */
|
|
2552
|
-
export declare interface ResourceCtx<T> {
|
|
2553
|
-
|
|
2554
|
-
cleanup(callback: () => void): void;
|
|
3043
|
+
export declare interface ResourceCtx<T = unknown> extends ComputeCtx<T> {
|
|
3044
|
+
/** @deprecated Does not do anything */
|
|
2555
3045
|
cache(policyOrMilliseconds: number | 'immutable'): void;
|
|
2556
|
-
readonly previous: T | undefined;
|
|
2557
3046
|
}
|
|
2558
3047
|
|
|
2559
|
-
declare const ResourceEvent = "qResource";
|
|
2560
|
-
|
|
2561
3048
|
/** @public */
|
|
2562
|
-
export declare type ResourceFn<T> = (ctx: ResourceCtx
|
|
3049
|
+
export declare type ResourceFn<T> = (ctx: ResourceCtx) => ValueOrPromise<T>;
|
|
2563
3050
|
|
|
2564
3051
|
/**
|
|
2565
3052
|
* Options to pass to `useResource$()`
|
|
@@ -2576,71 +3063,108 @@ export declare interface ResourceOptions {
|
|
|
2576
3063
|
}
|
|
2577
3064
|
|
|
2578
3065
|
/** @public */
|
|
2579
|
-
export declare
|
|
2580
|
-
readonly value: Promise<T>;
|
|
2581
|
-
readonly loading: boolean;
|
|
2582
|
-
}
|
|
3066
|
+
export declare type ResourcePending<T> = ResourceReturn<T>;
|
|
2583
3067
|
|
|
2584
3068
|
/** @public */
|
|
2585
3069
|
export declare interface ResourceProps<T> {
|
|
2586
3070
|
readonly value: ResourceReturn<T> | Signal<Promise<T> | T> | Promise<T>;
|
|
2587
|
-
onResolved: (value: T) => JSXOutput
|
|
2588
|
-
onPending?: () => JSXOutput
|
|
2589
|
-
onRejected?: (reason: Error) => JSXOutput
|
|
3071
|
+
onResolved: (value: T) => JSXOutput | Promise<JSXOutput>;
|
|
3072
|
+
onPending?: () => JSXOutput | Promise<JSXOutput>;
|
|
3073
|
+
onRejected?: (reason: Error) => JSXOutput | Promise<JSXOutput>;
|
|
2590
3074
|
}
|
|
2591
3075
|
|
|
2592
3076
|
/** @public */
|
|
2593
|
-
export declare
|
|
2594
|
-
readonly value: Promise<T>;
|
|
2595
|
-
readonly loading: boolean;
|
|
2596
|
-
}
|
|
3077
|
+
export declare type ResourceRejected<T> = ResourceReturn<T>;
|
|
2597
3078
|
|
|
2598
3079
|
/** @public */
|
|
2599
|
-
export declare
|
|
2600
|
-
readonly value: Promise<T>;
|
|
2601
|
-
readonly loading: boolean;
|
|
2602
|
-
}
|
|
3080
|
+
export declare type ResourceResolved<T> = ResourceReturn<T>;
|
|
2603
3081
|
|
|
2604
3082
|
/** @public */
|
|
2605
|
-
export declare type ResourceReturn<T> =
|
|
3083
|
+
export declare type ResourceReturn<T> = {
|
|
3084
|
+
readonly value: Promise<T>;
|
|
3085
|
+
readonly loading: boolean;
|
|
3086
|
+
};
|
|
2606
3087
|
|
|
2607
3088
|
declare interface ResourceReturnInternal<T> {
|
|
2608
3089
|
__brand: 'resource';
|
|
2609
|
-
_state: 'pending' | 'resolved' | 'rejected';
|
|
2610
|
-
_resolved: T | undefined;
|
|
2611
|
-
_error: Error | undefined;
|
|
2612
|
-
_cache: number;
|
|
2613
|
-
_timeout: number;
|
|
2614
3090
|
value: Promise<T>;
|
|
2615
3091
|
loading: boolean;
|
|
3092
|
+
signal: AsyncSignal<{
|
|
3093
|
+
r: T;
|
|
3094
|
+
}>;
|
|
2616
3095
|
}
|
|
2617
3096
|
|
|
2618
3097
|
/** @internal */
|
|
2619
|
-
export declare const _restProps: (props: PropsProxy, omit
|
|
3098
|
+
export declare const _restProps: (props: PropsProxy, omit?: string[], target?: Props) => Props;
|
|
3099
|
+
|
|
3100
|
+
/** @internal */
|
|
3101
|
+
export declare const _reT: ({ cleanup }: TaskCtx) => void;
|
|
2620
3102
|
|
|
2621
3103
|
/**
|
|
2622
|
-
*
|
|
3104
|
+
* Retries a function that throws a promise. If you pass `onError`, you're responsible for handling
|
|
3105
|
+
* errors.
|
|
2623
3106
|
*
|
|
2624
3107
|
* @internal
|
|
2625
3108
|
*/
|
|
2626
|
-
export declare
|
|
3109
|
+
export declare function _retryOnPromise<T>(fn: () => ValueOrPromise<T>, onError?: (e: any) => ValueOrPromise<T>): ValueOrPromise<T>;
|
|
3110
|
+
|
|
3111
|
+
/** @public @experimental */
|
|
3112
|
+
export declare const Reveal: typeof _reC;
|
|
3113
|
+
|
|
3114
|
+
declare interface RevealItemLike {
|
|
3115
|
+
boundary: {
|
|
3116
|
+
untrackedValue: number;
|
|
3117
|
+
};
|
|
3118
|
+
}
|
|
3119
|
+
|
|
3120
|
+
/** @public @experimental */
|
|
3121
|
+
export declare type RevealOrder = 'parallel' | 'sequential' | 'reverse' | 'together';
|
|
3122
|
+
|
|
3123
|
+
/** @public @experimental */
|
|
3124
|
+
export declare type RevealProps = {
|
|
3125
|
+
order?: RevealOrder;
|
|
3126
|
+
collapsed?: boolean;
|
|
3127
|
+
};
|
|
2627
3128
|
|
|
2628
|
-
declare
|
|
3129
|
+
declare interface RevealRegistrationLike<ITEM extends RevealItemLike = RevealItemLike> {
|
|
3130
|
+
reveal: {
|
|
3131
|
+
order: RevealOrder;
|
|
3132
|
+
items: ITEM[];
|
|
3133
|
+
};
|
|
3134
|
+
item: ITEM;
|
|
3135
|
+
}
|
|
2629
3136
|
|
|
3137
|
+
/**
|
|
3138
|
+
* The resource function wrapper
|
|
3139
|
+
*
|
|
3140
|
+
* @internal
|
|
3141
|
+
*/
|
|
3142
|
+
export declare const _rsc: <T>(arg: ResourceCtx<T>) => Promise<{
|
|
3143
|
+
r: T;
|
|
3144
|
+
}>;
|
|
3145
|
+
|
|
3146
|
+
/**
|
|
3147
|
+
* This is called by qwik-loader to run a QRL. It has to be synchronous when possible.
|
|
3148
|
+
*
|
|
3149
|
+
* @internal
|
|
3150
|
+
*/
|
|
3151
|
+
export declare function _run(this: string, event: Event, element: Element): ValueOrPromise<unknown>;
|
|
3152
|
+
|
|
3153
|
+
/** Stores the location of an object. If no parent, it's a root. */
|
|
2630
3154
|
declare type SeenRef = {
|
|
2631
|
-
$parent$: unknown | null;
|
|
2632
3155
|
$index$: number;
|
|
2633
|
-
$
|
|
3156
|
+
$parent$?: SeenRef | null;
|
|
2634
3157
|
};
|
|
2635
3158
|
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
|
|
3159
|
+
declare interface SegmentRenderContext {
|
|
3160
|
+
container: SSRSegmentContainer;
|
|
3161
|
+
writer: SSRInternalStreamWriter;
|
|
3162
|
+
htmlChunks: SSRSegmentWriteChunk[];
|
|
2640
3163
|
}
|
|
2641
3164
|
|
|
2642
3165
|
declare interface SerializationContext {
|
|
2643
|
-
$serialize$: () => void
|
|
3166
|
+
$serialize$: () => ValueOrPromise<void>;
|
|
3167
|
+
$serializePatch$: (rootStart: number, rootIds: number[], extraRootId?: number | string | number[], streamedRootLimit?: number) => ValueOrPromise<void>;
|
|
2644
3168
|
$symbolToChunkResolver$: SymbolToChunkResolver;
|
|
2645
3169
|
/**
|
|
2646
3170
|
* Map from object to parent and index reference.
|
|
@@ -2652,60 +3176,76 @@ declare interface SerializationContext {
|
|
|
2652
3176
|
* - `{ parent, index }` - The parent object and the index within that parent.
|
|
2653
3177
|
* - `undefined` - Object has not been seen yet.
|
|
2654
3178
|
*/
|
|
2655
|
-
|
|
3179
|
+
getSeenRef: (obj: unknown) => SeenRef | undefined;
|
|
3180
|
+
/** Returns the root index of the object, if it is a root. Otherwise returns undefined. */
|
|
2656
3181
|
$hasRootId$: (obj: unknown) => number | undefined;
|
|
2657
3182
|
/**
|
|
2658
3183
|
* Root objects which need to be serialized.
|
|
2659
3184
|
*
|
|
2660
|
-
* Roots are entry points into the object graph. Typically the roots are held by the listeners.
|
|
2661
|
-
*
|
|
2662
|
-
* Returns a path string representing the path from roots through all parents to the object.
|
|
2663
|
-
* Format: "3 2 0" where each number is the index within its parent, from root to leaf.
|
|
2664
|
-
*/
|
|
2665
|
-
$addRoot$: (obj: unknown, parent?: unknown) => number;
|
|
2666
|
-
/**
|
|
2667
|
-
* Get root path of the object without creating a new root.
|
|
2668
|
-
*
|
|
2669
|
-
* This is used during serialization, as new roots can't be created during serialization.
|
|
3185
|
+
* Roots are entry points into the object graph. Typically the roots are held by the listeners.
|
|
2670
3186
|
*
|
|
2671
|
-
*
|
|
3187
|
+
* Returns the index of the root object.
|
|
2672
3188
|
*/
|
|
2673
|
-
$
|
|
2674
|
-
$
|
|
3189
|
+
$addRoot$: AddRootFn;
|
|
3190
|
+
$addDuplicateRoot$: (obj: unknown) => SeenRef;
|
|
3191
|
+
$commitRoot$: (root: unknown, obj: unknown) => number;
|
|
3192
|
+
/** Mark an object as seen during serialization. This is used to handle backreferences and cycles */
|
|
3193
|
+
$markSeen$: (obj: unknown, parent: SeenRef | undefined, index: number) => SeenRef;
|
|
2675
3194
|
$roots$: unknown[];
|
|
2676
|
-
$
|
|
3195
|
+
$rootObjs$: unknown[];
|
|
3196
|
+
$onAddRoot$?: (id: number, root: unknown, obj: unknown) => void;
|
|
3197
|
+
$forwardRefOffset$: number;
|
|
3198
|
+
$serializedRootCount$: number;
|
|
3199
|
+
$serializedForwardRefCount$: number;
|
|
3200
|
+
$rootStateRootCount$: number;
|
|
3201
|
+
$hasRootStateForwardRefs$: boolean;
|
|
3202
|
+
$promoteToRoot$: (ref: SeenRef, obj: unknown, index?: number) => void;
|
|
2677
3203
|
$addSyncFn$($funcStr$: string | null, argsCount: number, fn: Function): number;
|
|
2678
|
-
$
|
|
3204
|
+
$setSyncFnOffset$(offset: number, existingFns?: string[]): void;
|
|
3205
|
+
$isSsrNode$: (obj: unknown) => obj is ISsrNode;
|
|
2679
3206
|
$isDomRef$: (obj: unknown) => obj is DomRef;
|
|
2680
|
-
$
|
|
3207
|
+
$markSsrNodeForSerialization$: (node: ISsrNode, flags: number) => void;
|
|
3208
|
+
$writer$: SSRInternalStreamWriter;
|
|
3209
|
+
$setWriter$(writer: SSRInternalStreamWriter): void;
|
|
2681
3210
|
$syncFns$: string[];
|
|
2682
3211
|
$eventQrls$: Set<QRL>;
|
|
2683
3212
|
$eventNames$: Set<string>;
|
|
2684
|
-
$resources$: Set<ResourceReturnInternal<unknown>>;
|
|
2685
3213
|
$renderSymbols$: Set<string>;
|
|
2686
3214
|
$storeProxyMap$: ObjToProxyMap;
|
|
2687
|
-
$
|
|
3215
|
+
$eagerResume$: Set<unknown>;
|
|
2688
3216
|
$setProp$: (obj: any, prop: string, value: any) => void;
|
|
2689
3217
|
}
|
|
2690
3218
|
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
$obj$: unknown;
|
|
2696
|
-
constructor($obj$: unknown);
|
|
3219
|
+
declare const enum SerializationSignalFlags {
|
|
3220
|
+
SERIALIZATION_STRATEGY_NEVER = 8,
|
|
3221
|
+
SERIALIZATION_STRATEGY_ALWAYS = 16,
|
|
3222
|
+
SERIALIZATION_ALL_STRATEGIES = 24
|
|
2697
3223
|
}
|
|
2698
3224
|
|
|
2699
|
-
/**
|
|
2700
|
-
|
|
3225
|
+
/**
|
|
3226
|
+
* Serialization strategy for computed and async signals. This determines whether to serialize their
|
|
3227
|
+
* value during SSR.
|
|
3228
|
+
*
|
|
3229
|
+
* - `never`: The value is never serialized. When the component is resumed, the value will be
|
|
3230
|
+
* recalculated when it is first read.
|
|
3231
|
+
* - `always`: The value is always serialized. This is the default.
|
|
3232
|
+
*
|
|
3233
|
+
* **IMPORTANT**: When you use `never`, your serialized HTML is smaller, but the recalculation will
|
|
3234
|
+
* trigger subscriptions, meaning that other signals using this signal will recalculate, even if
|
|
3235
|
+
* this signal didn't change.
|
|
3236
|
+
*
|
|
3237
|
+
* This is normally not a problem, but for async signals it may mean fetching something again.
|
|
3238
|
+
*
|
|
3239
|
+
* @public
|
|
3240
|
+
*/
|
|
3241
|
+
export declare type SerializationStrategy = 'never' | 'always';
|
|
2701
3242
|
|
|
2702
3243
|
/**
|
|
2703
3244
|
* Serialize data to string using SerializationContext.
|
|
2704
3245
|
*
|
|
2705
|
-
* @param data - Data to serialize
|
|
2706
3246
|
* @internal
|
|
2707
3247
|
*/
|
|
2708
|
-
export declare function _serialize(data:
|
|
3248
|
+
export declare function _serialize<T>(data: T): Promise<string>;
|
|
2709
3249
|
|
|
2710
3250
|
/**
|
|
2711
3251
|
* Serialize and deserialize custom objects.
|
|
@@ -2768,9 +3308,9 @@ declare interface SerializerSignal<T> extends ComputedSignal<T> {
|
|
|
2768
3308
|
* @public
|
|
2769
3309
|
*/
|
|
2770
3310
|
declare class SerializerSignalImpl<T, S> extends ComputedSignalImpl<T> {
|
|
2771
|
-
constructor(container:
|
|
3311
|
+
constructor(container: _Container | null, argQrl: _QRLInternal<SerializerArg<T, S>>);
|
|
2772
3312
|
$didInitialize$: boolean;
|
|
2773
|
-
$computeIfNeeded$():
|
|
3313
|
+
$computeIfNeeded$(): void;
|
|
2774
3314
|
}
|
|
2775
3315
|
|
|
2776
3316
|
/**
|
|
@@ -2791,12 +3331,17 @@ declare class SerializerSignalImpl<T, S> extends ComputedSignalImpl<T> {
|
|
|
2791
3331
|
*/
|
|
2792
3332
|
export declare const SerializerSymbol: unique symbol;
|
|
2793
3333
|
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
|
|
2798
|
-
|
|
2799
|
-
|
|
3334
|
+
declare class SetAttributeOperation {
|
|
3335
|
+
target: Element;
|
|
3336
|
+
attrName: string;
|
|
3337
|
+
attrValue: any;
|
|
3338
|
+
scopedStyleIdPrefix: string | null;
|
|
3339
|
+
isSvg: boolean;
|
|
3340
|
+
constructor(target: Element, attrName: string, attrValue: any, scopedStyleIdPrefix: string | null, isSvg: boolean);
|
|
3341
|
+
}
|
|
3342
|
+
|
|
3343
|
+
/** @internal */
|
|
3344
|
+
export declare function _setEvent(serializationCtx: SerializationContext, key: string, rawValue: unknown, hasMovedCaptures: boolean): string | SSRWriteChunk[] | null;
|
|
2800
3345
|
|
|
2801
3346
|
/**
|
|
2802
3347
|
* Sets the `CorePlatform`.
|
|
@@ -2810,19 +3355,39 @@ declare type ServerQwikManifest = Pick<QwikManifest, 'manifestHash' | 'injection
|
|
|
2810
3355
|
*/
|
|
2811
3356
|
export declare const setPlatform: (plt: CorePlatform) => CorePlatform;
|
|
2812
3357
|
|
|
3358
|
+
/**
|
|
3359
|
+
* Set the DOM target element for an external projection VNode.
|
|
3360
|
+
*
|
|
3361
|
+
* When the cursor walker processes this VNode, DOM operations will target this element instead of
|
|
3362
|
+
* walking the parent chain.
|
|
3363
|
+
*
|
|
3364
|
+
* @internal
|
|
3365
|
+
*/
|
|
3366
|
+
export declare function _setProjectionTarget(vnode: _VirtualVNode, targetElement: Element): void;
|
|
3367
|
+
|
|
3368
|
+
declare class SetTextOperation {
|
|
3369
|
+
target: Text;
|
|
3370
|
+
text: string;
|
|
3371
|
+
constructor(target: Text, text: string);
|
|
3372
|
+
}
|
|
3373
|
+
|
|
2813
3374
|
/** @internal */
|
|
2814
|
-
export declare abstract class _SharedContainer implements
|
|
3375
|
+
export declare abstract class _SharedContainer implements _Container {
|
|
2815
3376
|
readonly $version$: string;
|
|
2816
|
-
readonly $scheduler$: Scheduler;
|
|
2817
3377
|
readonly $storeProxyMap$: ObjToProxyMap;
|
|
3378
|
+
$rootContainer$: _Container | null;
|
|
3379
|
+
$isOutOfOrderSegment$: boolean;
|
|
2818
3380
|
readonly $locale$: string;
|
|
2819
3381
|
readonly $getObjectById$: (id: number | string) => any;
|
|
2820
3382
|
$serverData$: Record<string, any>;
|
|
2821
3383
|
$currentUniqueId$: number;
|
|
2822
3384
|
$instanceHash$: string | null;
|
|
2823
3385
|
$buildBase$: string | null;
|
|
2824
|
-
|
|
2825
|
-
|
|
3386
|
+
$renderPromise$: Promise<void> | null;
|
|
3387
|
+
$resolveRenderPromise$: (() => void) | null;
|
|
3388
|
+
$pendingCount$: number;
|
|
3389
|
+
constructor(serverData: Record<string, any>, locale: string);
|
|
3390
|
+
trackSignalValue<T>(signal: Signal, subscriber: _HostElement, property: string, data: _SubscriptionData): T;
|
|
2826
3391
|
serializationCtxFactory(NodeConstructor: {
|
|
2827
3392
|
new (...rest: any[]): {
|
|
2828
3393
|
__brand__: 'SsrNode';
|
|
@@ -2832,16 +3397,36 @@ export declare abstract class _SharedContainer implements Container {
|
|
|
2832
3397
|
__brand__: 'DomRef';
|
|
2833
3398
|
};
|
|
2834
3399
|
} | null, symbolToChunkResolver: SymbolToChunkResolver, writer?: StreamWriter): SerializationContext;
|
|
2835
|
-
|
|
2836
|
-
abstract
|
|
2837
|
-
abstract
|
|
2838
|
-
abstract
|
|
2839
|
-
abstract
|
|
2840
|
-
abstract
|
|
2841
|
-
abstract
|
|
2842
|
-
abstract
|
|
3400
|
+
$checkPendingCount$(): void;
|
|
3401
|
+
abstract ensureProjectionResolved(host: _HostElement): void;
|
|
3402
|
+
abstract handleError(err: any, $host$: _HostElement | null): void;
|
|
3403
|
+
abstract getParentHost(host: _HostElement): _HostElement | null;
|
|
3404
|
+
abstract setContext<T>(host: _HostElement, context: ContextId<T>, value: T): void;
|
|
3405
|
+
abstract resolveContext<T>(host: _HostElement, contextId: ContextId<T>): T | undefined;
|
|
3406
|
+
abstract setHostProp<T>(host: _HostElement, name: string, value: T): void;
|
|
3407
|
+
abstract getHostProp<T>(host: _HostElement, name: string): T | null;
|
|
3408
|
+
abstract $appendStyle$(content: string, styleId: string, host: _HostElement, scoped: boolean): void;
|
|
3409
|
+
}
|
|
3410
|
+
|
|
3411
|
+
/** @internal */
|
|
3412
|
+
export declare const _shC: (props: ShowProps<any>) => JSXNode<unknown>;
|
|
3413
|
+
|
|
3414
|
+
/** @public @experimental */
|
|
3415
|
+
export declare const Show: ShowComponent;
|
|
3416
|
+
|
|
3417
|
+
/** @public @experimental */
|
|
3418
|
+
export declare type ShowComponent = <WHEN = unknown, THEN extends JSXOutput = JSXOutput, ELSE extends JSXOutput = JSXOutput>(props: PublicProps<ShowProps<WHEN, THEN, ELSE>>, key: string | null, flags: number, dev?: DevJSX) => JSXOutput;
|
|
3419
|
+
|
|
3420
|
+
/** @public @experimental */
|
|
3421
|
+
export declare interface ShowProps<WHEN = unknown, THEN extends JSXOutput = JSXOutput, ELSE extends JSXOutput = JSXOutput> {
|
|
3422
|
+
when$: QRL<() => WHEN>;
|
|
3423
|
+
then$: QRL<(when: WHEN) => THEN>;
|
|
3424
|
+
else$?: QRL<(when: WHEN) => ELSE>;
|
|
2843
3425
|
}
|
|
2844
3426
|
|
|
3427
|
+
/** @internal */
|
|
3428
|
+
export declare const _shT: ({ track }: TaskCtx) => ValueOrPromise<void | undefined>;
|
|
3429
|
+
|
|
2845
3430
|
/**
|
|
2846
3431
|
* A signal is a reactive value which can be read and written. When the signal is written, all tasks
|
|
2847
3432
|
* which are tracking the signal will be re-run and all components that read the signal will be
|
|
@@ -2854,20 +3439,32 @@ export declare abstract class _SharedContainer implements Container {
|
|
|
2854
3439
|
*
|
|
2855
3440
|
* @public
|
|
2856
3441
|
*/
|
|
2857
|
-
export declare interface Signal<T = any>
|
|
3442
|
+
export declare interface Signal<T = any> {
|
|
3443
|
+
/** Reading from this subscribes to updates; writing to this triggers updates. */
|
|
2858
3444
|
value: T;
|
|
2859
|
-
|
|
2860
|
-
|
|
2861
|
-
|
|
2862
|
-
|
|
3445
|
+
/** Reading from this does not subscribe to updates; writing to this does not trigger updates. */
|
|
3446
|
+
untrackedValue: T;
|
|
3447
|
+
/**
|
|
3448
|
+
* Use this to trigger running subscribers, for example when the value mutated but remained the
|
|
3449
|
+
* same object.
|
|
3450
|
+
*/
|
|
3451
|
+
trigger(): void;
|
|
2863
3452
|
}
|
|
2864
3453
|
|
|
2865
3454
|
declare class SignalImpl<T = any> implements Signal<T> {
|
|
2866
3455
|
$untrackedValue$: T;
|
|
2867
3456
|
/** Store a list of effects which are dependent on this signal. */
|
|
2868
|
-
$effects$:
|
|
2869
|
-
$container$:
|
|
2870
|
-
|
|
3457
|
+
$effects$: undefined | Set<EffectSubscription>;
|
|
3458
|
+
$container$: _Container | null;
|
|
3459
|
+
$wrappedSignal$: WrappedSignalImpl<T> | null;
|
|
3460
|
+
constructor(container: _Container | null | undefined, value: T);
|
|
3461
|
+
/**
|
|
3462
|
+
* Use this to trigger running subscribers, for example when the calculated value has mutated but
|
|
3463
|
+
* remained the same object
|
|
3464
|
+
*/
|
|
3465
|
+
trigger(): void;
|
|
3466
|
+
/** @deprecated Use `trigger()` instead */
|
|
3467
|
+
force(): void;
|
|
2871
3468
|
get untrackedValue(): T;
|
|
2872
3469
|
set untrackedValue(value: T);
|
|
2873
3470
|
get value(): T;
|
|
@@ -2885,12 +3482,6 @@ declare interface SimplifiedServerRequestEvent<T = unknown> {
|
|
|
2885
3482
|
request: Request;
|
|
2886
3483
|
}
|
|
2887
3484
|
|
|
2888
|
-
/** @public */
|
|
2889
|
-
declare interface SingleEntryStrategy {
|
|
2890
|
-
type: 'single';
|
|
2891
|
-
manual?: Record<string, string>;
|
|
2892
|
-
}
|
|
2893
|
-
|
|
2894
3485
|
/** @public */
|
|
2895
3486
|
declare type Size = number | string;
|
|
2896
3487
|
|
|
@@ -2908,12 +3499,6 @@ export declare const Slot: FunctionComponent<{
|
|
|
2908
3499
|
children?: JSXChildren;
|
|
2909
3500
|
}>;
|
|
2910
3501
|
|
|
2911
|
-
/** @public */
|
|
2912
|
-
declare interface SmartEntryStrategy {
|
|
2913
|
-
type: 'smart';
|
|
2914
|
-
manual?: Record<string, string>;
|
|
2915
|
-
}
|
|
2916
|
-
|
|
2917
3502
|
/** @public */
|
|
2918
3503
|
export declare interface SnapshotListener {
|
|
2919
3504
|
key: string;
|
|
@@ -3154,49 +3739,65 @@ declare type SpecialAttrs = {
|
|
|
3154
3739
|
[key: string]: {};
|
|
3155
3740
|
};
|
|
3156
3741
|
|
|
3157
|
-
declare type SsrAttrKey = string;
|
|
3158
|
-
|
|
3159
|
-
declare type SsrAttrs = Array<SsrAttrKey | SsrAttrValue>;
|
|
3160
|
-
|
|
3161
|
-
declare type SsrAttrValue = string | Signal<any> | boolean | object | null;
|
|
3162
|
-
|
|
3163
3742
|
/** @public */
|
|
3164
3743
|
export declare const SSRComment: FunctionComponent<{
|
|
3165
3744
|
data: string;
|
|
3166
3745
|
}>;
|
|
3167
3746
|
|
|
3168
|
-
declare interface SSRContainer extends
|
|
3747
|
+
declare interface SSRContainer extends _Container {
|
|
3169
3748
|
readonly tag: string;
|
|
3170
3749
|
readonly isHtml: boolean;
|
|
3171
|
-
readonly
|
|
3750
|
+
readonly size: number;
|
|
3751
|
+
readonly writer: SSRInternalStreamWriter;
|
|
3752
|
+
readonly streamHandler: IStreamHandler;
|
|
3172
3753
|
readonly serializationCtx: SerializationContext;
|
|
3173
3754
|
readonly symbolToChunkResolver: SymbolToChunkResolver;
|
|
3174
3755
|
readonly resolvedManifest: ResolvedManifest;
|
|
3756
|
+
readonly outOfOrderStreaming: boolean;
|
|
3175
3757
|
additionalHeadNodes: Array<JSXNodeInternal>;
|
|
3176
3758
|
additionalBodyNodes: Array<JSXNodeInternal>;
|
|
3177
|
-
|
|
3759
|
+
$noScriptHere$: number;
|
|
3760
|
+
/**
|
|
3761
|
+
* Lets the container place a root-level `useOn` placeholder `<script>` itself when injecting it
|
|
3762
|
+
* inline would put it at an illegal position. Returns `true` if the container took the node, in
|
|
3763
|
+
* which case the caller must not inject it into the component's JSX.
|
|
3764
|
+
*/
|
|
3765
|
+
$deferRootPlaceholder$(scriptNode: JSXNodeInternal<string>): boolean;
|
|
3766
|
+
write(text: string): void;
|
|
3178
3767
|
openContainer(): void;
|
|
3179
3768
|
closeContainer(): ValueOrPromise<void>;
|
|
3180
|
-
openElement(elementName: string,
|
|
3769
|
+
openElement(elementName: string, key: string | null, varAttrs: Props, constAttrs: Props | null, styleScopedId: string | null, currentFile: string | null, hasMovedCaptures?: boolean): string | undefined;
|
|
3181
3770
|
closeElement(): ValueOrPromise<void>;
|
|
3182
|
-
openFragment(attrs:
|
|
3771
|
+
openFragment(attrs: Props): void;
|
|
3183
3772
|
closeFragment(): void;
|
|
3184
|
-
openProjection(attrs:
|
|
3773
|
+
openProjection(attrs: Props): void;
|
|
3185
3774
|
closeProjection(): void;
|
|
3186
|
-
openComponent(attrs:
|
|
3775
|
+
openComponent(attrs: Props): void;
|
|
3187
3776
|
getComponentFrame(projectionDepth: number): ISsrComponentFrame | null;
|
|
3188
3777
|
getParentComponentFrame(): ISsrComponentFrame | null;
|
|
3189
|
-
closeComponent(): void
|
|
3778
|
+
closeComponent(): Promise<void>;
|
|
3190
3779
|
textNode(text: string): void;
|
|
3191
3780
|
htmlNode(rawHtml: string): void;
|
|
3192
3781
|
commentNode(text: string): void;
|
|
3193
|
-
addRoot(obj: any): number | undefined;
|
|
3782
|
+
addRoot(obj: any): number | string | undefined;
|
|
3194
3783
|
getOrCreateLastNode(): ISsrNode;
|
|
3195
3784
|
addUnclaimedProjection(frame: ISsrComponentFrame, name: string, children: JSXChildren): void;
|
|
3196
3785
|
isStatic(): boolean;
|
|
3197
3786
|
render(jsx: JSXOutput): Promise<void>;
|
|
3787
|
+
renderJSX(jsx: JSXOutput, options: SSRRenderJSXOptions): Promise<void>;
|
|
3788
|
+
$runQueuedRender$<T>(render: () => ValueOrPromise<T>): ValueOrPromise<T>;
|
|
3789
|
+
nextOutOfOrderId(): number;
|
|
3790
|
+
emitOutOfOrderSegmentScripts(scripts: string): void;
|
|
3791
|
+
segment(segmentId: string, jsx: JSXOutput, options: SSRRenderJSXOptions): Promise<SSROutOfOrderSegment>;
|
|
3792
|
+
queueOutOfOrderSegment(segment: Promise<void>): void;
|
|
3793
|
+
emitOutOfOrderExecutorIfNeeded(): void;
|
|
3794
|
+
emitInlineScript(script: string): void;
|
|
3795
|
+
writeScript(attrs: Props, body?: string): void;
|
|
3198
3796
|
emitPreloaderPre(): void;
|
|
3199
3797
|
emitQwikLoaderAtTopIfNeeded(): void;
|
|
3798
|
+
emitPatchDataIfNeeded(): void;
|
|
3799
|
+
emitBackpatchDataAndExecutorIfNeeded(): void;
|
|
3800
|
+
addBackpatchEntry(ssrNodeId: string, attrName: string, serializedValue: string | boolean | null): void;
|
|
3200
3801
|
}
|
|
3201
3802
|
|
|
3202
3803
|
/** @public */
|
|
@@ -3204,19 +3805,68 @@ export declare type SSRHintProps = {
|
|
|
3204
3805
|
dynamic?: boolean;
|
|
3205
3806
|
};
|
|
3206
3807
|
|
|
3207
|
-
/**
|
|
3208
|
-
declare
|
|
3209
|
-
id:
|
|
3210
|
-
|
|
3211
|
-
|
|
3212
|
-
[
|
|
3213
|
-
}
|
|
3808
|
+
/** @internal */
|
|
3809
|
+
declare interface SSRInternalStreamWriter extends StreamWriter {
|
|
3810
|
+
writeRootRef(id: number): ValueOrPromise<void>;
|
|
3811
|
+
writeRootRefPath(path: number[]): ValueOrPromise<void>;
|
|
3812
|
+
writeRootRefDelta(id: number, base: number): ValueOrPromise<void>;
|
|
3813
|
+
toString(remap?: number[]): string;
|
|
3814
|
+
}
|
|
3815
|
+
|
|
3816
|
+
declare const enum SsrNodeFlags {
|
|
3817
|
+
Updatable = 1,
|
|
3818
|
+
WarnedStreamedChore = 2
|
|
3819
|
+
}
|
|
3820
|
+
|
|
3821
|
+
declare type SSROutOfOrderSegment = SegmentRenderContext;
|
|
3214
3822
|
|
|
3215
3823
|
/** @public */
|
|
3216
3824
|
export declare const SSRRaw: FunctionComponent<{
|
|
3217
3825
|
data: string;
|
|
3218
3826
|
}>;
|
|
3219
3827
|
|
|
3828
|
+
declare interface SSRRenderJSXOptions {
|
|
3829
|
+
currentStyleScoped: string | null;
|
|
3830
|
+
parentComponentFrame: ISsrComponentFrame | null;
|
|
3831
|
+
}
|
|
3832
|
+
|
|
3833
|
+
declare type SSRRevealSlotProps = {
|
|
3834
|
+
coordinator: OutOfOrderRevealCoordinator;
|
|
3835
|
+
};
|
|
3836
|
+
|
|
3837
|
+
/** @internal */
|
|
3838
|
+
declare interface SSRRootRefDeltaChunk {
|
|
3839
|
+
readonly id: number;
|
|
3840
|
+
readonly base: number;
|
|
3841
|
+
}
|
|
3842
|
+
|
|
3843
|
+
/** @internal */
|
|
3844
|
+
declare interface SSRRootRefPathChunk {
|
|
3845
|
+
readonly path: number[];
|
|
3846
|
+
}
|
|
3847
|
+
|
|
3848
|
+
declare interface SSRSegmentContainer extends SSRContainer {
|
|
3849
|
+
$rootContainer$: SSRContainer;
|
|
3850
|
+
$recordExternalRootEffect$(producer: unknown, effect: EffectSubscription, prop: string | symbol | null, sourceEffects?: Map<string | symbol, Set<EffectSubscription>>): void;
|
|
3851
|
+
$finalizeOutOfOrderSegment$(segmentId: string, segment: SSROutOfOrderSegment): Promise<{
|
|
3852
|
+
html: string;
|
|
3853
|
+
scripts: string;
|
|
3854
|
+
}>;
|
|
3855
|
+
}
|
|
3856
|
+
|
|
3857
|
+
/** @internal */
|
|
3858
|
+
declare type SSRSegmentWriteChunk = string | {
|
|
3859
|
+
readonly type: 'root-ref';
|
|
3860
|
+
readonly localId: number;
|
|
3861
|
+
} | {
|
|
3862
|
+
readonly type: 'root-ref-path';
|
|
3863
|
+
readonly localPath: number[];
|
|
3864
|
+
} | {
|
|
3865
|
+
readonly type: 'root-ref-delta';
|
|
3866
|
+
readonly localId: number;
|
|
3867
|
+
readonly localBaseId: number;
|
|
3868
|
+
};
|
|
3869
|
+
|
|
3220
3870
|
/** @public */
|
|
3221
3871
|
export declare const SSRStream: FunctionComponent<SSRStreamProps>;
|
|
3222
3872
|
|
|
@@ -3226,43 +3876,42 @@ export declare const SSRStreamBlock: FunctionComponent<{
|
|
|
3226
3876
|
}>;
|
|
3227
3877
|
|
|
3228
3878
|
/** @public */
|
|
3229
|
-
export declare type SSRStreamChildren = AsyncGenerator<JSXChildren, void, any> | ((stream:
|
|
3879
|
+
export declare type SSRStreamChildren = AsyncGenerator<JSXChildren, void, any> | ((stream: SSRStreamWriter) => Promise<void>) | (() => AsyncGenerator<JSXChildren, void, any>);
|
|
3230
3880
|
|
|
3231
3881
|
/** @public */
|
|
3232
3882
|
export declare type SSRStreamProps = {
|
|
3233
3883
|
children: SSRStreamChildren;
|
|
3234
3884
|
};
|
|
3235
3885
|
|
|
3886
|
+
/** @public */
|
|
3887
|
+
export declare interface SSRStreamWriter {
|
|
3888
|
+
write(chunk: JSXOutput): void;
|
|
3889
|
+
}
|
|
3890
|
+
|
|
3891
|
+
/** @internal */
|
|
3892
|
+
declare type SSRWriteChunk = string | number | SSRRootRefPathChunk | SSRRootRefDeltaChunk;
|
|
3893
|
+
|
|
3894
|
+
declare type StackFn = () => ValueOrPromise<void>;
|
|
3895
|
+
|
|
3896
|
+
declare type StackValue = ValueOrPromise<JSXOutput | StackFn | Promise<JSXOutput> | typeof Promise | AsyncGenerator | typeof MaybeAsyncSignal>;
|
|
3897
|
+
|
|
3236
3898
|
declare type StopPropagation = {
|
|
3237
3899
|
[K in keyof HTMLElementEventMap as `stoppropagation:${K}`]?: boolean;
|
|
3238
3900
|
};
|
|
3239
3901
|
|
|
3240
|
-
|
|
3902
|
+
/** @internal */
|
|
3903
|
+
export declare const enum _StoreFlags {
|
|
3241
3904
|
NONE = 0,
|
|
3242
3905
|
RECURSIVE = 1,
|
|
3243
3906
|
IMMUTABLE = 2
|
|
3244
3907
|
}
|
|
3245
3908
|
|
|
3246
|
-
declare class StoreHandler implements ProxyHandler<StoreTarget> {
|
|
3247
|
-
$flags$: StoreFlags;
|
|
3248
|
-
$container$: Container | null;
|
|
3249
|
-
$effects$: null | Map<string | symbol, Set<EffectSubscription>>;
|
|
3250
|
-
constructor($flags$: StoreFlags, $container$: Container | null);
|
|
3251
|
-
toString(): string;
|
|
3252
|
-
get(target: StoreTarget, prop: string | symbol): any;
|
|
3253
|
-
/** In the case of oldValue and value are the same, the effects are not triggered. */
|
|
3254
|
-
set(target: StoreTarget, prop: string | symbol, value: any): boolean;
|
|
3255
|
-
deleteProperty(target: StoreTarget, prop: string | symbol): boolean;
|
|
3256
|
-
has(target: StoreTarget, prop: string | symbol): boolean;
|
|
3257
|
-
ownKeys(target: StoreTarget): ArrayLike<string | symbol>;
|
|
3258
|
-
getOwnPropertyDescriptor(target: StoreTarget, prop: string | symbol): PropertyDescriptor | undefined;
|
|
3259
|
-
}
|
|
3260
|
-
|
|
3261
3909
|
declare type StoreTarget = Record<string | symbol, any>;
|
|
3262
3910
|
|
|
3263
3911
|
/** @internal */
|
|
3264
3912
|
export declare interface StreamWriter {
|
|
3265
|
-
write(chunk: string): void
|
|
3913
|
+
write(chunk: string): ValueOrPromise<void>;
|
|
3914
|
+
waitForDrain?(): ValueOrPromise<void>;
|
|
3266
3915
|
}
|
|
3267
3916
|
|
|
3268
3917
|
/** @file Shared types */
|
|
@@ -3275,6 +3924,28 @@ export declare class _SubscriptionData {
|
|
|
3275
3924
|
constructor(data: NodePropData);
|
|
3276
3925
|
}
|
|
3277
3926
|
|
|
3927
|
+
/** @internal */
|
|
3928
|
+
export declare class _SubscriptionPatch {
|
|
3929
|
+
rootId: number;
|
|
3930
|
+
subscriptions: Set<EffectSubscription> | Map<string | symbol, Set<EffectSubscription>>;
|
|
3931
|
+
constructor(rootId?: number, subscriptions?: Set<EffectSubscription> | Map<string | symbol, Set<EffectSubscription>>);
|
|
3932
|
+
}
|
|
3933
|
+
|
|
3934
|
+
/** @internal */
|
|
3935
|
+
export declare const _suC: (props: SuspenseProps) => JSXNodeInternal<string>[];
|
|
3936
|
+
|
|
3937
|
+
/** @public @experimental */
|
|
3938
|
+
export declare const Suspense: typeof _suC;
|
|
3939
|
+
|
|
3940
|
+
/** @public @experimental */
|
|
3941
|
+
export declare type SuspenseProps = {
|
|
3942
|
+
fallback?: JSXOutput;
|
|
3943
|
+
delay?: number;
|
|
3944
|
+
};
|
|
3945
|
+
|
|
3946
|
+
/** @internal */
|
|
3947
|
+
export declare const _suT: ({ track, cleanup }: TaskCtx) => void;
|
|
3948
|
+
|
|
3278
3949
|
/**
|
|
3279
3950
|
* The TS types don't include the SVG attributes so we have to define them ourselves
|
|
3280
3951
|
*
|
|
@@ -3544,12 +4215,9 @@ export declare interface SVGAttributes<T extends Element = Element> extends Aria
|
|
|
3544
4215
|
}
|
|
3545
4216
|
|
|
3546
4217
|
/** @public */
|
|
3547
|
-
declare interface SVGProps<T extends Element> extends SVGAttributes, QwikAttributes<T> {
|
|
4218
|
+
export declare interface SVGProps<T extends Element> extends SVGAttributes, QwikAttributes<T> {
|
|
3548
4219
|
}
|
|
3549
4220
|
|
|
3550
|
-
/** @public */
|
|
3551
|
-
declare type SymbolMapper = Record<string, readonly [symbol: string, chunk: string]>;
|
|
3552
|
-
|
|
3553
4221
|
declare type SymbolToChunkResolver = (symbol: string) => string;
|
|
3554
4222
|
|
|
3555
4223
|
/**
|
|
@@ -3563,18 +4231,19 @@ declare type SymbolToChunkResolver = (symbol: string) => string;
|
|
|
3563
4231
|
*/
|
|
3564
4232
|
export declare const sync$: <T extends Function>(fn: T) => SyncQRL<T>;
|
|
3565
4233
|
|
|
4234
|
+
declare const SYNC_QRL = "<sync>";
|
|
4235
|
+
|
|
3566
4236
|
/** @public */
|
|
3567
|
-
export declare
|
|
4237
|
+
export declare type SyncQRL<TYPE extends Function> = QRL<TYPE> & {
|
|
3568
4238
|
__brand__SyncQRL__: TYPE;
|
|
3569
|
-
/**
|
|
3570
|
-
* Resolve the QRL of closure and invoke it.
|
|
3571
|
-
*
|
|
3572
|
-
* @param args - Closure arguments.
|
|
3573
|
-
* @returns A return value of the closure.
|
|
3574
|
-
*/
|
|
3575
|
-
(...args: TYPE extends (...args: infer ARGS) => any ? ARGS : never): TYPE extends (...args: any[]) => infer RETURN ? RETURN : never;
|
|
3576
4239
|
resolved: TYPE;
|
|
3577
|
-
dev
|
|
4240
|
+
dev?: QRLDev | null;
|
|
4241
|
+
} & BivariantQrlFn<QrlArgs<TYPE>, QrlReturn<TYPE>>;
|
|
4242
|
+
|
|
4243
|
+
declare type SyncQRLInternal = _QRLInternal & SyncQRLSymbol;
|
|
4244
|
+
|
|
4245
|
+
declare interface SyncQRLSymbol {
|
|
4246
|
+
$symbol$: typeof SYNC_QRL;
|
|
3578
4247
|
}
|
|
3579
4248
|
|
|
3580
4249
|
declare type TableCellSpecialAttrs = {
|
|
@@ -3584,49 +4253,59 @@ declare type TableCellSpecialAttrs = {
|
|
|
3584
4253
|
valign?: 'top' | 'middle' | 'bottom' | 'baseline' | undefined;
|
|
3585
4254
|
};
|
|
3586
4255
|
|
|
3587
|
-
|
|
3588
|
-
|
|
4256
|
+
/** @internal */
|
|
4257
|
+
export declare class _Task<T = unknown, B = T> extends BackRef {
|
|
4258
|
+
$flags$: TaskFlags;
|
|
3589
4259
|
$index$: number;
|
|
3590
|
-
$el$:
|
|
3591
|
-
$qrl$:
|
|
3592
|
-
$
|
|
3593
|
-
$
|
|
3594
|
-
|
|
4260
|
+
$el$: _HostElement;
|
|
4261
|
+
$qrl$: _QRLInternal<T>;
|
|
4262
|
+
$destroy$: (() => void) | null;
|
|
4263
|
+
$destroyPromise$: Promise<void> | undefined;
|
|
4264
|
+
$taskPromise$: Promise<void> | null;
|
|
4265
|
+
constructor($flags$: TaskFlags, $index$: number, $el$: _HostElement, $qrl$: _QRLInternal<T>, $destroy$: (() => void) | null);
|
|
3595
4266
|
}
|
|
3596
4267
|
|
|
3597
4268
|
/**
|
|
3598
|
-
* Used internally as a
|
|
4269
|
+
* Used internally as a qwikloader event handler to schedule a task. The `this` context is the
|
|
4270
|
+
* captures part of the QRL, provided by qwikloader.
|
|
3599
4271
|
*
|
|
3600
4272
|
* @internal
|
|
3601
4273
|
*/
|
|
3602
|
-
export declare
|
|
4274
|
+
export declare function _task(this: string, _event: Event, element: Element): void | Promise<void>;
|
|
3603
4275
|
|
|
3604
4276
|
/** @public */
|
|
3605
4277
|
export declare interface TaskCtx {
|
|
3606
4278
|
track: Tracker;
|
|
3607
|
-
cleanup: (callback: () => void) => void;
|
|
4279
|
+
cleanup: (callback: () => ValueOrPromise<void>) => void;
|
|
3608
4280
|
}
|
|
3609
4281
|
|
|
3610
4282
|
declare const TaskEvent = "qTask";
|
|
3611
4283
|
|
|
4284
|
+
/** @internal */
|
|
4285
|
+
declare const enum TaskFlags {
|
|
4286
|
+
VISIBLE_TASK = 1,
|
|
4287
|
+
TASK = 2,
|
|
4288
|
+
DIRTY = 4,
|
|
4289
|
+
RENDER_BLOCKING = 8,
|
|
4290
|
+
NEEDS_CLEANUP = 16,
|
|
4291
|
+
EVENTS_REGISTERED = 32
|
|
4292
|
+
}
|
|
4293
|
+
|
|
4294
|
+
/** @public */
|
|
4295
|
+
export declare type TaskFn = (ctx: TaskCtx) => ValueOrPromise<void | (() => ValueOrPromise<void>)>;
|
|
4296
|
+
|
|
3612
4297
|
/** @public */
|
|
3613
|
-
export declare
|
|
4298
|
+
export declare interface TaskOptions {
|
|
4299
|
+
/** Block the rendering of the component until the task completes. Default is `true` */
|
|
4300
|
+
deferUpdates?: boolean;
|
|
4301
|
+
}
|
|
3614
4302
|
|
|
3615
4303
|
/** @internal */
|
|
3616
|
-
export declare
|
|
3617
|
-
|
|
3618
|
-
|
|
3619
|
-
_VNode | null,
|
|
3620
|
-
|
|
3621
|
-
_VNode | null,
|
|
3622
|
-
///////////////// 2 - Previous sibling
|
|
3623
|
-
_VNode | null,
|
|
3624
|
-
///////////////// 3 - Next sibling
|
|
3625
|
-
Text | null | undefined,
|
|
3626
|
-
string
|
|
3627
|
-
] & {
|
|
3628
|
-
__brand__: 'TextVNode';
|
|
3629
|
-
};
|
|
4304
|
+
export declare class _TextVNode extends _VNode {
|
|
4305
|
+
node: Text | null;
|
|
4306
|
+
text: string | undefined;
|
|
4307
|
+
constructor(flags: _VNodeFlags, parent: _VNode | null, previousSibling: _VNode | null | undefined, nextSibling: _VNode | null | undefined, props: Props | null, node: Text | null, text: string | undefined);
|
|
4308
|
+
}
|
|
3630
4309
|
|
|
3631
4310
|
/**
|
|
3632
4311
|
* Used to signal to Qwik which state should be watched for changes.
|
|
@@ -3647,6 +4326,8 @@ string
|
|
|
3647
4326
|
* useTask$(({ track }) => {
|
|
3648
4327
|
* // Any signals or stores accessed inside the task will be tracked
|
|
3649
4328
|
* const count = track(() => store.count);
|
|
4329
|
+
* // For stores you can also pass the store and specify the property
|
|
4330
|
+
* track(store, 'count');
|
|
3650
4331
|
* // You can also pass a signal to track() directly
|
|
3651
4332
|
* const signalCount = track(signal);
|
|
3652
4333
|
* store.doubleCount = count + signalCount;
|
|
@@ -3717,11 +4398,18 @@ export declare interface Tracker {
|
|
|
3717
4398
|
export declare const _UNINITIALIZED: unique symbol;
|
|
3718
4399
|
|
|
3719
4400
|
/**
|
|
3720
|
-
*
|
|
4401
|
+
* Get the value of the expression without tracking listeners. A function will be invoked, signals
|
|
4402
|
+
* will return their value, and stores will be unwrapped (they return the backing object).
|
|
3721
4403
|
*
|
|
4404
|
+
* When you pass a function, you can also pass additional arguments that the function will receive.
|
|
4405
|
+
*
|
|
4406
|
+
* Note that stores are not unwrapped recursively.
|
|
4407
|
+
*
|
|
4408
|
+
* @param expr - The function or object to evaluate without tracking.
|
|
4409
|
+
* @param args - Additional arguments to pass when `expr` is a function.
|
|
3722
4410
|
* @public
|
|
3723
4411
|
*/
|
|
3724
|
-
export declare const untrack: <T>(
|
|
4412
|
+
export declare const untrack: <T, A extends any[]>(expr: ((...args: A) => T) | Signal<T> | T, ...args: A) => T;
|
|
3725
4413
|
|
|
3726
4414
|
declare type UnwantedKeys = keyof HTMLAttributesBase | keyof DOMAttributes<any> | keyof ARIAMixin | keyof GlobalEventHandlers | 'enterKeyHint' | 'innerText' | 'innerHTML' | 'outerHTML' | 'inputMode' | 'outerText' | 'nodeValue' | 'textContent';
|
|
3727
4415
|
|
|
@@ -3734,19 +4422,42 @@ declare type UnwantedKeys = keyof HTMLAttributesBase | keyof DOMAttributes<any>
|
|
|
3734
4422
|
export declare const unwrapStore: <T>(value: T) => T;
|
|
3735
4423
|
|
|
3736
4424
|
/**
|
|
3737
|
-
*
|
|
3738
|
-
*
|
|
3739
|
-
*
|
|
3740
|
-
|
|
4425
|
+
* Update the props on an external projection VNode and trigger re-rendering.
|
|
4426
|
+
*
|
|
4427
|
+
* @internal
|
|
4428
|
+
*/
|
|
4429
|
+
export declare function _updateProjectionProps(container: _Container, vnode: _VirtualVNode, newProps: Record<string, unknown>): void;
|
|
4430
|
+
|
|
4431
|
+
/**
|
|
4432
|
+
* Creates an AsyncSignal which holds the result of the given async function. If the function uses
|
|
4433
|
+
* `track()` to track reactive state, and that state changes, the AsyncSignal is recalculated, and
|
|
4434
|
+
* if the result changed, all tasks which are tracking the AsyncSignal will be re-run and all
|
|
4435
|
+
* subscribers (components, tasks etc) that read the AsyncSignal will be updated.
|
|
4436
|
+
*
|
|
4437
|
+
* If the async function throws an error, the AsyncSignal will capture the error and set the `error`
|
|
4438
|
+
* property. The error can be cleared by re-running the async function successfully.
|
|
3741
4439
|
*
|
|
3742
|
-
*
|
|
4440
|
+
* While the async function is running, the `loading` property will be set to `true`. Once the
|
|
4441
|
+
* function completes, `loading` will be set to `false`.
|
|
3743
4442
|
*
|
|
4443
|
+
* If the value has not yet been resolved, reading the AsyncSignal will throw a Promise, which will
|
|
4444
|
+
* retry the component or task once the value resolves.
|
|
4445
|
+
*
|
|
4446
|
+
* If the value has been resolved, but the async function is re-running, reading the AsyncSignal
|
|
4447
|
+
* will subscribe to it and return the last resolved value until the new value is ready. As soon as
|
|
4448
|
+
* the new value is ready, the subscribers will be updated.
|
|
4449
|
+
*
|
|
4450
|
+
* @deprecated Use `useComputed$` instead, it has async support now. It auto-tracks synchronous
|
|
4451
|
+
* reads; after the first `await`, use the provided `track()` like before.
|
|
3744
4452
|
* @public
|
|
3745
4453
|
*/
|
|
3746
|
-
export declare const
|
|
4454
|
+
export declare const useAsync$: <T>(qrl: AsyncFn<T>, options?: AsyncSignalOptions<T> | undefined) => AsyncSignal<T>;
|
|
3747
4455
|
|
|
3748
|
-
/**
|
|
3749
|
-
|
|
4456
|
+
/**
|
|
4457
|
+
* @deprecated Use `useComputed$` instead, it has async support now.
|
|
4458
|
+
* @internal
|
|
4459
|
+
*/
|
|
4460
|
+
export declare const useAsyncQrl: <T>(qrl: QRL<AsyncFn<T>>, options?: AsyncSignalOptions<T>) => AsyncSignal<T>;
|
|
3750
4461
|
|
|
3751
4462
|
/**
|
|
3752
4463
|
* Creates a computed signal which is calculated from the given function. A computed signal is a
|
|
@@ -3754,24 +4465,42 @@ export declare const useAsyncComputedQrl: <T>(qrl: QRL<AsyncComputedFn<T>>, opti
|
|
|
3754
4465
|
* recalculated, and if the result changed, all tasks which are tracking the signal will be re-run
|
|
3755
4466
|
* and all components that read the signal will be re-rendered.
|
|
3756
4467
|
*
|
|
3757
|
-
*
|
|
4468
|
+
* Every synchronous signal or store read is tracked automatically. Reads after an `await` are not:
|
|
4469
|
+
* the tracking context is lost, so track them explicitly with the `track()` provided on the context
|
|
4470
|
+
* argument. When the function is async, the returned signal exposes the async API: reading an
|
|
4471
|
+
* unresolved `.value` throws the computation promise, and `.pending` and `.error` expose the
|
|
4472
|
+
* computation state.
|
|
4473
|
+
*
|
|
4474
|
+
* The function must not have any side effects.
|
|
3758
4475
|
*
|
|
3759
4476
|
* @public
|
|
3760
4477
|
*/
|
|
3761
|
-
export declare const useComputed$: <T>(qrl: ComputedFn<T>, options?: ComputedOptions | undefined) => ComputedReturnType<T>;
|
|
4478
|
+
export declare const useComputed$: <T>(qrl: ComputedFn<T>, options?: ComputedOptions<T> | undefined) => ComputedReturnType<T>;
|
|
3762
4479
|
|
|
3763
4480
|
/** @internal */
|
|
3764
|
-
export declare const useComputedQrl: <T>(qrl: QRL<ComputedFn<T>>, options?: ComputedOptions) => ComputedReturnType<T>;
|
|
4481
|
+
export declare const useComputedQrl: <T>(qrl: QRL<ComputedFn<T>>, options?: ComputedOptions<T>) => ComputedReturnType<T>;
|
|
3765
4482
|
|
|
3766
4483
|
/**
|
|
3767
4484
|
* Stores a value which is retained for the lifetime of the component. Subsequent calls to
|
|
3768
4485
|
* `useConstant` will always return the first value given.
|
|
3769
4486
|
*
|
|
3770
|
-
* If the value is a function, the function is invoked once to calculate the actual value.
|
|
4487
|
+
* If the value is a function, the function is invoked once to calculate the actual value. You can
|
|
4488
|
+
* then also pass arguments to call the function with, so that you don't need to create a new
|
|
4489
|
+
* function on every render.
|
|
4490
|
+
*
|
|
4491
|
+
* @example
|
|
4492
|
+
*
|
|
4493
|
+
* ```tsx
|
|
4494
|
+
* const fixedRandomValue = useConstant(() => Math.random);
|
|
4495
|
+
* const otherFixedRandomValue = useConstant(Math.random);
|
|
4496
|
+
*
|
|
4497
|
+
* const getConfig = (env: string) => { ... }
|
|
4498
|
+
* const config = useConstant(getConfig, environment);
|
|
4499
|
+
* ```
|
|
3771
4500
|
*
|
|
3772
4501
|
* @public
|
|
3773
4502
|
*/
|
|
3774
|
-
export declare const useConstant: <T>(value: (() => T) | T) => T;
|
|
4503
|
+
export declare const useConstant: <T, A extends any[]>(value: ((...args: A) => T) | T, ...args: A) => T;
|
|
3775
4504
|
|
|
3776
4505
|
declare interface UseContext {
|
|
3777
4506
|
<STATE, T>(context: ContextId<STATE>, transformer: (value: STATE) => T): T;
|
|
@@ -3883,12 +4612,17 @@ export declare const useContextProvider: <STATE>(context: ContextId<STATE>, newV
|
|
|
3883
4612
|
/** @public */
|
|
3884
4613
|
export declare const useErrorBoundary: () => ErrorBoundaryStore;
|
|
3885
4614
|
|
|
4615
|
+
/**
|
|
4616
|
+
* Injected by the optimizer into component$ bodies in HMR mode. Registers a document event listener
|
|
4617
|
+
* that triggers component re-render on HMR updates.
|
|
4618
|
+
*
|
|
4619
|
+
* @internal
|
|
4620
|
+
*/
|
|
4621
|
+
export declare function _useHmr(devPath: string): void;
|
|
4622
|
+
|
|
3886
4623
|
/** @public */
|
|
3887
4624
|
export declare const useId: () => string;
|
|
3888
4625
|
|
|
3889
|
-
/** @internal */
|
|
3890
|
-
export declare const _useInvokeContext: () => RenderInvokeContext;
|
|
3891
|
-
|
|
3892
4626
|
/**
|
|
3893
4627
|
* Used by the Qwik Optimizer to restore the lexically scoped variables.
|
|
3894
4628
|
*
|
|
@@ -3897,6 +4631,7 @@ export declare const _useInvokeContext: () => RenderInvokeContext;
|
|
|
3897
4631
|
* NOTE: `useLexicalScope` method can only be used in the synchronous portion of the callback
|
|
3898
4632
|
* (before any `await` statements.)
|
|
3899
4633
|
*
|
|
4634
|
+
* @deprecated Use `_captures` instead.
|
|
3900
4635
|
* @internal
|
|
3901
4636
|
*/
|
|
3902
4637
|
export declare const useLexicalScope: <VARS extends any[]>() => VARS;
|
|
@@ -3907,10 +4642,12 @@ export declare const useLexicalScope: <VARS extends any[]>() => VARS;
|
|
|
3907
4642
|
* Used to programmatically add event listeners. Useful from custom `use*` methods, which do not
|
|
3908
4643
|
* have access to the JSX. Otherwise, it's adding a JSX listener in the `<div>` is a better idea.
|
|
3909
4644
|
*
|
|
4645
|
+
* Events are case sensitive.
|
|
4646
|
+
*
|
|
3910
4647
|
* @public
|
|
3911
4648
|
* @see `useOn`, `useOnWindow`, `useOnDocument`.
|
|
3912
4649
|
*/
|
|
3913
|
-
export declare const useOn: <T extends KnownEventNames>(event: T | T[], eventQrl: EventQRL<T
|
|
4650
|
+
export declare const useOn: <T extends KnownEventNames>(event: T | T[], eventQrl: EventQRL<T>, options?: UseOnOptions) => void;
|
|
3914
4651
|
|
|
3915
4652
|
/**
|
|
3916
4653
|
* Register a listener on `document`.
|
|
@@ -3918,6 +4655,8 @@ export declare const useOn: <T extends KnownEventNames>(event: T | T[], eventQrl
|
|
|
3918
4655
|
* Used to programmatically add event listeners. Useful from custom `use*` methods, which do not
|
|
3919
4656
|
* have access to the JSX.
|
|
3920
4657
|
*
|
|
4658
|
+
* Events are case sensitive.
|
|
4659
|
+
*
|
|
3921
4660
|
* @public
|
|
3922
4661
|
* @see `useOn`, `useOnWindow`, `useOnDocument`.
|
|
3923
4662
|
*
|
|
@@ -3937,7 +4676,21 @@ export declare const useOn: <T extends KnownEventNames>(event: T | T[], eventQrl
|
|
|
3937
4676
|
* });
|
|
3938
4677
|
* ```
|
|
3939
4678
|
*/
|
|
3940
|
-
export declare const useOnDocument: <T extends KnownEventNames>(event: T | T[], eventQrl: EventQRL<T
|
|
4679
|
+
export declare const useOnDocument: <T extends KnownEventNames>(event: T | T[], eventQrl: EventQRL<T>, options?: UseOnOptions) => void;
|
|
4680
|
+
|
|
4681
|
+
/** @public */
|
|
4682
|
+
export declare type UseOnOptions = UseOnOptionsBase & ({
|
|
4683
|
+
passive?: boolean;
|
|
4684
|
+
preventdefault?: never;
|
|
4685
|
+
} | {
|
|
4686
|
+
passive?: never;
|
|
4687
|
+
preventdefault?: boolean;
|
|
4688
|
+
});
|
|
4689
|
+
|
|
4690
|
+
declare interface UseOnOptionsBase {
|
|
4691
|
+
capture?: boolean;
|
|
4692
|
+
stoppropagation?: boolean;
|
|
4693
|
+
}
|
|
3941
4694
|
|
|
3942
4695
|
/**
|
|
3943
4696
|
* Register a listener on `window`.
|
|
@@ -3945,6 +4698,8 @@ export declare const useOnDocument: <T extends KnownEventNames>(event: T | T[],
|
|
|
3945
4698
|
* Used to programmatically add event listeners. Useful from custom `use*` methods, which do not
|
|
3946
4699
|
* have access to the JSX.
|
|
3947
4700
|
*
|
|
4701
|
+
* Events are case sensitive.
|
|
4702
|
+
*
|
|
3948
4703
|
* @public
|
|
3949
4704
|
* @see `useOn`, `useOnWindow`, `useOnDocument`.
|
|
3950
4705
|
*
|
|
@@ -3965,7 +4720,7 @@ export declare const useOnDocument: <T extends KnownEventNames>(event: T | T[],
|
|
|
3965
4720
|
* });
|
|
3966
4721
|
* ```
|
|
3967
4722
|
*/
|
|
3968
|
-
export declare const useOnWindow: <T extends KnownEventNames>(event: T | T[], eventQrl: EventQRL<T
|
|
4723
|
+
export declare const useOnWindow: <T extends KnownEventNames>(event: T | T[], eventQrl: EventQRL<T>, options?: UseOnOptions) => void;
|
|
3969
4724
|
|
|
3970
4725
|
/**
|
|
3971
4726
|
* This method works like an async memoized function that runs whenever some tracked value changes
|
|
@@ -3983,45 +4738,15 @@ export declare const useOnWindow: <T extends KnownEventNames>(event: T | T[], ev
|
|
|
3983
4738
|
* Be careful when using a `try/catch` statement in `useResource$`. If you catch the error and don't
|
|
3984
4739
|
* re-throw it (or a new Error), the resource status will never be `rejected`.
|
|
3985
4740
|
*
|
|
3986
|
-
*
|
|
3987
|
-
*
|
|
3988
|
-
*
|
|
3989
|
-
* city name changes.
|
|
3990
|
-
*
|
|
3991
|
-
* ```tsx
|
|
3992
|
-
* const Cmp = component$(() => {
|
|
3993
|
-
* const cityS = useSignal('');
|
|
3994
|
-
*
|
|
3995
|
-
* const weatherResource = useResource$(async ({ track, cleanup }) => {
|
|
3996
|
-
* const cityName = track(cityS);
|
|
3997
|
-
* const abortController = new AbortController();
|
|
3998
|
-
* cleanup(() => abortController.abort('cleanup'));
|
|
3999
|
-
* const res = await fetch(`http://weatherdata.com?city=${cityName}`, {
|
|
4000
|
-
* signal: abortController.signal,
|
|
4001
|
-
* });
|
|
4002
|
-
* const data = await res.json();
|
|
4003
|
-
* return data as { temp: number };
|
|
4004
|
-
* });
|
|
4005
|
-
*
|
|
4006
|
-
* return (
|
|
4007
|
-
* <div>
|
|
4008
|
-
* <input name="city" bind:value={cityS} />
|
|
4009
|
-
* <Resource
|
|
4010
|
-
* value={weatherResource}
|
|
4011
|
-
* onResolved={(weather) => {
|
|
4012
|
-
* return <div>Temperature: {weather.temp}</div>;
|
|
4013
|
-
* }}
|
|
4014
|
-
* />
|
|
4015
|
-
* </div>
|
|
4016
|
-
* );
|
|
4017
|
-
* });
|
|
4018
|
-
* ```
|
|
4019
|
-
*
|
|
4741
|
+
* @deprecated Use `useComputed$` instead, which is more powerful and flexible. `useResource$` is
|
|
4742
|
+
* still available for backward compatibility but it is recommended to migrate to `useComputed$`
|
|
4743
|
+
* for new code and when updating existing code.
|
|
4020
4744
|
* @public
|
|
4745
|
+
* @see useComputed$
|
|
4021
4746
|
* @see Resource
|
|
4022
4747
|
* @see ResourceReturn
|
|
4023
4748
|
*/
|
|
4024
|
-
export declare const useResource$: <T>(
|
|
4749
|
+
export declare const useResource$: <T>(qrl: ResourceFn<T>, opts?: ResourceOptions | undefined) => ResourceReturn<T>;
|
|
4025
4750
|
|
|
4026
4751
|
/** @internal */
|
|
4027
4752
|
export declare const useResourceQrl: <T>(qrl: QRL<ResourceFn<T>>, opts?: ResourceOptions) => ResourceReturn<T>;
|
|
@@ -4090,7 +4815,7 @@ export declare const useResourceQrl: <T>(qrl: QRL<ResourceFn<T>>, opts?: Resourc
|
|
|
4090
4815
|
export declare const useSerializer$: typeof createSerializer$;
|
|
4091
4816
|
|
|
4092
4817
|
/** @internal */
|
|
4093
|
-
export declare const useSerializerQrl: <T, S>(qrl: QRL<SerializerArg<T, S>>) =>
|
|
4818
|
+
export declare const useSerializerQrl: <T, S>(qrl: QRL<SerializerArg<T, S>>) => SerializerSignalImpl<T, S>;
|
|
4094
4819
|
|
|
4095
4820
|
/** @public */
|
|
4096
4821
|
export declare function useServerData<T>(key: string): T | undefined;
|
|
@@ -4104,14 +4829,61 @@ export declare interface UseSignal {
|
|
|
4104
4829
|
<T>(value: T | (() => T)): Signal<T>;
|
|
4105
4830
|
}
|
|
4106
4831
|
|
|
4107
|
-
/**
|
|
4832
|
+
/**
|
|
4833
|
+
* Creates an object with a single reactive `.value` property, that Qwik can track across
|
|
4834
|
+
* serializations.
|
|
4835
|
+
*
|
|
4836
|
+
* Use it to create state for your application. The object has a getter and setter to track reads
|
|
4837
|
+
* and writes of the `.value` property. When the value changes, any functions that read from it will
|
|
4838
|
+
* re-run.
|
|
4839
|
+
*
|
|
4840
|
+
* Prefer `useSignal` over `useStore` when possible, as it is more efficient.
|
|
4841
|
+
*
|
|
4842
|
+
* ### Example
|
|
4843
|
+
*
|
|
4844
|
+
* ```tsx
|
|
4845
|
+
* const Signals = component$(() => {
|
|
4846
|
+
* const counter = useSignal(1);
|
|
4847
|
+
* const text = useSignal('changeme');
|
|
4848
|
+
* const toggle = useSignal(false);
|
|
4849
|
+
*
|
|
4850
|
+
* // useSignal() can also accept a function to calculate the initial value
|
|
4851
|
+
* const state = useSignal(() => {
|
|
4852
|
+
* return expensiveInitialValue();
|
|
4853
|
+
* });
|
|
4854
|
+
*
|
|
4855
|
+
* return (
|
|
4856
|
+
* <div>
|
|
4857
|
+
* <button onClick$={() => counter.value++}>Counter: {counter.value}</button>
|
|
4858
|
+
* {
|
|
4859
|
+
* // pass signal values as the value, the optimizer will make it pass the signal
|
|
4860
|
+
* }
|
|
4861
|
+
* <Child state={state.value} />
|
|
4862
|
+
* {
|
|
4863
|
+
* // signals can be bound to inputs. A property named `bind:x` implies that the property
|
|
4864
|
+
* is a signal
|
|
4865
|
+
* }
|
|
4866
|
+
* <input type="text" bind:value={text} />
|
|
4867
|
+
* <input type="checkbox" bind:checked={toggle} />
|
|
4868
|
+
* </div>
|
|
4869
|
+
* );
|
|
4870
|
+
* });
|
|
4871
|
+
* ```
|
|
4872
|
+
*
|
|
4873
|
+
* @public
|
|
4874
|
+
*/
|
|
4108
4875
|
export declare const useSignal: UseSignal;
|
|
4109
4876
|
|
|
4110
4877
|
/**
|
|
4111
|
-
* Creates
|
|
4878
|
+
* Creates a reactive object that Qwik can track across serialization.
|
|
4879
|
+
*
|
|
4880
|
+
* Use it to create state for your application. The returned object is a Proxy that tracks reads and
|
|
4881
|
+
* writes. When any of the properties change, the functions that read those properties will re-run.
|
|
4112
4882
|
*
|
|
4113
|
-
*
|
|
4114
|
-
*
|
|
4883
|
+
* `Store`s are deep by default, meaning that any objects assigned to properties will also become
|
|
4884
|
+
* `Store`s. This includes arrays.
|
|
4885
|
+
*
|
|
4886
|
+
* Prefer `useSignal` over `useStore` when possible, as it is more efficient.
|
|
4115
4887
|
*
|
|
4116
4888
|
* ### Example
|
|
4117
4889
|
*
|
|
@@ -4291,10 +5063,10 @@ export declare const useStylesScopedQrl: (styles: QRL<string>) => UseStylesScope
|
|
|
4291
5063
|
* @public
|
|
4292
5064
|
* @see `Tracker`
|
|
4293
5065
|
*/
|
|
4294
|
-
export declare const useTask$: (fn: TaskFn) => void;
|
|
5066
|
+
export declare const useTask$: (fn: TaskFn, opts?: TaskOptions) => void;
|
|
4295
5067
|
|
|
4296
5068
|
/** @internal */
|
|
4297
|
-
export declare const useTaskQrl: (qrl: QRL<TaskFn
|
|
5069
|
+
export declare const useTaskQrl: (qrl: QRL<TaskFn>, opts?: TaskOptions) => void;
|
|
4298
5070
|
|
|
4299
5071
|
/**
|
|
4300
5072
|
* ```tsx
|
|
@@ -4324,6 +5096,13 @@ export declare const useVisibleTask$: (fn: TaskFn, opts?: OnVisibleTaskOptions)
|
|
|
4324
5096
|
/** @internal */
|
|
4325
5097
|
export declare const useVisibleTaskQrl: (qrl: QRL<TaskFn>, opts?: OnVisibleTaskOptions) => void;
|
|
4326
5098
|
|
|
5099
|
+
/**
|
|
5100
|
+
* Handles events for bind:value
|
|
5101
|
+
*
|
|
5102
|
+
* @internal
|
|
5103
|
+
*/
|
|
5104
|
+
export declare function _val(this: string | undefined, _: any, element: HTMLInputElement): void | Promise<void>;
|
|
5105
|
+
|
|
4327
5106
|
/**
|
|
4328
5107
|
* Type representing a value which is either resolve or a promise.
|
|
4329
5108
|
*
|
|
@@ -4338,38 +5117,83 @@ export declare const _VAR_PROPS: unique symbol;
|
|
|
4338
5117
|
export declare const _verifySerializable: <T>(value: T, preMessage?: string) => T;
|
|
4339
5118
|
|
|
4340
5119
|
/**
|
|
4341
|
-
* 2.0.0-beta.
|
|
5120
|
+
* 2.0.0-beta.40-dev+a459d55
|
|
4342
5121
|
*
|
|
4343
5122
|
* @public
|
|
4344
5123
|
*/
|
|
4345
5124
|
export declare const version: string;
|
|
4346
5125
|
|
|
4347
5126
|
/** @internal */
|
|
4348
|
-
export declare
|
|
4349
|
-
|
|
4350
|
-
|
|
4351
|
-
_VNode | null
|
|
4352
|
-
|
|
4353
|
-
|
|
4354
|
-
/////////////// 2 - Previous sibling
|
|
4355
|
-
_VNode | null,
|
|
4356
|
-
/////////////// 3 - Next sibling
|
|
4357
|
-
_VNode | null,
|
|
4358
|
-
/////////////// 4 - First child
|
|
4359
|
-
_VNode | null,
|
|
4360
|
-
(string | null | boolean)[]
|
|
4361
|
-
] & {
|
|
4362
|
-
__brand__: 'FragmentNode' & 'HostElement';
|
|
4363
|
-
};
|
|
5127
|
+
export declare class _VirtualVNode extends _VNode {
|
|
5128
|
+
key: string | null;
|
|
5129
|
+
firstChild: _VNode | null | undefined;
|
|
5130
|
+
lastChild: _VNode | null | undefined;
|
|
5131
|
+
constructor(key: string | null, flags: _VNodeFlags, parent: _ElementVNode | _VirtualVNode | null, previousSibling: _VNode | null | undefined, nextSibling: _VNode | null | undefined, props: Props | null, firstChild: _VNode | null | undefined, lastChild: _VNode | null | undefined);
|
|
5132
|
+
}
|
|
4364
5133
|
|
|
4365
5134
|
/** @public */
|
|
4366
5135
|
export declare type VisibleTaskStrategy = 'intersection-observer' | 'document-ready' | 'document-idle';
|
|
4367
5136
|
|
|
4368
5137
|
/** @internal */
|
|
4369
|
-
export declare
|
|
5138
|
+
export declare abstract class _VNode implements BackRef {
|
|
5139
|
+
flags: _VNodeFlags;
|
|
5140
|
+
parent: _VNode | null;
|
|
5141
|
+
previousSibling: _VNode | null | undefined;
|
|
5142
|
+
nextSibling: _VNode | null | undefined;
|
|
5143
|
+
props: Props | null;
|
|
5144
|
+
[_EFFECT_BACK_REF]: Map<any, any> | undefined;
|
|
5145
|
+
slotParent: _VNode | null;
|
|
5146
|
+
dirty: ChoreBits;
|
|
5147
|
+
dirtyChildren: _VNode[] | null;
|
|
5148
|
+
nextDirtyChildIndex: number;
|
|
5149
|
+
constructor(flags: _VNodeFlags, parent: _VNode | null, previousSibling: _VNode | null | undefined, nextSibling: _VNode | null | undefined, props: Props | null);
|
|
5150
|
+
toString(): string;
|
|
5151
|
+
}
|
|
5152
|
+
|
|
5153
|
+
/** @internal */
|
|
5154
|
+
export declare const _vnode_ensureElementInflated: (container: _Container, vnode: _VNode) => void;
|
|
5155
|
+
|
|
5156
|
+
/** @internal */
|
|
5157
|
+
export declare const _vnode_getAttrKeys: (container: _Container, vnode: _ElementVNode | _VirtualVNode) => string[];
|
|
5158
|
+
|
|
5159
|
+
/** @internal */
|
|
5160
|
+
export declare const _vnode_getElementName: (vnode: _ElementVNode) => string;
|
|
5161
|
+
|
|
5162
|
+
/** @internal */
|
|
5163
|
+
export declare const _vnode_getFirstChild: (vnode: _VNode) => _VNode | null;
|
|
5164
|
+
|
|
5165
|
+
/** @internal */
|
|
5166
|
+
export declare const _vnode_getProp: <T = unknown>(vNode: _VNode, key: string, getObject: ((id: string) => unknown) | null) => T | null;
|
|
5167
|
+
|
|
5168
|
+
/** @internal */
|
|
5169
|
+
export declare const _vnode_getVNodeForChildNode: (vNode: _ElementVNode, childElement: Element) => _ElementVNode;
|
|
5170
|
+
|
|
5171
|
+
/** @internal */
|
|
5172
|
+
export declare const _vnode_insertBefore: (journal: _VNodeJournal, parent: _ElementVNode | _VirtualVNode, newChild: _VNode, insertBefore: _VNode | null) => void;
|
|
5173
|
+
|
|
5174
|
+
/** @internal */
|
|
5175
|
+
export declare const _vnode_isElementVNode: (vNode: _VNode) => vNode is _ElementVNode;
|
|
5176
|
+
|
|
5177
|
+
/** @internal */
|
|
5178
|
+
export declare const _vnode_isMaterialized: (vNode: _VNode) => boolean;
|
|
5179
|
+
|
|
5180
|
+
/** @internal */
|
|
5181
|
+
export declare const _vnode_isTextVNode: (vNode: _VNode) => vNode is _TextVNode;
|
|
5182
|
+
|
|
5183
|
+
/** @internal */
|
|
5184
|
+
export declare const _vnode_isVirtualVNode: (vNode: _VNode) => vNode is _VirtualVNode;
|
|
5185
|
+
|
|
5186
|
+
/** @internal */
|
|
5187
|
+
export declare const _vnode_newVirtual: () => _VirtualVNode;
|
|
5188
|
+
|
|
5189
|
+
/** @internal */
|
|
5190
|
+
export declare const _vnode_remove: (journal: _VNodeJournal, vParent: _ElementVNode | _VirtualVNode, vToRemove: _VNode, removeDOM: boolean) => void;
|
|
5191
|
+
|
|
5192
|
+
/** @internal */
|
|
5193
|
+
export declare const _vnode_setProp: (vNode: _VNode, key: string, value: unknown) => void;
|
|
4370
5194
|
|
|
4371
5195
|
/** @internal */
|
|
4372
|
-
export declare function _vnode_toString(this: _VNode | null, depth?: number, offset?: string, materialize?: boolean, siblings?: boolean, colorize?: boolean): string;
|
|
5196
|
+
export declare function _vnode_toString(this: _VNode | null, depth?: number, offset?: string, materialize?: boolean, siblings?: boolean, colorize?: boolean, container?: _Container | null): string;
|
|
4373
5197
|
|
|
4374
5198
|
/**
|
|
4375
5199
|
* Array of numbers which describes virtual nodes in the tree.
|
|
@@ -4398,7 +5222,7 @@ export declare function _vnode_toString(this: _VNode | null, depth?: number, off
|
|
|
4398
5222
|
* this data needs to be serialized into a string and stored in the DOM as a script tag which has
|
|
4399
5223
|
* deferent serialization format.
|
|
4400
5224
|
*/
|
|
4401
|
-
declare type VNodeData = [VNodeDataFlag, ...(
|
|
5225
|
+
declare type VNodeData = [VNodeDataFlag, ...(Props | number)[]];
|
|
4402
5226
|
|
|
4403
5227
|
/**
|
|
4404
5228
|
* Flags for VNodeData (Flags con be bitwise combined)
|
|
@@ -4437,46 +5261,34 @@ export declare const enum _VNodeFlags {
|
|
|
4437
5261
|
Element = 1,
|
|
4438
5262
|
Virtual = 2,
|
|
4439
5263
|
ELEMENT_OR_VIRTUAL_MASK = 3,
|
|
5264
|
+
Text = 4,
|
|
4440
5265
|
ELEMENT_OR_TEXT_MASK = 5,
|
|
4441
5266
|
TYPE_MASK = 7,
|
|
4442
5267
|
INFLATED_TYPE_MASK = 15,
|
|
4443
|
-
Text = 4,
|
|
4444
5268
|
Inflated = 8,
|
|
4445
5269
|
Resolved = 16,
|
|
4446
5270
|
Deleted = 32,
|
|
4447
|
-
|
|
4448
|
-
|
|
5271
|
+
HasIterationItems = 64,
|
|
5272
|
+
InflatedIterationItems = 128,
|
|
5273
|
+
Cursor = 256,
|
|
5274
|
+
NAMESPACE_MASK = 1536,
|
|
5275
|
+
NEGATED_NAMESPACE_MASK = -1537,
|
|
4449
5276
|
NS_html = 0,// http://www.w3.org/1999/xhtml
|
|
4450
|
-
NS_svg =
|
|
4451
|
-
NS_math =
|
|
5277
|
+
NS_svg = 512,// http://www.w3.org/2000/svg
|
|
5278
|
+
NS_math = 1024,// http://www.w3.org/1998/Math/MathML
|
|
5279
|
+
HasTargetElement = 2048
|
|
4452
5280
|
}
|
|
4453
5281
|
|
|
4454
|
-
|
|
5282
|
+
/** @internal */
|
|
5283
|
+
export declare type _VNodeJournal = Array<VNodeOperation>;
|
|
4455
5284
|
|
|
4456
|
-
|
|
4457
|
-
* Fundamental DOM operations are:
|
|
4458
|
-
*
|
|
4459
|
-
* - Insert new DOM element/text
|
|
4460
|
-
* - Remove DOM element/text
|
|
4461
|
-
* - Set DOM element attributes
|
|
4462
|
-
* - Set text node value
|
|
4463
|
-
*/
|
|
4464
|
-
declare const enum VNodeJournalOpCode {
|
|
4465
|
-
SetText = 1,// ------ [SetAttribute, target, text]
|
|
4466
|
-
SetAttribute = 2,// - [SetAttribute, target, ...(key, values)]]
|
|
4467
|
-
HoistStyles = 3,// -- [HoistStyles, document]
|
|
4468
|
-
Remove = 4,// ------- [Insert, target(parent), ...nodes]
|
|
4469
|
-
Insert = 5
|
|
4470
|
-
}
|
|
5285
|
+
declare type VNodeOperation = DeleteOperation | RemoveAllChildrenOperation | SetTextOperation | InsertOrMoveOperation | SetAttributeOperation;
|
|
4471
5286
|
|
|
4472
5287
|
/** @internal */
|
|
4473
|
-
export declare const _waitUntilRendered: (
|
|
5288
|
+
export declare const _waitUntilRendered: (container: _Container) => Promise<void>;
|
|
4474
5289
|
|
|
4475
5290
|
/** @internal */
|
|
4476
|
-
export declare function _walkJSX(ssr: SSRContainer, value: JSXOutput, options:
|
|
4477
|
-
currentStyleScoped: string | null;
|
|
4478
|
-
parentComponentFrame: ISsrComponentFrame | null;
|
|
4479
|
-
}): Promise<void>;
|
|
5291
|
+
export declare function _walkJSX(ssr: SSRContainer, value: JSXOutput, options: SSRRenderJSXOptions): Promise<void>;
|
|
4480
5292
|
|
|
4481
5293
|
/**
|
|
4482
5294
|
* Override the `getLocale` with `lang` within the `fn` execution.
|
|
@@ -4485,27 +5297,20 @@ export declare function _walkJSX(ssr: SSRContainer, value: JSXOutput, options: {
|
|
|
4485
5297
|
*/
|
|
4486
5298
|
export declare function withLocale<T>(locale: string, fn: () => T): T;
|
|
4487
5299
|
|
|
4488
|
-
declare
|
|
4489
|
-
UNWRAP = 2
|
|
4490
|
-
}
|
|
5300
|
+
declare type WrappedProp<T extends object, P extends keyof T> = T extends Signal ? WrappedSignalImpl<PropType<T, P>> : PropType<T, P>;
|
|
4491
5301
|
|
|
4492
|
-
declare class WrappedSignalImpl<T> extends SignalImpl<T>
|
|
5302
|
+
declare class WrappedSignalImpl<T> extends SignalImpl<T> {
|
|
4493
5303
|
$args$: any[];
|
|
4494
5304
|
$func$: (...args: any[]) => T;
|
|
4495
5305
|
$funcStr$: string | null;
|
|
4496
5306
|
$flags$: AllSignalFlags;
|
|
4497
|
-
$hostElement$:
|
|
4498
|
-
|
|
4499
|
-
[
|
|
4500
|
-
constructor(container: Container | null, fn: (...args: any[]) => T, args: any[], fnStr: string | null, flags?: SignalFlags);
|
|
5307
|
+
$hostElement$: _HostElement | undefined;
|
|
5308
|
+
[_EFFECT_BACK_REF]: Map<_EffectProperty | string, EffectSubscription> | undefined;
|
|
5309
|
+
constructor(container: _Container | null, fn: (...args: any[]) => T, args: any[], fnStr: string | null, flags?: AllSignalFlags);
|
|
4501
5310
|
invalidate(): void;
|
|
4502
|
-
/**
|
|
4503
|
-
* Use this to force running subscribers, for example when the calculated value has mutated but
|
|
4504
|
-
* remained the same object.
|
|
4505
|
-
*/
|
|
4506
|
-
force(): void;
|
|
4507
5311
|
get untrackedValue(): T;
|
|
4508
|
-
$computeIfNeeded$():
|
|
5312
|
+
$computeIfNeeded$(): void;
|
|
5313
|
+
$unwrapIfSignal$(): SignalImpl<T> | WrappedSignalImpl<T>;
|
|
4509
5314
|
set value(_: any);
|
|
4510
5315
|
get value(): any;
|
|
4511
5316
|
}
|
|
@@ -4521,9 +5326,9 @@ declare class WrappedSignalImpl<T> extends SignalImpl<T> implements BackRef {
|
|
|
4521
5326
|
*
|
|
4522
5327
|
* @internal
|
|
4523
5328
|
*/
|
|
4524
|
-
export declare const _wrapProp: <T extends
|
|
5329
|
+
export declare const _wrapProp: <T extends object, P extends keyof T>(...args: [T, P?]) => WrappedProp<T, P>;
|
|
4525
5330
|
|
|
4526
5331
|
/** @internal @deprecated v1 compat */
|
|
4527
|
-
export declare const _wrapSignal: <T extends
|
|
5332
|
+
export declare const _wrapSignal: <T extends object, P extends keyof T>(obj: T, prop: P) => T[P] | WrappedProp<T, P>;
|
|
4528
5333
|
|
|
4529
5334
|
export { }
|