@qwik.dev/core 2.0.0-beta.3 → 2.0.0-beta.30
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 +39 -0
- package/dist/backpatch-executor.js +1 -0
- package/dist/build/package.json +1 -1
- package/dist/cli.mjs +12916 -0
- package/dist/core-internal.d.ts +1077 -707
- package/dist/core.min.mjs +2 -1
- package/dist/core.mjs +11616 -8673
- package/dist/core.mjs.map +1 -1
- package/dist/core.prod.mjs +8266 -5225
- package/dist/insights/index.qwik.mjs +80 -57
- package/dist/loader/index.mjs +2 -2
- package/dist/loader/package.json +1 -1
- package/dist/optimizer.d.ts +47 -278
- package/dist/optimizer.mjs +2403 -3791
- package/dist/preloader.mjs +5 -8
- package/dist/qwikloader.debug.js +156 -131
- package/dist/qwikloader.js +1 -1
- package/dist/server.d.ts +51 -203
- package/dist/server.mjs +1418 -1088
- package/dist/server.prod.mjs +3264 -0
- package/dist/starters/adapters/aws-lambda/adapters/aws-lambda/{vite.config.mts → vite.config.ts} +2 -2
- 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} +2 -2
- 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} +3 -3
- package/dist/starters/adapters/bun/package.json +3 -2
- package/dist/starters/adapters/bun/src/entry.bun.ts +0 -2
- package/dist/starters/adapters/cloud-run/adapters/cloud-run/{vite.config.mts → vite.config.ts} +2 -2
- package/dist/starters/adapters/cloud-run/package.json +3 -2
- package/dist/starters/adapters/cloud-run/src/entry.cloud-run.tsx +1 -3
- package/dist/starters/adapters/cloudflare-pages/adapters/cloudflare-pages/{vite.config.mts → vite.config.ts} +2 -2
- 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} +2 -2
- package/dist/starters/adapters/deno/package.json +3 -2
- package/dist/starters/adapters/deno/src/entry.deno.ts +0 -2
- package/dist/starters/adapters/express/adapters/express/{vite.config.mts → vite.config.ts} +2 -2
- package/dist/starters/adapters/express/package.json +4 -3
- package/dist/starters/adapters/express/src/entry.express.tsx +1 -3
- package/dist/starters/adapters/fastify/adapters/fastify/{vite.config.mts → vite.config.ts} +2 -2
- package/dist/starters/adapters/fastify/package.json +4 -3
- package/dist/starters/adapters/fastify/src/entry.fastify.tsx +1 -1
- package/dist/starters/adapters/fastify/src/plugins/fastify-qwik.ts +1 -2
- package/dist/starters/adapters/firebase/adapters/firebase/{vite.config.mts → vite.config.ts} +2 -2
- 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} +2 -2
- 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} +2 -2
- package/dist/starters/adapters/node-server/package.json +3 -2
- package/dist/starters/adapters/node-server/src/entry.node-server.tsx +0 -2
- package/dist/starters/adapters/{static/adapters/static/vite.config.mts → ssg/adapters/ssg/vite.config.ts} +3 -3
- 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} +2 -2
- 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/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/testing/index.d.ts +925 -6
- package/dist/testing/index.mjs +15796 -11480
- package/dist/testing/package.json +1 -1
- package/handlers.mjs +1 -1
- package/package.json +34 -56
- package/public.d.ts +5 -1
- package/{qwik-cli.cjs → qwik-cli.mjs} +1 -1
- package/server.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 -11800
- package/dist/core.cjs.map +0 -1
- package/dist/core.prod.cjs +0 -5661
- 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 -3037
- 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 -33331
- /package/dist/starters/adapters/{static → ssg}/README.md +0 -0
package/dist/core-internal.d.ts
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
import * as CSS_2 from 'csstype';
|
|
1
|
+
import type * as CSS_2 from 'csstype';
|
|
2
2
|
import { isBrowser } from './build';
|
|
3
3
|
import { isDev } from './build';
|
|
4
4
|
import { isServer } from './build';
|
|
5
|
-
import {
|
|
6
|
-
import { ReadonlySignal as ReadonlySignal_2 } from '..';
|
|
7
|
-
import type { StreamWriter as StreamWriter_2 } from '.';
|
|
8
|
-
import { ValueOrPromise as ValueOrPromise_2 } from '..';
|
|
5
|
+
import { ResolvedManifest } from './optimizer';
|
|
9
6
|
|
|
10
7
|
/**
|
|
11
8
|
* Qwik Optimizer marker function.
|
|
@@ -83,23 +80,33 @@ import { ValueOrPromise as ValueOrPromise_2 } from '..';
|
|
|
83
80
|
*/
|
|
84
81
|
export declare const $: <T>(expression: T) => QRL<T>;
|
|
85
82
|
|
|
83
|
+
/**
|
|
84
|
+
* Register an external projection on a parent component VNode.
|
|
85
|
+
*
|
|
86
|
+
* Creates a new VirtualVNode that will render the given component QRL with the given props. The
|
|
87
|
+
* VNode is stored as a projection on the parent, and a low-priority cursor is added so the cursor
|
|
88
|
+
* walker will process it.
|
|
89
|
+
*
|
|
90
|
+
* Use `_setProjectionTarget` to set the DOM target element before the cursor fires.
|
|
91
|
+
*
|
|
92
|
+
* @internal
|
|
93
|
+
*/
|
|
94
|
+
export declare function _addProjection(container: _Container, parentVNode: _VirtualVNode, componentQRL: QRL<any>, props: Record<string, unknown>, slotName: string): _VirtualVNode;
|
|
95
|
+
|
|
96
|
+
declare interface AddRootFn {
|
|
97
|
+
(obj: unknown, returnRef?: never): number;
|
|
98
|
+
(obj: unknown, returnRef: true): SeenRef;
|
|
99
|
+
}
|
|
100
|
+
|
|
86
101
|
declare type AllEventKeys = keyof AllEventsMap;
|
|
87
102
|
|
|
88
|
-
declare type AllEventMapRaw =
|
|
89
|
-
qidle: QwikIdleEvent;
|
|
90
|
-
qinit: QwikInitEvent;
|
|
91
|
-
qsymbol: QwikSymbolEvent;
|
|
92
|
-
qvisible: QwikVisibleEvent;
|
|
93
|
-
qviewtransition: QwikViewTransitionEvent;
|
|
94
|
-
};
|
|
103
|
+
declare type AllEventMapRaw = QwikHTMLElementEventMap & QwikDocumentEventMap & QwikWindowEventMap;
|
|
95
104
|
|
|
96
105
|
declare type AllEventsMap = Omit<AllEventMapRaw, keyof EventCorrectionMap> & EventCorrectionMap;
|
|
97
106
|
|
|
98
107
|
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
108
|
|
|
100
|
-
declare type
|
|
101
|
-
|
|
102
|
-
declare type AllSignalFlags = SignalFlags | WrappedSignalFlags;
|
|
109
|
+
declare type AllSignalFlags = SignalFlags | WrappedSignalFlags | SerializationSignalFlags | AsyncSignalFlags;
|
|
103
110
|
|
|
104
111
|
/**
|
|
105
112
|
* TS defines these with the React syntax which is not compatible with Qwik. E.g. `ariaAtomic`
|
|
@@ -357,22 +364,219 @@ declare interface AriaAttributes {
|
|
|
357
364
|
/** @public */
|
|
358
365
|
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
366
|
|
|
360
|
-
declare type
|
|
367
|
+
declare type AsyncCtx<T = unknown> = {
|
|
361
368
|
track: Tracker;
|
|
362
|
-
|
|
369
|
+
/**
|
|
370
|
+
* Register a cleanup callback to be called when the async computation is aborted or completed.
|
|
371
|
+
* The next invocation will await the previous cleanup. If you do not want this, do not return a
|
|
372
|
+
* Promise.
|
|
373
|
+
*/
|
|
374
|
+
cleanup: (callback: () => void | Promise<void>) => void;
|
|
375
|
+
/**
|
|
376
|
+
* A lazily created AbortSignal, for interrupting the async computation when needed, e.g. when the
|
|
377
|
+
* component is unmounted or the computation is invalidated. Pass it to `fetch` or other APIs that
|
|
378
|
+
* support it to ensure that unnecessary work is not performed.
|
|
379
|
+
*/
|
|
380
|
+
readonly abortSignal: AbortSignal;
|
|
381
|
+
/** The result of the previous computation, if any */
|
|
382
|
+
readonly previous: T | undefined;
|
|
363
383
|
};
|
|
364
384
|
|
|
365
|
-
/**
|
|
366
|
-
|
|
385
|
+
/**
|
|
386
|
+
* Note, we don't pass the generic type to AsyncCtx because it causes TypeScript to not infer the
|
|
387
|
+
* type of the resource correctly. The type is only used for the `previous` property, which is not
|
|
388
|
+
* commonly used, and can be easily cast if needed.
|
|
389
|
+
*
|
|
390
|
+
* @public
|
|
391
|
+
*/
|
|
392
|
+
export declare type AsyncFn<T> = (ctx: AsyncCtx) => ValueOrPromise<T>;
|
|
393
|
+
|
|
394
|
+
/** Retains job metadata and also serves as the argument for the compute function */
|
|
395
|
+
declare class AsyncJob<T> implements AsyncCtx<T> {
|
|
396
|
+
readonly $signal$: AsyncSignalImpl<T>;
|
|
397
|
+
/** First holds the compute promise and then the cleanup promise */
|
|
398
|
+
$promise$: Promise<void> | null;
|
|
399
|
+
$cleanupRequested$: boolean;
|
|
400
|
+
$canWrite$: boolean;
|
|
401
|
+
$track$: AsyncCtx<T>['track'] | undefined;
|
|
402
|
+
$cleanups$: Parameters<AsyncCtx<T>['cleanup']>[0][] | undefined;
|
|
403
|
+
$abortController$: AbortController | undefined;
|
|
404
|
+
constructor($signal$: AsyncSignalImpl<T>);
|
|
405
|
+
get track(): AsyncCtx<T>['track'];
|
|
406
|
+
get abortSignal(): AbortSignal;
|
|
407
|
+
/** Backward compatible cache method for resource */
|
|
408
|
+
cache(): void;
|
|
409
|
+
get previous(): T | undefined;
|
|
410
|
+
cleanup(callback: () => void): void;
|
|
411
|
+
}
|
|
367
412
|
|
|
368
|
-
|
|
369
|
-
|
|
413
|
+
declare type AsyncQRL<T> = _QRLInternal<AsyncFn<T>>;
|
|
414
|
+
|
|
415
|
+
/**
|
|
416
|
+
* An AsyncSignal holds the result of the given async function. If the function uses `track()` to
|
|
417
|
+
* track reactive state, and that state changes, the AsyncSignal is recalculated, and if the result
|
|
418
|
+
* changed, all tasks which are tracking the AsyncSignal will be re-run and all subscribers
|
|
419
|
+
* (components, tasks etc) that read the AsyncSignal will be updated.
|
|
420
|
+
*
|
|
421
|
+
* If the async function throws an error, the AsyncSignal will capture the error and set the `error`
|
|
422
|
+
* property. The error can be cleared by re-running the async function successfully.
|
|
423
|
+
*
|
|
424
|
+
* While the async function is running, the `.loading` property will be set to `true`. Once the
|
|
425
|
+
* function completes, `loading` will be set to `false`.
|
|
426
|
+
*
|
|
427
|
+
* If the value has not yet been resolved, reading the AsyncSignal will throw a Promise, which will
|
|
428
|
+
* retry the component or task once the value resolves.
|
|
429
|
+
*
|
|
430
|
+
* If the value has been resolved, but the async function is re-running, reading the AsyncSignal
|
|
431
|
+
* will subscribe to it and return the last resolved value until the new value is ready. As soon as
|
|
432
|
+
* the new value is ready, the subscribers will be updated.
|
|
433
|
+
*
|
|
434
|
+
* If the async function threw an error, reading the `.value` will throw that same error. Read from
|
|
435
|
+
* `.error` to check if there was an error.
|
|
436
|
+
*
|
|
437
|
+
* @public
|
|
438
|
+
*/
|
|
439
|
+
export declare interface AsyncSignal<T = unknown> extends ComputedSignal<T> {
|
|
440
|
+
/**
|
|
441
|
+
* Whether the signal is currently loading. This will trigger lazy loading of the signal, so you
|
|
442
|
+
* can use it like this:
|
|
443
|
+
*
|
|
444
|
+
* ```tsx
|
|
445
|
+
* signal.loading ? <Loading /> : signal.error ? <Error /> : <Component
|
|
446
|
+
* value={signal.value} />
|
|
447
|
+
* ```
|
|
448
|
+
*/
|
|
449
|
+
loading: boolean;
|
|
450
|
+
/**
|
|
451
|
+
* The error that occurred while computing the signal, if any. This will be cleared when the
|
|
452
|
+
* signal is successfully computed.
|
|
453
|
+
*/
|
|
454
|
+
error: Error | undefined;
|
|
455
|
+
/**
|
|
456
|
+
* Poll interval in ms. Writable and immediately effective when the signal has consumers. If set
|
|
457
|
+
* to `0`, polling stops.
|
|
458
|
+
*/
|
|
459
|
+
interval: number;
|
|
460
|
+
/** A promise that resolves when the value is computed or rejected. */
|
|
461
|
+
promise(): Promise<void>;
|
|
462
|
+
/** Abort the current computation and run cleanups if needed. */
|
|
463
|
+
abort(reason?: any): void;
|
|
370
464
|
}
|
|
371
465
|
|
|
372
|
-
|
|
373
|
-
|
|
466
|
+
declare const enum AsyncSignalFlags {
|
|
467
|
+
EAGER_CLEANUP = 32,
|
|
468
|
+
CLIENT_ONLY = 64
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
/**
|
|
472
|
+
* # ================================
|
|
473
|
+
*
|
|
474
|
+
* AsyncSignalImpl
|
|
475
|
+
*
|
|
476
|
+
* # ================================
|
|
477
|
+
*/
|
|
478
|
+
declare class AsyncSignalImpl<T> extends ComputedSignalImpl<T, AsyncQRL<T>> implements BackRef, AsyncSignal<T> {
|
|
479
|
+
$untrackedLoading$: boolean;
|
|
480
|
+
$untrackedError$: Error | undefined;
|
|
481
|
+
$loadingEffects$: undefined | Set<EffectSubscription>;
|
|
482
|
+
$errorEffects$: undefined | Set<EffectSubscription>;
|
|
483
|
+
$current$: AsyncJob<T> | null;
|
|
484
|
+
$jobs$: AsyncJob<T>[];
|
|
485
|
+
$concurrency$: number;
|
|
486
|
+
$interval$: number;
|
|
487
|
+
$timeoutMs$: number | undefined;
|
|
488
|
+
$pollTimeoutId$: ReturnType<typeof setTimeout> | undefined;
|
|
489
|
+
$computationTimeoutId$: ReturnType<typeof setTimeout> | undefined;
|
|
490
|
+
[_EFFECT_BACK_REF]: Map<EffectProperty | string, EffectSubscription> | undefined;
|
|
491
|
+
constructor(container: _Container | null, fn: AsyncQRL<T>, flags?: SignalFlags | SerializationSignalFlags, options?: AsyncSignalOptions<T>);
|
|
492
|
+
get untrackedValue(): T;
|
|
493
|
+
set untrackedValue(value: T);
|
|
494
|
+
/**
|
|
495
|
+
* Loading is true if the signal is still waiting for the promise to resolve, false if the promise
|
|
496
|
+
* has resolved or rejected.
|
|
497
|
+
*
|
|
498
|
+
* Accessing .loading will trigger computation if needed, since it's often used like
|
|
499
|
+
* `signal.loading ? <Loading /> : signal.value`.
|
|
500
|
+
*/
|
|
501
|
+
get loading(): boolean;
|
|
502
|
+
set untrackedLoading(value: boolean);
|
|
503
|
+
get untrackedLoading(): boolean;
|
|
504
|
+
/** The error that occurred when the signal was resolved. */
|
|
505
|
+
get error(): Error | undefined;
|
|
506
|
+
set untrackedError(value: Error | undefined);
|
|
507
|
+
get untrackedError(): Error | undefined;
|
|
508
|
+
get interval(): number;
|
|
509
|
+
set interval(value: number);
|
|
510
|
+
/** Invalidates the signal, causing it to re-compute its value. */
|
|
511
|
+
invalidate(): Promise<void>;
|
|
512
|
+
/** Abort the current computation and run cleanups if needed. */
|
|
513
|
+
abort(reason?: any): void;
|
|
514
|
+
/** Schedule eager cleanup on next macro task if no subscribers remain. */
|
|
515
|
+
$scheduleEagerCleanup$(): void;
|
|
516
|
+
/** Returns a promise resolves when the signal finished computing. */
|
|
517
|
+
promise(): Promise<void>;
|
|
518
|
+
/** Run the computation if needed */
|
|
519
|
+
$computeIfNeeded$(): void;
|
|
520
|
+
$runComputation$(running: AsyncJob<T>): Promise<void>;
|
|
521
|
+
/** Called after SSR/unmount */
|
|
522
|
+
$destroy$(): Promise<void>;
|
|
523
|
+
private $clearNextPoll$;
|
|
524
|
+
private $scheduleNextPoll$;
|
|
525
|
+
private $hasSubscribers$;
|
|
526
|
+
$requestCleanups$(job: AsyncJob<T>, reason?: any): Promise<void | null>;
|
|
527
|
+
/** Clean up and trigger signal compute once complete */
|
|
528
|
+
$runCleanups$(job: AsyncJob<T>): Promise<void>;
|
|
529
|
+
}
|
|
374
530
|
|
|
375
|
-
|
|
531
|
+
/** @public */
|
|
532
|
+
export declare interface AsyncSignalOptions<T> extends ComputedOptions {
|
|
533
|
+
/** Like useSignal's `initial`; prevents the throw on first read when uninitialized */
|
|
534
|
+
initial?: T | (() => T);
|
|
535
|
+
/**
|
|
536
|
+
* Maximum number of concurrent computations. Use `0` for unlimited.
|
|
537
|
+
*
|
|
538
|
+
* Defaults to `1`.
|
|
539
|
+
*/
|
|
540
|
+
concurrency?: number;
|
|
541
|
+
/**
|
|
542
|
+
* When subscribers drop to 0, run cleanup in the next tick, instead of waiting for the function
|
|
543
|
+
* inputs to change.
|
|
544
|
+
*
|
|
545
|
+
* Defaults to `false`, meaning cleanup happens only when inputs change.
|
|
546
|
+
*/
|
|
547
|
+
eagerCleanup?: boolean;
|
|
548
|
+
/**
|
|
549
|
+
* Wait for previous invocation to complete before running again.
|
|
550
|
+
*
|
|
551
|
+
* Defaults to `true`.
|
|
552
|
+
*
|
|
553
|
+
* @deprecated Not implemented yet
|
|
554
|
+
*/
|
|
555
|
+
awaitPrevious?: boolean;
|
|
556
|
+
/**
|
|
557
|
+
* In the browser, re-run the function after `interval` ms if subscribers exist, even when no
|
|
558
|
+
* input state changed. If `0`, does not poll.
|
|
559
|
+
*
|
|
560
|
+
* Defaults to `0`.
|
|
561
|
+
*/
|
|
562
|
+
interval?: number;
|
|
563
|
+
/**
|
|
564
|
+
* When true, the async computation is postponed to the browser. On SSR, the signal remains
|
|
565
|
+
* INVALID and does not execute the function. On the client, it will compute on first read.
|
|
566
|
+
*
|
|
567
|
+
* Defaults to `false`.
|
|
568
|
+
*/
|
|
569
|
+
clientOnly?: boolean;
|
|
570
|
+
/**
|
|
571
|
+
* Maximum time in milliseconds to wait for the async computation to complete. If exceeded, the
|
|
572
|
+
* computation is aborted and an error is thrown.
|
|
573
|
+
*
|
|
574
|
+
* If `0`, no timeout is applied.
|
|
575
|
+
*
|
|
576
|
+
* Defaults to `0`.
|
|
577
|
+
*/
|
|
578
|
+
timeout?: number;
|
|
579
|
+
}
|
|
376
580
|
|
|
377
581
|
/**
|
|
378
582
|
* Replace given element's props with custom types and return all props specific to the element. Use
|
|
@@ -384,7 +588,7 @@ declare type Augmented<E, A = {}> = Prettify<Filtered<E, A> & A>;
|
|
|
384
588
|
|
|
385
589
|
/** Class for back reference to the EffectSubscription */
|
|
386
590
|
declare abstract class BackRef {
|
|
387
|
-
[_EFFECT_BACK_REF]: Map<
|
|
591
|
+
[_EFFECT_BACK_REF]: Map<any, any> | undefined;
|
|
388
592
|
}
|
|
389
593
|
|
|
390
594
|
declare type BivariantQrlFn<ARGS extends any[], RETURN> = {
|
|
@@ -400,21 +604,33 @@ declare type BivariantQrlFn<ARGS extends any[], RETURN> = {
|
|
|
400
604
|
/** @public */
|
|
401
605
|
declare type Booleanish = boolean | `${boolean}`;
|
|
402
606
|
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
607
|
+
/**
|
|
608
|
+
* The current captured scope during QRL invocation. This is used to provide the lexical scope for
|
|
609
|
+
* QRL functions. It is used one time per invocation, synchronously, so it is safe to store it in
|
|
610
|
+
* module scope.
|
|
611
|
+
*
|
|
612
|
+
* @internal
|
|
613
|
+
*/
|
|
614
|
+
export declare let _captures: Readonly<unknown[]> | null;
|
|
615
|
+
|
|
616
|
+
/**
|
|
617
|
+
* Handles events for bind:checked
|
|
618
|
+
*
|
|
619
|
+
* @internal
|
|
620
|
+
*/
|
|
621
|
+
export declare function _chk(this: string | undefined, _: any, element: HTMLInputElement): void;
|
|
622
|
+
|
|
623
|
+
declare const enum ChoreBits {
|
|
624
|
+
NONE = 0,
|
|
625
|
+
TASKS = 1,
|
|
626
|
+
NODE_DIFF = 2,
|
|
627
|
+
COMPONENT = 4,
|
|
628
|
+
NODE_PROPS = 8,
|
|
629
|
+
COMPUTE = 16,
|
|
630
|
+
CHILDREN = 32,
|
|
631
|
+
CLEANUP = 64,
|
|
632
|
+
RECONCILE = 128,
|
|
633
|
+
DIRTY_MASK = 255
|
|
418
634
|
}
|
|
419
635
|
|
|
420
636
|
/**
|
|
@@ -430,17 +646,14 @@ declare const enum ChoreType {
|
|
|
430
646
|
export declare type ClassList = string | undefined | null | false | Record<string, boolean | string | number | null | undefined> | ClassList[];
|
|
431
647
|
|
|
432
648
|
/** @internal */
|
|
433
|
-
export declare interface ClientContainer extends
|
|
649
|
+
export declare interface ClientContainer extends _Container {
|
|
434
650
|
document: _QDocument;
|
|
435
651
|
element: _ContainerElement;
|
|
436
652
|
qContainer: string;
|
|
437
653
|
$locale$: string;
|
|
438
654
|
qManifestHash: string;
|
|
439
655
|
rootVNode: _ElementVNode;
|
|
440
|
-
$journal$: VNodeJournal;
|
|
441
|
-
renderDone: Promise<void> | null;
|
|
442
656
|
$forwardRefs$: Array<number> | null;
|
|
443
|
-
$initialQRLsIndexes$: Array<number> | null;
|
|
444
657
|
parseQRL<T = unknown>(qrl: string): QRL<T>;
|
|
445
658
|
$setRawState$(id: number, vParent: _ElementVNode | _VirtualVNode): void;
|
|
446
659
|
}
|
|
@@ -468,11 +681,11 @@ export declare interface ClientContainer extends Container {
|
|
|
468
681
|
* step?: number;
|
|
469
682
|
* }
|
|
470
683
|
* export const Counter = component$((props: CounterProps) => {
|
|
471
|
-
* const state =
|
|
684
|
+
* const state = useSignal(props.initialValue || 0);
|
|
472
685
|
* return (
|
|
473
686
|
* <div>
|
|
474
|
-
* <span>{state.
|
|
475
|
-
* <button onClick$={() => (state.
|
|
687
|
+
* <span>{state.value}</span>
|
|
688
|
+
* <button onClick$={() => (state.value += props.step || 1)}>+</button>
|
|
476
689
|
* </div>
|
|
477
690
|
* );
|
|
478
691
|
* });
|
|
@@ -527,12 +740,6 @@ declare type ComponentChildren<PROPS> = PROPS extends {
|
|
|
527
740
|
children?: JSXChildren;
|
|
528
741
|
};
|
|
529
742
|
|
|
530
|
-
/** @public */
|
|
531
|
-
declare interface ComponentEntryStrategy {
|
|
532
|
-
type: 'component';
|
|
533
|
-
manual?: Record<string, string>;
|
|
534
|
-
}
|
|
535
|
-
|
|
536
743
|
/** @internal */
|
|
537
744
|
export declare const componentQrl: <PROPS extends Record<any, any>>(componentQrl: QRL<OnRenderFn<PROPS>>) => Component<PROPS>;
|
|
538
745
|
|
|
@@ -540,7 +747,13 @@ export declare const componentQrl: <PROPS extends Record<any, any>>(componentQrl
|
|
|
540
747
|
export declare type ComputedFn<T> = () => T;
|
|
541
748
|
|
|
542
749
|
/** @public */
|
|
543
|
-
export declare
|
|
750
|
+
export declare interface ComputedOptions {
|
|
751
|
+
serializationStrategy?: SerializationStrategy;
|
|
752
|
+
container?: _Container;
|
|
753
|
+
}
|
|
754
|
+
|
|
755
|
+
/** @public */
|
|
756
|
+
export declare type ComputedReturnType<T> = T extends Promise<any> ? never : ComputedSignal<T>;
|
|
544
757
|
|
|
545
758
|
/**
|
|
546
759
|
* A computed signal is a signal which is calculated from other signals. When the signals change,
|
|
@@ -549,12 +762,11 @@ export declare type ComputedReturnType<T> = T extends Promise<any> ? never : Rea
|
|
|
549
762
|
*
|
|
550
763
|
* @public
|
|
551
764
|
*/
|
|
552
|
-
export declare interface ComputedSignal<T> extends
|
|
553
|
-
/**
|
|
554
|
-
* Use this to force recalculation and running subscribers, for example when the calculated value
|
|
555
|
-
* mutates but remains the same object. Useful for third-party libraries.
|
|
556
|
-
*/
|
|
765
|
+
export declare interface ComputedSignal<T> extends Signal<T> {
|
|
766
|
+
/** @deprecated Use `trigger()` instead */
|
|
557
767
|
force(): void;
|
|
768
|
+
/** Use this to force recalculation. */
|
|
769
|
+
invalidate(): void;
|
|
558
770
|
}
|
|
559
771
|
|
|
560
772
|
/**
|
|
@@ -562,7 +774,7 @@ export declare interface ComputedSignal<T> extends ReadonlySignal<T> {
|
|
|
562
774
|
*
|
|
563
775
|
* The value is available synchronously, but the computation is done lazily.
|
|
564
776
|
*/
|
|
565
|
-
declare class ComputedSignalImpl<T, S extends
|
|
777
|
+
declare class ComputedSignalImpl<T, S extends _QRLInternal = ComputeQRL<T>> extends SignalImpl<T> implements BackRef {
|
|
566
778
|
/**
|
|
567
779
|
* The compute function is stored here.
|
|
568
780
|
*
|
|
@@ -570,23 +782,16 @@ declare class ComputedSignalImpl<T, S extends QRLInternal = ComputeQRL<T>> exten
|
|
|
570
782
|
* resolve the QRL during the mark dirty phase so that any call to it will be synchronous). )
|
|
571
783
|
*/
|
|
572
784
|
$computeQrl$: S;
|
|
573
|
-
$flags$: SignalFlags;
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
$invalidate$(): void;
|
|
578
|
-
/**
|
|
579
|
-
* Use this to force running subscribers, for example when the calculated value has mutated but
|
|
580
|
-
* remained the same object
|
|
581
|
-
*/
|
|
582
|
-
force(): void;
|
|
785
|
+
$flags$: SignalFlags | SerializationSignalFlags;
|
|
786
|
+
[_EFFECT_BACK_REF]: Map<EffectProperty | string, EffectSubscription> | undefined;
|
|
787
|
+
constructor(container: _Container | null, fn: S, flags?: SignalFlags | SerializationSignalFlags);
|
|
788
|
+
invalidate(): void;
|
|
583
789
|
get untrackedValue(): T;
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
get value(): any;
|
|
790
|
+
set untrackedValue(value: T);
|
|
791
|
+
$computeIfNeeded$(): void;
|
|
587
792
|
}
|
|
588
793
|
|
|
589
|
-
declare type ComputeQRL<T> =
|
|
794
|
+
declare type ComputeQRL<T> = _QRLInternal<ComputedFn<T>>;
|
|
590
795
|
|
|
591
796
|
/** @internal */
|
|
592
797
|
export declare const _CONST_PROPS: unique symbol;
|
|
@@ -600,18 +805,22 @@ export declare const _CONST_PROPS: unique symbol;
|
|
|
600
805
|
* - `VNode` and `ISsrNode`: Either a component or `<Signal>`
|
|
601
806
|
* - `Signal2`: A derived signal which contains a computation function.
|
|
602
807
|
*/
|
|
603
|
-
declare type Consumer = Task | _VNode |
|
|
808
|
+
declare type Consumer = Task | _VNode | SignalImpl | ISsrNode;
|
|
604
809
|
|
|
605
|
-
|
|
810
|
+
/** @internal */
|
|
811
|
+
export declare interface _Container {
|
|
606
812
|
readonly $version$: string;
|
|
607
|
-
readonly $scheduler$: Scheduler;
|
|
608
813
|
readonly $storeProxyMap$: ObjToProxyMap;
|
|
609
814
|
readonly $locale$: string;
|
|
610
815
|
readonly $getObjectById$: (id: number | string) => any;
|
|
611
816
|
readonly $serverData$: Record<string, any>;
|
|
612
817
|
$currentUniqueId$: number;
|
|
613
818
|
$buildBase$: string | null;
|
|
614
|
-
|
|
819
|
+
$renderPromise$: Promise<void> | null;
|
|
820
|
+
$resolveRenderPromise$: (() => void) | null;
|
|
821
|
+
$pendingCount$: number;
|
|
822
|
+
$checkPendingCount$(): void;
|
|
823
|
+
handleError(err: any, $host$: HostElement | null): void;
|
|
615
824
|
getParentHost(host: HostElement): HostElement | null;
|
|
616
825
|
setContext<T>(host: HostElement, context: ContextId<T>, value: T): void;
|
|
617
826
|
resolveContext<T>(host: HostElement, contextId: ContextId<T>): T | undefined;
|
|
@@ -755,19 +964,13 @@ export declare interface CorePlatform {
|
|
|
755
964
|
* @param symbol - The name of the symbol to import.
|
|
756
965
|
* @returns A promise that resolves to the imported symbol.
|
|
757
966
|
*/
|
|
758
|
-
importSymbol: (containerEl: Element | undefined, url: string | URL | undefined | null, symbol: string) => ValueOrPromise<
|
|
967
|
+
importSymbol: (containerEl: Element | undefined, url: string | URL | undefined | null, symbol: string) => ValueOrPromise<unknown>;
|
|
759
968
|
/**
|
|
760
969
|
* Perform operation on next request-animation-frame.
|
|
761
970
|
*
|
|
762
971
|
* @param fn - The function to call when the next animation frame is ready.
|
|
763
972
|
*/
|
|
764
973
|
raf: (fn: () => any) => Promise<any>;
|
|
765
|
-
/**
|
|
766
|
-
* Perform operation on next tick.
|
|
767
|
-
*
|
|
768
|
-
* @param fn - The function to call when the tick is ready.
|
|
769
|
-
*/
|
|
770
|
-
nextTick: (fn: () => any) => Promise<any>;
|
|
771
974
|
/**
|
|
772
975
|
* Retrieve chunk name for the symbol.
|
|
773
976
|
*
|
|
@@ -789,6 +992,17 @@ export declare interface CorrectedToggleEvent extends Event {
|
|
|
789
992
|
readonly prevState: 'open' | 'closed';
|
|
790
993
|
}
|
|
791
994
|
|
|
995
|
+
/**
|
|
996
|
+
* Create a signal holding a `.value` which is calculated from the given async function (QRL). The
|
|
997
|
+
* standalone version of `useAsync$`.
|
|
998
|
+
*
|
|
999
|
+
* @public
|
|
1000
|
+
*/
|
|
1001
|
+
export declare const createAsync$: <T>(qrl: (arg: AsyncCtx<T>) => Promise<T>, options?: AsyncSignalOptions<T>) => AsyncSignal<T>;
|
|
1002
|
+
|
|
1003
|
+
/** @internal */
|
|
1004
|
+
export declare const createAsyncQrl: <T>(qrl: QRL<AsyncFn<T>>, options?: AsyncSignalOptions<T>) => AsyncSignalImpl<T>;
|
|
1005
|
+
|
|
792
1006
|
/**
|
|
793
1007
|
* Create a computed signal which is calculated from the given QRL. A computed signal is a signal
|
|
794
1008
|
* which is calculated from other signals. When the signals change, the computed signal is
|
|
@@ -797,14 +1011,14 @@ export declare interface CorrectedToggleEvent extends Event {
|
|
|
797
1011
|
* The QRL must be a function which returns the value of the signal. The function must not have side
|
|
798
1012
|
* effects, and it must be synchronous.
|
|
799
1013
|
*
|
|
800
|
-
* If you need the function to be async, use `
|
|
1014
|
+
* If you need the function to be async, use `createAsync$` instead (don't forget to use `track()`).
|
|
801
1015
|
*
|
|
802
1016
|
* @public
|
|
803
1017
|
*/
|
|
804
|
-
export declare const createComputed$: <T>(qrl: () => T) =>
|
|
1018
|
+
export declare const createComputed$: <T>(qrl: () => T, options?: ComputedOptions) => ComputedReturnType<T>;
|
|
805
1019
|
|
|
806
1020
|
/** @internal */
|
|
807
|
-
export declare const createComputedQrl: <T>(qrl: QRL<() => T
|
|
1021
|
+
export declare const createComputedQrl: <T>(qrl: QRL<() => T>, options?: ComputedOptions) => ComputedSignalImpl<T>;
|
|
808
1022
|
|
|
809
1023
|
/**
|
|
810
1024
|
* Create a context ID to be used in your application. The name should be written with no spaces.
|
|
@@ -858,18 +1072,20 @@ export declare const createComputedQrl: <T>(qrl: QRL<() => T>) => ComputedSignal
|
|
|
858
1072
|
*/
|
|
859
1073
|
export declare const createContextId: <STATE = unknown>(name: string) => ContextId<STATE>;
|
|
860
1074
|
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
1075
|
+
/**
|
|
1076
|
+
* Creates a QRL instance to represent a lazily loaded value. Normally this is a function, but it
|
|
1077
|
+
* can be any value.
|
|
1078
|
+
*
|
|
1079
|
+
* When the value is a function, calling the returned qrl will load the underlying code when
|
|
1080
|
+
* invoked, and call it with the captured scope. This always returns a promise since the code may
|
|
1081
|
+
* not be loaded yet.
|
|
1082
|
+
*
|
|
1083
|
+
* To get the underlying function without invoking it, await `qrl.resolve()` and then `qrl.resolved`
|
|
1084
|
+
* holds the loaded function, wrapped with the captured scope.
|
|
1085
|
+
*
|
|
1086
|
+
* @internal
|
|
1087
|
+
*/
|
|
1088
|
+
export declare const _createQRL: <TYPE>(chunk: string | null, symbol: string, symbolRef?: null | ValueOrPromise<TYPE>, symbolFn?: null | (() => Promise<Record<string, TYPE>>), captures?: Readonly<unknown[]> | string | null, container?: _Container) => _QRLInternal<TYPE>;
|
|
873
1089
|
|
|
874
1090
|
/**
|
|
875
1091
|
* Create a signal that holds a custom serializable value. See {@link useSerializer$} for more
|
|
@@ -909,24 +1125,22 @@ export declare interface CSSProperties extends CSS_2.Properties<string | number>
|
|
|
909
1125
|
[v: `--${string}`]: string | number | undefined;
|
|
910
1126
|
}
|
|
911
1127
|
|
|
912
|
-
/** @public */
|
|
913
1128
|
declare interface DescriptorBase<T = unknown, B = unknown> extends BackRef {
|
|
914
1129
|
$flags$: number;
|
|
915
1130
|
$index$: number;
|
|
916
1131
|
$el$: HostElement;
|
|
917
|
-
$qrl$:
|
|
1132
|
+
$qrl$: _QRLInternal<T>;
|
|
918
1133
|
$state$: B | undefined;
|
|
919
|
-
$destroy$:
|
|
1134
|
+
$destroy$: (() => void) | null;
|
|
920
1135
|
}
|
|
921
1136
|
|
|
922
1137
|
/**
|
|
923
1138
|
* Deserialize data from string to an array of objects.
|
|
924
1139
|
*
|
|
925
1140
|
* @param rawStateData - Data to deserialize
|
|
926
|
-
* @param element - Container element
|
|
927
1141
|
* @internal
|
|
928
1142
|
*/
|
|
929
|
-
export declare function _deserialize(rawStateData: string
|
|
1143
|
+
export declare function _deserialize<T>(rawStateData: string): T;
|
|
930
1144
|
|
|
931
1145
|
declare interface DeserializeContainer {
|
|
932
1146
|
$getObjectById$: (id: number | string) => unknown;
|
|
@@ -935,8 +1149,6 @@ declare interface DeserializeContainer {
|
|
|
935
1149
|
$state$?: unknown[];
|
|
936
1150
|
$storeProxyMap$: ObjToProxyMap;
|
|
937
1151
|
$forwardRefs$: Array<number> | null;
|
|
938
|
-
$initialQRLsIndexes$: Array<number> | null;
|
|
939
|
-
readonly $scheduler$: Scheduler | null;
|
|
940
1152
|
}
|
|
941
1153
|
|
|
942
1154
|
/** @public */
|
|
@@ -963,53 +1175,40 @@ declare class DomContainer extends _SharedContainer implements ClientContainer {
|
|
|
963
1175
|
qManifestHash: string;
|
|
964
1176
|
rootVNode: _ElementVNode;
|
|
965
1177
|
document: _QDocument;
|
|
966
|
-
$journal$: VNodeJournal;
|
|
967
|
-
renderDone: Promise<void> | null;
|
|
968
|
-
$rawStateData$: unknown[];
|
|
969
1178
|
$storeProxyMap$: ObjToProxyMap;
|
|
970
1179
|
$qFuncs$: Array<(...args: unknown[]) => unknown>;
|
|
971
1180
|
$instanceHash$: string;
|
|
972
1181
|
$forwardRefs$: Array<number> | null;
|
|
973
|
-
$initialQRLsIndexes$: Array<number> | null;
|
|
974
1182
|
vNodeLocate: (id: string | Element) => _VNode;
|
|
1183
|
+
private $rawStateData$;
|
|
975
1184
|
private $stateData$;
|
|
976
1185
|
private $styleIds$;
|
|
977
|
-
private $renderCount$;
|
|
978
1186
|
constructor(element: _ContainerElement);
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
1187
|
+
/** Tear down this container so stale references fail gracefully. */
|
|
1188
|
+
$destroy$(): void;
|
|
1189
|
+
/**
|
|
1190
|
+
* The first time we render we need to hoist the styles. (Meaning we need to move all styles from
|
|
1191
|
+
* component inline to <head>)
|
|
1192
|
+
*
|
|
1193
|
+
* We bulk move all of the styles, because the expensive part is for the browser to recompute the
|
|
1194
|
+
* styles, (not the actual DOM manipulation.) By moving all of them at once we can minimize the
|
|
1195
|
+
* reflow.
|
|
1196
|
+
*/
|
|
1197
|
+
$hoistStyles$(): void;
|
|
1198
|
+
$setRawState$(id: number, vParent: _VNode): void;
|
|
1199
|
+
parseQRL<T = unknown>(qrlStr: string): QRL<T>;
|
|
1200
|
+
handleError(err: any, host: _VNode | null): void;
|
|
1201
|
+
setContext<T>(host: _VNode, context: ContextId<T>, value: T): void;
|
|
1202
|
+
resolveContext<T>(host: _VNode, contextId: ContextId<T>): T | undefined;
|
|
1203
|
+
getParentHost(host: _VNode): _VNode | null;
|
|
985
1204
|
setHostProp<T>(host: HostElement, name: string, value: T): void;
|
|
986
1205
|
getHostProp<T>(host: HostElement, name: string): T | null;
|
|
987
|
-
scheduleRender(): Promise<void>;
|
|
988
|
-
private processChores;
|
|
989
1206
|
ensureProjectionResolved(vNode: _VirtualVNode): void;
|
|
990
1207
|
$getObjectById$: (id: number | string) => unknown;
|
|
991
1208
|
getSyncFn(id: number): (...args: unknown[]) => unknown;
|
|
992
1209
|
$appendStyle$(content: string, styleId: string, host: _VirtualVNode, scoped: boolean): void;
|
|
993
1210
|
/** Set the server data for the Qwik Router. */
|
|
994
1211
|
private $setServerData$;
|
|
995
|
-
/**
|
|
996
|
-
* Schedule the initial QRLs to be resolved.
|
|
997
|
-
*
|
|
998
|
-
* Schedules the QRLs that are defined in the state data as `PreloadQRL`.
|
|
999
|
-
*
|
|
1000
|
-
* This is done because when computed and custom serializer QRLs are called they need QRL to work.
|
|
1001
|
-
* If the QRL is not resolved at this point, it will be resolved by throwing a promise and
|
|
1002
|
-
* rerunning the whole wrapping function again. We want to avoid that, because it means that the
|
|
1003
|
-
* function can execute twice.
|
|
1004
|
-
*
|
|
1005
|
-
* ```ts
|
|
1006
|
-
* useVisibleTask$(() => {
|
|
1007
|
-
* runHeavyLogic(); // This will be called again if the QRL of `computedOrCustomSerializer` is not resolved.
|
|
1008
|
-
* console.log(computedOrCustomSerializer.value); // Throw a promise if QRL not resolved and execute visible task again.
|
|
1009
|
-
* });
|
|
1010
|
-
* ```
|
|
1011
|
-
*/
|
|
1012
|
-
private $scheduleInitialQRLs$;
|
|
1013
1212
|
}
|
|
1014
1213
|
export { DomContainer }
|
|
1015
1214
|
export { DomContainer as _DomContainer }
|
|
@@ -1021,9 +1220,28 @@ declare type DomRef = {
|
|
|
1021
1220
|
/** @internal */
|
|
1022
1221
|
export declare const _dumpState: (state: unknown[], color?: boolean, prefix?: string, limit?: number | null) => string;
|
|
1023
1222
|
|
|
1223
|
+
/** @internal */
|
|
1224
|
+
export declare const _eaC: (props: EachProps<any>) => JSXNode<unknown>;
|
|
1225
|
+
|
|
1226
|
+
/** @public @experimental */
|
|
1227
|
+
export declare const Each: EachComponent;
|
|
1228
|
+
|
|
1229
|
+
declare type EachComponent = <T, ITEM extends JSXOutput = JSXOutput>(props: PublicProps<EachProps<T, ITEM>>, key: string | null, flags: number, dev?: DevJSX) => JSXOutput;
|
|
1230
|
+
|
|
1231
|
+
declare interface EachProps<T, ITEM extends JSXOutput = JSXOutput> {
|
|
1232
|
+
items: readonly T[];
|
|
1233
|
+
item$: QRL<(item: T, index: number) => ITEM>;
|
|
1234
|
+
key$: QRL<(item: T, index: number) => string>;
|
|
1235
|
+
}
|
|
1236
|
+
|
|
1237
|
+
/** @internal */
|
|
1238
|
+
export declare const _eaT: ({ track }: TaskCtx) => Promise<void>;
|
|
1239
|
+
|
|
1024
1240
|
/** @internal */
|
|
1025
1241
|
export declare const _EFFECT_BACK_REF: unique symbol;
|
|
1026
1242
|
|
|
1243
|
+
declare type EffectBackRef = SignalImpl | StoreTarget | PropsProxy;
|
|
1244
|
+
|
|
1027
1245
|
declare const enum EffectProperty {
|
|
1028
1246
|
COMPONENT = ":",
|
|
1029
1247
|
VNODE = "."
|
|
@@ -1065,42 +1283,26 @@ declare const enum EffectProperty {
|
|
|
1065
1283
|
* - `EffectProperty.COMPONENT` if component
|
|
1066
1284
|
* - `EffectProperty.VNODE` if VNode
|
|
1067
1285
|
*/
|
|
1068
|
-
declare
|
|
1069
|
-
Consumer
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
Set<
|
|
1074
|
-
|
|
1075
|
-
_SubscriptionData | null
|
|
1076
|
-
];
|
|
1286
|
+
declare class EffectSubscription {
|
|
1287
|
+
consumer: Consumer;
|
|
1288
|
+
property: EffectProperty | string;
|
|
1289
|
+
backRef: Set<EffectBackRef> | null;
|
|
1290
|
+
data: _SubscriptionData | null;
|
|
1291
|
+
constructor(consumer: Consumer, property: EffectProperty | string, backRef?: Set<EffectBackRef> | null, data?: _SubscriptionData | null);
|
|
1292
|
+
}
|
|
1077
1293
|
|
|
1078
1294
|
/** @internal */
|
|
1079
|
-
export declare
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
_VNode | null,
|
|
1083
|
-
|
|
1084
|
-
_VNode | null,
|
|
1085
|
-
/////////////// 2 - Previous sibling
|
|
1086
|
-
_VNode | null,
|
|
1087
|
-
/////////////// 3 - Next sibling
|
|
1088
|
-
_VNode | null | undefined,
|
|
1089
|
-
/// 4 - First child - undefined if children need to be materialize
|
|
1090
|
-
_VNode | null | undefined,
|
|
1091
|
-
Element,
|
|
1092
|
-
//////////////////// 6 - Element
|
|
1093
|
-
string | undefined,
|
|
1094
|
-
(string | null)[]
|
|
1095
|
-
] & {
|
|
1096
|
-
__brand__: 'ElementVNode';
|
|
1097
|
-
};
|
|
1295
|
+
export declare class _ElementVNode extends _VirtualVNode {
|
|
1296
|
+
node: Element;
|
|
1297
|
+
elementName: string | undefined;
|
|
1298
|
+
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);
|
|
1299
|
+
}
|
|
1098
1300
|
|
|
1099
1301
|
/** @internal */
|
|
1100
1302
|
export declare const _EMPTY_ARRAY: any[];
|
|
1101
1303
|
|
|
1102
|
-
/** @
|
|
1103
|
-
declare
|
|
1304
|
+
/** @internal */
|
|
1305
|
+
export declare const _EMPTY_OBJ: Record<string, any>;
|
|
1104
1306
|
|
|
1105
1307
|
/** @public */
|
|
1106
1308
|
export declare interface ErrorBoundaryStore {
|
|
@@ -1108,15 +1310,14 @@ export declare interface ErrorBoundaryStore {
|
|
|
1108
1310
|
}
|
|
1109
1311
|
|
|
1110
1312
|
/** @public */
|
|
1111
|
-
export declare const event$: <T>(qrl: T) =>
|
|
1313
|
+
export declare const event$: <T>(qrl: T) => QRL<T>;
|
|
1112
1314
|
|
|
1113
1315
|
declare type EventCorrectionMap = {
|
|
1114
1316
|
auxclick: PointerEvent;
|
|
1115
|
-
beforetoggle: CorrectedToggleEvent;
|
|
1116
1317
|
click: PointerEvent;
|
|
1117
1318
|
dblclick: PointerEvent;
|
|
1118
1319
|
input: InputEvent;
|
|
1119
|
-
|
|
1320
|
+
qvisible: QwikVisibleEvent;
|
|
1120
1321
|
};
|
|
1121
1322
|
|
|
1122
1323
|
declare type EventFromName<T extends string> = LcEvent<T>;
|
|
@@ -1135,6 +1336,9 @@ declare type EventQRL<T extends string = AllEventKeys> = QRL<EventHandler<EventF
|
|
|
1135
1336
|
/** @internal */
|
|
1136
1337
|
export declare const eventQrl: <T>(qrl: QRL<T>) => QRL<T>;
|
|
1137
1338
|
|
|
1339
|
+
/** @internal */
|
|
1340
|
+
export declare function _executeSsrChores(container: SSRContainer, ssrNode: ISsrNode): ValueOrPromise<void>;
|
|
1341
|
+
|
|
1138
1342
|
declare type FilterBase<T> = {
|
|
1139
1343
|
[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];
|
|
1140
1344
|
};
|
|
@@ -1147,6 +1351,13 @@ declare type Filtered<T, A = {}> = {
|
|
|
1147
1351
|
/** @internal */
|
|
1148
1352
|
export declare const _fnSignal: <T extends (...args: any) => any>(fn: T, args: Parameters<T>, fnStr?: string) => WrappedSignalImpl<any>;
|
|
1149
1353
|
|
|
1354
|
+
/**
|
|
1355
|
+
* Force a store to recompute and schedule effects.
|
|
1356
|
+
*
|
|
1357
|
+
* @public
|
|
1358
|
+
*/
|
|
1359
|
+
export declare const forceStoreEffects: (value: StoreTarget, prop: keyof StoreTarget) => void;
|
|
1360
|
+
|
|
1150
1361
|
/** @public */
|
|
1151
1362
|
export declare const Fragment: FunctionComponent<{
|
|
1152
1363
|
children?: any;
|
|
@@ -1164,14 +1375,20 @@ export declare type FunctionComponent<P = unknown> = {
|
|
|
1164
1375
|
renderFn(props: P, key: string | null, flags: number, dev?: DevJSX): JSXOutput;
|
|
1165
1376
|
}['renderFn'];
|
|
1166
1377
|
|
|
1378
|
+
/** Used by the optimizer for spread props operations @internal */
|
|
1379
|
+
export declare const _getConstProps: (props: PropsProxy | Record<string, unknown> | null | undefined) => Props | null;
|
|
1380
|
+
|
|
1167
1381
|
/** @internal */
|
|
1168
|
-
export declare const
|
|
1382
|
+
export declare const _getContextContainer: () => _Container | undefined;
|
|
1169
1383
|
|
|
1170
1384
|
/** @internal */
|
|
1171
1385
|
export declare const _getContextEvent: () => unknown;
|
|
1172
1386
|
|
|
1387
|
+
/** @internal */
|
|
1388
|
+
export declare const _getContextHostElement: () => HostElement | undefined;
|
|
1389
|
+
|
|
1173
1390
|
/** @public */
|
|
1174
|
-
declare function getDomContainer(element: Element
|
|
1391
|
+
declare function getDomContainer(element: Element): ClientContainer;
|
|
1175
1392
|
export { getDomContainer as _getDomContainer }
|
|
1176
1393
|
export { getDomContainer }
|
|
1177
1394
|
|
|
@@ -1200,22 +1417,14 @@ export declare function getLocale(defaultLocale?: string): string;
|
|
|
1200
1417
|
export declare const getPlatform: () => CorePlatform;
|
|
1201
1418
|
|
|
1202
1419
|
/** @internal */
|
|
1203
|
-
export declare function _getQContainerElement(element: Element
|
|
1420
|
+
export declare function _getQContainerElement(element: Element): Element | null;
|
|
1204
1421
|
|
|
1205
|
-
/** @
|
|
1206
|
-
declare
|
|
1207
|
-
tag: string;
|
|
1208
|
-
attributes?: {
|
|
1209
|
-
[key: string]: string;
|
|
1210
|
-
};
|
|
1211
|
-
location: 'head' | 'body';
|
|
1212
|
-
}
|
|
1422
|
+
/** Used by the optimizer for spread props operations @internal */
|
|
1423
|
+
export declare const _getVarProps: (props: PropsProxy | Record<string, unknown> | null | undefined) => Props | null;
|
|
1213
1424
|
|
|
1214
1425
|
/**
|
|
1215
|
-
* The legacy transform, used
|
|
1216
|
-
*
|
|
1217
|
-
*
|
|
1218
|
-
* Also note that this disables optimizations.
|
|
1426
|
+
* The legacy transform, used by some JSX transpilers. The optimizer normally replaces this with
|
|
1427
|
+
* optimized calls, with the same caveat as `jsx()`.
|
|
1219
1428
|
*
|
|
1220
1429
|
* @public
|
|
1221
1430
|
*/
|
|
@@ -1223,16 +1432,18 @@ declare function h<TYPE extends string | FunctionComponent<PROPS>, PROPS extends
|
|
|
1223
1432
|
export { h as createElement }
|
|
1224
1433
|
export { h }
|
|
1225
1434
|
|
|
1226
|
-
/**
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1435
|
+
/**
|
|
1436
|
+
* @returns True if the store has effects for the given prop
|
|
1437
|
+
* @internal
|
|
1438
|
+
*/
|
|
1439
|
+
export declare const _hasStoreEffects: (value: StoreTarget, prop: keyof StoreTarget) => boolean;
|
|
1230
1440
|
|
|
1231
|
-
/**
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1441
|
+
/**
|
|
1442
|
+
* HMR event handler. Replaces the component QRL with a fresh one and marks dirty.
|
|
1443
|
+
*
|
|
1444
|
+
* @internal
|
|
1445
|
+
*/
|
|
1446
|
+
export declare const _hmr: (event: Event, element: Element) => void;
|
|
1236
1447
|
|
|
1237
1448
|
declare type HostElement = _VNode | ISsrNode;
|
|
1238
1449
|
|
|
@@ -1345,16 +1556,19 @@ export declare const _IMMUTABLE: unique symbol;
|
|
|
1345
1556
|
*/
|
|
1346
1557
|
export declare const implicit$FirstArg: <FIRST, REST extends any[], RET>(fn: (qrl: QRL<FIRST>, ...rest: REST) => RET) => ((qrl: FIRST, ...rest: REST) => RET);
|
|
1347
1558
|
|
|
1348
|
-
/**
|
|
1349
|
-
|
|
1559
|
+
/**
|
|
1560
|
+
* Create an inlined QRL. This is mostly useful on the server side for serialization.
|
|
1561
|
+
*
|
|
1562
|
+
* @param symbol - The object/function to register, or `null` to retrieve a previously registered
|
|
1563
|
+
* one by hash
|
|
1564
|
+
* @param symbolName - The name of the symbol.
|
|
1565
|
+
* @param lexicalScopeCapture - A set of lexically scoped variables to capture.
|
|
1566
|
+
* @public
|
|
1567
|
+
*/
|
|
1568
|
+
export declare const inlinedQrl: <T>(symbol: T | null, symbolName: string, lexicalScopeCapture?: Readonly<unknown[]>) => QRL<T>;
|
|
1350
1569
|
|
|
1351
1570
|
/** @internal */
|
|
1352
|
-
export declare const inlinedQrlDEV: <T = any>(symbol: T, symbolName: string, opts: QRLDev, lexicalScopeCapture?:
|
|
1353
|
-
|
|
1354
|
-
/** @public */
|
|
1355
|
-
declare interface InlineEntryStrategy {
|
|
1356
|
-
type: 'inline';
|
|
1357
|
-
}
|
|
1571
|
+
export declare const inlinedQrlDEV: <T = any>(symbol: T, symbolName: string, opts: QRLDev, lexicalScopeCapture?: Readonly<unknown[]>) => QRL<T>;
|
|
1358
1572
|
|
|
1359
1573
|
/**
|
|
1360
1574
|
* These are the HTML tags with handlers allowing plain callbacks, to be used for the JSX interface
|
|
@@ -1381,24 +1595,15 @@ declare type IntrinsicSVGElements = {
|
|
|
1381
1595
|
|
|
1382
1596
|
/** The shared state during an invoke() call */
|
|
1383
1597
|
declare interface InvokeContext {
|
|
1384
|
-
$url$: URL | undefined;
|
|
1385
|
-
/** The next available index for the sequentialScope array */
|
|
1386
|
-
$i$: number;
|
|
1387
1598
|
/** The Virtual parent component for the current component code */
|
|
1388
1599
|
$hostElement$: HostElement | undefined;
|
|
1389
|
-
/** The current DOM element */
|
|
1390
|
-
$element$: Element | undefined;
|
|
1391
1600
|
/** The event we're currently handling */
|
|
1392
1601
|
$event$: PossibleEvents | undefined;
|
|
1393
|
-
/** The QRL function we're currently executing */
|
|
1394
|
-
$qrl$: QRL | undefined;
|
|
1395
1602
|
$effectSubscriber$: EffectSubscription | undefined;
|
|
1396
1603
|
$locale$: string | undefined;
|
|
1397
|
-
$container$:
|
|
1604
|
+
$container$: _Container | undefined;
|
|
1398
1605
|
}
|
|
1399
1606
|
|
|
1400
|
-
declare type InvokeTuple = [Element, Event, URL?];
|
|
1401
|
-
|
|
1402
1607
|
declare type IsAcceptableDOMValue<T> = T extends boolean | number | string | null | undefined ? ((...args: any[]) => any) extends T ? false : true : false;
|
|
1403
1608
|
|
|
1404
1609
|
declare type IsAny<T> = 0 extends T & 1 ? true : false;
|
|
@@ -1424,11 +1629,11 @@ export declare const isSignal: (value: any) => value is Signal<unknown>;
|
|
|
1424
1629
|
/** @internal */
|
|
1425
1630
|
export declare interface ISsrComponentFrame {
|
|
1426
1631
|
componentNode: ISsrNode;
|
|
1632
|
+
slots: (string | JSXChildren)[];
|
|
1427
1633
|
scopedStyleIds: Set<string>;
|
|
1428
1634
|
projectionScopedStyle: string | null;
|
|
1429
1635
|
projectionComponentFrame: ISsrComponentFrame | null;
|
|
1430
1636
|
projectionDepth: number;
|
|
1431
|
-
releaseUnclaimedProjections(unclaimedProjections: (ISsrComponentFrame | JSXChildren | string)[]): void;
|
|
1432
1637
|
consumeChildrenForSlot(projectionNode: ISsrNode, slotName: string): JSXChildren | null;
|
|
1433
1638
|
distributeChildrenIntoSlots(children: JSXChildren, parentScopedStyle: string | null, parentComponentFrame: ISsrComponentFrame | null): void;
|
|
1434
1639
|
hasSlot(slotName: string): boolean;
|
|
@@ -1436,27 +1641,52 @@ export declare interface ISsrComponentFrame {
|
|
|
1436
1641
|
|
|
1437
1642
|
declare interface ISsrNode {
|
|
1438
1643
|
id: string;
|
|
1439
|
-
|
|
1440
|
-
|
|
1644
|
+
flags: SsrNodeFlags;
|
|
1645
|
+
dirty: ChoreBits;
|
|
1646
|
+
parentComponent: ISsrNode | null;
|
|
1647
|
+
vnodeData: VNodeData;
|
|
1648
|
+
currentFile: string | null;
|
|
1441
1649
|
setProp(name: string, value: any): void;
|
|
1442
1650
|
getProp(name: string): any;
|
|
1443
1651
|
removeProp(name: string): void;
|
|
1444
1652
|
addChild(child: ISsrNode): void;
|
|
1653
|
+
setTreeNonUpdatable(): void;
|
|
1445
1654
|
}
|
|
1446
1655
|
|
|
1656
|
+
/** @internal */
|
|
1657
|
+
export declare const _isStore: (value: object) => boolean;
|
|
1658
|
+
|
|
1447
1659
|
/** @internal */
|
|
1448
1660
|
export declare function _isStringifiable(value: unknown): value is _Stringifiable;
|
|
1449
1661
|
|
|
1662
|
+
/** @internal */
|
|
1663
|
+
export declare const _isTask: (value: any) => value is Task;
|
|
1664
|
+
|
|
1665
|
+
/** @internal */
|
|
1666
|
+
declare interface IStreamHandler {
|
|
1667
|
+
flush(): void;
|
|
1668
|
+
streamBlockStart(): void;
|
|
1669
|
+
streamBlockEnd(): void;
|
|
1670
|
+
}
|
|
1671
|
+
|
|
1450
1672
|
/**
|
|
1673
|
+
* Used by the JSX transpilers to create a JSXNode. Note that the optimizer will normally not use
|
|
1674
|
+
* this, instead using _jsxSplit and _jsxSorted directly.
|
|
1675
|
+
*
|
|
1676
|
+
* The optimizer will also replace all `jsx()` calls with the more optimized versions.
|
|
1677
|
+
*
|
|
1678
|
+
* The exception is when the props are not a literal object, which can only happen when the `jsx`
|
|
1679
|
+
* call is written directly.
|
|
1680
|
+
*
|
|
1451
1681
|
* @public
|
|
1452
|
-
* Used by the JSX transpilers to create a JSXNode.
|
|
1453
|
-
* Note that the optimizer will not use this, instead using _jsxSplit and _jsxSorted directly.
|
|
1454
1682
|
*/
|
|
1455
|
-
declare const jsx: <T extends string | FunctionComponent<any>>(type: T, props: T extends FunctionComponent<infer PROPS> ? PROPS : Props, key?: string | number | null) => JSXNode<T>;
|
|
1456
|
-
export { jsx }
|
|
1457
|
-
export { jsx as jsxs }
|
|
1683
|
+
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>;
|
|
1458
1684
|
|
|
1459
|
-
/**
|
|
1685
|
+
/**
|
|
1686
|
+
* @deprecated
|
|
1687
|
+
* @internal
|
|
1688
|
+
* No longer used since v2
|
|
1689
|
+
*/
|
|
1460
1690
|
export declare const _jsxBranch: <T>(input?: T) => T | undefined;
|
|
1461
1691
|
|
|
1462
1692
|
/** @internal @deprecated v1 compat */
|
|
@@ -1465,8 +1695,12 @@ export declare const _jsxC: (type: any, mutable: any, _flags: any, key: any) =>
|
|
|
1465
1695
|
/** @public */
|
|
1466
1696
|
export declare type JSXChildren = string | number | boolean | null | undefined | Function | RegExp | JSXChildren[] | Promise<JSXChildren> | Signal<JSXChildren> | JSXNode;
|
|
1467
1697
|
|
|
1468
|
-
/**
|
|
1469
|
-
|
|
1698
|
+
/**
|
|
1699
|
+
* Alias of `jsx` for development purposes.
|
|
1700
|
+
*
|
|
1701
|
+
* @public
|
|
1702
|
+
*/
|
|
1703
|
+
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>;
|
|
1470
1704
|
|
|
1471
1705
|
declare interface JsxDevOpts {
|
|
1472
1706
|
fileName: string;
|
|
@@ -1474,6 +1708,14 @@ declare interface JsxDevOpts {
|
|
|
1474
1708
|
columnNumber: number;
|
|
1475
1709
|
}
|
|
1476
1710
|
|
|
1711
|
+
declare type JSXDocumentEvents = {
|
|
1712
|
+
[K in keyof QwikDocumentEventMap as `document:on${PascalCaseName<K>}$`]: QwikDocumentEventMap[K];
|
|
1713
|
+
};
|
|
1714
|
+
|
|
1715
|
+
declare type JSXElementEvents = {
|
|
1716
|
+
[K in keyof QwikHTMLElementEventMap as `on${PascalCaseName<K>}$`]: QwikHTMLElementEventMap[K];
|
|
1717
|
+
};
|
|
1718
|
+
|
|
1477
1719
|
/**
|
|
1478
1720
|
* A JSX Node, an internal structure. You probably want to use `JSXOutput` instead.
|
|
1479
1721
|
*
|
|
@@ -1487,15 +1729,68 @@ export declare interface JSXNode<T extends string | FunctionComponent | unknown
|
|
|
1487
1729
|
dev?: DevJSX;
|
|
1488
1730
|
}
|
|
1489
1731
|
|
|
1732
|
+
declare const enum JSXNodeFlags {
|
|
1733
|
+
None = 0,
|
|
1734
|
+
StaticSubtree = 2,
|
|
1735
|
+
HasCapturedProps = 4
|
|
1736
|
+
}
|
|
1737
|
+
|
|
1738
|
+
declare class JSXNodeImpl<T = unknown> implements JSXNodeInternal<T> {
|
|
1739
|
+
type: T;
|
|
1740
|
+
children: JSXChildren;
|
|
1741
|
+
flags: JSXNodeFlags;
|
|
1742
|
+
toSort: boolean;
|
|
1743
|
+
key: string | null;
|
|
1744
|
+
varProps: Props;
|
|
1745
|
+
constProps: Props | null;
|
|
1746
|
+
dev?: DevJSX & {
|
|
1747
|
+
stack: string | undefined;
|
|
1748
|
+
};
|
|
1749
|
+
_proxy: Props | null;
|
|
1750
|
+
constructor(type: T, varProps: Props | null, constProps: Props | null, children: JSXChildren, flags: JSXNodeFlags, key: string | number | null | undefined, toSort?: boolean, dev?: DevJSX);
|
|
1751
|
+
get props(): T extends FunctionComponent<infer PROPS> ? PROPS : Props;
|
|
1752
|
+
}
|
|
1753
|
+
|
|
1490
1754
|
/**
|
|
1491
1755
|
* The internal representation of a JSX Node.
|
|
1492
1756
|
*
|
|
1493
1757
|
* @internal
|
|
1494
1758
|
*/
|
|
1495
1759
|
export declare interface JSXNodeInternal<T extends string | FunctionComponent | unknown = unknown> extends JSXNode<T> {
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1760
|
+
/** The type of node */
|
|
1761
|
+
type: T;
|
|
1762
|
+
/** Do the varProps need sorting */
|
|
1763
|
+
toSort: boolean;
|
|
1764
|
+
/** The key property */
|
|
1765
|
+
key: string | null;
|
|
1766
|
+
/** Flags */
|
|
1767
|
+
flags: JSXNodeFlags;
|
|
1768
|
+
/**
|
|
1769
|
+
* Props that are not guaranteed shallow equal across runs.
|
|
1770
|
+
*
|
|
1771
|
+
* Any prop that is in `constProps` takes precedence over `varProps`.
|
|
1772
|
+
*
|
|
1773
|
+
* Does not contain `children` or `key`.
|
|
1774
|
+
*
|
|
1775
|
+
* `onEvent$` props are normalized to the html `q-x:event` version
|
|
1776
|
+
*/
|
|
1777
|
+
varProps: Props;
|
|
1778
|
+
/**
|
|
1779
|
+
* Props that will be shallow equal across runs. Does not contain any props that are in varProps.
|
|
1780
|
+
*
|
|
1781
|
+
* Any prop that is in `constProps` takes precedence over `varProps`.
|
|
1782
|
+
*
|
|
1783
|
+
* Does not contain `children` or `key`.
|
|
1784
|
+
*
|
|
1785
|
+
* `onEvent$` props are normalized to the html `q-x:event` version
|
|
1786
|
+
*/
|
|
1787
|
+
constProps: Props | null;
|
|
1788
|
+
/** The children of the node */
|
|
1789
|
+
children: JSXChildren;
|
|
1790
|
+
/** Filename etc for debugging */
|
|
1791
|
+
dev?: DevJSX & {
|
|
1792
|
+
stack: string | undefined;
|
|
1793
|
+
};
|
|
1499
1794
|
}
|
|
1500
1795
|
|
|
1501
1796
|
/**
|
|
@@ -1511,6 +1806,13 @@ export declare const _jsxQ: (type: any, mutable: any, immutable: any, children:
|
|
|
1511
1806
|
/** @internal @deprecated v1 compat */
|
|
1512
1807
|
export declare const _jsxS: (type: any, mutable: any, immutable: any, _flags: any, key: any) => JSXNode<any>;
|
|
1513
1808
|
|
|
1809
|
+
/**
|
|
1810
|
+
* Alias of `jsx` to support JSX syntax.
|
|
1811
|
+
*
|
|
1812
|
+
* @public
|
|
1813
|
+
*/
|
|
1814
|
+
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>;
|
|
1815
|
+
|
|
1514
1816
|
/**
|
|
1515
1817
|
* Create a JSXNode with the properties fully split into variable and constant parts, and children
|
|
1516
1818
|
* separated out. Furthermore, the varProps must be a sorted object, that is, the keys must be
|
|
@@ -1521,7 +1823,7 @@ export declare const _jsxS: (type: any, mutable: any, immutable: any, _flags: an
|
|
|
1521
1823
|
* still update the attribute on the vnode.
|
|
1522
1824
|
*
|
|
1523
1825
|
* @param type - The JSX type
|
|
1524
|
-
* @param varProps - The properties of the tag, sorted, excluding children,
|
|
1826
|
+
* @param varProps - The properties of the tag, sorted, excluding children, key and any constProps
|
|
1525
1827
|
* @param constProps - The properties of the tag that are known to be constant references and don't
|
|
1526
1828
|
* need checking for changes on re-render
|
|
1527
1829
|
* @param children - JSX children. Any `children` in the props objects are ignored.
|
|
@@ -1531,13 +1833,13 @@ export declare const _jsxSorted: <T>(type: T, varProps: Props | null, constProps
|
|
|
1531
1833
|
|
|
1532
1834
|
/**
|
|
1533
1835
|
* Create a JSXNode, with the properties split into variable and constant parts, but the variable
|
|
1534
|
-
* parts could include keys from constProps
|
|
1836
|
+
* parts could include keys from `constProps`, as well as `key` and `children`.
|
|
1535
1837
|
*
|
|
1536
|
-
* The constant parts are expected to be the same
|
|
1537
|
-
*
|
|
1538
|
-
* still update the attribute on the vnode.
|
|
1838
|
+
* `constProps` cannot include `key` or `children`. The constant parts are expected to be the same
|
|
1839
|
+
* on every render, and are not checked for changes. This means that they are constant scalars or
|
|
1840
|
+
* refs. When the ref is a signal or a store, it can still update the attribute on the vnode.
|
|
1539
1841
|
*
|
|
1540
|
-
* If `children`
|
|
1842
|
+
* If `children` or `key` are defined, any `children`/`key` in the props will be ignored.
|
|
1541
1843
|
*
|
|
1542
1844
|
* @param type - The tag type
|
|
1543
1845
|
* @param varProps - The properties of the tag that could change, including children
|
|
@@ -1545,11 +1847,15 @@ export declare const _jsxSorted: <T>(type: T, varProps: Props | null, constProps
|
|
|
1545
1847
|
* for changes on re-render
|
|
1546
1848
|
* @internal
|
|
1547
1849
|
*/
|
|
1548
|
-
export declare const _jsxSplit: <T extends string | FunctionComponent<any>>(type: T, varProps: Props | null, constProps: Props | null, children: JSXChildren | null | undefined, flags: number, key
|
|
1850
|
+
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>;
|
|
1549
1851
|
|
|
1550
1852
|
/** @public */
|
|
1551
1853
|
export declare type JSXTagName = keyof HTMLElementTagNameMap | Omit<string, keyof HTMLElementTagNameMap>;
|
|
1552
1854
|
|
|
1855
|
+
declare type JSXWindowEvents = {
|
|
1856
|
+
[K in keyof QwikWindowEventMap as `window:on${PascalCaseName<K>}$`]: QwikWindowEventMap[K];
|
|
1857
|
+
};
|
|
1858
|
+
|
|
1553
1859
|
/**
|
|
1554
1860
|
* The names of events that Qwik knows about. They are all lowercase, but on the JSX side, they are
|
|
1555
1861
|
* PascalCase for nicer DX. (`onAuxClick$` vs `onauxclick$`)
|
|
@@ -1558,6 +1864,25 @@ export declare type JSXTagName = keyof HTMLElementTagNameMap | Omit<string, keyo
|
|
|
1558
1864
|
*/
|
|
1559
1865
|
export declare type KnownEventNames = LiteralUnion<AllEventKeys, string>;
|
|
1560
1866
|
|
|
1867
|
+
/**
|
|
1868
|
+
* Shared lazy-loading reference that holds module loading metadata. Multiple QRLs pointing to the
|
|
1869
|
+
* same chunk+symbol can share a single LazyRef, differing only in their captured scope.
|
|
1870
|
+
*/
|
|
1871
|
+
declare class LazyRef<TYPE = unknown> {
|
|
1872
|
+
readonly $chunk$: string | null;
|
|
1873
|
+
readonly $symbol$: string;
|
|
1874
|
+
readonly $symbolFn$: undefined | null | (() => Promise<Record<string, TYPE>>);
|
|
1875
|
+
$ref$?: (null | ValueOrPromise<TYPE>) | undefined;
|
|
1876
|
+
$container$: _Container | undefined;
|
|
1877
|
+
dev?: QRLDev | null | undefined;
|
|
1878
|
+
constructor($chunk$: string | null, $symbol$: string, $symbolFn$: undefined | null | (() => Promise<Record<string, TYPE>>), $ref$?: (null | ValueOrPromise<TYPE>) | undefined, container?: _Container | null);
|
|
1879
|
+
/** We don't read hash very often so let's not allocate a string for every QRL */
|
|
1880
|
+
get $hash$(): string;
|
|
1881
|
+
$setRef$(ref: ValueOrPromise<TYPE>): void;
|
|
1882
|
+
/** Load the raw module export without capture binding. */
|
|
1883
|
+
$load$(): ValueOrPromise<TYPE>;
|
|
1884
|
+
}
|
|
1885
|
+
|
|
1561
1886
|
declare type LcEvent<T extends string, C extends string = Lowercase<T>> = C extends keyof AllEventsMap ? AllEventsMap[C] : Event;
|
|
1562
1887
|
|
|
1563
1888
|
declare type LcEventNameMap = {
|
|
@@ -1601,6 +1926,15 @@ declare interface LenientSVGProps<T extends Element> extends SVGAttributes, DOMA
|
|
|
1601
1926
|
*/
|
|
1602
1927
|
declare type LiteralUnion<LiteralType, BaseType extends Primitive> = LiteralType | (BaseType & Record<never, never>);
|
|
1603
1928
|
|
|
1929
|
+
/** @internal */
|
|
1930
|
+
export declare const _mapApp_findIndx: <T>(array: (T | null)[], key: string, start: number) => number;
|
|
1931
|
+
|
|
1932
|
+
/** @internal */
|
|
1933
|
+
export declare const _mapArray_get: <T>(array: (T | null)[], key: string, start: number) => T | null;
|
|
1934
|
+
|
|
1935
|
+
/** @internal */
|
|
1936
|
+
export declare const _mapArray_set: <T>(array: (T | null)[], key: string, value: T | null, start: number, allowNullValue?: boolean) => void;
|
|
1937
|
+
|
|
1604
1938
|
declare type MediaSpecialAttrs = {
|
|
1605
1939
|
crossOrigin?: HTMLCrossOriginAttribute;
|
|
1606
1940
|
};
|
|
@@ -1647,10 +1981,10 @@ declare interface NodePropData {
|
|
|
1647
1981
|
}
|
|
1648
1982
|
|
|
1649
1983
|
/** @internal */
|
|
1650
|
-
export declare const _noopQrl: <T>(symbolName: string, lexicalScopeCapture?:
|
|
1984
|
+
export declare const _noopQrl: <T>(symbolName: string, lexicalScopeCapture?: Readonly<unknown[]>) => QRL<T>;
|
|
1651
1985
|
|
|
1652
1986
|
/** @internal */
|
|
1653
|
-
export declare const _noopQrlDEV: <T>(symbolName: string, opts: QRLDev, lexicalScopeCapture?:
|
|
1987
|
+
export declare const _noopQrlDEV: <T>(symbolName: string, opts: QRLDev, lexicalScopeCapture?: Readonly<unknown[]>) => QRL<T>;
|
|
1654
1988
|
|
|
1655
1989
|
/**
|
|
1656
1990
|
* Returned type of the `noSerialize()` function. It will be TYPE or undefined.
|
|
@@ -1659,7 +1993,7 @@ export declare const _noopQrlDEV: <T>(symbolName: string, opts: QRLDev, lexicalS
|
|
|
1659
1993
|
* @see noSerialize
|
|
1660
1994
|
*/
|
|
1661
1995
|
export declare type NoSerialize<T> = (T & {
|
|
1662
|
-
__no_serialize__
|
|
1996
|
+
__no_serialize__?: true;
|
|
1663
1997
|
}) | undefined;
|
|
1664
1998
|
|
|
1665
1999
|
/**
|
|
@@ -1717,6 +2051,11 @@ export declare interface OnVisibleTaskOptions {
|
|
|
1717
2051
|
strategy?: VisibleTaskStrategy;
|
|
1718
2052
|
}
|
|
1719
2053
|
|
|
2054
|
+
/** @internal */
|
|
2055
|
+
declare const _OWNER: unique symbol;
|
|
2056
|
+
|
|
2057
|
+
declare type PascalCaseName<T extends string> = T extends keyof LcEventNameMap ? LcEventNameMap[T] : Capitalize<T>;
|
|
2058
|
+
|
|
1720
2059
|
/**
|
|
1721
2060
|
* Capitalized multi-word names of some known events so we have nicer qwik attributes. For example,
|
|
1722
2061
|
* instead of `oncompositionEnd$` we can use `onCompositionEnd$`. Note that any capitalization
|
|
@@ -1724,19 +2063,11 @@ export declare interface OnVisibleTaskOptions {
|
|
|
1724
2063
|
*
|
|
1725
2064
|
* Add any multi-word event names to this list. Single word events are automatically converted.
|
|
1726
2065
|
*/
|
|
1727
|
-
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';
|
|
1728
|
-
|
|
1729
|
-
/**
|
|
1730
|
-
* Convert an event map to PascalCase. For example, `HTMLElementEventMap` contains lowercase keys,
|
|
1731
|
-
* so this will capitalize them, and use the `LcEventNameMap` for multi-word events names.
|
|
1732
|
-
*/
|
|
1733
|
-
declare type PascalMap<M> = {
|
|
1734
|
-
[K in Extract<keyof M, string> as K extends keyof LcEventNameMap ? LcEventNameMap[K] : Capitalize<K>]: M[K];
|
|
1735
|
-
};
|
|
2066
|
+
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';
|
|
1736
2067
|
|
|
1737
2068
|
declare type PopoverTargetAction = 'hide' | 'show' | 'toggle';
|
|
1738
2069
|
|
|
1739
|
-
declare type PossibleEvents = Event | SimplifiedServerRequestEvent | typeof TaskEvent | typeof RenderEvent
|
|
2070
|
+
declare type PossibleEvents = Event | SimplifiedServerRequestEvent | typeof TaskEvent | typeof RenderEvent;
|
|
1740
2071
|
|
|
1741
2072
|
/**
|
|
1742
2073
|
* @deprecated This is no longer needed as the preloading happens automatically in qrl-class. You
|
|
@@ -1834,6 +2165,9 @@ export declare type PropFunction<T> = QRL<T>;
|
|
|
1834
2165
|
|
|
1835
2166
|
declare type Props = Record<string, unknown>;
|
|
1836
2167
|
|
|
2168
|
+
/** @internal */
|
|
2169
|
+
declare const _PROPS_HANDLER: unique symbol;
|
|
2170
|
+
|
|
1837
2171
|
/**
|
|
1838
2172
|
* Infers `Props` from the component or tag.
|
|
1839
2173
|
*
|
|
@@ -1856,7 +2190,24 @@ export declare type PropsOf<COMP> = COMP extends string ? COMP extends keyof Qwi
|
|
|
1856
2190
|
declare type PropsProxy = {
|
|
1857
2191
|
[_VAR_PROPS]: Props;
|
|
1858
2192
|
[_CONST_PROPS]: Props | null;
|
|
1859
|
-
|
|
2193
|
+
[_OWNER]: JSXNodeInternal;
|
|
2194
|
+
[_PROPS_HANDLER]: PropsProxyHandler;
|
|
2195
|
+
} & Record<string | symbol, unknown>;
|
|
2196
|
+
|
|
2197
|
+
declare class PropsProxyHandler implements ProxyHandler<any> {
|
|
2198
|
+
owner: JSXNodeImpl;
|
|
2199
|
+
$effects$: undefined | Map<string | symbol, Set<EffectSubscription>>;
|
|
2200
|
+
$container$: _Container | null;
|
|
2201
|
+
constructor(owner: JSXNodeImpl);
|
|
2202
|
+
get(_: any, prop: string | symbol): any;
|
|
2203
|
+
set(_: any, prop: string | symbol, value: any): boolean;
|
|
2204
|
+
deleteProperty(_: any, prop: string | symbol): boolean;
|
|
2205
|
+
has(_: any, prop: string | symbol): boolean;
|
|
2206
|
+
getOwnPropertyDescriptor(_: any, p: string | symbol): PropertyDescriptor | undefined;
|
|
2207
|
+
ownKeys(): string[];
|
|
2208
|
+
}
|
|
2209
|
+
|
|
2210
|
+
declare type PropType<T extends object, P extends keyof T> = P extends keyof T ? T[P] : 'value' extends keyof T ? T['value'] : never;
|
|
1860
2211
|
|
|
1861
2212
|
/**
|
|
1862
2213
|
* Extends the defined component PROPS, adding the default ones (children and q:slot) and allowing
|
|
@@ -1972,7 +2323,7 @@ export declare interface _QDocument extends Document {
|
|
|
1972
2323
|
*
|
|
1973
2324
|
* ```
|
|
1974
2325
|
* <div q:base="/build/">
|
|
1975
|
-
* <button
|
|
2326
|
+
* <button q-e:click="./chunk-abc.js#onClick">...</button>
|
|
1976
2327
|
* </div>
|
|
1977
2328
|
* ```
|
|
1978
2329
|
*
|
|
@@ -1995,7 +2346,7 @@ export declare interface _QDocument extends Document {
|
|
|
1995
2346
|
*/
|
|
1996
2347
|
export declare type QRL<TYPE = unknown> = {
|
|
1997
2348
|
__qwik_serializable__?: any;
|
|
1998
|
-
__brand__QRL__
|
|
2349
|
+
__brand__QRL__?: TYPE;
|
|
1999
2350
|
/** Resolve the QRL and return the actual value. */
|
|
2000
2351
|
resolve(): Promise<TYPE>;
|
|
2001
2352
|
/** The resolved value, once `resolve()` returns. */
|
|
@@ -2003,7 +2354,7 @@ export declare type QRL<TYPE = unknown> = {
|
|
|
2003
2354
|
getCaptured(): unknown[] | null;
|
|
2004
2355
|
getSymbol(): string;
|
|
2005
2356
|
getHash(): string;
|
|
2006
|
-
dev
|
|
2357
|
+
dev?: QRLDev | null;
|
|
2007
2358
|
} & BivariantQrlFn<QrlArgs<TYPE>, QrlReturn<TYPE>>;
|
|
2008
2359
|
|
|
2009
2360
|
/**
|
|
@@ -2018,7 +2369,7 @@ export declare type QRL<TYPE = unknown> = {
|
|
|
2018
2369
|
* @public
|
|
2019
2370
|
* @see `QRL`, `$(...)`
|
|
2020
2371
|
*/
|
|
2021
|
-
export declare const qrl: <T = any>(chunkOrFn: string | (() => Promise<any>), symbol: string, lexicalScopeCapture?:
|
|
2372
|
+
export declare const qrl: <T = any>(chunkOrFn: string | (() => Promise<any>), symbol: string, lexicalScopeCapture?: Readonly<unknown[]> | null, stackOffset?: number) => QRL<T>;
|
|
2022
2373
|
|
|
2023
2374
|
declare type QrlArgs<T> = T extends (...args: infer ARGS) => any ? ARGS : unknown[];
|
|
2024
2375
|
|
|
@@ -2030,31 +2381,52 @@ declare interface QRLDev {
|
|
|
2030
2381
|
}
|
|
2031
2382
|
|
|
2032
2383
|
/** @internal */
|
|
2033
|
-
export declare const qrlDEV: <T = any>(chunkOrFn: string | (() => Promise<any>), symbol: string, opts: QRLDev, lexicalScopeCapture?:
|
|
2384
|
+
export declare const qrlDEV: <T = any>(chunkOrFn: string | (() => Promise<any>), symbol: string, opts: QRLDev, lexicalScopeCapture?: Readonly<unknown[]>) => QRL<T>;
|
|
2034
2385
|
|
|
2035
2386
|
/**
|
|
2036
2387
|
* An event handler for Qwik events, can be a handler QRL or an array of handler QRLs.
|
|
2037
2388
|
*
|
|
2038
2389
|
* @public
|
|
2039
2390
|
*/
|
|
2040
|
-
export declare type QRLEventHandlerMulti<EV extends Event, EL> = QRL<EventHandler<EV, EL>> | undefined | null | QRLEventHandlerMulti<EV, EL>[]
|
|
2391
|
+
export declare type QRLEventHandlerMulti<EV extends Event, EL> = QRL<EventHandler<EV, EL>> | undefined | null | QRLEventHandlerMulti<EV, EL>[];
|
|
2041
2392
|
|
|
2042
|
-
|
|
2393
|
+
/** @internal */
|
|
2394
|
+
export declare type _QRLInternal<TYPE = unknown> = QRL<TYPE> & QRLInternalMethods<TYPE>;
|
|
2043
2395
|
|
|
2044
2396
|
declare type QRLInternalMethods<TYPE> = {
|
|
2045
2397
|
readonly $chunk$: string | null;
|
|
2046
2398
|
readonly $symbol$: string;
|
|
2047
2399
|
readonly $hash$: string;
|
|
2048
|
-
|
|
2049
|
-
$
|
|
2050
|
-
dev
|
|
2400
|
+
/** If it's a string it's serialized */
|
|
2401
|
+
readonly $captures$?: Readonly<unknown[]> | string | null;
|
|
2402
|
+
dev?: QRLDev | null;
|
|
2403
|
+
resolve(container?: _Container): Promise<TYPE>;
|
|
2051
2404
|
resolved: undefined | TYPE;
|
|
2052
|
-
resolve(containerEl?: Element): Promise<TYPE>;
|
|
2053
2405
|
getSymbol(): string;
|
|
2054
2406
|
getHash(): string;
|
|
2055
2407
|
getCaptured(): unknown[] | null;
|
|
2056
|
-
getFn(currentCtx?: InvokeContext
|
|
2057
|
-
|
|
2408
|
+
getFn(currentCtx?: InvokeContext,
|
|
2409
|
+
/** If this returns false, the function execution will be skipped */
|
|
2410
|
+
beforeFn?: () => void | false): TYPE extends (...args: any) => any ? (...args: Parameters<TYPE>) => ValueOrPromise<ReturnType<TYPE> | undefined> : unknown;
|
|
2411
|
+
$callFn$(withThis: unknown, ...args: QrlArgs<TYPE>): ValueOrPromise<QrlReturn<TYPE>>;
|
|
2412
|
+
/**
|
|
2413
|
+
* "with captures" - Get a new QRL for these captures, reusing the lazy ref. It's an internal
|
|
2414
|
+
* method but we need to have a stable name because it gets called in user code by the optimizer,
|
|
2415
|
+
* after the $name$ props are mangled
|
|
2416
|
+
*/
|
|
2417
|
+
w(captures: Readonly<unknown[]> | string | null): _QRLInternal<TYPE>;
|
|
2418
|
+
/**
|
|
2419
|
+
* "set ref" - Set the ref of the QRL. It's an internal method but we need to have a stable name
|
|
2420
|
+
* because it gets called in user code by the optimizer, after the $name$ props are mangled
|
|
2421
|
+
*/
|
|
2422
|
+
s(ref: ValueOrPromise<TYPE>): void;
|
|
2423
|
+
/**
|
|
2424
|
+
* Needed for deserialization and importing. We don't always have the container while creating
|
|
2425
|
+
* qrls in async sections of code
|
|
2426
|
+
*/
|
|
2427
|
+
readonly $container$?: _Container | null;
|
|
2428
|
+
/** The shared lazy-loading reference */
|
|
2429
|
+
readonly $lazy$: LazyRef<TYPE>;
|
|
2058
2430
|
};
|
|
2059
2431
|
|
|
2060
2432
|
declare type QrlReturn<T> = T extends (...args: any) => infer R ? Awaited<R> : unknown;
|
|
@@ -2071,50 +2443,20 @@ declare type QrlReturn<T> = T extends (...args: any) => infer R ? Awaited<R> : u
|
|
|
2071
2443
|
*/
|
|
2072
2444
|
export declare const _qrlSync: <TYPE extends Function>(fn: TYPE, serializedFn?: string) => SyncQRL<TYPE>;
|
|
2073
2445
|
|
|
2446
|
+
/** @internal */
|
|
2447
|
+
export declare function _qrlToString(serializationContext: SerializationContext, qrl: _QRLInternal | SyncQRLInternal): string;
|
|
2448
|
+
|
|
2449
|
+
/** @internal */
|
|
2450
|
+
export declare function _qrlToString(serializationContext: SerializationContext, qrl: _QRLInternal | SyncQRLInternal, raw: true): [string, string, string | null];
|
|
2451
|
+
|
|
2074
2452
|
/** @public @deprecated Use `AnimationEvent` and use the second argument to the handler function for the current event target */
|
|
2075
2453
|
export declare type QwikAnimationEvent<T = Element> = NativeAnimationEvent;
|
|
2076
2454
|
|
|
2077
|
-
/** @public */
|
|
2078
|
-
declare interface QwikAsset {
|
|
2079
|
-
/** Name of the asset */
|
|
2080
|
-
name: string | undefined;
|
|
2081
|
-
/** Size of the asset */
|
|
2082
|
-
size: number;
|
|
2083
|
-
}
|
|
2084
|
-
|
|
2085
2455
|
/** The Qwik DOM attributes without plain handlers, for use as function parameters @public */
|
|
2086
2456
|
export declare interface QwikAttributes<EL extends Element> extends DOMAttributesBase<EL>, QwikEvents<EL, false> {
|
|
2087
2457
|
class?: ClassList | undefined;
|
|
2088
2458
|
}
|
|
2089
2459
|
|
|
2090
|
-
/** @public */
|
|
2091
|
-
declare interface QwikBundle {
|
|
2092
|
-
/** Size of the bundle */
|
|
2093
|
-
size: number;
|
|
2094
|
-
/** Total size of this bundle's static import graph */
|
|
2095
|
-
total: number;
|
|
2096
|
-
/** Interactivity score of the bundle */
|
|
2097
|
-
interactivity?: number;
|
|
2098
|
-
/** Symbols in the bundle */
|
|
2099
|
-
symbols?: string[];
|
|
2100
|
-
/** Direct imports */
|
|
2101
|
-
imports?: string[];
|
|
2102
|
-
/** Dynamic imports */
|
|
2103
|
-
dynamicImports?: string[];
|
|
2104
|
-
/** Source files of the bundle */
|
|
2105
|
-
origins?: string[];
|
|
2106
|
-
}
|
|
2107
|
-
|
|
2108
|
-
/**
|
|
2109
|
-
* Bundle graph.
|
|
2110
|
-
*
|
|
2111
|
-
* Format: [ 'bundle-a.js', 3, 5 // Depends on 'bundle-b.js' and 'bundle-c.js' 'bundle-b.js', 5, //
|
|
2112
|
-
* Depends on 'bundle-c.js' 'bundle-c.js', ]
|
|
2113
|
-
*
|
|
2114
|
-
* @public
|
|
2115
|
-
*/
|
|
2116
|
-
declare type QwikBundleGraph = Array<string | number>;
|
|
2117
|
-
|
|
2118
2460
|
/** @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. */
|
|
2119
2461
|
export declare type QwikChangeEvent<T = Element> = Event;
|
|
2120
2462
|
|
|
@@ -2124,13 +2466,19 @@ export declare type QwikClipboardEvent<T = Element> = NativeClipboardEvent;
|
|
|
2124
2466
|
/** @public @deprecated Use `CompositionEvent` and use the second argument to the handler function for the current event target */
|
|
2125
2467
|
export declare type QwikCompositionEvent<T = Element> = NativeCompositionEvent;
|
|
2126
2468
|
|
|
2127
|
-
declare type QwikCustomEvents<EL> = {};
|
|
2128
|
-
|
|
2129
2469
|
declare type QwikCustomEventsPlain<EL> = {
|
|
2130
2470
|
/** The handler */
|
|
2131
2471
|
[key: `${'document:' | 'window:' | ''}on${string}$`]: QRLEventHandlerMulti<Event, EL> | EventHandler<Event, EL>;
|
|
2132
2472
|
};
|
|
2133
2473
|
|
|
2474
|
+
declare type QwikDocumentEventMap = Omit<DocumentEventMap, keyof QwikHTMLElementEventMap> & Omit<QwikHTMLElementEventMap, 'qvisible' | 'focus' | 'blur'> & {
|
|
2475
|
+
qidle: QwikIdleEvent;
|
|
2476
|
+
qinit: QwikInitEvent;
|
|
2477
|
+
qsymbol: QwikSymbolEvent;
|
|
2478
|
+
qresume: QwikResumeEvent;
|
|
2479
|
+
qviewtransition: QwikViewTransitionEvent;
|
|
2480
|
+
};
|
|
2481
|
+
|
|
2134
2482
|
/** @public */
|
|
2135
2483
|
export declare interface QwikDOMAttributes extends DOMAttributes<Element> {
|
|
2136
2484
|
}
|
|
@@ -2139,11 +2487,13 @@ export declare interface QwikDOMAttributes extends DOMAttributes<Element> {
|
|
|
2139
2487
|
export declare type QwikDragEvent<T = Element> = NativeDragEvent;
|
|
2140
2488
|
|
|
2141
2489
|
/** @public */
|
|
2142
|
-
declare type QwikEvents<EL, Plain extends boolean = true> = Plain extends true ? QwikKnownEventsPlain<EL> & QwikCustomEventsPlain<EL> : QwikKnownEvents<EL
|
|
2490
|
+
declare type QwikEvents<EL, Plain extends boolean = true> = Plain extends true ? QwikKnownEventsPlain<EL> & QwikCustomEventsPlain<EL> : QwikKnownEvents<EL>;
|
|
2143
2491
|
|
|
2144
2492
|
/** @public @deprecated Use `FocusEvent` and use the second argument to the handler function for the current event target */
|
|
2145
2493
|
export declare type QwikFocusEvent<T = Element> = NativeFocusEvent;
|
|
2146
2494
|
|
|
2495
|
+
declare type QwikHTMLElementEventMap = Omit<HTMLElementEventMap, keyof EventCorrectionMap> & EventCorrectionMap;
|
|
2496
|
+
|
|
2147
2497
|
/**
|
|
2148
2498
|
* The DOM props without plain handlers, for use inside functions
|
|
2149
2499
|
*
|
|
@@ -2214,71 +2564,18 @@ declare namespace QwikJSX {
|
|
|
2214
2564
|
export { QwikJSX as JSX }
|
|
2215
2565
|
export { QwikJSX }
|
|
2216
2566
|
|
|
2567
|
+
declare type QwikJSXEvents = JSXElementEvents & JSXDocumentEvents & JSXWindowEvents;
|
|
2568
|
+
|
|
2217
2569
|
/** @public @deprecated Use `KeyboardEvent` and use the second argument to the handler function for the current event target */
|
|
2218
2570
|
export declare type QwikKeyboardEvent<T = Element> = NativeKeyboardEvent;
|
|
2219
2571
|
|
|
2220
2572
|
declare type QwikKnownEvents<EL> = {
|
|
2221
|
-
[K in keyof
|
|
2573
|
+
[K in keyof QwikJSXEvents]?: QRLEventHandlerMulti<QwikJSXEvents[K], EL>;
|
|
2222
2574
|
};
|
|
2223
2575
|
|
|
2224
2576
|
declare type QwikKnownEventsPlain<EL> = {
|
|
2225
|
-
[K in keyof
|
|
2226
|
-
};
|
|
2227
|
-
|
|
2228
|
-
/**
|
|
2229
|
-
* The metadata of the build. One of its uses is storing where QRL symbols are located.
|
|
2230
|
-
*
|
|
2231
|
-
* @public
|
|
2232
|
-
*/
|
|
2233
|
-
declare interface QwikManifest {
|
|
2234
|
-
/** Content hash of the manifest, if this changes, the code changed */
|
|
2235
|
-
manifestHash: string;
|
|
2236
|
-
/** QRL symbols */
|
|
2237
|
-
symbols: {
|
|
2238
|
-
[symbolName: string]: QwikSymbol;
|
|
2239
|
-
};
|
|
2240
|
-
/** Where QRLs are located. The key is the symbol name, the value is the bundle fileName */
|
|
2241
|
-
mapping: {
|
|
2242
|
-
[symbolName: string]: string;
|
|
2243
|
-
};
|
|
2244
|
-
/**
|
|
2245
|
-
* All code bundles, used to know the import graph. The key is the bundle fileName relative to
|
|
2246
|
-
* "build/"
|
|
2247
|
-
*/
|
|
2248
|
-
bundles: {
|
|
2249
|
-
[fileName: string]: QwikBundle;
|
|
2250
|
-
};
|
|
2251
|
-
/** All assets. The key is the fileName relative to the rootDir */
|
|
2252
|
-
assets?: {
|
|
2253
|
-
[fileName: string]: QwikAsset;
|
|
2254
|
-
};
|
|
2255
|
-
/** All bundles in a compact graph format with probabilities */
|
|
2256
|
-
bundleGraph?: QwikBundleGraph;
|
|
2257
|
-
/** The bundle graph fileName */
|
|
2258
|
-
bundleGraphAsset?: string;
|
|
2259
|
-
/** The preloader bundle fileName */
|
|
2260
|
-
preloader?: string;
|
|
2261
|
-
/** The Qwik core bundle fileName */
|
|
2262
|
-
core?: string;
|
|
2263
|
-
/** The Qwik loader bundle fileName */
|
|
2264
|
-
qwikLoader?: string;
|
|
2265
|
-
/** CSS etc to inject in the document head */
|
|
2266
|
-
injections?: GlobalInjections[];
|
|
2267
|
-
/** The version of the manifest */
|
|
2268
|
-
version: string;
|
|
2269
|
-
/** The options used to build the manifest */
|
|
2270
|
-
options?: {
|
|
2271
|
-
target?: string;
|
|
2272
|
-
buildMode?: string;
|
|
2273
|
-
entryStrategy?: {
|
|
2274
|
-
type: EntryStrategy['type'];
|
|
2275
|
-
};
|
|
2276
|
-
};
|
|
2277
|
-
/** The platform used to build the manifest */
|
|
2278
|
-
platform?: {
|
|
2279
|
-
[name: string]: string;
|
|
2280
|
-
};
|
|
2281
|
-
}
|
|
2577
|
+
[K in keyof QwikJSXEvents]?: QRLEventHandlerMulti<QwikJSXEvents[K], EL> | EventHandler<QwikJSXEvents[K], EL>;
|
|
2578
|
+
};
|
|
2282
2579
|
|
|
2283
2580
|
/** @public @deprecated Use `MouseEvent` and use the second argument to the handler function for the current event target */
|
|
2284
2581
|
export declare type QwikMouseEvent<T = Element, E = NativeMouseEvent> = E;
|
|
@@ -2286,6 +2583,12 @@ export declare type QwikMouseEvent<T = Element, E = NativeMouseEvent> = E;
|
|
|
2286
2583
|
/** @public @deprecated Use `PointerEvent` and use the second argument to the handler function for the current event target */
|
|
2287
2584
|
export declare type QwikPointerEvent<T = Element> = NativePointerEvent;
|
|
2288
2585
|
|
|
2586
|
+
/**
|
|
2587
|
+
* Emitted by qwik-core on the container element when it resumes from a paused state. You cannot put
|
|
2588
|
+
* a Qwik event handler on the container so you must listen on the document instead. @public
|
|
2589
|
+
*/
|
|
2590
|
+
export declare type QwikResumeEvent = CustomEvent<{}>;
|
|
2591
|
+
|
|
2289
2592
|
/** @public @deprecated Use `SubmitEvent` and use the second argument to the handler function for the current event target */
|
|
2290
2593
|
export declare type QwikSubmitEvent<T = Element> = SubmitEvent;
|
|
2291
2594
|
|
|
@@ -2298,32 +2601,12 @@ export declare type QwikSVGElements = {
|
|
|
2298
2601
|
[K in keyof Omit<SVGElementTagNameMap, keyof HTMLElementTagNameMap>]: SVGProps<SVGElementTagNameMap[K]>;
|
|
2299
2602
|
};
|
|
2300
2603
|
|
|
2301
|
-
/** @public */
|
|
2302
|
-
declare interface QwikSymbol {
|
|
2303
|
-
origin: string;
|
|
2304
|
-
displayName: string;
|
|
2305
|
-
hash: string;
|
|
2306
|
-
canonicalFilename: string;
|
|
2307
|
-
ctxKind: 'function' | 'eventHandler';
|
|
2308
|
-
ctxName: string;
|
|
2309
|
-
/** Whether the symbol captures a variable */
|
|
2310
|
-
captures: boolean;
|
|
2311
|
-
parent: string | null;
|
|
2312
|
-
loc: [number, number];
|
|
2313
|
-
/** The parameter names if it's a function with parameters */
|
|
2314
|
-
paramNames?: string[];
|
|
2315
|
-
/** The transformed names of scoped variables, if any */
|
|
2316
|
-
captureNames?: string[];
|
|
2317
|
-
}
|
|
2318
|
-
|
|
2319
|
-
/** Emitted by qwik-loader when a module was lazily loaded @public */
|
|
2604
|
+
/** Emitted by qwik-loader on document when a module was lazily loaded @public */
|
|
2320
2605
|
export declare type QwikSymbolEvent = CustomEvent<{
|
|
2321
2606
|
symbol: string;
|
|
2322
2607
|
element: Element;
|
|
2323
2608
|
reqTime: number;
|
|
2324
2609
|
qBase?: string;
|
|
2325
|
-
qManifest?: string;
|
|
2326
|
-
qVersion?: string;
|
|
2327
2610
|
href?: string;
|
|
2328
2611
|
}>;
|
|
2329
2612
|
|
|
@@ -2337,15 +2620,20 @@ export declare type QwikTransitionEvent<T = Element> = NativeTransitionEvent;
|
|
|
2337
2620
|
export declare type QwikUIEvent<T = Element> = NativeUIEvent;
|
|
2338
2621
|
|
|
2339
2622
|
/** Emitted by qwik-core on document when the a view transition start @public */
|
|
2340
|
-
declare type QwikViewTransitionEvent = CustomEvent<ViewTransition>;
|
|
2623
|
+
export declare type QwikViewTransitionEvent = CustomEvent<ViewTransition>;
|
|
2341
2624
|
|
|
2342
|
-
/**
|
|
2625
|
+
/**
|
|
2626
|
+
* Handled by qwik-loader when an element becomes visible. Used by `useVisibleTask$`. Does not
|
|
2627
|
+
* bubble. @public
|
|
2628
|
+
*/
|
|
2343
2629
|
export declare type QwikVisibleEvent = CustomEvent<IntersectionObserverEntry>;
|
|
2344
2630
|
|
|
2345
2631
|
/** @public @deprecated Use `WheelEvent` and use the second argument to the handler function for the current event target */
|
|
2346
2632
|
export declare type QwikWheelEvent<T = Element> = NativeWheelEvent;
|
|
2347
2633
|
|
|
2348
|
-
|
|
2634
|
+
declare type QwikWindowEventMap = Omit<WindowEventHandlersEventMap, keyof QwikDocumentEventMap> & QwikDocumentEventMap;
|
|
2635
|
+
|
|
2636
|
+
/** @public @deprecated not used */
|
|
2349
2637
|
export declare interface ReadonlySignal<T = unknown> {
|
|
2350
2638
|
readonly value: T;
|
|
2351
2639
|
}
|
|
@@ -2366,9 +2654,21 @@ declare type RefFnInterface<EL> = {
|
|
|
2366
2654
|
(el: EL): void;
|
|
2367
2655
|
};
|
|
2368
2656
|
|
|
2369
|
-
/**
|
|
2657
|
+
/**
|
|
2658
|
+
* Register a QRL symbol globally for lookup by its hash. This is used by the optimizer to register
|
|
2659
|
+
* the names passed in `reg_ctx_name`.
|
|
2660
|
+
*
|
|
2661
|
+
* @internal
|
|
2662
|
+
*/
|
|
2370
2663
|
export declare const _regSymbol: (symbol: any, hash: string) => any;
|
|
2371
2664
|
|
|
2665
|
+
/**
|
|
2666
|
+
* Remove an external projection from its parent and clean up.
|
|
2667
|
+
*
|
|
2668
|
+
* @internal
|
|
2669
|
+
*/
|
|
2670
|
+
export declare function _removeProjection(container: _Container, parentVNode: _VirtualVNode, vnode: _VirtualVNode, slotName: string): void;
|
|
2671
|
+
|
|
2372
2672
|
/**
|
|
2373
2673
|
* Render JSX.
|
|
2374
2674
|
*
|
|
@@ -2392,6 +2692,8 @@ export declare const RenderOnce: FunctionComponent<{
|
|
|
2392
2692
|
key?: string | number | null | undefined;
|
|
2393
2693
|
}>;
|
|
2394
2694
|
|
|
2695
|
+
/** @internal */
|
|
2696
|
+
/** @internal */
|
|
2395
2697
|
/** @public */
|
|
2396
2698
|
export declare interface RenderOptions {
|
|
2397
2699
|
serverData?: Record<string, any>;
|
|
@@ -2412,82 +2714,61 @@ export declare interface RenderSSROptions {
|
|
|
2412
2714
|
manifestHash: string;
|
|
2413
2715
|
}
|
|
2414
2716
|
|
|
2415
|
-
/** @public */
|
|
2416
|
-
declare interface ResolvedManifest {
|
|
2417
|
-
mapper: SymbolMapper;
|
|
2418
|
-
manifest: ServerQwikManifest;
|
|
2419
|
-
injections?: GlobalInjections[];
|
|
2420
|
-
bundleGraph?: QwikBundleGraph;
|
|
2421
|
-
}
|
|
2422
|
-
|
|
2423
2717
|
/**
|
|
2424
|
-
*
|
|
2425
|
-
*
|
|
2426
|
-
*
|
|
2427
|
-
* `useResource` however returns immediate a `ResourceReturn` object that contains the data and a
|
|
2428
|
-
* state that indicates if the data is available or not.
|
|
2429
|
-
*
|
|
2430
|
-
* The status can be one of the following:
|
|
2431
|
-
*
|
|
2432
|
-
* - `pending` - the data is not yet available.
|
|
2433
|
-
* - `resolved` - the data is available.
|
|
2434
|
-
* - `rejected` - the data is not available due to an error or timeout.
|
|
2435
|
-
*
|
|
2436
|
-
* Be careful when using a `try/catch` statement in `useResource$`. If you catch the error and don't
|
|
2437
|
-
* re-throw it (or a new Error), the resource status will never be `rejected`.
|
|
2438
|
-
*
|
|
2439
|
-
* ### Example
|
|
2440
|
-
*
|
|
2441
|
-
* Example showing how `useResource` to perform a fetch to request the weather, whenever the input
|
|
2442
|
-
* city name changes.
|
|
2718
|
+
* Resumes selected state (e.g. polling AsyncSignals) by deserializing captures. Used for
|
|
2719
|
+
* document:onQIdle to resume async signals with active polling.
|
|
2443
2720
|
*
|
|
2721
|
+
* @internal
|
|
2722
|
+
*/
|
|
2723
|
+
export declare function _res(this: string | undefined, _: any, element: Element): void;
|
|
2724
|
+
|
|
2725
|
+
/** @internal */
|
|
2726
|
+
export declare const _resolveContextWithoutSequentialScope: <STATE>(context: ContextId<STATE>) => STATE | undefined;
|
|
2727
|
+
|
|
2728
|
+
/**
|
|
2444
2729
|
* ```tsx
|
|
2445
2730
|
* const Cmp = component$(() => {
|
|
2446
|
-
* const
|
|
2731
|
+
* const city = useSignal('');
|
|
2447
2732
|
*
|
|
2448
|
-
* const
|
|
2449
|
-
* const cityName = track(
|
|
2450
|
-
* const abortController = new AbortController();
|
|
2451
|
-
* cleanup(() => abortController.abort('cleanup'));
|
|
2733
|
+
* const weather = useAsync$(async ({ track, cleanup, abortSignal }) => {
|
|
2734
|
+
* const cityName = track(city);
|
|
2452
2735
|
* const res = await fetch(`http://weatherdata.com?city=${cityName}`, {
|
|
2453
|
-
* signal:
|
|
2736
|
+
* signal: abortSignal,
|
|
2454
2737
|
* });
|
|
2455
|
-
* const
|
|
2456
|
-
* return
|
|
2738
|
+
* const temp = (await res.json()) as { temp: number };
|
|
2739
|
+
* return temp;
|
|
2457
2740
|
* });
|
|
2458
2741
|
*
|
|
2459
2742
|
* return (
|
|
2460
2743
|
* <div>
|
|
2461
|
-
* <input name="city" bind:value={
|
|
2462
|
-
* <
|
|
2463
|
-
*
|
|
2464
|
-
*
|
|
2465
|
-
*
|
|
2466
|
-
*
|
|
2467
|
-
*
|
|
2744
|
+
* <input name="city" bind:value={city} />
|
|
2745
|
+
* <div>
|
|
2746
|
+
* Temperature:{' '}
|
|
2747
|
+
* {weather.loading
|
|
2748
|
+
* ? 'Loading...'
|
|
2749
|
+
* : weather.error
|
|
2750
|
+
* ? `Error: ${weather.error.message}`
|
|
2751
|
+
* : weather.value.temp}
|
|
2752
|
+
* </div>
|
|
2468
2753
|
* </div>
|
|
2469
2754
|
* );
|
|
2470
2755
|
* });
|
|
2471
2756
|
* ```
|
|
2472
2757
|
*
|
|
2758
|
+
* @deprecated Use `useAsync$` instead, which is more efficient, and has a more flexible API. Just
|
|
2759
|
+
* read the `loading` and `error` properties from the returned signal to determine the status.
|
|
2473
2760
|
* @public
|
|
2474
|
-
* @see Resource
|
|
2475
|
-
* @see ResourceReturn
|
|
2476
2761
|
*/
|
|
2477
|
-
export declare const Resource: <T>(
|
|
2762
|
+
export declare const Resource: <T>({ value, onResolved, onPending, onRejected, }: ResourceProps<T>) => JSXOutput;
|
|
2478
2763
|
|
|
2479
2764
|
/** @public */
|
|
2480
|
-
export declare interface ResourceCtx<T> {
|
|
2481
|
-
|
|
2482
|
-
cleanup(callback: () => void): void;
|
|
2765
|
+
export declare interface ResourceCtx<T = unknown> extends AsyncCtx<T> {
|
|
2766
|
+
/** @deprecated Does not do anything */
|
|
2483
2767
|
cache(policyOrMilliseconds: number | 'immutable'): void;
|
|
2484
|
-
readonly previous: T | undefined;
|
|
2485
2768
|
}
|
|
2486
2769
|
|
|
2487
|
-
declare const ResourceEvent = "qResource";
|
|
2488
|
-
|
|
2489
2770
|
/** @public */
|
|
2490
|
-
export declare type ResourceFn<T> = (ctx: ResourceCtx
|
|
2771
|
+
export declare type ResourceFn<T> = (ctx: ResourceCtx) => ValueOrPromise<T>;
|
|
2491
2772
|
|
|
2492
2773
|
/**
|
|
2493
2774
|
* Options to pass to `useResource$()`
|
|
@@ -2504,71 +2785,64 @@ export declare interface ResourceOptions {
|
|
|
2504
2785
|
}
|
|
2505
2786
|
|
|
2506
2787
|
/** @public */
|
|
2507
|
-
export declare
|
|
2508
|
-
readonly value: Promise<T>;
|
|
2509
|
-
readonly loading: boolean;
|
|
2510
|
-
}
|
|
2788
|
+
export declare type ResourcePending<T> = ResourceReturn<T>;
|
|
2511
2789
|
|
|
2512
2790
|
/** @public */
|
|
2513
2791
|
export declare interface ResourceProps<T> {
|
|
2514
2792
|
readonly value: ResourceReturn<T> | Signal<Promise<T> | T> | Promise<T>;
|
|
2515
|
-
onResolved: (value: T) => JSXOutput
|
|
2516
|
-
onPending?: () => JSXOutput
|
|
2517
|
-
onRejected?: (reason: Error) => JSXOutput
|
|
2793
|
+
onResolved: (value: T) => JSXOutput | Promise<JSXOutput>;
|
|
2794
|
+
onPending?: () => JSXOutput | Promise<JSXOutput>;
|
|
2795
|
+
onRejected?: (reason: Error) => JSXOutput | Promise<JSXOutput>;
|
|
2518
2796
|
}
|
|
2519
2797
|
|
|
2520
2798
|
/** @public */
|
|
2521
|
-
export declare
|
|
2522
|
-
readonly value: Promise<T>;
|
|
2523
|
-
readonly loading: boolean;
|
|
2524
|
-
}
|
|
2799
|
+
export declare type ResourceRejected<T> = ResourceReturn<T>;
|
|
2525
2800
|
|
|
2526
2801
|
/** @public */
|
|
2527
|
-
export declare
|
|
2528
|
-
readonly value: Promise<T>;
|
|
2529
|
-
readonly loading: boolean;
|
|
2530
|
-
}
|
|
2802
|
+
export declare type ResourceResolved<T> = ResourceReturn<T>;
|
|
2531
2803
|
|
|
2532
2804
|
/** @public */
|
|
2533
|
-
export declare type ResourceReturn<T> =
|
|
2805
|
+
export declare type ResourceReturn<T> = {
|
|
2806
|
+
readonly value: Promise<T>;
|
|
2807
|
+
readonly loading: boolean;
|
|
2808
|
+
};
|
|
2534
2809
|
|
|
2535
2810
|
declare interface ResourceReturnInternal<T> {
|
|
2536
2811
|
__brand: 'resource';
|
|
2537
|
-
_state: 'pending' | 'resolved' | 'rejected';
|
|
2538
|
-
_resolved: T | undefined;
|
|
2539
|
-
_error: Error | undefined;
|
|
2540
|
-
_cache: number;
|
|
2541
|
-
_timeout: number;
|
|
2542
2812
|
value: Promise<T>;
|
|
2543
2813
|
loading: boolean;
|
|
2814
|
+
signal: AsyncSignal<{
|
|
2815
|
+
r: T;
|
|
2816
|
+
}>;
|
|
2544
2817
|
}
|
|
2545
2818
|
|
|
2546
2819
|
/** @internal */
|
|
2547
|
-
export declare const _restProps: (props: PropsProxy, omit
|
|
2820
|
+
export declare const _restProps: (props: PropsProxy, omit?: string[], target?: Props) => Props;
|
|
2548
2821
|
|
|
2549
2822
|
/**
|
|
2550
|
-
*
|
|
2823
|
+
* The resource function wrapper
|
|
2551
2824
|
*
|
|
2552
2825
|
* @internal
|
|
2553
2826
|
*/
|
|
2554
|
-
export declare const
|
|
2827
|
+
export declare const _rsc: <T>(arg: ResourceCtx<T>) => Promise<{
|
|
2828
|
+
r: T;
|
|
2829
|
+
}>;
|
|
2555
2830
|
|
|
2556
|
-
|
|
2831
|
+
/**
|
|
2832
|
+
* This is called by qwik-loader to run a QRL. It has to be synchronous when possible.
|
|
2833
|
+
*
|
|
2834
|
+
* @internal
|
|
2835
|
+
*/
|
|
2836
|
+
export declare function _run(this: string, event: Event, element: Element): ValueOrPromise<unknown>;
|
|
2557
2837
|
|
|
2838
|
+
/** Stores the location of an object. If no parent, it's a root. */
|
|
2558
2839
|
declare type SeenRef = {
|
|
2559
|
-
$parent$: unknown | null;
|
|
2560
2840
|
$index$: number;
|
|
2561
|
-
$
|
|
2841
|
+
$parent$?: SeenRef | null;
|
|
2562
2842
|
};
|
|
2563
2843
|
|
|
2564
|
-
/** @public */
|
|
2565
|
-
declare interface SegmentEntryStrategy {
|
|
2566
|
-
type: 'segment';
|
|
2567
|
-
manual?: Record<string, string>;
|
|
2568
|
-
}
|
|
2569
|
-
|
|
2570
2844
|
declare interface SerializationContext {
|
|
2571
|
-
$serialize$: () => void
|
|
2845
|
+
$serialize$: () => ValueOrPromise<void>;
|
|
2572
2846
|
$symbolToChunkResolver$: SymbolToChunkResolver;
|
|
2573
2847
|
/**
|
|
2574
2848
|
* Map from object to parent and index reference.
|
|
@@ -2580,49 +2854,64 @@ declare interface SerializationContext {
|
|
|
2580
2854
|
* - `{ parent, index }` - The parent object and the index within that parent.
|
|
2581
2855
|
* - `undefined` - Object has not been seen yet.
|
|
2582
2856
|
*/
|
|
2583
|
-
|
|
2857
|
+
getSeenRef: (obj: unknown) => SeenRef | undefined;
|
|
2858
|
+
/** Returns the root index of the object, if it is a root. Otherwise returns undefined. */
|
|
2584
2859
|
$hasRootId$: (obj: unknown) => number | undefined;
|
|
2585
2860
|
/**
|
|
2586
2861
|
* Root objects which need to be serialized.
|
|
2587
2862
|
*
|
|
2588
2863
|
* Roots are entry points into the object graph. Typically the roots are held by the listeners.
|
|
2589
2864
|
*
|
|
2590
|
-
* Returns
|
|
2591
|
-
* Format: "3 2 0" where each number is the index within its parent, from root to leaf.
|
|
2592
|
-
*/
|
|
2593
|
-
$addRoot$: (obj: unknown, parent?: unknown) => number;
|
|
2594
|
-
/**
|
|
2595
|
-
* Get root path of the object without creating a new root.
|
|
2596
|
-
*
|
|
2597
|
-
* This is used during serialization, as new roots can't be created during serialization.
|
|
2598
|
-
*
|
|
2599
|
-
* The function throws if the root was not found.
|
|
2865
|
+
* Returns the index of the root object.
|
|
2600
2866
|
*/
|
|
2601
|
-
$
|
|
2602
|
-
|
|
2867
|
+
$addRoot$: AddRootFn;
|
|
2868
|
+
/** Mark an object as seen during serialization. This is used to handle backreferences and cycles */
|
|
2869
|
+
$markSeen$: (obj: unknown, parent: SeenRef | undefined, index: number) => SeenRef;
|
|
2603
2870
|
$roots$: unknown[];
|
|
2604
|
-
$
|
|
2871
|
+
$promoteToRoot$: (ref: SeenRef, index?: number) => void;
|
|
2605
2872
|
$addSyncFn$($funcStr$: string | null, argsCount: number, fn: Function): number;
|
|
2606
2873
|
$isSsrNode$: (obj: unknown) => obj is SsrNode;
|
|
2607
2874
|
$isDomRef$: (obj: unknown) => obj is DomRef;
|
|
2608
|
-
$writer$:
|
|
2875
|
+
$writer$: StreamWriter;
|
|
2609
2876
|
$syncFns$: string[];
|
|
2610
2877
|
$eventQrls$: Set<QRL>;
|
|
2611
2878
|
$eventNames$: Set<string>;
|
|
2612
|
-
$resources$: Set<ResourceReturnInternal<unknown>>;
|
|
2613
2879
|
$renderSymbols$: Set<string>;
|
|
2614
2880
|
$storeProxyMap$: ObjToProxyMap;
|
|
2615
|
-
$
|
|
2881
|
+
$eagerResume$: Set<unknown>;
|
|
2616
2882
|
$setProp$: (obj: any, prop: string, value: any) => void;
|
|
2617
2883
|
}
|
|
2618
2884
|
|
|
2885
|
+
declare const enum SerializationSignalFlags {
|
|
2886
|
+
SERIALIZATION_STRATEGY_NEVER = 8,
|
|
2887
|
+
SERIALIZATION_STRATEGY_ALWAYS = 16,
|
|
2888
|
+
SERIALIZATION_ALL_STRATEGIES = 24
|
|
2889
|
+
}
|
|
2890
|
+
|
|
2891
|
+
/**
|
|
2892
|
+
* Serialization strategy for computed and async signals. This determines whether to serialize their
|
|
2893
|
+
* value during SSR.
|
|
2894
|
+
*
|
|
2895
|
+
* - `never`: The value is never serialized. When the component is resumed, the value will be
|
|
2896
|
+
* recalculated when it is first read.
|
|
2897
|
+
* - `always`: The value is always serialized. This is the default.
|
|
2898
|
+
*
|
|
2899
|
+
* **IMPORTANT**: When you use `never`, your serialized HTML is smaller, but the recalculation will
|
|
2900
|
+
* trigger subscriptions, meaning that other signals using this signal will recalculate, even if
|
|
2901
|
+
* this signal didn't change.
|
|
2902
|
+
*
|
|
2903
|
+
* This is normally not a problem, but for async signals it may mean fetching something again.
|
|
2904
|
+
*
|
|
2905
|
+
* @public
|
|
2906
|
+
*/
|
|
2907
|
+
export declare type SerializationStrategy = 'never' | 'always';
|
|
2908
|
+
|
|
2619
2909
|
/**
|
|
2620
2910
|
* Serialize data to string using SerializationContext.
|
|
2621
2911
|
*
|
|
2622
|
-
* @param data - Data to serialize
|
|
2623
2912
|
* @internal
|
|
2624
2913
|
*/
|
|
2625
|
-
export declare function _serialize(data:
|
|
2914
|
+
export declare function _serialize<T>(data: T): Promise<string>;
|
|
2626
2915
|
|
|
2627
2916
|
/**
|
|
2628
2917
|
* Serialize and deserialize custom objects.
|
|
@@ -2685,9 +2974,9 @@ declare interface SerializerSignal<T> extends ComputedSignal<T> {
|
|
|
2685
2974
|
* @public
|
|
2686
2975
|
*/
|
|
2687
2976
|
declare class SerializerSignalImpl<T, S> extends ComputedSignalImpl<T> {
|
|
2688
|
-
constructor(container:
|
|
2977
|
+
constructor(container: _Container | null, argQrl: _QRLInternal<SerializerArg<T, S>>);
|
|
2689
2978
|
$didInitialize$: boolean;
|
|
2690
|
-
$computeIfNeeded$():
|
|
2979
|
+
$computeIfNeeded$(): void;
|
|
2691
2980
|
}
|
|
2692
2981
|
|
|
2693
2982
|
/**
|
|
@@ -2708,12 +2997,8 @@ declare class SerializerSignalImpl<T, S> extends ComputedSignalImpl<T> {
|
|
|
2708
2997
|
*/
|
|
2709
2998
|
export declare const SerializerSymbol: unique symbol;
|
|
2710
2999
|
|
|
2711
|
-
/**
|
|
2712
|
-
|
|
2713
|
-
*
|
|
2714
|
-
* @public
|
|
2715
|
-
*/
|
|
2716
|
-
declare type ServerQwikManifest = Pick<QwikManifest, 'manifestHash' | 'injections' | 'bundleGraph' | 'bundleGraphAsset' | 'mapping' | 'preloader' | 'core' | 'qwikLoader'>;
|
|
3000
|
+
/** @internal */
|
|
3001
|
+
export declare function _setEvent(serializationCtx: SerializationContext, key: string, rawValue: unknown, hasMovedCaptures: boolean): string | null;
|
|
2717
3002
|
|
|
2718
3003
|
/**
|
|
2719
3004
|
* Sets the `CorePlatform`.
|
|
@@ -2727,10 +3012,19 @@ declare type ServerQwikManifest = Pick<QwikManifest, 'manifestHash' | 'injection
|
|
|
2727
3012
|
*/
|
|
2728
3013
|
export declare const setPlatform: (plt: CorePlatform) => CorePlatform;
|
|
2729
3014
|
|
|
3015
|
+
/**
|
|
3016
|
+
* Set the DOM target element for an external projection VNode.
|
|
3017
|
+
*
|
|
3018
|
+
* When the cursor walker processes this VNode, DOM operations will target this element instead of
|
|
3019
|
+
* walking the parent chain.
|
|
3020
|
+
*
|
|
3021
|
+
* @internal
|
|
3022
|
+
*/
|
|
3023
|
+
export declare function _setProjectionTarget(vnode: _VirtualVNode, targetElement: Element): void;
|
|
3024
|
+
|
|
2730
3025
|
/** @internal */
|
|
2731
|
-
export declare abstract class _SharedContainer implements
|
|
3026
|
+
export declare abstract class _SharedContainer implements _Container {
|
|
2732
3027
|
readonly $version$: string;
|
|
2733
|
-
readonly $scheduler$: Scheduler;
|
|
2734
3028
|
readonly $storeProxyMap$: ObjToProxyMap;
|
|
2735
3029
|
readonly $locale$: string;
|
|
2736
3030
|
readonly $getObjectById$: (id: number | string) => any;
|
|
@@ -2738,7 +3032,10 @@ export declare abstract class _SharedContainer implements Container {
|
|
|
2738
3032
|
$currentUniqueId$: number;
|
|
2739
3033
|
$instanceHash$: string | null;
|
|
2740
3034
|
$buildBase$: string | null;
|
|
2741
|
-
|
|
3035
|
+
$renderPromise$: Promise<void> | null;
|
|
3036
|
+
$resolveRenderPromise$: (() => void) | null;
|
|
3037
|
+
$pendingCount$: number;
|
|
3038
|
+
constructor(serverData: Record<string, any>, locale: string);
|
|
2742
3039
|
trackSignalValue<T>(signal: Signal, subscriber: HostElement, property: string, data: _SubscriptionData): T;
|
|
2743
3040
|
serializationCtxFactory(NodeConstructor: {
|
|
2744
3041
|
new (...rest: any[]): {
|
|
@@ -2749,8 +3046,9 @@ export declare abstract class _SharedContainer implements Container {
|
|
|
2749
3046
|
__brand__: 'DomRef';
|
|
2750
3047
|
};
|
|
2751
3048
|
} | null, symbolToChunkResolver: SymbolToChunkResolver, writer?: StreamWriter): SerializationContext;
|
|
3049
|
+
$checkPendingCount$(): void;
|
|
2752
3050
|
abstract ensureProjectionResolved(host: HostElement): void;
|
|
2753
|
-
abstract handleError(err: any, $host$: HostElement): void;
|
|
3051
|
+
abstract handleError(err: any, $host$: HostElement | null): void;
|
|
2754
3052
|
abstract getParentHost(host: HostElement): HostElement | null;
|
|
2755
3053
|
abstract setContext<T>(host: HostElement, context: ContextId<T>, value: T): void;
|
|
2756
3054
|
abstract resolveContext<T>(host: HostElement, contextId: ContextId<T>): T | undefined;
|
|
@@ -2771,20 +3069,37 @@ export declare abstract class _SharedContainer implements Container {
|
|
|
2771
3069
|
*
|
|
2772
3070
|
* @public
|
|
2773
3071
|
*/
|
|
2774
|
-
export declare interface Signal<T = any>
|
|
3072
|
+
export declare interface Signal<T = any> {
|
|
3073
|
+
/** Reading from this subscribes to updates; writing to this triggers updates. */
|
|
2775
3074
|
value: T;
|
|
3075
|
+
/** Reading from this does not subscribe to updates; writing to this does not trigger updates. */
|
|
3076
|
+
untrackedValue: T;
|
|
3077
|
+
/**
|
|
3078
|
+
* Use this to trigger running subscribers, for example when the value mutated but remained the
|
|
3079
|
+
* same object.
|
|
3080
|
+
*/
|
|
3081
|
+
trigger(): void;
|
|
2776
3082
|
}
|
|
2777
3083
|
|
|
2778
3084
|
declare const enum SignalFlags {
|
|
2779
|
-
INVALID = 1
|
|
3085
|
+
INVALID = 1,
|
|
3086
|
+
RUN_EFFECTS = 2
|
|
2780
3087
|
}
|
|
2781
3088
|
|
|
2782
3089
|
declare class SignalImpl<T = any> implements Signal<T> {
|
|
2783
3090
|
$untrackedValue$: T;
|
|
2784
3091
|
/** Store a list of effects which are dependent on this signal. */
|
|
2785
|
-
$effects$:
|
|
2786
|
-
$container$:
|
|
2787
|
-
|
|
3092
|
+
$effects$: undefined | Set<EffectSubscription>;
|
|
3093
|
+
$container$: _Container | null;
|
|
3094
|
+
$wrappedSignal$: WrappedSignalImpl<T> | null;
|
|
3095
|
+
constructor(container: _Container | null | undefined, value: T);
|
|
3096
|
+
/**
|
|
3097
|
+
* Use this to trigger running subscribers, for example when the calculated value has mutated but
|
|
3098
|
+
* remained the same object
|
|
3099
|
+
*/
|
|
3100
|
+
trigger(): void;
|
|
3101
|
+
/** @deprecated Use `trigger()` instead */
|
|
3102
|
+
force(): void;
|
|
2788
3103
|
get untrackedValue(): T;
|
|
2789
3104
|
set untrackedValue(value: T);
|
|
2790
3105
|
get value(): T;
|
|
@@ -2802,12 +3117,6 @@ declare interface SimplifiedServerRequestEvent<T = unknown> {
|
|
|
2802
3117
|
request: Request;
|
|
2803
3118
|
}
|
|
2804
3119
|
|
|
2805
|
-
/** @public */
|
|
2806
|
-
declare interface SingleEntryStrategy {
|
|
2807
|
-
type: 'single';
|
|
2808
|
-
manual?: Record<string, string>;
|
|
2809
|
-
}
|
|
2810
|
-
|
|
2811
3120
|
/** @public */
|
|
2812
3121
|
declare type Size = number | string;
|
|
2813
3122
|
|
|
@@ -2825,12 +3134,6 @@ export declare const Slot: FunctionComponent<{
|
|
|
2825
3134
|
children?: JSXChildren;
|
|
2826
3135
|
}>;
|
|
2827
3136
|
|
|
2828
|
-
/** @public */
|
|
2829
|
-
declare interface SmartEntryStrategy {
|
|
2830
|
-
type: 'smart';
|
|
2831
|
-
manual?: Record<string, string>;
|
|
2832
|
-
}
|
|
2833
|
-
|
|
2834
3137
|
/** @public */
|
|
2835
3138
|
export declare interface SnapshotListener {
|
|
2836
3139
|
key: string;
|
|
@@ -3071,39 +3374,35 @@ declare type SpecialAttrs = {
|
|
|
3071
3374
|
[key: string]: {};
|
|
3072
3375
|
};
|
|
3073
3376
|
|
|
3074
|
-
declare type SsrAttrKey = string;
|
|
3075
|
-
|
|
3076
|
-
declare type SsrAttrs = Array<SsrAttrKey | SsrAttrValue>;
|
|
3077
|
-
|
|
3078
|
-
declare type SsrAttrValue = string | Signal<any> | boolean | object | null;
|
|
3079
|
-
|
|
3080
3377
|
/** @public */
|
|
3081
3378
|
export declare const SSRComment: FunctionComponent<{
|
|
3082
3379
|
data: string;
|
|
3083
3380
|
}>;
|
|
3084
3381
|
|
|
3085
|
-
declare interface SSRContainer extends
|
|
3382
|
+
declare interface SSRContainer extends _Container {
|
|
3086
3383
|
readonly tag: string;
|
|
3087
3384
|
readonly isHtml: boolean;
|
|
3385
|
+
readonly size: number;
|
|
3088
3386
|
readonly writer: StreamWriter;
|
|
3387
|
+
readonly streamHandler: IStreamHandler;
|
|
3089
3388
|
readonly serializationCtx: SerializationContext;
|
|
3090
3389
|
readonly symbolToChunkResolver: SymbolToChunkResolver;
|
|
3091
3390
|
readonly resolvedManifest: ResolvedManifest;
|
|
3092
3391
|
additionalHeadNodes: Array<JSXNodeInternal>;
|
|
3093
3392
|
additionalBodyNodes: Array<JSXNodeInternal>;
|
|
3094
|
-
|
|
3393
|
+
write(text: string): void;
|
|
3095
3394
|
openContainer(): void;
|
|
3096
3395
|
closeContainer(): ValueOrPromise<void>;
|
|
3097
|
-
openElement(elementName: string,
|
|
3396
|
+
openElement(elementName: string, key: string | null, varAttrs: Props, constAttrs: Props | null, styleScopedId: string | null, currentFile: string | null, hasMovedCaptures?: boolean): string | undefined;
|
|
3098
3397
|
closeElement(): ValueOrPromise<void>;
|
|
3099
|
-
openFragment(attrs:
|
|
3398
|
+
openFragment(attrs: Props): void;
|
|
3100
3399
|
closeFragment(): void;
|
|
3101
|
-
openProjection(attrs:
|
|
3400
|
+
openProjection(attrs: Props): void;
|
|
3102
3401
|
closeProjection(): void;
|
|
3103
|
-
openComponent(attrs:
|
|
3402
|
+
openComponent(attrs: Props): void;
|
|
3104
3403
|
getComponentFrame(projectionDepth: number): ISsrComponentFrame | null;
|
|
3105
3404
|
getParentComponentFrame(): ISsrComponentFrame | null;
|
|
3106
|
-
closeComponent(): void
|
|
3405
|
+
closeComponent(): Promise<void>;
|
|
3107
3406
|
textNode(text: string): void;
|
|
3108
3407
|
htmlNode(rawHtml: string): void;
|
|
3109
3408
|
commentNode(text: string): void;
|
|
@@ -3112,8 +3411,14 @@ declare interface SSRContainer extends Container {
|
|
|
3112
3411
|
addUnclaimedProjection(frame: ISsrComponentFrame, name: string, children: JSXChildren): void;
|
|
3113
3412
|
isStatic(): boolean;
|
|
3114
3413
|
render(jsx: JSXOutput): Promise<void>;
|
|
3414
|
+
renderJSX(jsx: JSXOutput, options: {
|
|
3415
|
+
currentStyleScoped: string | null;
|
|
3416
|
+
parentComponentFrame: ISsrComponentFrame | null;
|
|
3417
|
+
}): Promise<void>;
|
|
3115
3418
|
emitPreloaderPre(): void;
|
|
3116
3419
|
emitQwikLoaderAtTopIfNeeded(): void;
|
|
3420
|
+
emitPatchDataIfNeeded(): void;
|
|
3421
|
+
addBackpatchEntry(ssrNodeId: string, attrName: string, serializedValue: string | boolean | null): void;
|
|
3117
3422
|
}
|
|
3118
3423
|
|
|
3119
3424
|
/** @public */
|
|
@@ -3129,6 +3434,10 @@ declare type SsrNode = {
|
|
|
3129
3434
|
[_EFFECT_BACK_REF]: Map<EffectProperty | string, EffectSubscription> | null;
|
|
3130
3435
|
};
|
|
3131
3436
|
|
|
3437
|
+
declare const enum SsrNodeFlags {
|
|
3438
|
+
Updatable = 1
|
|
3439
|
+
}
|
|
3440
|
+
|
|
3132
3441
|
/** @public */
|
|
3133
3442
|
export declare const SSRRaw: FunctionComponent<{
|
|
3134
3443
|
data: string;
|
|
@@ -3143,38 +3452,22 @@ export declare const SSRStreamBlock: FunctionComponent<{
|
|
|
3143
3452
|
}>;
|
|
3144
3453
|
|
|
3145
3454
|
/** @public */
|
|
3146
|
-
export declare type SSRStreamChildren = AsyncGenerator<JSXChildren, void, any> | ((stream:
|
|
3455
|
+
export declare type SSRStreamChildren = AsyncGenerator<JSXChildren, void, any> | ((stream: SSRStreamWriter) => Promise<void>) | (() => AsyncGenerator<JSXChildren, void, any>);
|
|
3147
3456
|
|
|
3148
3457
|
/** @public */
|
|
3149
3458
|
export declare type SSRStreamProps = {
|
|
3150
3459
|
children: SSRStreamChildren;
|
|
3151
3460
|
};
|
|
3152
3461
|
|
|
3462
|
+
/** @public */
|
|
3463
|
+
export declare interface SSRStreamWriter {
|
|
3464
|
+
write(chunk: JSXOutput): void;
|
|
3465
|
+
}
|
|
3466
|
+
|
|
3153
3467
|
declare type StopPropagation = {
|
|
3154
3468
|
[K in keyof HTMLElementEventMap as `stoppropagation:${K}`]?: boolean;
|
|
3155
3469
|
};
|
|
3156
3470
|
|
|
3157
|
-
declare const enum StoreFlags {
|
|
3158
|
-
NONE = 0,
|
|
3159
|
-
RECURSIVE = 1,
|
|
3160
|
-
IMMUTABLE = 2
|
|
3161
|
-
}
|
|
3162
|
-
|
|
3163
|
-
declare class StoreHandler implements ProxyHandler<StoreTarget> {
|
|
3164
|
-
$flags$: StoreFlags;
|
|
3165
|
-
$container$: Container | null;
|
|
3166
|
-
$effects$: null | Map<string | symbol, Set<EffectSubscription>>;
|
|
3167
|
-
constructor($flags$: StoreFlags, $container$: Container | null);
|
|
3168
|
-
toString(): string;
|
|
3169
|
-
get(target: StoreTarget, prop: string | symbol): any;
|
|
3170
|
-
/** In the case of oldValue and value are the same, the effects are not triggered. */
|
|
3171
|
-
set(target: StoreTarget, prop: string | symbol, value: any): boolean;
|
|
3172
|
-
deleteProperty(target: StoreTarget, prop: string | symbol): boolean;
|
|
3173
|
-
has(target: StoreTarget, prop: string | symbol): boolean;
|
|
3174
|
-
ownKeys(target: StoreTarget): ArrayLike<string | symbol>;
|
|
3175
|
-
getOwnPropertyDescriptor(target: StoreTarget, prop: string | symbol): PropertyDescriptor | undefined;
|
|
3176
|
-
}
|
|
3177
|
-
|
|
3178
3471
|
declare type StoreTarget = Record<string | symbol, any>;
|
|
3179
3472
|
|
|
3180
3473
|
/** @internal */
|
|
@@ -3464,9 +3757,6 @@ export declare interface SVGAttributes<T extends Element = Element> extends Aria
|
|
|
3464
3757
|
export declare interface SVGProps<T extends Element> extends SVGAttributes, QwikAttributes<T> {
|
|
3465
3758
|
}
|
|
3466
3759
|
|
|
3467
|
-
/** @public */
|
|
3468
|
-
declare type SymbolMapper = Record<string, readonly [symbol: string, chunk: string]>;
|
|
3469
|
-
|
|
3470
3760
|
declare type SymbolToChunkResolver = (symbol: string) => string;
|
|
3471
3761
|
|
|
3472
3762
|
/**
|
|
@@ -3480,18 +3770,19 @@ declare type SymbolToChunkResolver = (symbol: string) => string;
|
|
|
3480
3770
|
*/
|
|
3481
3771
|
export declare const sync$: <T extends Function>(fn: T) => SyncQRL<T>;
|
|
3482
3772
|
|
|
3773
|
+
declare const SYNC_QRL = "<sync>";
|
|
3774
|
+
|
|
3483
3775
|
/** @public */
|
|
3484
|
-
export declare
|
|
3776
|
+
export declare type SyncQRL<TYPE extends Function> = QRL<TYPE> & {
|
|
3485
3777
|
__brand__SyncQRL__: TYPE;
|
|
3486
|
-
/**
|
|
3487
|
-
* Resolve the QRL of closure and invoke it.
|
|
3488
|
-
*
|
|
3489
|
-
* @param args - Closure arguments.
|
|
3490
|
-
* @returns A return value of the closure.
|
|
3491
|
-
*/
|
|
3492
|
-
(...args: TYPE extends (...args: infer ARGS) => any ? ARGS : never): TYPE extends (...args: any[]) => infer RETURN ? RETURN : never;
|
|
3493
3778
|
resolved: TYPE;
|
|
3494
|
-
dev
|
|
3779
|
+
dev?: QRLDev | null;
|
|
3780
|
+
} & BivariantQrlFn<QrlArgs<TYPE>, QrlReturn<TYPE>>;
|
|
3781
|
+
|
|
3782
|
+
declare type SyncQRLInternal = _QRLInternal & SyncQRLSymbol;
|
|
3783
|
+
|
|
3784
|
+
declare interface SyncQRLSymbol {
|
|
3785
|
+
$symbol$: typeof SYNC_QRL;
|
|
3495
3786
|
}
|
|
3496
3787
|
|
|
3497
3788
|
declare type TableCellSpecialAttrs = {
|
|
@@ -3501,49 +3792,49 @@ declare type TableCellSpecialAttrs = {
|
|
|
3501
3792
|
valign?: 'top' | 'middle' | 'bottom' | 'baseline' | undefined;
|
|
3502
3793
|
};
|
|
3503
3794
|
|
|
3504
|
-
declare class Task<T = unknown, B = T> extends BackRef implements DescriptorBase<unknown, Signal<B
|
|
3795
|
+
declare class Task<T = unknown, B = T> extends BackRef implements DescriptorBase<unknown, Signal<B>> {
|
|
3505
3796
|
$flags$: number;
|
|
3506
3797
|
$index$: number;
|
|
3507
3798
|
$el$: HostElement;
|
|
3508
|
-
$qrl$:
|
|
3509
|
-
$state$: Signal<B> |
|
|
3510
|
-
$destroy$:
|
|
3511
|
-
|
|
3799
|
+
$qrl$: _QRLInternal<T>;
|
|
3800
|
+
$state$: Signal<B> | undefined;
|
|
3801
|
+
$destroy$: (() => void) | null;
|
|
3802
|
+
$destroyPromise$: Promise<void> | undefined;
|
|
3803
|
+
$taskPromise$: Promise<void> | null;
|
|
3804
|
+
constructor($flags$: number, $index$: number, $el$: HostElement, $qrl$: _QRLInternal<T>, $state$: Signal<B> | undefined, $destroy$: (() => void) | null);
|
|
3512
3805
|
}
|
|
3513
3806
|
|
|
3514
3807
|
/**
|
|
3515
|
-
* Used internally as a
|
|
3808
|
+
* Used internally as a qwikloader event handler to schedule a task. The `this` context is the
|
|
3809
|
+
* captures part of the QRL, provided by qwikloader.
|
|
3516
3810
|
*
|
|
3517
3811
|
* @internal
|
|
3518
3812
|
*/
|
|
3519
|
-
export declare
|
|
3813
|
+
export declare function _task(this: string, _event: Event, element: Element): void;
|
|
3520
3814
|
|
|
3521
3815
|
/** @public */
|
|
3522
3816
|
export declare interface TaskCtx {
|
|
3523
3817
|
track: Tracker;
|
|
3524
|
-
cleanup: (callback: () => void) => void;
|
|
3818
|
+
cleanup: (callback: () => ValueOrPromise<void>) => void;
|
|
3525
3819
|
}
|
|
3526
3820
|
|
|
3527
3821
|
declare const TaskEvent = "qTask";
|
|
3528
3822
|
|
|
3529
3823
|
/** @public */
|
|
3530
|
-
export declare type TaskFn = (ctx: TaskCtx) => ValueOrPromise<void | (() => void)>;
|
|
3824
|
+
export declare type TaskFn = (ctx: TaskCtx) => ValueOrPromise<void | (() => ValueOrPromise<void>)>;
|
|
3825
|
+
|
|
3826
|
+
/** @public */
|
|
3827
|
+
export declare interface TaskOptions {
|
|
3828
|
+
/** Block the rendering of the component until the task completes. Default is `true` */
|
|
3829
|
+
deferUpdates?: boolean;
|
|
3830
|
+
}
|
|
3531
3831
|
|
|
3532
3832
|
/** @internal */
|
|
3533
|
-
export declare
|
|
3534
|
-
|
|
3535
|
-
|
|
3536
|
-
_VNode | null,
|
|
3537
|
-
|
|
3538
|
-
_VNode | null,
|
|
3539
|
-
///////////////// 2 - Previous sibling
|
|
3540
|
-
_VNode | null,
|
|
3541
|
-
///////////////// 3 - Next sibling
|
|
3542
|
-
Text | null | undefined,
|
|
3543
|
-
string
|
|
3544
|
-
] & {
|
|
3545
|
-
__brand__: 'TextVNode';
|
|
3546
|
-
};
|
|
3833
|
+
export declare class _TextVNode extends _VNode {
|
|
3834
|
+
node: Text | null;
|
|
3835
|
+
text: string | undefined;
|
|
3836
|
+
constructor(flags: _VNodeFlags, parent: _VNode | null, previousSibling: _VNode | null | undefined, nextSibling: _VNode | null | undefined, props: Props | null, node: Text | null, text: string | undefined);
|
|
3837
|
+
}
|
|
3547
3838
|
|
|
3548
3839
|
/**
|
|
3549
3840
|
* Used to signal to Qwik which state should be watched for changes.
|
|
@@ -3564,6 +3855,8 @@ string
|
|
|
3564
3855
|
* useTask$(({ track }) => {
|
|
3565
3856
|
* // Any signals or stores accessed inside the task will be tracked
|
|
3566
3857
|
* const count = track(() => store.count);
|
|
3858
|
+
* // For stores you can also pass the store and specify the property
|
|
3859
|
+
* track(store, 'count');
|
|
3567
3860
|
* // You can also pass a signal to track() directly
|
|
3568
3861
|
* const signalCount = track(signal);
|
|
3569
3862
|
* store.doubleCount = count + signalCount;
|
|
@@ -3630,12 +3923,22 @@ export declare interface Tracker {
|
|
|
3630
3923
|
<T extends object, P extends keyof T>(obj: T, prop: P): T[P];
|
|
3631
3924
|
}
|
|
3632
3925
|
|
|
3926
|
+
/** @internal */
|
|
3927
|
+
export declare const _UNINITIALIZED: unique symbol;
|
|
3928
|
+
|
|
3633
3929
|
/**
|
|
3634
|
-
*
|
|
3930
|
+
* Get the value of the expression without tracking listeners. A function will be invoked, signals
|
|
3931
|
+
* will return their value, and stores will be unwrapped (they return the backing object).
|
|
3932
|
+
*
|
|
3933
|
+
* When you pass a function, you can also pass additional arguments that the function will receive.
|
|
3934
|
+
*
|
|
3935
|
+
* Note that stores are not unwrapped recursively.
|
|
3635
3936
|
*
|
|
3937
|
+
* @param expr - The function or object to evaluate without tracking.
|
|
3938
|
+
* @param args - Additional arguments to pass when `expr` is a function.
|
|
3636
3939
|
* @public
|
|
3637
3940
|
*/
|
|
3638
|
-
export declare const untrack: <T>(
|
|
3941
|
+
export declare const untrack: <T, A extends any[]>(expr: ((...args: A) => T) | Signal<T> | T, ...args: A) => T;
|
|
3639
3942
|
|
|
3640
3943
|
declare type UnwantedKeys = keyof HTMLAttributesBase | keyof DOMAttributes<any> | keyof ARIAMixin | keyof GlobalEventHandlers | 'enterKeyHint' | 'innerText' | 'innerHTML' | 'outerHTML' | 'inputMode' | 'outerText' | 'nodeValue' | 'textContent';
|
|
3641
3944
|
|
|
@@ -3648,19 +3951,37 @@ declare type UnwantedKeys = keyof HTMLAttributesBase | keyof DOMAttributes<any>
|
|
|
3648
3951
|
export declare const unwrapStore: <T>(value: T) => T;
|
|
3649
3952
|
|
|
3650
3953
|
/**
|
|
3651
|
-
*
|
|
3652
|
-
* signal which is calculated from other signals. When the signals change, the computed signal is
|
|
3653
|
-
* recalculated, and if the result changed, all tasks which are tracking the signal will be re-run
|
|
3654
|
-
* and all components that read the signal will be re-rendered.
|
|
3954
|
+
* Update the props on an external projection VNode and trigger re-rendering.
|
|
3655
3955
|
*
|
|
3656
|
-
*
|
|
3956
|
+
* @internal
|
|
3957
|
+
*/
|
|
3958
|
+
export declare function _updateProjectionProps(container: _Container, vnode: _VirtualVNode, newProps: Record<string, unknown>): void;
|
|
3959
|
+
|
|
3960
|
+
/**
|
|
3961
|
+
* Creates an AsyncSignal which holds the result of the given async function. If the function uses
|
|
3962
|
+
* `track()` to track reactive state, and that state changes, the AsyncSignal is recalculated, and
|
|
3963
|
+
* if the result changed, all tasks which are tracking the AsyncSignal will be re-run and all
|
|
3964
|
+
* subscribers (components, tasks etc) that read the AsyncSignal will be updated.
|
|
3965
|
+
*
|
|
3966
|
+
* If the async function throws an error, the AsyncSignal will capture the error and set the `error`
|
|
3967
|
+
* property. The error can be cleared by re-running the async function successfully.
|
|
3968
|
+
*
|
|
3969
|
+
* While the async function is running, the `loading` property will be set to `true`. Once the
|
|
3970
|
+
* function completes, `loading` will be set to `false`.
|
|
3971
|
+
*
|
|
3972
|
+
* If the value has not yet been resolved, reading the AsyncSignal will throw a Promise, which will
|
|
3973
|
+
* retry the component or task once the value resolves.
|
|
3974
|
+
*
|
|
3975
|
+
* If the value has been resolved, but the async function is re-running, reading the AsyncSignal
|
|
3976
|
+
* will subscribe to it and return the last resolved value until the new value is ready. As soon as
|
|
3977
|
+
* the new value is ready, the subscribers will be updated.
|
|
3657
3978
|
*
|
|
3658
3979
|
* @public
|
|
3659
3980
|
*/
|
|
3660
|
-
export declare const
|
|
3981
|
+
export declare const useAsync$: <T>(qrl: AsyncFn<T>, options?: AsyncSignalOptions<T> | undefined) => AsyncSignal<T>;
|
|
3661
3982
|
|
|
3662
3983
|
/** @internal */
|
|
3663
|
-
export declare const
|
|
3984
|
+
export declare const useAsyncQrl: <T>(qrl: QRL<AsyncFn<T>>, options?: AsyncSignalOptions<T>) => AsyncSignal<T>;
|
|
3664
3985
|
|
|
3665
3986
|
/**
|
|
3666
3987
|
* Creates a computed signal which is calculated from the given function. A computed signal is a
|
|
@@ -3672,20 +3993,32 @@ export declare const useAsyncComputedQrl: <T>(qrl: QRL<AsyncComputedFn<T>>) => A
|
|
|
3672
3993
|
*
|
|
3673
3994
|
* @public
|
|
3674
3995
|
*/
|
|
3675
|
-
export declare const useComputed$: <T>(qrl: ComputedFn<T
|
|
3996
|
+
export declare const useComputed$: <T>(qrl: ComputedFn<T>, options?: ComputedOptions | undefined) => ComputedReturnType<T>;
|
|
3676
3997
|
|
|
3677
3998
|
/** @internal */
|
|
3678
|
-
export declare const useComputedQrl: <T>(qrl: QRL<ComputedFn<T
|
|
3999
|
+
export declare const useComputedQrl: <T>(qrl: QRL<ComputedFn<T>>, options?: ComputedOptions) => ComputedReturnType<T>;
|
|
3679
4000
|
|
|
3680
4001
|
/**
|
|
3681
4002
|
* Stores a value which is retained for the lifetime of the component. Subsequent calls to
|
|
3682
4003
|
* `useConstant` will always return the first value given.
|
|
3683
4004
|
*
|
|
3684
|
-
* If the value is a function, the function is invoked once to calculate the actual value.
|
|
4005
|
+
* If the value is a function, the function is invoked once to calculate the actual value. You can
|
|
4006
|
+
* then also pass arguments to call the function with, so that you don't need to create a new
|
|
4007
|
+
* function on every render.
|
|
4008
|
+
*
|
|
4009
|
+
* @example
|
|
4010
|
+
*
|
|
4011
|
+
* ```tsx
|
|
4012
|
+
* const fixedRandomValue = useConstant(() => Math.random);
|
|
4013
|
+
* const otherFixedRandomValue = useConstant(Math.random);
|
|
4014
|
+
*
|
|
4015
|
+
* const getConfig = (env: string) => { ... }
|
|
4016
|
+
* const config = useConstant(getConfig, environment);
|
|
4017
|
+
* ```
|
|
3685
4018
|
*
|
|
3686
4019
|
* @public
|
|
3687
4020
|
*/
|
|
3688
|
-
export declare const useConstant: <T>(value: (() => T) | T) => T;
|
|
4021
|
+
export declare const useConstant: <T, A extends any[]>(value: ((...args: A) => T) | T, ...args: A) => T;
|
|
3689
4022
|
|
|
3690
4023
|
declare interface UseContext {
|
|
3691
4024
|
<STATE, T>(context: ContextId<STATE>, transformer: (value: STATE) => T): T;
|
|
@@ -3797,6 +4130,14 @@ export declare const useContextProvider: <STATE>(context: ContextId<STATE>, newV
|
|
|
3797
4130
|
/** @public */
|
|
3798
4131
|
export declare const useErrorBoundary: () => ErrorBoundaryStore;
|
|
3799
4132
|
|
|
4133
|
+
/**
|
|
4134
|
+
* Injected by the optimizer into component$ bodies in HMR mode. Registers a document event listener
|
|
4135
|
+
* that triggers component re-render on HMR updates.
|
|
4136
|
+
*
|
|
4137
|
+
* @internal
|
|
4138
|
+
*/
|
|
4139
|
+
export declare function _useHmr(devPath: string): void;
|
|
4140
|
+
|
|
3800
4141
|
/** @public */
|
|
3801
4142
|
export declare const useId: () => string;
|
|
3802
4143
|
|
|
@@ -3808,6 +4149,7 @@ export declare const useId: () => string;
|
|
|
3808
4149
|
* NOTE: `useLexicalScope` method can only be used in the synchronous portion of the callback
|
|
3809
4150
|
* (before any `await` statements.)
|
|
3810
4151
|
*
|
|
4152
|
+
* @deprecated Use `_captures` instead.
|
|
3811
4153
|
* @internal
|
|
3812
4154
|
*/
|
|
3813
4155
|
export declare const useLexicalScope: <VARS extends any[]>() => VARS;
|
|
@@ -3818,6 +4160,8 @@ export declare const useLexicalScope: <VARS extends any[]>() => VARS;
|
|
|
3818
4160
|
* Used to programmatically add event listeners. Useful from custom `use*` methods, which do not
|
|
3819
4161
|
* have access to the JSX. Otherwise, it's adding a JSX listener in the `<div>` is a better idea.
|
|
3820
4162
|
*
|
|
4163
|
+
* Events are case sensitive.
|
|
4164
|
+
*
|
|
3821
4165
|
* @public
|
|
3822
4166
|
* @see `useOn`, `useOnWindow`, `useOnDocument`.
|
|
3823
4167
|
*/
|
|
@@ -3829,6 +4173,8 @@ export declare const useOn: <T extends KnownEventNames>(event: T | T[], eventQrl
|
|
|
3829
4173
|
* Used to programmatically add event listeners. Useful from custom `use*` methods, which do not
|
|
3830
4174
|
* have access to the JSX.
|
|
3831
4175
|
*
|
|
4176
|
+
* Events are case sensitive.
|
|
4177
|
+
*
|
|
3832
4178
|
* @public
|
|
3833
4179
|
* @see `useOn`, `useOnWindow`, `useOnDocument`.
|
|
3834
4180
|
*
|
|
@@ -3856,6 +4202,8 @@ export declare const useOnDocument: <T extends KnownEventNames>(event: T | T[],
|
|
|
3856
4202
|
* Used to programmatically add event listeners. Useful from custom `use*` methods, which do not
|
|
3857
4203
|
* have access to the JSX.
|
|
3858
4204
|
*
|
|
4205
|
+
* Events are case sensitive.
|
|
4206
|
+
*
|
|
3859
4207
|
* @public
|
|
3860
4208
|
* @see `useOn`, `useOnWindow`, `useOnDocument`.
|
|
3861
4209
|
*
|
|
@@ -3894,45 +4242,15 @@ export declare const useOnWindow: <T extends KnownEventNames>(event: T | T[], ev
|
|
|
3894
4242
|
* Be careful when using a `try/catch` statement in `useResource$`. If you catch the error and don't
|
|
3895
4243
|
* re-throw it (or a new Error), the resource status will never be `rejected`.
|
|
3896
4244
|
*
|
|
3897
|
-
*
|
|
3898
|
-
*
|
|
3899
|
-
*
|
|
3900
|
-
* city name changes.
|
|
3901
|
-
*
|
|
3902
|
-
* ```tsx
|
|
3903
|
-
* const Cmp = component$(() => {
|
|
3904
|
-
* const cityS = useSignal('');
|
|
3905
|
-
*
|
|
3906
|
-
* const weatherResource = useResource$(async ({ track, cleanup }) => {
|
|
3907
|
-
* const cityName = track(cityS);
|
|
3908
|
-
* const abortController = new AbortController();
|
|
3909
|
-
* cleanup(() => abortController.abort('cleanup'));
|
|
3910
|
-
* const res = await fetch(`http://weatherdata.com?city=${cityName}`, {
|
|
3911
|
-
* signal: abortController.signal,
|
|
3912
|
-
* });
|
|
3913
|
-
* const data = await res.json();
|
|
3914
|
-
* return data as { temp: number };
|
|
3915
|
-
* });
|
|
3916
|
-
*
|
|
3917
|
-
* return (
|
|
3918
|
-
* <div>
|
|
3919
|
-
* <input name="city" bind:value={cityS} />
|
|
3920
|
-
* <Resource
|
|
3921
|
-
* value={weatherResource}
|
|
3922
|
-
* onResolved={(weather) => {
|
|
3923
|
-
* return <div>Temperature: {weather.temp}</div>;
|
|
3924
|
-
* }}
|
|
3925
|
-
* />
|
|
3926
|
-
* </div>
|
|
3927
|
-
* );
|
|
3928
|
-
* });
|
|
3929
|
-
* ```
|
|
3930
|
-
*
|
|
4245
|
+
* @deprecated Use `useAsync$` instead, which is more powerful and flexible. `useResource$` is still
|
|
4246
|
+
* available for backward compatibility but it is recommended to migrate to `useAsync$` for new
|
|
4247
|
+
* code and when updating existing code.
|
|
3931
4248
|
* @public
|
|
4249
|
+
* @see useAsync$
|
|
3932
4250
|
* @see Resource
|
|
3933
4251
|
* @see ResourceReturn
|
|
3934
4252
|
*/
|
|
3935
|
-
export declare const useResource$: <T>(
|
|
4253
|
+
export declare const useResource$: <T>(qrl: ResourceFn<T>, opts?: ResourceOptions | undefined) => ResourceReturn<T>;
|
|
3936
4254
|
|
|
3937
4255
|
/** @internal */
|
|
3938
4256
|
export declare const useResourceQrl: <T>(qrl: QRL<ResourceFn<T>>, opts?: ResourceOptions) => ResourceReturn<T>;
|
|
@@ -4001,7 +4319,7 @@ export declare const useResourceQrl: <T>(qrl: QRL<ResourceFn<T>>, opts?: Resourc
|
|
|
4001
4319
|
export declare const useSerializer$: typeof createSerializer$;
|
|
4002
4320
|
|
|
4003
4321
|
/** @internal */
|
|
4004
|
-
export declare const useSerializerQrl: <T, S>(qrl: QRL<SerializerArg<T, S>>) =>
|
|
4322
|
+
export declare const useSerializerQrl: <T, S>(qrl: QRL<SerializerArg<T, S>>) => SerializerSignalImpl<T, S>;
|
|
4005
4323
|
|
|
4006
4324
|
/** @public */
|
|
4007
4325
|
export declare function useServerData<T>(key: string): T | undefined;
|
|
@@ -4015,14 +4333,61 @@ export declare interface UseSignal {
|
|
|
4015
4333
|
<T>(value: T | (() => T)): Signal<T>;
|
|
4016
4334
|
}
|
|
4017
4335
|
|
|
4018
|
-
/**
|
|
4336
|
+
/**
|
|
4337
|
+
* Creates an object with a single reactive `.value` property, that Qwik can track across
|
|
4338
|
+
* serializations.
|
|
4339
|
+
*
|
|
4340
|
+
* Use it to create state for your application. The object has a getter and setter to track reads
|
|
4341
|
+
* and writes of the `.value` property. When the value changes, any functions that read from it will
|
|
4342
|
+
* re-run.
|
|
4343
|
+
*
|
|
4344
|
+
* Prefer `useSignal` over `useStore` when possible, as it is more efficient.
|
|
4345
|
+
*
|
|
4346
|
+
* ### Example
|
|
4347
|
+
*
|
|
4348
|
+
* ```tsx
|
|
4349
|
+
* const Signals = component$(() => {
|
|
4350
|
+
* const counter = useSignal(1);
|
|
4351
|
+
* const text = useSignal('changeme');
|
|
4352
|
+
* const toggle = useSignal(false);
|
|
4353
|
+
*
|
|
4354
|
+
* // useSignal() can also accept a function to calculate the initial value
|
|
4355
|
+
* const state = useSignal(() => {
|
|
4356
|
+
* return expensiveInitialValue();
|
|
4357
|
+
* });
|
|
4358
|
+
*
|
|
4359
|
+
* return (
|
|
4360
|
+
* <div>
|
|
4361
|
+
* <button onClick$={() => counter.value++}>Counter: {counter.value}</button>
|
|
4362
|
+
* {
|
|
4363
|
+
* // pass signal values as the value, the optimizer will make it pass the signal
|
|
4364
|
+
* }
|
|
4365
|
+
* <Child state={state.value} />
|
|
4366
|
+
* {
|
|
4367
|
+
* // signals can be bound to inputs. A property named `bind:x` implies that the property
|
|
4368
|
+
* is a signal
|
|
4369
|
+
* }
|
|
4370
|
+
* <input type="text" bind:value={text} />
|
|
4371
|
+
* <input type="checkbox" bind:checked={toggle} />
|
|
4372
|
+
* </div>
|
|
4373
|
+
* );
|
|
4374
|
+
* });
|
|
4375
|
+
* ```
|
|
4376
|
+
*
|
|
4377
|
+
* @public
|
|
4378
|
+
*/
|
|
4019
4379
|
export declare const useSignal: UseSignal;
|
|
4020
4380
|
|
|
4021
4381
|
/**
|
|
4022
|
-
* Creates
|
|
4382
|
+
* Creates a reactive object that Qwik can track across serialization.
|
|
4383
|
+
*
|
|
4384
|
+
* Use it to create state for your application. The returned object is a Proxy that tracks reads and
|
|
4385
|
+
* writes. When any of the properties change, the functions that read those properties will re-run.
|
|
4386
|
+
*
|
|
4387
|
+
* `Store`s are deep by default, meaning that any objects assigned to properties will also become
|
|
4388
|
+
* `Store`s. This includes arrays.
|
|
4023
4389
|
*
|
|
4024
|
-
*
|
|
4025
|
-
* unique ID. The ID of the object is used in the `QRL`s to refer to the store.
|
|
4390
|
+
* Prefer `useSignal` over `useStore` when possible, as it is more efficient.
|
|
4026
4391
|
*
|
|
4027
4392
|
* ### Example
|
|
4028
4393
|
*
|
|
@@ -4202,10 +4567,10 @@ export declare const useStylesScopedQrl: (styles: QRL<string>) => UseStylesScope
|
|
|
4202
4567
|
* @public
|
|
4203
4568
|
* @see `Tracker`
|
|
4204
4569
|
*/
|
|
4205
|
-
export declare const useTask$: (fn: TaskFn) => void;
|
|
4570
|
+
export declare const useTask$: (fn: TaskFn, opts?: TaskOptions) => void;
|
|
4206
4571
|
|
|
4207
4572
|
/** @internal */
|
|
4208
|
-
export declare const useTaskQrl: (qrl: QRL<TaskFn
|
|
4573
|
+
export declare const useTaskQrl: (qrl: QRL<TaskFn>, opts?: TaskOptions) => void;
|
|
4209
4574
|
|
|
4210
4575
|
/**
|
|
4211
4576
|
* ```tsx
|
|
@@ -4235,6 +4600,13 @@ export declare const useVisibleTask$: (fn: TaskFn, opts?: OnVisibleTaskOptions)
|
|
|
4235
4600
|
/** @internal */
|
|
4236
4601
|
export declare const useVisibleTaskQrl: (qrl: QRL<TaskFn>, opts?: OnVisibleTaskOptions) => void;
|
|
4237
4602
|
|
|
4603
|
+
/**
|
|
4604
|
+
* Handles events for bind:value
|
|
4605
|
+
*
|
|
4606
|
+
* @internal
|
|
4607
|
+
*/
|
|
4608
|
+
export declare function _val(this: string | undefined, _: any, element: HTMLInputElement): void;
|
|
4609
|
+
|
|
4238
4610
|
/**
|
|
4239
4611
|
* Type representing a value which is either resolve or a promise.
|
|
4240
4612
|
*
|
|
@@ -4249,38 +4621,59 @@ export declare const _VAR_PROPS: unique symbol;
|
|
|
4249
4621
|
export declare const _verifySerializable: <T>(value: T, preMessage?: string) => T;
|
|
4250
4622
|
|
|
4251
4623
|
/**
|
|
4252
|
-
* 2.0.0-beta.
|
|
4624
|
+
* 2.0.0-beta.30-dev+5421ed4
|
|
4253
4625
|
*
|
|
4254
4626
|
* @public
|
|
4255
4627
|
*/
|
|
4256
4628
|
export declare const version: string;
|
|
4257
4629
|
|
|
4258
4630
|
/** @internal */
|
|
4259
|
-
export declare
|
|
4260
|
-
|
|
4261
|
-
|
|
4262
|
-
_VNode | null
|
|
4263
|
-
|
|
4264
|
-
|
|
4265
|
-
/////////////// 2 - Previous sibling
|
|
4266
|
-
_VNode | null,
|
|
4267
|
-
/////////////// 3 - Next sibling
|
|
4268
|
-
_VNode | null,
|
|
4269
|
-
/////////////// 4 - First child
|
|
4270
|
-
_VNode | null,
|
|
4271
|
-
(string | null | boolean)[]
|
|
4272
|
-
] & {
|
|
4273
|
-
__brand__: 'FragmentNode' & 'HostElement';
|
|
4274
|
-
};
|
|
4631
|
+
export declare class _VirtualVNode extends _VNode {
|
|
4632
|
+
key: string | null;
|
|
4633
|
+
firstChild: _VNode | null | undefined;
|
|
4634
|
+
lastChild: _VNode | null | undefined;
|
|
4635
|
+
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);
|
|
4636
|
+
}
|
|
4275
4637
|
|
|
4276
4638
|
/** @public */
|
|
4277
4639
|
export declare type VisibleTaskStrategy = 'intersection-observer' | 'document-ready' | 'document-idle';
|
|
4278
4640
|
|
|
4279
4641
|
/** @internal */
|
|
4280
|
-
export declare
|
|
4642
|
+
export declare abstract class _VNode implements BackRef {
|
|
4643
|
+
flags: _VNodeFlags;
|
|
4644
|
+
parent: _VNode | null;
|
|
4645
|
+
previousSibling: _VNode | null | undefined;
|
|
4646
|
+
nextSibling: _VNode | null | undefined;
|
|
4647
|
+
props: Props | null;
|
|
4648
|
+
[_EFFECT_BACK_REF]: Map<any, any> | undefined;
|
|
4649
|
+
slotParent: _VNode | null;
|
|
4650
|
+
dirty: ChoreBits;
|
|
4651
|
+
dirtyChildren: _VNode[] | null;
|
|
4652
|
+
nextDirtyChildIndex: number;
|
|
4653
|
+
constructor(flags: _VNodeFlags, parent: _VNode | null, previousSibling: _VNode | null | undefined, nextSibling: _VNode | null | undefined, props: Props | null);
|
|
4654
|
+
toString(): string;
|
|
4655
|
+
}
|
|
4656
|
+
|
|
4657
|
+
/** @internal */
|
|
4658
|
+
export declare const _vnode_ensureElementInflated: (container: _Container, vnode: _VNode) => void;
|
|
4659
|
+
|
|
4660
|
+
/** @internal */
|
|
4661
|
+
export declare const _vnode_getAttrKeys: (container: _Container, vnode: _ElementVNode | _VirtualVNode) => string[];
|
|
4662
|
+
|
|
4663
|
+
/** @internal */
|
|
4664
|
+
export declare const _vnode_getFirstChild: (vnode: _VNode) => _VNode | null;
|
|
4281
4665
|
|
|
4282
4666
|
/** @internal */
|
|
4283
|
-
export declare
|
|
4667
|
+
export declare const _vnode_isMaterialized: (vNode: _VNode) => boolean;
|
|
4668
|
+
|
|
4669
|
+
/** @internal */
|
|
4670
|
+
export declare const _vnode_isTextVNode: (vNode: _VNode) => vNode is _TextVNode;
|
|
4671
|
+
|
|
4672
|
+
/** @internal */
|
|
4673
|
+
export declare const _vnode_isVirtualVNode: (vNode: _VNode) => vNode is _VirtualVNode;
|
|
4674
|
+
|
|
4675
|
+
/** @internal */
|
|
4676
|
+
export declare function _vnode_toString(this: _VNode | null, depth?: number, offset?: string, materialize?: boolean, siblings?: boolean, colorize?: boolean, container?: _Container | null): string;
|
|
4284
4677
|
|
|
4285
4678
|
/**
|
|
4286
4679
|
* Array of numbers which describes virtual nodes in the tree.
|
|
@@ -4309,7 +4702,7 @@ export declare function _vnode_toString(this: _VNode | null, depth?: number, off
|
|
|
4309
4702
|
* this data needs to be serialized into a string and stored in the DOM as a script tag which has
|
|
4310
4703
|
* deferent serialization format.
|
|
4311
4704
|
*/
|
|
4312
|
-
declare type VNodeData = [VNodeDataFlag, ...(
|
|
4705
|
+
declare type VNodeData = [VNodeDataFlag, ...(Props | number)[]];
|
|
4313
4706
|
|
|
4314
4707
|
/**
|
|
4315
4708
|
* Flags for VNodeData (Flags con be bitwise combined)
|
|
@@ -4348,40 +4741,26 @@ export declare const enum _VNodeFlags {
|
|
|
4348
4741
|
Element = 1,
|
|
4349
4742
|
Virtual = 2,
|
|
4350
4743
|
ELEMENT_OR_VIRTUAL_MASK = 3,
|
|
4744
|
+
Text = 4,
|
|
4351
4745
|
ELEMENT_OR_TEXT_MASK = 5,
|
|
4352
4746
|
TYPE_MASK = 7,
|
|
4353
4747
|
INFLATED_TYPE_MASK = 15,
|
|
4354
|
-
Text = 4,
|
|
4355
4748
|
Inflated = 8,
|
|
4356
4749
|
Resolved = 16,
|
|
4357
4750
|
Deleted = 32,
|
|
4358
|
-
|
|
4359
|
-
|
|
4751
|
+
HasIterationItems = 64,
|
|
4752
|
+
InflatedIterationItems = 128,
|
|
4753
|
+
Cursor = 256,
|
|
4754
|
+
NAMESPACE_MASK = 1536,
|
|
4755
|
+
NEGATED_NAMESPACE_MASK = -1537,
|
|
4360
4756
|
NS_html = 0,// http://www.w3.org/1999/xhtml
|
|
4361
|
-
NS_svg =
|
|
4362
|
-
NS_math =
|
|
4363
|
-
|
|
4364
|
-
|
|
4365
|
-
declare type VNodeJournal = Array<VNodeJournalOpCode | Document | Element | Text | string | boolean | null>;
|
|
4366
|
-
|
|
4367
|
-
/**
|
|
4368
|
-
* Fundamental DOM operations are:
|
|
4369
|
-
*
|
|
4370
|
-
* - Insert new DOM element/text
|
|
4371
|
-
* - Remove DOM element/text
|
|
4372
|
-
* - Set DOM element attributes
|
|
4373
|
-
* - Set text node value
|
|
4374
|
-
*/
|
|
4375
|
-
declare const enum VNodeJournalOpCode {
|
|
4376
|
-
SetText = 1,// ------ [SetAttribute, target, text]
|
|
4377
|
-
SetAttribute = 2,// - [SetAttribute, target, ...(key, values)]]
|
|
4378
|
-
HoistStyles = 3,// -- [HoistStyles, document]
|
|
4379
|
-
Remove = 4,// ------- [Insert, target(parent), ...nodes]
|
|
4380
|
-
Insert = 5
|
|
4757
|
+
NS_svg = 512,// http://www.w3.org/2000/svg
|
|
4758
|
+
NS_math = 1024,// http://www.w3.org/1998/Math/MathML
|
|
4759
|
+
HasTargetElement = 2048
|
|
4381
4760
|
}
|
|
4382
4761
|
|
|
4383
4762
|
/** @internal */
|
|
4384
|
-
export declare const _waitUntilRendered: (
|
|
4763
|
+
export declare const _waitUntilRendered: (container: _Container) => Promise<void>;
|
|
4385
4764
|
|
|
4386
4765
|
/** @internal */
|
|
4387
4766
|
export declare function _walkJSX(ssr: SSRContainer, value: JSXOutput, options: {
|
|
@@ -4389,9 +4768,6 @@ export declare function _walkJSX(ssr: SSRContainer, value: JSXOutput, options: {
|
|
|
4389
4768
|
parentComponentFrame: ISsrComponentFrame | null;
|
|
4390
4769
|
}): Promise<void>;
|
|
4391
4770
|
|
|
4392
|
-
/** @internal */
|
|
4393
|
-
export declare const _weakSerialize: <T extends object>(input: T) => Partial<T>;
|
|
4394
|
-
|
|
4395
4771
|
/**
|
|
4396
4772
|
* Override the `getLocale` with `lang` within the `fn` execution.
|
|
4397
4773
|
*
|
|
@@ -4399,27 +4775,24 @@ export declare const _weakSerialize: <T extends object>(input: T) => Partial<T>;
|
|
|
4399
4775
|
*/
|
|
4400
4776
|
export declare function withLocale<T>(locale: string, fn: () => T): T;
|
|
4401
4777
|
|
|
4778
|
+
declare type WrappedProp<T extends object, P extends keyof T> = T extends Signal ? WrappedSignalImpl<PropType<T, P>> : PropType<T, P>;
|
|
4779
|
+
|
|
4402
4780
|
declare const enum WrappedSignalFlags {
|
|
4403
|
-
UNWRAP =
|
|
4781
|
+
UNWRAP = 4
|
|
4404
4782
|
}
|
|
4405
4783
|
|
|
4406
|
-
declare class WrappedSignalImpl<T> extends SignalImpl<T>
|
|
4784
|
+
declare class WrappedSignalImpl<T> extends SignalImpl<T> {
|
|
4407
4785
|
$args$: any[];
|
|
4408
4786
|
$func$: (...args: any[]) => T;
|
|
4409
4787
|
$funcStr$: string | null;
|
|
4410
4788
|
$flags$: AllSignalFlags;
|
|
4411
|
-
$hostElement$: HostElement |
|
|
4412
|
-
|
|
4413
|
-
[
|
|
4414
|
-
|
|
4415
|
-
$invalidate$(): void;
|
|
4416
|
-
/**
|
|
4417
|
-
* Use this to force running subscribers, for example when the calculated value has mutated but
|
|
4418
|
-
* remained the same object.
|
|
4419
|
-
*/
|
|
4420
|
-
force(): void;
|
|
4789
|
+
$hostElement$: HostElement | undefined;
|
|
4790
|
+
[_EFFECT_BACK_REF]: Map<EffectProperty | string, EffectSubscription> | undefined;
|
|
4791
|
+
constructor(container: _Container | null, fn: (...args: any[]) => T, args: any[], fnStr: string | null, flags?: SignalFlags);
|
|
4792
|
+
invalidate(): void;
|
|
4421
4793
|
get untrackedValue(): T;
|
|
4422
|
-
$computeIfNeeded$():
|
|
4794
|
+
$computeIfNeeded$(): void;
|
|
4795
|
+
$unwrapIfSignal$(): SignalImpl<T> | WrappedSignalImpl<T>;
|
|
4423
4796
|
set value(_: any);
|
|
4424
4797
|
get value(): any;
|
|
4425
4798
|
}
|
|
@@ -4435,12 +4808,9 @@ declare class WrappedSignalImpl<T> extends SignalImpl<T> implements BackRef {
|
|
|
4435
4808
|
*
|
|
4436
4809
|
* @internal
|
|
4437
4810
|
*/
|
|
4438
|
-
export declare const _wrapProp: <T extends
|
|
4811
|
+
export declare const _wrapProp: <T extends object, P extends keyof T>(...args: [T, P?]) => WrappedProp<T, P>;
|
|
4439
4812
|
|
|
4440
4813
|
/** @internal @deprecated v1 compat */
|
|
4441
|
-
export declare const _wrapSignal: <T extends
|
|
4442
|
-
|
|
4443
|
-
/** @internal */
|
|
4444
|
-
export declare const _wrapStore: <T extends Record<any, any>, P extends keyof T>(obj: T, prop: P) => Signal<T>;
|
|
4814
|
+
export declare const _wrapSignal: <T extends object, P extends keyof T>(obj: T, prop: P) => T[P] | WrappedProp<T, P>;
|
|
4445
4815
|
|
|
4446
4816
|
export { }
|