@qwik.dev/core 2.0.0-beta.2 → 2.0.0-beta.23
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/bindings/qwik.darwin-arm64.node +0 -0
- package/bindings/qwik.linux-x64-gnu.node +0 -0
- package/bindings/qwik.win32-x64-msvc.node +0 -0
- package/bindings/qwik_wasm_bg.wasm +0 -0
- 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 +12953 -0
- package/dist/core-internal.d.ts +894 -511
- package/dist/core.min.mjs +1 -1
- package/dist/core.mjs +10207 -8327
- package/dist/core.mjs.map +1 -1
- package/dist/core.prod.mjs +5848 -4637
- package/dist/insights/vite/index.mjs +10 -10
- package/dist/loader/index.mjs +2 -2
- package/dist/loader/package.json +1 -1
- package/dist/optimizer.d.ts +16 -38
- package/dist/optimizer.mjs +2607 -3719
- package/dist/preloader.mjs +8 -11
- package/dist/qwikloader.debug.js +152 -132
- package/dist/qwikloader.js +1 -1
- package/dist/server.d.ts +38 -15
- package/dist/server.mjs +1224 -927
- 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 +3 -2
- 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 +3 -2
- 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 +23 -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/playwright/playwright-report/index.html +953 -930
- 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 +809 -6
- package/dist/testing/index.mjs +14880 -11342
- package/dist/testing/package.json +1 -1
- package/handlers.mjs +1 -1
- package/package.json +30 -55
- package/public.d.ts +3 -1
- package/{qwik-cli.cjs → qwik-cli.mjs} +1 -1
- package/server.d.ts +2 -0
- package/bindings/qwik.darwin-x64.node +0 -0
- package/bindings/qwik.wasm.cjs +0 -471
- 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 -11754
- package/dist/core.cjs.map +0 -1
- package/dist/core.prod.cjs +0 -5647
- 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 -3027
- 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/tailwind/.prettierrc.js +0 -3
- package/dist/testing/index.cjs +0 -33287
- /package/dist/starters/adapters/{static → ssg}/README.md +0 -0
package/dist/core-internal.d.ts
CHANGED
|
@@ -2,10 +2,6 @@ import * 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 { QRL as QRL_2 } from './qrl.public';
|
|
6
|
-
import { ReadonlySignal as ReadonlySignal_2 } from '..';
|
|
7
|
-
import type { StreamWriter as StreamWriter_2 } from '.';
|
|
8
|
-
import { ValueOrPromise as ValueOrPromise_2 } from '..';
|
|
9
5
|
|
|
10
6
|
/**
|
|
11
7
|
* Qwik Optimizer marker function.
|
|
@@ -83,23 +79,20 @@ import { ValueOrPromise as ValueOrPromise_2 } from '..';
|
|
|
83
79
|
*/
|
|
84
80
|
export declare const $: <T>(expression: T) => QRL<T>;
|
|
85
81
|
|
|
82
|
+
declare interface AddRootFn {
|
|
83
|
+
(obj: unknown, returnRef?: never): number;
|
|
84
|
+
(obj: unknown, returnRef: true): SeenRef;
|
|
85
|
+
}
|
|
86
|
+
|
|
86
87
|
declare type AllEventKeys = keyof AllEventsMap;
|
|
87
88
|
|
|
88
|
-
declare type AllEventMapRaw =
|
|
89
|
-
qidle: QwikIdleEvent;
|
|
90
|
-
qinit: QwikInitEvent;
|
|
91
|
-
qsymbol: QwikSymbolEvent;
|
|
92
|
-
qvisible: QwikVisibleEvent;
|
|
93
|
-
qviewtransition: QwikViewTransitionEvent;
|
|
94
|
-
};
|
|
89
|
+
declare type AllEventMapRaw = QwikHTMLElementEventMap & QwikDocumentEventMap & QwikWindowEventMap;
|
|
95
90
|
|
|
96
91
|
declare type AllEventsMap = Omit<AllEventMapRaw, keyof EventCorrectionMap> & EventCorrectionMap;
|
|
97
92
|
|
|
98
93
|
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
94
|
|
|
100
|
-
declare type
|
|
101
|
-
|
|
102
|
-
declare type AllSignalFlags = SignalFlags | WrappedSignalFlags;
|
|
95
|
+
declare type AllSignalFlags = SignalFlags | WrappedSignalFlags | SerializationSignalFlags | AsyncSignalFlags;
|
|
103
96
|
|
|
104
97
|
/**
|
|
105
98
|
* TS defines these with the React syntax which is not compatible with Qwik. E.g. `ariaAtomic`
|
|
@@ -357,22 +350,188 @@ declare interface AriaAttributes {
|
|
|
357
350
|
/** @public */
|
|
358
351
|
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
352
|
|
|
360
|
-
declare type
|
|
353
|
+
declare type AsyncCtx<T = unknown> = {
|
|
361
354
|
track: Tracker;
|
|
362
|
-
|
|
355
|
+
/**
|
|
356
|
+
* Register a cleanup callback to be called when the async computation is aborted or completed.
|
|
357
|
+
* The next invocation will await the previous cleanup. If you do not want this, do not return a
|
|
358
|
+
* Promise.
|
|
359
|
+
*/
|
|
360
|
+
cleanup: (callback: () => void | Promise<void>) => void;
|
|
361
|
+
/**
|
|
362
|
+
* A lazily created AbortSignal, for interrupting the async computation when needed, e.g. when the
|
|
363
|
+
* component is unmounted or the computation is invalidated. Pass it to `fetch` or other APIs that
|
|
364
|
+
* support it to ensure that unnecessary work is not performed.
|
|
365
|
+
*/
|
|
366
|
+
readonly abortSignal: AbortSignal;
|
|
367
|
+
/** The result of the previous computation, if any */
|
|
368
|
+
readonly previous: T | undefined;
|
|
363
369
|
};
|
|
364
370
|
|
|
365
|
-
/**
|
|
366
|
-
|
|
371
|
+
/**
|
|
372
|
+
* Note, we don't pass the generic type to AsyncCtx because it causes TypeScript to not infer the
|
|
373
|
+
* type of the resource correctly. The type is only used for the `previous` property, which is not
|
|
374
|
+
* commonly used, and can be easily cast if needed.
|
|
375
|
+
*
|
|
376
|
+
* @public
|
|
377
|
+
*/
|
|
378
|
+
export declare type AsyncFn<T> = (ctx: AsyncCtx) => ValueOrPromise<T>;
|
|
379
|
+
|
|
380
|
+
/** Retains job metadata and also serves as the argument for the compute function */
|
|
381
|
+
declare class AsyncJob<T> implements AsyncCtx<T> {
|
|
382
|
+
readonly $signal$: AsyncSignalImpl<T>;
|
|
383
|
+
/** First holds the compute promise and then the cleanup promise */
|
|
384
|
+
$promise$: Promise<void> | null;
|
|
385
|
+
$cleanupRequested$: boolean;
|
|
386
|
+
$canWrite$: boolean;
|
|
387
|
+
$track$: AsyncCtx<T>['track'] | undefined;
|
|
388
|
+
$cleanups$: Parameters<AsyncCtx<T>['cleanup']>[0][] | undefined;
|
|
389
|
+
$abortController$: AbortController | undefined;
|
|
390
|
+
constructor($signal$: AsyncSignalImpl<T>);
|
|
391
|
+
get track(): AsyncCtx<T>['track'];
|
|
392
|
+
get abortSignal(): AbortSignal;
|
|
393
|
+
/** Backward compatible cache method for resource */
|
|
394
|
+
cache(): void;
|
|
395
|
+
get previous(): T | undefined;
|
|
396
|
+
cleanup(callback: () => void): void;
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
declare type AsyncQRL<T> = _QRLInternal<AsyncFn<T>>;
|
|
367
400
|
|
|
368
401
|
/** @public */
|
|
369
|
-
export declare interface
|
|
402
|
+
export declare interface AsyncSignal<T = unknown> extends ComputedSignal<T> {
|
|
403
|
+
/**
|
|
404
|
+
* Whether the signal is currently loading. This will trigger lazy loading of the signal, so you
|
|
405
|
+
* can use it like this:
|
|
406
|
+
*
|
|
407
|
+
* ```tsx
|
|
408
|
+
* signal.loading ? <Loading /> : signal.error ? <Error /> : <Component
|
|
409
|
+
* value={signal.value} />
|
|
410
|
+
* ```
|
|
411
|
+
*/
|
|
412
|
+
loading: boolean;
|
|
413
|
+
/**
|
|
414
|
+
* The error that occurred while computing the signal, if any. This will be cleared when the
|
|
415
|
+
* signal is successfully computed.
|
|
416
|
+
*/
|
|
417
|
+
error: Error | undefined;
|
|
418
|
+
/**
|
|
419
|
+
* Poll interval in ms. Writable and immediately effective when the signal has consumers. If set
|
|
420
|
+
* to `0`, polling stops.
|
|
421
|
+
*/
|
|
422
|
+
interval: number;
|
|
423
|
+
/** A promise that resolves when the value is computed or rejected. */
|
|
424
|
+
promise(): Promise<void>;
|
|
425
|
+
/** Abort the current computation and run cleanups if needed. */
|
|
426
|
+
abort(reason?: any): void;
|
|
370
427
|
}
|
|
371
428
|
|
|
372
|
-
|
|
373
|
-
|
|
429
|
+
declare const enum AsyncSignalFlags {
|
|
430
|
+
EAGER_CLEANUP = 32,
|
|
431
|
+
AWAIT_PREVIOUS = 64
|
|
432
|
+
}
|
|
374
433
|
|
|
375
|
-
|
|
434
|
+
/**
|
|
435
|
+
* # ================================
|
|
436
|
+
*
|
|
437
|
+
* AsyncSignalImpl
|
|
438
|
+
*
|
|
439
|
+
* # ================================
|
|
440
|
+
*/
|
|
441
|
+
declare class AsyncSignalImpl<T> extends ComputedSignalImpl<T, AsyncQRL<T>> implements BackRef, AsyncSignal<T> {
|
|
442
|
+
$untrackedLoading$: boolean;
|
|
443
|
+
$untrackedError$: Error | undefined;
|
|
444
|
+
$loadingEffects$: undefined | Set<EffectSubscription>;
|
|
445
|
+
$errorEffects$: undefined | Set<EffectSubscription>;
|
|
446
|
+
$current$: AsyncJob<T> | null;
|
|
447
|
+
$jobs$: AsyncJob<T>[];
|
|
448
|
+
$concurrency$: number;
|
|
449
|
+
$interval$: number;
|
|
450
|
+
$pollTimeoutId$: ReturnType<typeof setTimeout> | undefined;
|
|
451
|
+
$timeoutMs$: number | undefined;
|
|
452
|
+
$computationTimeoutId$: ReturnType<typeof setTimeout> | undefined;
|
|
453
|
+
[_EFFECT_BACK_REF]: Map<EffectProperty | string, EffectSubscription> | undefined;
|
|
454
|
+
constructor(container: _Container | null, fn: AsyncQRL<T>, flags?: SignalFlags | SerializationSignalFlags, options?: AsyncSignalOptions<T>);
|
|
455
|
+
/**
|
|
456
|
+
* Loading is true if the signal is still waiting for the promise to resolve, false if the promise
|
|
457
|
+
* has resolved or rejected.
|
|
458
|
+
*
|
|
459
|
+
* Accessing .loading will trigger computation if needed, since it's often used like
|
|
460
|
+
* `signal.loading ? <Loading /> : signal.value`.
|
|
461
|
+
*/
|
|
462
|
+
get loading(): boolean;
|
|
463
|
+
set untrackedLoading(value: boolean);
|
|
464
|
+
get untrackedLoading(): boolean;
|
|
465
|
+
/** The error that occurred when the signal was resolved. */
|
|
466
|
+
get error(): Error | undefined;
|
|
467
|
+
set untrackedError(value: Error | undefined);
|
|
468
|
+
get untrackedError(): Error | undefined;
|
|
469
|
+
get interval(): number;
|
|
470
|
+
set interval(value: number);
|
|
471
|
+
/** Invalidates the signal, causing it to re-compute its value. */
|
|
472
|
+
invalidate(): Promise<void>;
|
|
473
|
+
/** Abort the current computation and run cleanups if needed. */
|
|
474
|
+
abort(reason?: any): void;
|
|
475
|
+
/** Schedule eager cleanup on next macro task if no subscribers remain. */
|
|
476
|
+
$scheduleEagerCleanup$(): void;
|
|
477
|
+
/** Returns a promise resolves when the signal finished computing. */
|
|
478
|
+
promise(): Promise<void>;
|
|
479
|
+
/** Run the computation if needed */
|
|
480
|
+
$computeIfNeeded$(): void;
|
|
481
|
+
$runComputation$(running: AsyncJob<T>): Promise<void>;
|
|
482
|
+
/** Called after SSR/unmount */
|
|
483
|
+
$destroy$(): Promise<void>;
|
|
484
|
+
get untrackedValue(): T;
|
|
485
|
+
private $clearNextPoll$;
|
|
486
|
+
private $scheduleNextPoll$;
|
|
487
|
+
private $hasSubscribers$;
|
|
488
|
+
$requestCleanups$(job: AsyncJob<T>, reason?: any): Promise<void | null>;
|
|
489
|
+
/** Clean up and trigger signal compute once complete */
|
|
490
|
+
$runCleanups$(job: AsyncJob<T>): Promise<void>;
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
/** @public */
|
|
494
|
+
export declare interface AsyncSignalOptions<T> extends ComputedOptions {
|
|
495
|
+
/** Like useSignal's `initial`; prevents the throw on first read when uninitialized */
|
|
496
|
+
initial?: T | (() => T);
|
|
497
|
+
/**
|
|
498
|
+
* Maximum number of concurrent computations. Use `0` for unlimited.
|
|
499
|
+
*
|
|
500
|
+
* Defaults to `1`.
|
|
501
|
+
*/
|
|
502
|
+
concurrency?: number;
|
|
503
|
+
/**
|
|
504
|
+
* When subscribers drop to 0, run cleanup in the next tick, instead of waiting for the function
|
|
505
|
+
* inputs to change.
|
|
506
|
+
*
|
|
507
|
+
* Defaults to `false`, meaning cleanup happens only when inputs change.
|
|
508
|
+
*/
|
|
509
|
+
eagerCleanup?: boolean;
|
|
510
|
+
/**
|
|
511
|
+
* Wait for previous invocation to complete before running again.
|
|
512
|
+
*
|
|
513
|
+
* Defaults to `true`.
|
|
514
|
+
*
|
|
515
|
+
* @deprecated Not implemented yet
|
|
516
|
+
*/
|
|
517
|
+
awaitPrevious?: boolean;
|
|
518
|
+
/**
|
|
519
|
+
* In the browser, re-run the function after `interval` ms if subscribers exist, even when no
|
|
520
|
+
* input state changed. If `0`, does not poll.
|
|
521
|
+
*
|
|
522
|
+
* Defaults to `0`.
|
|
523
|
+
*/
|
|
524
|
+
interval?: number;
|
|
525
|
+
/**
|
|
526
|
+
* Maximum time in milliseconds to wait for the async computation to complete. If exceeded, the
|
|
527
|
+
* computation is aborted and an error is thrown.
|
|
528
|
+
*
|
|
529
|
+
* If `0`, no timeout is applied.
|
|
530
|
+
*
|
|
531
|
+
* Defaults to `0`.
|
|
532
|
+
*/
|
|
533
|
+
timeout?: number;
|
|
534
|
+
}
|
|
376
535
|
|
|
377
536
|
/**
|
|
378
537
|
* Replace given element's props with custom types and return all props specific to the element. Use
|
|
@@ -384,7 +543,7 @@ declare type Augmented<E, A = {}> = Prettify<Filtered<E, A> & A>;
|
|
|
384
543
|
|
|
385
544
|
/** Class for back reference to the EffectSubscription */
|
|
386
545
|
declare abstract class BackRef {
|
|
387
|
-
[_EFFECT_BACK_REF]: Map<
|
|
546
|
+
[_EFFECT_BACK_REF]: Map<any, any> | undefined;
|
|
388
547
|
}
|
|
389
548
|
|
|
390
549
|
declare type BivariantQrlFn<ARGS extends any[], RETURN> = {
|
|
@@ -400,21 +559,32 @@ declare type BivariantQrlFn<ARGS extends any[], RETURN> = {
|
|
|
400
559
|
/** @public */
|
|
401
560
|
declare type Booleanish = boolean | `${boolean}`;
|
|
402
561
|
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
562
|
+
/**
|
|
563
|
+
* The current captured scope during QRL invocation. This is used to provide the lexical scope for
|
|
564
|
+
* QRL functions. It is used one time per invocation, synchronously, so it is safe to store it in
|
|
565
|
+
* module scope.
|
|
566
|
+
*
|
|
567
|
+
* @internal
|
|
568
|
+
*/
|
|
569
|
+
export declare let _captures: Readonly<unknown[]> | null;
|
|
570
|
+
|
|
571
|
+
/**
|
|
572
|
+
* Handles events for bind:checked
|
|
573
|
+
*
|
|
574
|
+
* @internal
|
|
575
|
+
*/
|
|
576
|
+
export declare function _chk(this: string | undefined, _: any, element: HTMLInputElement): void;
|
|
577
|
+
|
|
578
|
+
declare const enum ChoreBits {
|
|
579
|
+
NONE = 0,
|
|
580
|
+
TASKS = 1,
|
|
581
|
+
NODE_DIFF = 2,
|
|
582
|
+
COMPONENT = 4,
|
|
583
|
+
NODE_PROPS = 8,
|
|
584
|
+
COMPUTE = 16,
|
|
585
|
+
CHILDREN = 32,
|
|
586
|
+
CLEANUP = 64,
|
|
587
|
+
DIRTY_MASK = 127
|
|
418
588
|
}
|
|
419
589
|
|
|
420
590
|
/**
|
|
@@ -430,17 +600,14 @@ declare const enum ChoreType {
|
|
|
430
600
|
export declare type ClassList = string | undefined | null | false | Record<string, boolean | string | number | null | undefined> | ClassList[];
|
|
431
601
|
|
|
432
602
|
/** @internal */
|
|
433
|
-
export declare interface ClientContainer extends
|
|
603
|
+
export declare interface ClientContainer extends _Container {
|
|
434
604
|
document: _QDocument;
|
|
435
605
|
element: _ContainerElement;
|
|
436
606
|
qContainer: string;
|
|
437
607
|
$locale$: string;
|
|
438
608
|
qManifestHash: string;
|
|
439
609
|
rootVNode: _ElementVNode;
|
|
440
|
-
$journal$: VNodeJournal;
|
|
441
|
-
renderDone: Promise<void> | null;
|
|
442
610
|
$forwardRefs$: Array<number> | null;
|
|
443
|
-
$initialQRLsIndexes$: Array<number> | null;
|
|
444
611
|
parseQRL<T = unknown>(qrl: string): QRL<T>;
|
|
445
612
|
$setRawState$(id: number, vParent: _ElementVNode | _VirtualVNode): void;
|
|
446
613
|
}
|
|
@@ -468,11 +635,11 @@ export declare interface ClientContainer extends Container {
|
|
|
468
635
|
* step?: number;
|
|
469
636
|
* }
|
|
470
637
|
* export const Counter = component$((props: CounterProps) => {
|
|
471
|
-
* const state =
|
|
638
|
+
* const state = useSignal(props.initialValue || 0);
|
|
472
639
|
* return (
|
|
473
640
|
* <div>
|
|
474
|
-
* <span>{state.
|
|
475
|
-
* <button onClick$={() => (state.
|
|
641
|
+
* <span>{state.value}</span>
|
|
642
|
+
* <button onClick$={() => (state.value += props.step || 1)}>+</button>
|
|
476
643
|
* </div>
|
|
477
644
|
* );
|
|
478
645
|
* });
|
|
@@ -540,7 +707,13 @@ export declare const componentQrl: <PROPS extends Record<any, any>>(componentQrl
|
|
|
540
707
|
export declare type ComputedFn<T> = () => T;
|
|
541
708
|
|
|
542
709
|
/** @public */
|
|
543
|
-
export declare
|
|
710
|
+
export declare interface ComputedOptions {
|
|
711
|
+
serializationStrategy?: SerializationStrategy;
|
|
712
|
+
container?: _Container;
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
/** @public */
|
|
716
|
+
export declare type ComputedReturnType<T> = T extends Promise<any> ? never : ComputedSignal<T>;
|
|
544
717
|
|
|
545
718
|
/**
|
|
546
719
|
* A computed signal is a signal which is calculated from other signals. When the signals change,
|
|
@@ -551,10 +724,15 @@ export declare type ComputedReturnType<T> = T extends Promise<any> ? never : Rea
|
|
|
551
724
|
*/
|
|
552
725
|
export declare interface ComputedSignal<T> extends ReadonlySignal<T> {
|
|
553
726
|
/**
|
|
554
|
-
* Use this to force
|
|
555
|
-
*
|
|
727
|
+
* Use this to force running subscribers, for example when the calculated value mutates but
|
|
728
|
+
* remains the same object.
|
|
556
729
|
*/
|
|
557
730
|
force(): void;
|
|
731
|
+
/**
|
|
732
|
+
* Use this to force recalculation and running subscribers, for example when the calculated value
|
|
733
|
+
* mutates but remains the same object.
|
|
734
|
+
*/
|
|
735
|
+
invalidate(): void;
|
|
558
736
|
}
|
|
559
737
|
|
|
560
738
|
/**
|
|
@@ -562,7 +740,7 @@ export declare interface ComputedSignal<T> extends ReadonlySignal<T> {
|
|
|
562
740
|
*
|
|
563
741
|
* The value is available synchronously, but the computation is done lazily.
|
|
564
742
|
*/
|
|
565
|
-
declare class ComputedSignalImpl<T, S extends
|
|
743
|
+
declare class ComputedSignalImpl<T, S extends _QRLInternal = ComputeQRL<T>> extends SignalImpl<T> implements BackRef {
|
|
566
744
|
/**
|
|
567
745
|
* The compute function is stored here.
|
|
568
746
|
*
|
|
@@ -570,23 +748,15 @@ declare class ComputedSignalImpl<T, S extends QRLInternal = ComputeQRL<T>> exten
|
|
|
570
748
|
* resolve the QRL during the mark dirty phase so that any call to it will be synchronous). )
|
|
571
749
|
*/
|
|
572
750
|
$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;
|
|
751
|
+
$flags$: SignalFlags | SerializationSignalFlags;
|
|
752
|
+
[_EFFECT_BACK_REF]: Map<EffectProperty | string, EffectSubscription> | undefined;
|
|
753
|
+
constructor(container: _Container | null, fn: S, flags?: SignalFlags | SerializationSignalFlags);
|
|
754
|
+
invalidate(): void;
|
|
583
755
|
get untrackedValue(): T;
|
|
584
|
-
$computeIfNeeded$():
|
|
585
|
-
set value(_: any);
|
|
586
|
-
get value(): any;
|
|
756
|
+
$computeIfNeeded$(): void;
|
|
587
757
|
}
|
|
588
758
|
|
|
589
|
-
declare type ComputeQRL<T> =
|
|
759
|
+
declare type ComputeQRL<T> = _QRLInternal<ComputedFn<T>>;
|
|
590
760
|
|
|
591
761
|
/** @internal */
|
|
592
762
|
export declare const _CONST_PROPS: unique symbol;
|
|
@@ -600,18 +770,22 @@ export declare const _CONST_PROPS: unique symbol;
|
|
|
600
770
|
* - `VNode` and `ISsrNode`: Either a component or `<Signal>`
|
|
601
771
|
* - `Signal2`: A derived signal which contains a computation function.
|
|
602
772
|
*/
|
|
603
|
-
declare type Consumer = Task | _VNode |
|
|
773
|
+
declare type Consumer = Task | _VNode | SignalImpl | ISsrNode;
|
|
604
774
|
|
|
605
|
-
|
|
775
|
+
/** @internal */
|
|
776
|
+
export declare interface _Container {
|
|
606
777
|
readonly $version$: string;
|
|
607
|
-
readonly $scheduler$: Scheduler;
|
|
608
778
|
readonly $storeProxyMap$: ObjToProxyMap;
|
|
609
779
|
readonly $locale$: string;
|
|
610
780
|
readonly $getObjectById$: (id: number | string) => any;
|
|
611
781
|
readonly $serverData$: Record<string, any>;
|
|
612
782
|
$currentUniqueId$: number;
|
|
613
783
|
$buildBase$: string | null;
|
|
614
|
-
|
|
784
|
+
$renderPromise$: Promise<void> | null;
|
|
785
|
+
$resolveRenderPromise$: (() => void) | null;
|
|
786
|
+
$pendingCount$: number;
|
|
787
|
+
$checkPendingCount$(): void;
|
|
788
|
+
handleError(err: any, $host$: HostElement | null): void;
|
|
615
789
|
getParentHost(host: HostElement): HostElement | null;
|
|
616
790
|
setContext<T>(host: HostElement, context: ContextId<T>, value: T): void;
|
|
617
791
|
resolveContext<T>(host: HostElement, contextId: ContextId<T>): T | undefined;
|
|
@@ -755,19 +929,13 @@ export declare interface CorePlatform {
|
|
|
755
929
|
* @param symbol - The name of the symbol to import.
|
|
756
930
|
* @returns A promise that resolves to the imported symbol.
|
|
757
931
|
*/
|
|
758
|
-
importSymbol: (containerEl: Element | undefined, url: string | URL | undefined | null, symbol: string) => ValueOrPromise<
|
|
932
|
+
importSymbol: (containerEl: Element | undefined, url: string | URL | undefined | null, symbol: string) => ValueOrPromise<unknown>;
|
|
759
933
|
/**
|
|
760
934
|
* Perform operation on next request-animation-frame.
|
|
761
935
|
*
|
|
762
936
|
* @param fn - The function to call when the next animation frame is ready.
|
|
763
937
|
*/
|
|
764
938
|
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
939
|
/**
|
|
772
940
|
* Retrieve chunk name for the symbol.
|
|
773
941
|
*
|
|
@@ -789,6 +957,17 @@ export declare interface CorrectedToggleEvent extends Event {
|
|
|
789
957
|
readonly prevState: 'open' | 'closed';
|
|
790
958
|
}
|
|
791
959
|
|
|
960
|
+
/**
|
|
961
|
+
* Create a signal holding a `.value` which is calculated from the given async function (QRL). The
|
|
962
|
+
* standalone version of `useAsync$`.
|
|
963
|
+
*
|
|
964
|
+
* @public
|
|
965
|
+
*/
|
|
966
|
+
export declare const createAsync$: <T>(qrl: (arg: AsyncCtx<T>) => Promise<T>, options?: AsyncSignalOptions<T>) => AsyncSignal<T>;
|
|
967
|
+
|
|
968
|
+
/** @internal */
|
|
969
|
+
export declare const createAsyncQrl: <T>(qrl: QRL<AsyncFn<T>>, options?: AsyncSignalOptions<T>) => AsyncSignalImpl<T>;
|
|
970
|
+
|
|
792
971
|
/**
|
|
793
972
|
* Create a computed signal which is calculated from the given QRL. A computed signal is a signal
|
|
794
973
|
* which is calculated from other signals. When the signals change, the computed signal is
|
|
@@ -797,14 +976,14 @@ export declare interface CorrectedToggleEvent extends Event {
|
|
|
797
976
|
* The QRL must be a function which returns the value of the signal. The function must not have side
|
|
798
977
|
* effects, and it must be synchronous.
|
|
799
978
|
*
|
|
800
|
-
* If you need the function to be async, use `
|
|
979
|
+
* If you need the function to be async, use `createAsync$` instead (don't forget to use `track()`).
|
|
801
980
|
*
|
|
802
981
|
* @public
|
|
803
982
|
*/
|
|
804
|
-
export declare const createComputed$: <T>(qrl: () => T) =>
|
|
983
|
+
export declare const createComputed$: <T>(qrl: () => T, options?: ComputedOptions) => ComputedReturnType<T>;
|
|
805
984
|
|
|
806
985
|
/** @internal */
|
|
807
|
-
export declare const createComputedQrl: <T>(qrl: QRL<() => T
|
|
986
|
+
export declare const createComputedQrl: <T>(qrl: QRL<() => T>, options?: ComputedOptions) => ComputedSignalImpl<T>;
|
|
808
987
|
|
|
809
988
|
/**
|
|
810
989
|
* Create a context ID to be used in your application. The name should be written with no spaces.
|
|
@@ -858,18 +1037,20 @@ export declare const createComputedQrl: <T>(qrl: QRL<() => T>) => ComputedSignal
|
|
|
858
1037
|
*/
|
|
859
1038
|
export declare const createContextId: <STATE = unknown>(name: string) => ContextId<STATE>;
|
|
860
1039
|
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
1040
|
+
/**
|
|
1041
|
+
* Creates a QRL instance to represent a lazily loaded value. Normally this is a function, but it
|
|
1042
|
+
* can be any value.
|
|
1043
|
+
*
|
|
1044
|
+
* When the value is a function, calling the returned qrl will load the underlying code when
|
|
1045
|
+
* invoked, and call it with the captured scope. This always returns a promise since the code may
|
|
1046
|
+
* not be loaded yet.
|
|
1047
|
+
*
|
|
1048
|
+
* To get the underlying function without invoking it, await `qrl.resolve()` and then `qrl.resolved`
|
|
1049
|
+
* holds the loaded function, wrapped with the captured scope.
|
|
1050
|
+
*
|
|
1051
|
+
* @internal
|
|
1052
|
+
*/
|
|
1053
|
+
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) => _QRLInternal<TYPE>;
|
|
873
1054
|
|
|
874
1055
|
/**
|
|
875
1056
|
* Create a signal that holds a custom serializable value. See {@link useSerializer$} for more
|
|
@@ -909,24 +1090,22 @@ export declare interface CSSProperties extends CSS_2.Properties<string | number>
|
|
|
909
1090
|
[v: `--${string}`]: string | number | undefined;
|
|
910
1091
|
}
|
|
911
1092
|
|
|
912
|
-
/** @public */
|
|
913
1093
|
declare interface DescriptorBase<T = unknown, B = unknown> extends BackRef {
|
|
914
1094
|
$flags$: number;
|
|
915
1095
|
$index$: number;
|
|
916
1096
|
$el$: HostElement;
|
|
917
|
-
$qrl$:
|
|
1097
|
+
$qrl$: _QRLInternal<T>;
|
|
918
1098
|
$state$: B | undefined;
|
|
919
|
-
$destroy$:
|
|
1099
|
+
$destroy$: (() => void) | null;
|
|
920
1100
|
}
|
|
921
1101
|
|
|
922
1102
|
/**
|
|
923
1103
|
* Deserialize data from string to an array of objects.
|
|
924
1104
|
*
|
|
925
1105
|
* @param rawStateData - Data to deserialize
|
|
926
|
-
* @param element - Container element
|
|
927
1106
|
* @internal
|
|
928
1107
|
*/
|
|
929
|
-
export declare function _deserialize(rawStateData: string
|
|
1108
|
+
export declare function _deserialize<T>(rawStateData: string): T;
|
|
930
1109
|
|
|
931
1110
|
declare interface DeserializeContainer {
|
|
932
1111
|
$getObjectById$: (id: number | string) => unknown;
|
|
@@ -935,8 +1114,6 @@ declare interface DeserializeContainer {
|
|
|
935
1114
|
$state$?: unknown[];
|
|
936
1115
|
$storeProxyMap$: ObjToProxyMap;
|
|
937
1116
|
$forwardRefs$: Array<number> | null;
|
|
938
|
-
$initialQRLsIndexes$: Array<number> | null;
|
|
939
|
-
readonly $scheduler$: Scheduler | null;
|
|
940
1117
|
}
|
|
941
1118
|
|
|
942
1119
|
/** @public */
|
|
@@ -963,53 +1140,38 @@ declare class DomContainer extends _SharedContainer implements ClientContainer {
|
|
|
963
1140
|
qManifestHash: string;
|
|
964
1141
|
rootVNode: _ElementVNode;
|
|
965
1142
|
document: _QDocument;
|
|
966
|
-
$journal$: VNodeJournal;
|
|
967
|
-
renderDone: Promise<void> | null;
|
|
968
1143
|
$rawStateData$: unknown[];
|
|
969
1144
|
$storeProxyMap$: ObjToProxyMap;
|
|
970
1145
|
$qFuncs$: Array<(...args: unknown[]) => unknown>;
|
|
971
1146
|
$instanceHash$: string;
|
|
972
1147
|
$forwardRefs$: Array<number> | null;
|
|
973
|
-
$initialQRLsIndexes$: Array<number> | null;
|
|
974
1148
|
vNodeLocate: (id: string | Element) => _VNode;
|
|
975
1149
|
private $stateData$;
|
|
976
1150
|
private $styleIds$;
|
|
977
|
-
private $renderCount$;
|
|
978
1151
|
constructor(element: _ContainerElement);
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
1152
|
+
/**
|
|
1153
|
+
* The first time we render we need to hoist the styles. (Meaning we need to move all styles from
|
|
1154
|
+
* component inline to <head>)
|
|
1155
|
+
*
|
|
1156
|
+
* We bulk move all of the styles, because the expensive part is for the browser to recompute the
|
|
1157
|
+
* styles, (not the actual DOM manipulation.) By moving all of them at once we can minimize the
|
|
1158
|
+
* reflow.
|
|
1159
|
+
*/
|
|
1160
|
+
$hoistStyles$(): void;
|
|
1161
|
+
$setRawState$(id: number, vParent: _VNode): void;
|
|
1162
|
+
parseQRL<T = unknown>(qrlStr: string): QRL<T>;
|
|
1163
|
+
handleError(err: any, host: _VNode | null): void;
|
|
1164
|
+
setContext<T>(host: _VNode, context: ContextId<T>, value: T): void;
|
|
1165
|
+
resolveContext<T>(host: _VNode, contextId: ContextId<T>): T | undefined;
|
|
1166
|
+
getParentHost(host: _VNode): _VNode | null;
|
|
985
1167
|
setHostProp<T>(host: HostElement, name: string, value: T): void;
|
|
986
1168
|
getHostProp<T>(host: HostElement, name: string): T | null;
|
|
987
|
-
scheduleRender(): Promise<void>;
|
|
988
|
-
private processChores;
|
|
989
1169
|
ensureProjectionResolved(vNode: _VirtualVNode): void;
|
|
990
1170
|
$getObjectById$: (id: number | string) => unknown;
|
|
991
1171
|
getSyncFn(id: number): (...args: unknown[]) => unknown;
|
|
992
1172
|
$appendStyle$(content: string, styleId: string, host: _VirtualVNode, scoped: boolean): void;
|
|
993
1173
|
/** Set the server data for the Qwik Router. */
|
|
994
1174
|
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
1175
|
}
|
|
1014
1176
|
export { DomContainer }
|
|
1015
1177
|
export { DomContainer as _DomContainer }
|
|
@@ -1065,36 +1227,20 @@ declare const enum EffectProperty {
|
|
|
1065
1227
|
* - `EffectProperty.COMPONENT` if component
|
|
1066
1228
|
* - `EffectProperty.VNODE` if VNode
|
|
1067
1229
|
*/
|
|
1068
|
-
declare
|
|
1069
|
-
Consumer
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
Set<SignalImpl | StoreTarget> | null,
|
|
1074
|
-
|
|
1075
|
-
_SubscriptionData | null
|
|
1076
|
-
];
|
|
1230
|
+
declare class EffectSubscription {
|
|
1231
|
+
consumer: Consumer;
|
|
1232
|
+
property: EffectProperty | string;
|
|
1233
|
+
backRef: Set<SignalImpl | StoreTarget> | null;
|
|
1234
|
+
data: _SubscriptionData | null;
|
|
1235
|
+
constructor(consumer: Consumer, property: EffectProperty | string, backRef?: Set<SignalImpl | StoreTarget> | null, data?: _SubscriptionData | null);
|
|
1236
|
+
}
|
|
1077
1237
|
|
|
1078
1238
|
/** @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
|
-
};
|
|
1239
|
+
export declare class _ElementVNode extends _VirtualVNode {
|
|
1240
|
+
node: Element;
|
|
1241
|
+
elementName: string | undefined;
|
|
1242
|
+
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);
|
|
1243
|
+
}
|
|
1098
1244
|
|
|
1099
1245
|
/** @internal */
|
|
1100
1246
|
export declare const _EMPTY_ARRAY: any[];
|
|
@@ -1108,15 +1254,14 @@ export declare interface ErrorBoundaryStore {
|
|
|
1108
1254
|
}
|
|
1109
1255
|
|
|
1110
1256
|
/** @public */
|
|
1111
|
-
export declare const event$: <T>(qrl: T) =>
|
|
1257
|
+
export declare const event$: <T>(qrl: T) => QRL<T>;
|
|
1112
1258
|
|
|
1113
1259
|
declare type EventCorrectionMap = {
|
|
1114
1260
|
auxclick: PointerEvent;
|
|
1115
|
-
beforetoggle: CorrectedToggleEvent;
|
|
1116
1261
|
click: PointerEvent;
|
|
1117
1262
|
dblclick: PointerEvent;
|
|
1118
1263
|
input: InputEvent;
|
|
1119
|
-
|
|
1264
|
+
qvisible: QwikVisibleEvent;
|
|
1120
1265
|
};
|
|
1121
1266
|
|
|
1122
1267
|
declare type EventFromName<T extends string> = LcEvent<T>;
|
|
@@ -1135,6 +1280,9 @@ declare type EventQRL<T extends string = AllEventKeys> = QRL<EventHandler<EventF
|
|
|
1135
1280
|
/** @internal */
|
|
1136
1281
|
export declare const eventQrl: <T>(qrl: QRL<T>) => QRL<T>;
|
|
1137
1282
|
|
|
1283
|
+
/** @internal */
|
|
1284
|
+
export declare function _executeSsrChores(container: SSRContainer, ssrNode: ISsrNode): ValueOrPromise<void>;
|
|
1285
|
+
|
|
1138
1286
|
declare type FilterBase<T> = {
|
|
1139
1287
|
[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
1288
|
};
|
|
@@ -1147,6 +1295,13 @@ declare type Filtered<T, A = {}> = {
|
|
|
1147
1295
|
/** @internal */
|
|
1148
1296
|
export declare const _fnSignal: <T extends (...args: any) => any>(fn: T, args: Parameters<T>, fnStr?: string) => WrappedSignalImpl<any>;
|
|
1149
1297
|
|
|
1298
|
+
/**
|
|
1299
|
+
* Force a store to recompute and schedule effects.
|
|
1300
|
+
*
|
|
1301
|
+
* @public
|
|
1302
|
+
*/
|
|
1303
|
+
export declare const forceStoreEffects: (value: StoreTarget, prop: keyof StoreTarget) => void;
|
|
1304
|
+
|
|
1150
1305
|
/** @public */
|
|
1151
1306
|
export declare const Fragment: FunctionComponent<{
|
|
1152
1307
|
children?: any;
|
|
@@ -1164,14 +1319,20 @@ export declare type FunctionComponent<P = unknown> = {
|
|
|
1164
1319
|
renderFn(props: P, key: string | null, flags: number, dev?: DevJSX): JSXOutput;
|
|
1165
1320
|
}['renderFn'];
|
|
1166
1321
|
|
|
1322
|
+
/** Used by the optimizer for spread props operations @internal */
|
|
1323
|
+
export declare const _getConstProps: (props: PropsProxy | Record<string, unknown> | null | undefined) => Props | null;
|
|
1324
|
+
|
|
1167
1325
|
/** @internal */
|
|
1168
|
-
export declare const
|
|
1326
|
+
export declare const _getContextContainer: () => _Container | undefined;
|
|
1169
1327
|
|
|
1170
1328
|
/** @internal */
|
|
1171
1329
|
export declare const _getContextEvent: () => unknown;
|
|
1172
1330
|
|
|
1331
|
+
/** @internal */
|
|
1332
|
+
export declare const _getContextHostElement: () => HostElement | undefined;
|
|
1333
|
+
|
|
1173
1334
|
/** @public */
|
|
1174
|
-
declare function getDomContainer(element: Element
|
|
1335
|
+
declare function getDomContainer(element: Element): ClientContainer;
|
|
1175
1336
|
export { getDomContainer as _getDomContainer }
|
|
1176
1337
|
export { getDomContainer }
|
|
1177
1338
|
|
|
@@ -1200,7 +1361,10 @@ export declare function getLocale(defaultLocale?: string): string;
|
|
|
1200
1361
|
export declare const getPlatform: () => CorePlatform;
|
|
1201
1362
|
|
|
1202
1363
|
/** @internal */
|
|
1203
|
-
export declare function _getQContainerElement(element: Element
|
|
1364
|
+
export declare function _getQContainerElement(element: Element): Element | null;
|
|
1365
|
+
|
|
1366
|
+
/** Used by the optimizer for spread props operations @internal */
|
|
1367
|
+
export declare const _getVarProps: (props: PropsProxy | Record<string, unknown> | null | undefined) => Props | null;
|
|
1204
1368
|
|
|
1205
1369
|
/** @public */
|
|
1206
1370
|
declare interface GlobalInjections {
|
|
@@ -1212,10 +1376,8 @@ declare interface GlobalInjections {
|
|
|
1212
1376
|
}
|
|
1213
1377
|
|
|
1214
1378
|
/**
|
|
1215
|
-
* The legacy transform, used
|
|
1216
|
-
*
|
|
1217
|
-
*
|
|
1218
|
-
* Also note that this disables optimizations.
|
|
1379
|
+
* The legacy transform, used by some JSX transpilers. The optimizer normally replaces this with
|
|
1380
|
+
* optimized calls, with the same caveat as `jsx()`.
|
|
1219
1381
|
*
|
|
1220
1382
|
* @public
|
|
1221
1383
|
*/
|
|
@@ -1223,6 +1385,12 @@ declare function h<TYPE extends string | FunctionComponent<PROPS>, PROPS extends
|
|
|
1223
1385
|
export { h as createElement }
|
|
1224
1386
|
export { h }
|
|
1225
1387
|
|
|
1388
|
+
/**
|
|
1389
|
+
* @returns True if the store has effects for the given prop
|
|
1390
|
+
* @internal
|
|
1391
|
+
*/
|
|
1392
|
+
export declare const _hasStoreEffects: (value: StoreTarget, prop: keyof StoreTarget) => boolean;
|
|
1393
|
+
|
|
1226
1394
|
/** @public */
|
|
1227
1395
|
declare interface HoistEntryStrategy {
|
|
1228
1396
|
type: 'hoist';
|
|
@@ -1345,11 +1513,19 @@ export declare const _IMMUTABLE: unique symbol;
|
|
|
1345
1513
|
*/
|
|
1346
1514
|
export declare const implicit$FirstArg: <FIRST, REST extends any[], RET>(fn: (qrl: QRL<FIRST>, ...rest: REST) => RET) => ((qrl: FIRST, ...rest: REST) => RET);
|
|
1347
1515
|
|
|
1348
|
-
/**
|
|
1349
|
-
|
|
1516
|
+
/**
|
|
1517
|
+
* Create an inlined QRL. This is mostly useful on the server side for serialization.
|
|
1518
|
+
*
|
|
1519
|
+
* @param symbol - The object/function to register, or `null` to retrieve a previously registered
|
|
1520
|
+
* one by hash
|
|
1521
|
+
* @param symbolName - The name of the symbol.
|
|
1522
|
+
* @param lexicalScopeCapture - A set of lexically scoped variables to capture.
|
|
1523
|
+
* @public
|
|
1524
|
+
*/
|
|
1525
|
+
export declare const inlinedQrl: <T>(symbol: T | null, symbolName: string, lexicalScopeCapture?: Readonly<unknown[]>) => QRL<T>;
|
|
1350
1526
|
|
|
1351
1527
|
/** @internal */
|
|
1352
|
-
export declare const inlinedQrlDEV: <T = any>(symbol: T, symbolName: string, opts: QRLDev, lexicalScopeCapture?:
|
|
1528
|
+
export declare const inlinedQrlDEV: <T = any>(symbol: T, symbolName: string, opts: QRLDev, lexicalScopeCapture?: Readonly<unknown[]>) => QRL<T>;
|
|
1353
1529
|
|
|
1354
1530
|
/** @public */
|
|
1355
1531
|
declare interface InlineEntryStrategy {
|
|
@@ -1381,24 +1557,15 @@ declare type IntrinsicSVGElements = {
|
|
|
1381
1557
|
|
|
1382
1558
|
/** The shared state during an invoke() call */
|
|
1383
1559
|
declare interface InvokeContext {
|
|
1384
|
-
$url$: URL | undefined;
|
|
1385
|
-
/** The next available index for the sequentialScope array */
|
|
1386
|
-
$i$: number;
|
|
1387
1560
|
/** The Virtual parent component for the current component code */
|
|
1388
1561
|
$hostElement$: HostElement | undefined;
|
|
1389
|
-
/** The current DOM element */
|
|
1390
|
-
$element$: Element | undefined;
|
|
1391
1562
|
/** The event we're currently handling */
|
|
1392
1563
|
$event$: PossibleEvents | undefined;
|
|
1393
|
-
/** The QRL function we're currently executing */
|
|
1394
|
-
$qrl$: QRL | undefined;
|
|
1395
1564
|
$effectSubscriber$: EffectSubscription | undefined;
|
|
1396
1565
|
$locale$: string | undefined;
|
|
1397
|
-
$container$:
|
|
1566
|
+
$container$: _Container | undefined;
|
|
1398
1567
|
}
|
|
1399
1568
|
|
|
1400
|
-
declare type InvokeTuple = [Element, Event, URL?];
|
|
1401
|
-
|
|
1402
1569
|
declare type IsAcceptableDOMValue<T> = T extends boolean | number | string | null | undefined ? ((...args: any[]) => any) extends T ? false : true : false;
|
|
1403
1570
|
|
|
1404
1571
|
declare type IsAny<T> = 0 extends T & 1 ? true : false;
|
|
@@ -1424,11 +1591,11 @@ export declare const isSignal: (value: any) => value is Signal<unknown>;
|
|
|
1424
1591
|
/** @internal */
|
|
1425
1592
|
export declare interface ISsrComponentFrame {
|
|
1426
1593
|
componentNode: ISsrNode;
|
|
1594
|
+
slots: (string | JSXChildren)[];
|
|
1427
1595
|
scopedStyleIds: Set<string>;
|
|
1428
1596
|
projectionScopedStyle: string | null;
|
|
1429
1597
|
projectionComponentFrame: ISsrComponentFrame | null;
|
|
1430
1598
|
projectionDepth: number;
|
|
1431
|
-
releaseUnclaimedProjections(unclaimedProjections: (ISsrComponentFrame | JSXChildren | string)[]): void;
|
|
1432
1599
|
consumeChildrenForSlot(projectionNode: ISsrNode, slotName: string): JSXChildren | null;
|
|
1433
1600
|
distributeChildrenIntoSlots(children: JSXChildren, parentScopedStyle: string | null, parentComponentFrame: ISsrComponentFrame | null): void;
|
|
1434
1601
|
hasSlot(slotName: string): boolean;
|
|
@@ -1436,27 +1603,45 @@ export declare interface ISsrComponentFrame {
|
|
|
1436
1603
|
|
|
1437
1604
|
declare interface ISsrNode {
|
|
1438
1605
|
id: string;
|
|
1439
|
-
|
|
1440
|
-
|
|
1606
|
+
flags: SsrNodeFlags;
|
|
1607
|
+
dirty: ChoreBits;
|
|
1608
|
+
parentComponent: ISsrNode | null;
|
|
1609
|
+
vnodeData: VNodeData;
|
|
1610
|
+
currentFile: string | null;
|
|
1441
1611
|
setProp(name: string, value: any): void;
|
|
1442
1612
|
getProp(name: string): any;
|
|
1443
1613
|
removeProp(name: string): void;
|
|
1444
1614
|
addChild(child: ISsrNode): void;
|
|
1615
|
+
setTreeNonUpdatable(): void;
|
|
1445
1616
|
}
|
|
1446
1617
|
|
|
1618
|
+
/** @internal */
|
|
1619
|
+
export declare const _isStore: (value: StoreTarget) => boolean;
|
|
1620
|
+
|
|
1447
1621
|
/** @internal */
|
|
1448
1622
|
export declare function _isStringifiable(value: unknown): value is _Stringifiable;
|
|
1449
1623
|
|
|
1624
|
+
/** @internal */
|
|
1625
|
+
export declare const _isTask: (value: any) => value is Task;
|
|
1626
|
+
|
|
1450
1627
|
/**
|
|
1628
|
+
* Used by the JSX transpilers to create a JSXNode. Note that the optimizer will normally not use
|
|
1629
|
+
* this, instead using _jsxSplit and _jsxSorted directly.
|
|
1630
|
+
*
|
|
1631
|
+
* The optimizer will also replace all `jsx()` calls with the more optimized versions.
|
|
1632
|
+
*
|
|
1633
|
+
* The exception is when the props are not a literal object, which can only happen when the `jsx`
|
|
1634
|
+
* call is written directly.
|
|
1635
|
+
*
|
|
1451
1636
|
* @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
1637
|
*/
|
|
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 }
|
|
1638
|
+
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
1639
|
|
|
1459
|
-
/**
|
|
1640
|
+
/**
|
|
1641
|
+
* @deprecated
|
|
1642
|
+
* @internal
|
|
1643
|
+
* No longer used since v2
|
|
1644
|
+
*/
|
|
1460
1645
|
export declare const _jsxBranch: <T>(input?: T) => T | undefined;
|
|
1461
1646
|
|
|
1462
1647
|
/** @internal @deprecated v1 compat */
|
|
@@ -1465,8 +1650,12 @@ export declare const _jsxC: (type: any, mutable: any, _flags: any, key: any) =>
|
|
|
1465
1650
|
/** @public */
|
|
1466
1651
|
export declare type JSXChildren = string | number | boolean | null | undefined | Function | RegExp | JSXChildren[] | Promise<JSXChildren> | Signal<JSXChildren> | JSXNode;
|
|
1467
1652
|
|
|
1468
|
-
/**
|
|
1469
|
-
|
|
1653
|
+
/**
|
|
1654
|
+
* Alias of `jsx` for development purposes.
|
|
1655
|
+
*
|
|
1656
|
+
* @public
|
|
1657
|
+
*/
|
|
1658
|
+
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
1659
|
|
|
1471
1660
|
declare interface JsxDevOpts {
|
|
1472
1661
|
fileName: string;
|
|
@@ -1474,6 +1663,14 @@ declare interface JsxDevOpts {
|
|
|
1474
1663
|
columnNumber: number;
|
|
1475
1664
|
}
|
|
1476
1665
|
|
|
1666
|
+
declare type JSXDocumentEvents = {
|
|
1667
|
+
[K in keyof QwikDocumentEventMap as `document:on${PascalCaseName<K>}$`]: QwikDocumentEventMap[K];
|
|
1668
|
+
};
|
|
1669
|
+
|
|
1670
|
+
declare type JSXElementEvents = {
|
|
1671
|
+
[K in keyof QwikHTMLElementEventMap as `on${PascalCaseName<K>}$`]: QwikHTMLElementEventMap[K];
|
|
1672
|
+
};
|
|
1673
|
+
|
|
1477
1674
|
/**
|
|
1478
1675
|
* A JSX Node, an internal structure. You probably want to use `JSXOutput` instead.
|
|
1479
1676
|
*
|
|
@@ -1487,15 +1684,59 @@ export declare interface JSXNode<T extends string | FunctionComponent | unknown
|
|
|
1487
1684
|
dev?: DevJSX;
|
|
1488
1685
|
}
|
|
1489
1686
|
|
|
1687
|
+
declare class JSXNodeImpl<T = unknown> implements JSXNodeInternal<T> {
|
|
1688
|
+
type: T;
|
|
1689
|
+
children: JSXChildren;
|
|
1690
|
+
toSort: boolean;
|
|
1691
|
+
key: string | null;
|
|
1692
|
+
varProps: Props;
|
|
1693
|
+
constProps: Props | null;
|
|
1694
|
+
dev?: DevJSX & {
|
|
1695
|
+
stack: string | undefined;
|
|
1696
|
+
};
|
|
1697
|
+
_proxy: Props | null;
|
|
1698
|
+
constructor(type: T, varProps: Props | null, constProps: Props | null, children: JSXChildren, key: string | number | null | undefined, toSort?: boolean, dev?: DevJSX);
|
|
1699
|
+
get props(): T extends FunctionComponent<infer PROPS> ? PROPS : Props;
|
|
1700
|
+
}
|
|
1701
|
+
|
|
1490
1702
|
/**
|
|
1491
1703
|
* The internal representation of a JSX Node.
|
|
1492
1704
|
*
|
|
1493
1705
|
* @internal
|
|
1494
1706
|
*/
|
|
1495
1707
|
export declare interface JSXNodeInternal<T extends string | FunctionComponent | unknown = unknown> extends JSXNode<T> {
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1708
|
+
/** The type of node */
|
|
1709
|
+
type: T;
|
|
1710
|
+
/** Do the varProps need sorting */
|
|
1711
|
+
toSort: boolean;
|
|
1712
|
+
/** The key property */
|
|
1713
|
+
key: string | null;
|
|
1714
|
+
/**
|
|
1715
|
+
* Props that are not guaranteed shallow equal across runs.
|
|
1716
|
+
*
|
|
1717
|
+
* Any prop that is in `constProps` takes precedence over `varProps`.
|
|
1718
|
+
*
|
|
1719
|
+
* Does not contain `children` or `key`.
|
|
1720
|
+
*
|
|
1721
|
+
* `onEvent$` props are normalized to the html `q-x:event` version
|
|
1722
|
+
*/
|
|
1723
|
+
varProps: Props;
|
|
1724
|
+
/**
|
|
1725
|
+
* Props that will be shallow equal across runs. Does not contain any props that are in varProps.
|
|
1726
|
+
*
|
|
1727
|
+
* Any prop that is in `constProps` takes precedence over `varProps`.
|
|
1728
|
+
*
|
|
1729
|
+
* Does not contain `children` or `key`.
|
|
1730
|
+
*
|
|
1731
|
+
* `onEvent$` props are normalized to the html `q-x:event` version
|
|
1732
|
+
*/
|
|
1733
|
+
constProps: Props | null;
|
|
1734
|
+
/** The children of the node */
|
|
1735
|
+
children: JSXChildren;
|
|
1736
|
+
/** Filename etc for debugging */
|
|
1737
|
+
dev?: DevJSX & {
|
|
1738
|
+
stack: string | undefined;
|
|
1739
|
+
};
|
|
1499
1740
|
}
|
|
1500
1741
|
|
|
1501
1742
|
/**
|
|
@@ -1511,6 +1752,13 @@ export declare const _jsxQ: (type: any, mutable: any, immutable: any, children:
|
|
|
1511
1752
|
/** @internal @deprecated v1 compat */
|
|
1512
1753
|
export declare const _jsxS: (type: any, mutable: any, immutable: any, _flags: any, key: any) => JSXNode<any>;
|
|
1513
1754
|
|
|
1755
|
+
/**
|
|
1756
|
+
* Alias of `jsx` to support JSX syntax.
|
|
1757
|
+
*
|
|
1758
|
+
* @public
|
|
1759
|
+
*/
|
|
1760
|
+
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>;
|
|
1761
|
+
|
|
1514
1762
|
/**
|
|
1515
1763
|
* Create a JSXNode with the properties fully split into variable and constant parts, and children
|
|
1516
1764
|
* separated out. Furthermore, the varProps must be a sorted object, that is, the keys must be
|
|
@@ -1521,7 +1769,7 @@ export declare const _jsxS: (type: any, mutable: any, immutable: any, _flags: an
|
|
|
1521
1769
|
* still update the attribute on the vnode.
|
|
1522
1770
|
*
|
|
1523
1771
|
* @param type - The JSX type
|
|
1524
|
-
* @param varProps - The properties of the tag, sorted, excluding children,
|
|
1772
|
+
* @param varProps - The properties of the tag, sorted, excluding children, key and any constProps
|
|
1525
1773
|
* @param constProps - The properties of the tag that are known to be constant references and don't
|
|
1526
1774
|
* need checking for changes on re-render
|
|
1527
1775
|
* @param children - JSX children. Any `children` in the props objects are ignored.
|
|
@@ -1531,13 +1779,13 @@ export declare const _jsxSorted: <T>(type: T, varProps: Props | null, constProps
|
|
|
1531
1779
|
|
|
1532
1780
|
/**
|
|
1533
1781
|
* Create a JSXNode, with the properties split into variable and constant parts, but the variable
|
|
1534
|
-
* parts could include keys from constProps
|
|
1782
|
+
* parts could include keys from `constProps`, as well as `key` and `children`.
|
|
1535
1783
|
*
|
|
1536
|
-
* The constant parts are expected to be the same
|
|
1537
|
-
*
|
|
1538
|
-
* still update the attribute on the vnode.
|
|
1784
|
+
* `constProps` cannot include `key` or `children`. The constant parts are expected to be the same
|
|
1785
|
+
* on every render, and are not checked for changes. This means that they are constant scalars or
|
|
1786
|
+
* refs. When the ref is a signal or a store, it can still update the attribute on the vnode.
|
|
1539
1787
|
*
|
|
1540
|
-
* If `children`
|
|
1788
|
+
* If `children` or `key` are defined, any `children`/`key` in the props will be ignored.
|
|
1541
1789
|
*
|
|
1542
1790
|
* @param type - The tag type
|
|
1543
1791
|
* @param varProps - The properties of the tag that could change, including children
|
|
@@ -1545,11 +1793,15 @@ export declare const _jsxSorted: <T>(type: T, varProps: Props | null, constProps
|
|
|
1545
1793
|
* for changes on re-render
|
|
1546
1794
|
* @internal
|
|
1547
1795
|
*/
|
|
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
|
|
1796
|
+
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
1797
|
|
|
1550
1798
|
/** @public */
|
|
1551
1799
|
export declare type JSXTagName = keyof HTMLElementTagNameMap | Omit<string, keyof HTMLElementTagNameMap>;
|
|
1552
1800
|
|
|
1801
|
+
declare type JSXWindowEvents = {
|
|
1802
|
+
[K in keyof QwikWindowEventMap as `window:on${PascalCaseName<K>}$`]: QwikWindowEventMap[K];
|
|
1803
|
+
};
|
|
1804
|
+
|
|
1553
1805
|
/**
|
|
1554
1806
|
* The names of events that Qwik knows about. They are all lowercase, but on the JSX side, they are
|
|
1555
1807
|
* PascalCase for nicer DX. (`onAuxClick$` vs `onauxclick$`)
|
|
@@ -1601,6 +1853,15 @@ declare interface LenientSVGProps<T extends Element> extends SVGAttributes, DOMA
|
|
|
1601
1853
|
*/
|
|
1602
1854
|
declare type LiteralUnion<LiteralType, BaseType extends Primitive> = LiteralType | (BaseType & Record<never, never>);
|
|
1603
1855
|
|
|
1856
|
+
/** @internal */
|
|
1857
|
+
export declare const _mapApp_findIndx: <T>(array: (T | null)[], key: string, start: number) => number;
|
|
1858
|
+
|
|
1859
|
+
/** @internal */
|
|
1860
|
+
export declare const _mapArray_get: <T>(array: (T | null)[], key: string, start: number) => T | null;
|
|
1861
|
+
|
|
1862
|
+
/** @internal */
|
|
1863
|
+
export declare const _mapArray_set: <T>(array: (T | null)[], key: string, value: T | null, start: number, allowNullValue?: boolean) => void;
|
|
1864
|
+
|
|
1604
1865
|
declare type MediaSpecialAttrs = {
|
|
1605
1866
|
crossOrigin?: HTMLCrossOriginAttribute;
|
|
1606
1867
|
};
|
|
@@ -1647,10 +1908,10 @@ declare interface NodePropData {
|
|
|
1647
1908
|
}
|
|
1648
1909
|
|
|
1649
1910
|
/** @internal */
|
|
1650
|
-
export declare const _noopQrl: <T>(symbolName: string, lexicalScopeCapture?:
|
|
1911
|
+
export declare const _noopQrl: <T>(symbolName: string, lexicalScopeCapture?: Readonly<unknown[]>) => QRL<T>;
|
|
1651
1912
|
|
|
1652
1913
|
/** @internal */
|
|
1653
|
-
export declare const _noopQrlDEV: <T>(symbolName: string, opts: QRLDev, lexicalScopeCapture?:
|
|
1914
|
+
export declare const _noopQrlDEV: <T>(symbolName: string, opts: QRLDev, lexicalScopeCapture?: Readonly<unknown[]>) => QRL<T>;
|
|
1654
1915
|
|
|
1655
1916
|
/**
|
|
1656
1917
|
* Returned type of the `noSerialize()` function. It will be TYPE or undefined.
|
|
@@ -1717,6 +1978,11 @@ export declare interface OnVisibleTaskOptions {
|
|
|
1717
1978
|
strategy?: VisibleTaskStrategy;
|
|
1718
1979
|
}
|
|
1719
1980
|
|
|
1981
|
+
/** @internal */
|
|
1982
|
+
declare const _OWNER: unique symbol;
|
|
1983
|
+
|
|
1984
|
+
declare type PascalCaseName<T extends string> = T extends keyof LcEventNameMap ? LcEventNameMap[T] : Capitalize<T>;
|
|
1985
|
+
|
|
1720
1986
|
/**
|
|
1721
1987
|
* Capitalized multi-word names of some known events so we have nicer qwik attributes. For example,
|
|
1722
1988
|
* instead of `oncompositionEnd$` we can use `onCompositionEnd$`. Note that any capitalization
|
|
@@ -1724,19 +1990,11 @@ export declare interface OnVisibleTaskOptions {
|
|
|
1724
1990
|
*
|
|
1725
1991
|
* Add any multi-word event names to this list. Single word events are automatically converted.
|
|
1726
1992
|
*/
|
|
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
|
-
};
|
|
1993
|
+
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
1994
|
|
|
1737
1995
|
declare type PopoverTargetAction = 'hide' | 'show' | 'toggle';
|
|
1738
1996
|
|
|
1739
|
-
declare type PossibleEvents = Event | SimplifiedServerRequestEvent | typeof TaskEvent | typeof RenderEvent
|
|
1997
|
+
declare type PossibleEvents = Event | SimplifiedServerRequestEvent | typeof TaskEvent | typeof RenderEvent;
|
|
1740
1998
|
|
|
1741
1999
|
/**
|
|
1742
2000
|
* @deprecated This is no longer needed as the preloading happens automatically in qrl-class. You
|
|
@@ -1834,6 +2092,9 @@ export declare type PropFunction<T> = QRL<T>;
|
|
|
1834
2092
|
|
|
1835
2093
|
declare type Props = Record<string, unknown>;
|
|
1836
2094
|
|
|
2095
|
+
/** @internal */
|
|
2096
|
+
declare const _PROPS_HANDLER: unique symbol;
|
|
2097
|
+
|
|
1837
2098
|
/**
|
|
1838
2099
|
* Infers `Props` from the component or tag.
|
|
1839
2100
|
*
|
|
@@ -1856,7 +2117,24 @@ export declare type PropsOf<COMP> = COMP extends string ? COMP extends keyof Qwi
|
|
|
1856
2117
|
declare type PropsProxy = {
|
|
1857
2118
|
[_VAR_PROPS]: Props;
|
|
1858
2119
|
[_CONST_PROPS]: Props | null;
|
|
1859
|
-
|
|
2120
|
+
[_OWNER]: JSXNodeInternal;
|
|
2121
|
+
[_PROPS_HANDLER]: PropsProxyHandler;
|
|
2122
|
+
} & Record<string | symbol, unknown>;
|
|
2123
|
+
|
|
2124
|
+
declare class PropsProxyHandler implements ProxyHandler<any> {
|
|
2125
|
+
owner: JSXNodeImpl;
|
|
2126
|
+
$effects$: undefined | Map<string | symbol, Set<EffectSubscription>>;
|
|
2127
|
+
$container$: _Container | null;
|
|
2128
|
+
constructor(owner: JSXNodeImpl);
|
|
2129
|
+
get(_: any, prop: string | symbol): any;
|
|
2130
|
+
set(_: any, prop: string | symbol, value: any): boolean;
|
|
2131
|
+
deleteProperty(_: any, prop: string | symbol): boolean;
|
|
2132
|
+
has(_: any, prop: string | symbol): boolean;
|
|
2133
|
+
getOwnPropertyDescriptor(_: any, p: string | symbol): PropertyDescriptor | undefined;
|
|
2134
|
+
ownKeys(): string[];
|
|
2135
|
+
}
|
|
2136
|
+
|
|
2137
|
+
declare type PropType<T extends object, P extends keyof T> = P extends keyof T ? T[P] : 'value' extends keyof T ? T['value'] : never;
|
|
1860
2138
|
|
|
1861
2139
|
/**
|
|
1862
2140
|
* Extends the defined component PROPS, adding the default ones (children and q:slot) and allowing
|
|
@@ -1972,7 +2250,7 @@ export declare interface _QDocument extends Document {
|
|
|
1972
2250
|
*
|
|
1973
2251
|
* ```
|
|
1974
2252
|
* <div q:base="/build/">
|
|
1975
|
-
* <button
|
|
2253
|
+
* <button q-e:click="./chunk-abc.js#onClick">...</button>
|
|
1976
2254
|
* </div>
|
|
1977
2255
|
* ```
|
|
1978
2256
|
*
|
|
@@ -1995,7 +2273,7 @@ export declare interface _QDocument extends Document {
|
|
|
1995
2273
|
*/
|
|
1996
2274
|
export declare type QRL<TYPE = unknown> = {
|
|
1997
2275
|
__qwik_serializable__?: any;
|
|
1998
|
-
__brand__QRL__
|
|
2276
|
+
__brand__QRL__?: TYPE;
|
|
1999
2277
|
/** Resolve the QRL and return the actual value. */
|
|
2000
2278
|
resolve(): Promise<TYPE>;
|
|
2001
2279
|
/** The resolved value, once `resolve()` returns. */
|
|
@@ -2003,7 +2281,7 @@ export declare type QRL<TYPE = unknown> = {
|
|
|
2003
2281
|
getCaptured(): unknown[] | null;
|
|
2004
2282
|
getSymbol(): string;
|
|
2005
2283
|
getHash(): string;
|
|
2006
|
-
dev
|
|
2284
|
+
dev?: QRLDev | null;
|
|
2007
2285
|
} & BivariantQrlFn<QrlArgs<TYPE>, QrlReturn<TYPE>>;
|
|
2008
2286
|
|
|
2009
2287
|
/**
|
|
@@ -2018,7 +2296,7 @@ export declare type QRL<TYPE = unknown> = {
|
|
|
2018
2296
|
* @public
|
|
2019
2297
|
* @see `QRL`, `$(...)`
|
|
2020
2298
|
*/
|
|
2021
|
-
export declare const qrl: <T = any>(chunkOrFn: string | (() => Promise<any>), symbol: string, lexicalScopeCapture?:
|
|
2299
|
+
export declare const qrl: <T = any>(chunkOrFn: string | (() => Promise<any>), symbol: string, lexicalScopeCapture?: Readonly<unknown[]> | null, stackOffset?: number) => QRL<T>;
|
|
2022
2300
|
|
|
2023
2301
|
declare type QrlArgs<T> = T extends (...args: infer ARGS) => any ? ARGS : unknown[];
|
|
2024
2302
|
|
|
@@ -2030,32 +2308,38 @@ declare interface QRLDev {
|
|
|
2030
2308
|
}
|
|
2031
2309
|
|
|
2032
2310
|
/** @internal */
|
|
2033
|
-
export declare const qrlDEV: <T = any>(chunkOrFn: string | (() => Promise<any>), symbol: string, opts: QRLDev, lexicalScopeCapture?:
|
|
2311
|
+
export declare const qrlDEV: <T = any>(chunkOrFn: string | (() => Promise<any>), symbol: string, opts: QRLDev, lexicalScopeCapture?: Readonly<unknown[]>) => QRL<T>;
|
|
2034
2312
|
|
|
2035
2313
|
/**
|
|
2036
2314
|
* An event handler for Qwik events, can be a handler QRL or an array of handler QRLs.
|
|
2037
2315
|
*
|
|
2038
2316
|
* @public
|
|
2039
2317
|
*/
|
|
2040
|
-
export declare type QRLEventHandlerMulti<EV extends Event, EL> = QRL<EventHandler<EV, EL>> | undefined | null | QRLEventHandlerMulti<EV, EL>[]
|
|
2318
|
+
export declare type QRLEventHandlerMulti<EV extends Event, EL> = QRL<EventHandler<EV, EL>> | undefined | null | QRLEventHandlerMulti<EV, EL>[];
|
|
2041
2319
|
|
|
2042
|
-
|
|
2320
|
+
/** @internal */
|
|
2321
|
+
export declare type _QRLInternal<TYPE = unknown> = QRL<TYPE> & QRLInternalMethods<TYPE>;
|
|
2043
2322
|
|
|
2044
2323
|
declare type QRLInternalMethods<TYPE> = {
|
|
2045
2324
|
readonly $chunk$: string | null;
|
|
2046
2325
|
readonly $symbol$: string;
|
|
2047
2326
|
readonly $hash$: string;
|
|
2048
|
-
|
|
2049
|
-
$
|
|
2327
|
+
/** If it's a string it's serialized */
|
|
2328
|
+
$captures$: Readonly<unknown[]> | string | null;
|
|
2050
2329
|
dev: QRLDev | null;
|
|
2330
|
+
resolve(container?: _Container): Promise<TYPE>;
|
|
2051
2331
|
resolved: undefined | TYPE;
|
|
2052
|
-
resolve(): Promise<TYPE>;
|
|
2053
2332
|
getSymbol(): string;
|
|
2054
2333
|
getHash(): string;
|
|
2055
2334
|
getCaptured(): unknown[] | null;
|
|
2056
|
-
getFn(currentCtx?: InvokeContext
|
|
2057
|
-
|
|
2058
|
-
|
|
2335
|
+
getFn(currentCtx?: InvokeContext, beforeFn?: () => void): TYPE extends (...args: any) => any ? (...args: Parameters<TYPE>) => ValueOrPromise<ReturnType<TYPE>> : unknown;
|
|
2336
|
+
/**
|
|
2337
|
+
* Needed for deserialization and importing. We don't always have the container while creating
|
|
2338
|
+
* qrls in async sections of code
|
|
2339
|
+
*/
|
|
2340
|
+
$container$: _Container | null;
|
|
2341
|
+
/** Only in dev mode */
|
|
2342
|
+
$symbolRef$?: null | ValueOrPromise<TYPE>;
|
|
2059
2343
|
};
|
|
2060
2344
|
|
|
2061
2345
|
declare type QrlReturn<T> = T extends (...args: any) => infer R ? Awaited<R> : unknown;
|
|
@@ -2072,6 +2356,12 @@ declare type QrlReturn<T> = T extends (...args: any) => infer R ? Awaited<R> : u
|
|
|
2072
2356
|
*/
|
|
2073
2357
|
export declare const _qrlSync: <TYPE extends Function>(fn: TYPE, serializedFn?: string) => SyncQRL<TYPE>;
|
|
2074
2358
|
|
|
2359
|
+
/** @internal */
|
|
2360
|
+
export declare function _qrlToString(serializationContext: SerializationContext, qrl: _QRLInternal | SyncQRLInternal): string;
|
|
2361
|
+
|
|
2362
|
+
/** @internal */
|
|
2363
|
+
export declare function _qrlToString(serializationContext: SerializationContext, qrl: _QRLInternal | SyncQRLInternal, raw: true): [string, string, string | null];
|
|
2364
|
+
|
|
2075
2365
|
/** @public @deprecated Use `AnimationEvent` and use the second argument to the handler function for the current event target */
|
|
2076
2366
|
export declare type QwikAnimationEvent<T = Element> = NativeAnimationEvent;
|
|
2077
2367
|
|
|
@@ -2125,13 +2415,19 @@ export declare type QwikClipboardEvent<T = Element> = NativeClipboardEvent;
|
|
|
2125
2415
|
/** @public @deprecated Use `CompositionEvent` and use the second argument to the handler function for the current event target */
|
|
2126
2416
|
export declare type QwikCompositionEvent<T = Element> = NativeCompositionEvent;
|
|
2127
2417
|
|
|
2128
|
-
declare type QwikCustomEvents<EL> = {};
|
|
2129
|
-
|
|
2130
2418
|
declare type QwikCustomEventsPlain<EL> = {
|
|
2131
2419
|
/** The handler */
|
|
2132
2420
|
[key: `${'document:' | 'window:' | ''}on${string}$`]: QRLEventHandlerMulti<Event, EL> | EventHandler<Event, EL>;
|
|
2133
2421
|
};
|
|
2134
2422
|
|
|
2423
|
+
declare type QwikDocumentEventMap = Omit<DocumentEventMap, keyof QwikHTMLElementEventMap> & Omit<QwikHTMLElementEventMap, 'qvisible' | 'focus' | 'blur'> & {
|
|
2424
|
+
qidle: QwikIdleEvent;
|
|
2425
|
+
qinit: QwikInitEvent;
|
|
2426
|
+
qsymbol: QwikSymbolEvent;
|
|
2427
|
+
qresume: QwikResumeEvent;
|
|
2428
|
+
qviewtransition: QwikViewTransitionEvent;
|
|
2429
|
+
};
|
|
2430
|
+
|
|
2135
2431
|
/** @public */
|
|
2136
2432
|
export declare interface QwikDOMAttributes extends DOMAttributes<Element> {
|
|
2137
2433
|
}
|
|
@@ -2140,11 +2436,13 @@ export declare interface QwikDOMAttributes extends DOMAttributes<Element> {
|
|
|
2140
2436
|
export declare type QwikDragEvent<T = Element> = NativeDragEvent;
|
|
2141
2437
|
|
|
2142
2438
|
/** @public */
|
|
2143
|
-
declare type QwikEvents<EL, Plain extends boolean = true> = Plain extends true ? QwikKnownEventsPlain<EL> & QwikCustomEventsPlain<EL> : QwikKnownEvents<EL
|
|
2439
|
+
declare type QwikEvents<EL, Plain extends boolean = true> = Plain extends true ? QwikKnownEventsPlain<EL> & QwikCustomEventsPlain<EL> : QwikKnownEvents<EL>;
|
|
2144
2440
|
|
|
2145
2441
|
/** @public @deprecated Use `FocusEvent` and use the second argument to the handler function for the current event target */
|
|
2146
2442
|
export declare type QwikFocusEvent<T = Element> = NativeFocusEvent;
|
|
2147
2443
|
|
|
2444
|
+
declare type QwikHTMLElementEventMap = Omit<HTMLElementEventMap, keyof EventCorrectionMap> & EventCorrectionMap;
|
|
2445
|
+
|
|
2148
2446
|
/**
|
|
2149
2447
|
* The DOM props without plain handlers, for use inside functions
|
|
2150
2448
|
*
|
|
@@ -2215,15 +2513,17 @@ declare namespace QwikJSX {
|
|
|
2215
2513
|
export { QwikJSX as JSX }
|
|
2216
2514
|
export { QwikJSX }
|
|
2217
2515
|
|
|
2516
|
+
declare type QwikJSXEvents = JSXElementEvents & JSXDocumentEvents & JSXWindowEvents;
|
|
2517
|
+
|
|
2218
2518
|
/** @public @deprecated Use `KeyboardEvent` and use the second argument to the handler function for the current event target */
|
|
2219
2519
|
export declare type QwikKeyboardEvent<T = Element> = NativeKeyboardEvent;
|
|
2220
2520
|
|
|
2221
2521
|
declare type QwikKnownEvents<EL> = {
|
|
2222
|
-
[K in keyof
|
|
2522
|
+
[K in keyof QwikJSXEvents]?: QRLEventHandlerMulti<QwikJSXEvents[K], EL>;
|
|
2223
2523
|
};
|
|
2224
2524
|
|
|
2225
2525
|
declare type QwikKnownEventsPlain<EL> = {
|
|
2226
|
-
[K in keyof
|
|
2526
|
+
[K in keyof QwikJSXEvents]?: QRLEventHandlerMulti<QwikJSXEvents[K], EL> | EventHandler<QwikJSXEvents[K], EL>;
|
|
2227
2527
|
};
|
|
2228
2528
|
|
|
2229
2529
|
/**
|
|
@@ -2287,6 +2587,12 @@ export declare type QwikMouseEvent<T = Element, E = NativeMouseEvent> = E;
|
|
|
2287
2587
|
/** @public @deprecated Use `PointerEvent` and use the second argument to the handler function for the current event target */
|
|
2288
2588
|
export declare type QwikPointerEvent<T = Element> = NativePointerEvent;
|
|
2289
2589
|
|
|
2590
|
+
/**
|
|
2591
|
+
* Emitted by qwik-core on the container element when it resumes from a paused state. You cannot put
|
|
2592
|
+
* a Qwik event handler on the container so you must listen on the document instead. @public
|
|
2593
|
+
*/
|
|
2594
|
+
export declare type QwikResumeEvent = CustomEvent<{}>;
|
|
2595
|
+
|
|
2290
2596
|
/** @public @deprecated Use `SubmitEvent` and use the second argument to the handler function for the current event target */
|
|
2291
2597
|
export declare type QwikSubmitEvent<T = Element> = SubmitEvent;
|
|
2292
2598
|
|
|
@@ -2317,14 +2623,12 @@ declare interface QwikSymbol {
|
|
|
2317
2623
|
captureNames?: string[];
|
|
2318
2624
|
}
|
|
2319
2625
|
|
|
2320
|
-
/** Emitted by qwik-loader when a module was lazily loaded @public */
|
|
2626
|
+
/** Emitted by qwik-loader on document when a module was lazily loaded @public */
|
|
2321
2627
|
export declare type QwikSymbolEvent = CustomEvent<{
|
|
2322
2628
|
symbol: string;
|
|
2323
2629
|
element: Element;
|
|
2324
2630
|
reqTime: number;
|
|
2325
2631
|
qBase?: string;
|
|
2326
|
-
qManifest?: string;
|
|
2327
|
-
qVersion?: string;
|
|
2328
2632
|
href?: string;
|
|
2329
2633
|
}>;
|
|
2330
2634
|
|
|
@@ -2338,14 +2642,19 @@ export declare type QwikTransitionEvent<T = Element> = NativeTransitionEvent;
|
|
|
2338
2642
|
export declare type QwikUIEvent<T = Element> = NativeUIEvent;
|
|
2339
2643
|
|
|
2340
2644
|
/** Emitted by qwik-core on document when the a view transition start @public */
|
|
2341
|
-
declare type QwikViewTransitionEvent = CustomEvent<ViewTransition>;
|
|
2645
|
+
export declare type QwikViewTransitionEvent = CustomEvent<ViewTransition>;
|
|
2342
2646
|
|
|
2343
|
-
/**
|
|
2647
|
+
/**
|
|
2648
|
+
* Handled by qwik-loader when an element becomes visible. Used by `useVisibleTask$`. Does not
|
|
2649
|
+
* bubble. @public
|
|
2650
|
+
*/
|
|
2344
2651
|
export declare type QwikVisibleEvent = CustomEvent<IntersectionObserverEntry>;
|
|
2345
2652
|
|
|
2346
2653
|
/** @public @deprecated Use `WheelEvent` and use the second argument to the handler function for the current event target */
|
|
2347
2654
|
export declare type QwikWheelEvent<T = Element> = NativeWheelEvent;
|
|
2348
2655
|
|
|
2656
|
+
declare type QwikWindowEventMap = Omit<WindowEventHandlersEventMap, keyof QwikDocumentEventMap> & QwikDocumentEventMap;
|
|
2657
|
+
|
|
2349
2658
|
/** @public */
|
|
2350
2659
|
export declare interface ReadonlySignal<T = unknown> {
|
|
2351
2660
|
readonly value: T;
|
|
@@ -2367,7 +2676,12 @@ declare type RefFnInterface<EL> = {
|
|
|
2367
2676
|
(el: EL): void;
|
|
2368
2677
|
};
|
|
2369
2678
|
|
|
2370
|
-
/**
|
|
2679
|
+
/**
|
|
2680
|
+
* Register a QRL symbol globally for lookup by its hash. This is used by the optimizer to register
|
|
2681
|
+
* the names passed in `reg_ctx_name`.
|
|
2682
|
+
*
|
|
2683
|
+
* @internal
|
|
2684
|
+
*/
|
|
2371
2685
|
export declare const _regSymbol: (symbol: any, hash: string) => any;
|
|
2372
2686
|
|
|
2373
2687
|
/**
|
|
@@ -2393,6 +2707,8 @@ export declare const RenderOnce: FunctionComponent<{
|
|
|
2393
2707
|
key?: string | number | null | undefined;
|
|
2394
2708
|
}>;
|
|
2395
2709
|
|
|
2710
|
+
/** @internal */
|
|
2711
|
+
/** @internal */
|
|
2396
2712
|
/** @public */
|
|
2397
2713
|
export declare interface RenderOptions {
|
|
2398
2714
|
serverData?: Record<string, any>;
|
|
@@ -2413,6 +2729,17 @@ export declare interface RenderSSROptions {
|
|
|
2413
2729
|
manifestHash: string;
|
|
2414
2730
|
}
|
|
2415
2731
|
|
|
2732
|
+
/**
|
|
2733
|
+
* Resumes selected state (e.g. polling AsyncSignals) by deserializing captures. Used for
|
|
2734
|
+
* document:onQIdle to resume async signals with active polling.
|
|
2735
|
+
*
|
|
2736
|
+
* @internal
|
|
2737
|
+
*/
|
|
2738
|
+
export declare function _res(this: string | undefined, _: any, element: Element): void;
|
|
2739
|
+
|
|
2740
|
+
/** @internal */
|
|
2741
|
+
export declare const _resolveContextWithoutSequentialScope: <STATE>(context: ContextId<STATE>) => STATE | undefined;
|
|
2742
|
+
|
|
2416
2743
|
/** @public */
|
|
2417
2744
|
declare interface ResolvedManifest {
|
|
2418
2745
|
mapper: SymbolMapper;
|
|
@@ -2422,73 +2749,49 @@ declare interface ResolvedManifest {
|
|
|
2422
2749
|
}
|
|
2423
2750
|
|
|
2424
2751
|
/**
|
|
2425
|
-
* This method works like an async memoized function that runs whenever some tracked value changes
|
|
2426
|
-
* and returns some data.
|
|
2427
|
-
*
|
|
2428
|
-
* `useResource` however returns immediate a `ResourceReturn` object that contains the data and a
|
|
2429
|
-
* state that indicates if the data is available or not.
|
|
2430
|
-
*
|
|
2431
|
-
* The status can be one of the following:
|
|
2432
|
-
*
|
|
2433
|
-
* - `pending` - the data is not yet available.
|
|
2434
|
-
* - `resolved` - the data is available.
|
|
2435
|
-
* - `rejected` - the data is not available due to an error or timeout.
|
|
2436
|
-
*
|
|
2437
|
-
* Be careful when using a `try/catch` statement in `useResource$`. If you catch the error and don't
|
|
2438
|
-
* re-throw it (or a new Error), the resource status will never be `rejected`.
|
|
2439
|
-
*
|
|
2440
|
-
* ### Example
|
|
2441
|
-
*
|
|
2442
|
-
* Example showing how `useResource` to perform a fetch to request the weather, whenever the input
|
|
2443
|
-
* city name changes.
|
|
2444
|
-
*
|
|
2445
2752
|
* ```tsx
|
|
2446
2753
|
* const Cmp = component$(() => {
|
|
2447
|
-
* const
|
|
2754
|
+
* const city = useSignal('');
|
|
2448
2755
|
*
|
|
2449
|
-
* const
|
|
2450
|
-
* const cityName = track(
|
|
2451
|
-
* const abortController = new AbortController();
|
|
2452
|
-
* cleanup(() => abortController.abort('cleanup'));
|
|
2756
|
+
* const weather = useAsync$(async ({ track, cleanup, abortSignal }) => {
|
|
2757
|
+
* const cityName = track(city);
|
|
2453
2758
|
* const res = await fetch(`http://weatherdata.com?city=${cityName}`, {
|
|
2454
|
-
* signal:
|
|
2759
|
+
* signal: abortSignal,
|
|
2455
2760
|
* });
|
|
2456
|
-
* const
|
|
2457
|
-
* return
|
|
2761
|
+
* const temp = (await res.json()) as { temp: number };
|
|
2762
|
+
* return temp;
|
|
2458
2763
|
* });
|
|
2459
2764
|
*
|
|
2460
2765
|
* return (
|
|
2461
2766
|
* <div>
|
|
2462
|
-
* <input name="city" bind:value={
|
|
2463
|
-
* <
|
|
2464
|
-
*
|
|
2465
|
-
*
|
|
2466
|
-
*
|
|
2467
|
-
*
|
|
2468
|
-
*
|
|
2767
|
+
* <input name="city" bind:value={city} />
|
|
2768
|
+
* <div>
|
|
2769
|
+
* Temperature:{' '}
|
|
2770
|
+
* {weather.loading
|
|
2771
|
+
* ? 'Loading...'
|
|
2772
|
+
* : weather.error
|
|
2773
|
+
* ? `Error: ${weather.error.message}`
|
|
2774
|
+
* : weather.value.temp}
|
|
2775
|
+
* </div>
|
|
2469
2776
|
* </div>
|
|
2470
2777
|
* );
|
|
2471
2778
|
* });
|
|
2472
2779
|
* ```
|
|
2473
2780
|
*
|
|
2781
|
+
* @deprecated Use `useAsync$` instead, which is more efficient, and has a more flexible API. Just
|
|
2782
|
+
* read the `loading` and `error` properties from the returned signal to determine the status.
|
|
2474
2783
|
* @public
|
|
2475
|
-
* @see Resource
|
|
2476
|
-
* @see ResourceReturn
|
|
2477
2784
|
*/
|
|
2478
|
-
export declare const Resource: <T>(
|
|
2785
|
+
export declare const Resource: <T>({ value, onResolved, onPending, onRejected, }: ResourceProps<T>) => JSXOutput;
|
|
2479
2786
|
|
|
2480
2787
|
/** @public */
|
|
2481
|
-
export declare interface ResourceCtx<T> {
|
|
2482
|
-
|
|
2483
|
-
cleanup(callback: () => void): void;
|
|
2788
|
+
export declare interface ResourceCtx<T = unknown> extends AsyncCtx<T> {
|
|
2789
|
+
/** @deprecated Does not do anything */
|
|
2484
2790
|
cache(policyOrMilliseconds: number | 'immutable'): void;
|
|
2485
|
-
readonly previous: T | undefined;
|
|
2486
2791
|
}
|
|
2487
2792
|
|
|
2488
|
-
declare const ResourceEvent = "qResource";
|
|
2489
|
-
|
|
2490
2793
|
/** @public */
|
|
2491
|
-
export declare type ResourceFn<T> = (ctx: ResourceCtx
|
|
2794
|
+
export declare type ResourceFn<T> = (ctx: ResourceCtx) => ValueOrPromise<T>;
|
|
2492
2795
|
|
|
2493
2796
|
/**
|
|
2494
2797
|
* Options to pass to `useResource$()`
|
|
@@ -2505,61 +2808,60 @@ export declare interface ResourceOptions {
|
|
|
2505
2808
|
}
|
|
2506
2809
|
|
|
2507
2810
|
/** @public */
|
|
2508
|
-
export declare
|
|
2509
|
-
readonly value: Promise<T>;
|
|
2510
|
-
readonly loading: boolean;
|
|
2511
|
-
}
|
|
2811
|
+
export declare type ResourcePending<T> = ResourceReturn<T>;
|
|
2512
2812
|
|
|
2513
2813
|
/** @public */
|
|
2514
2814
|
export declare interface ResourceProps<T> {
|
|
2515
2815
|
readonly value: ResourceReturn<T> | Signal<Promise<T> | T> | Promise<T>;
|
|
2516
|
-
onResolved: (value: T) => JSXOutput
|
|
2517
|
-
onPending?: () => JSXOutput
|
|
2518
|
-
onRejected?: (reason: Error) => JSXOutput
|
|
2816
|
+
onResolved: (value: T) => JSXOutput | Promise<JSXOutput>;
|
|
2817
|
+
onPending?: () => JSXOutput | Promise<JSXOutput>;
|
|
2818
|
+
onRejected?: (reason: Error) => JSXOutput | Promise<JSXOutput>;
|
|
2519
2819
|
}
|
|
2520
2820
|
|
|
2521
2821
|
/** @public */
|
|
2522
|
-
export declare
|
|
2523
|
-
readonly value: Promise<T>;
|
|
2524
|
-
readonly loading: boolean;
|
|
2525
|
-
}
|
|
2822
|
+
export declare type ResourceRejected<T> = ResourceReturn<T>;
|
|
2526
2823
|
|
|
2527
2824
|
/** @public */
|
|
2528
|
-
export declare
|
|
2529
|
-
readonly value: Promise<T>;
|
|
2530
|
-
readonly loading: boolean;
|
|
2531
|
-
}
|
|
2825
|
+
export declare type ResourceResolved<T> = ResourceReturn<T>;
|
|
2532
2826
|
|
|
2533
2827
|
/** @public */
|
|
2534
|
-
export declare type ResourceReturn<T> =
|
|
2828
|
+
export declare type ResourceReturn<T> = {
|
|
2829
|
+
readonly value: Promise<T>;
|
|
2830
|
+
readonly loading: boolean;
|
|
2831
|
+
};
|
|
2535
2832
|
|
|
2536
2833
|
declare interface ResourceReturnInternal<T> {
|
|
2537
2834
|
__brand: 'resource';
|
|
2538
|
-
_state: 'pending' | 'resolved' | 'rejected';
|
|
2539
|
-
_resolved: T | undefined;
|
|
2540
|
-
_error: Error | undefined;
|
|
2541
|
-
_cache: number;
|
|
2542
|
-
_timeout: number;
|
|
2543
2835
|
value: Promise<T>;
|
|
2544
2836
|
loading: boolean;
|
|
2837
|
+
signal: AsyncSignal<{
|
|
2838
|
+
r: T;
|
|
2839
|
+
}>;
|
|
2545
2840
|
}
|
|
2546
2841
|
|
|
2547
2842
|
/** @internal */
|
|
2548
|
-
export declare const _restProps: (props: PropsProxy, omit
|
|
2843
|
+
export declare const _restProps: (props: PropsProxy, omit?: string[], target?: Props) => Props;
|
|
2549
2844
|
|
|
2550
2845
|
/**
|
|
2551
|
-
*
|
|
2846
|
+
* The resource function wrapper
|
|
2552
2847
|
*
|
|
2553
2848
|
* @internal
|
|
2554
2849
|
*/
|
|
2555
|
-
export declare const
|
|
2850
|
+
export declare const _rsc: <T>(arg: ResourceCtx<T>) => Promise<{
|
|
2851
|
+
r: T;
|
|
2852
|
+
}>;
|
|
2556
2853
|
|
|
2557
|
-
|
|
2854
|
+
/**
|
|
2855
|
+
* This is called by qwik-loader to run a QRL. It has to be synchronous when possible.
|
|
2856
|
+
*
|
|
2857
|
+
* @internal
|
|
2858
|
+
*/
|
|
2859
|
+
export declare function _run(this: string, event: Event, element: Element): ValueOrPromise<unknown>;
|
|
2558
2860
|
|
|
2861
|
+
/** Stores the location of an object. If no parent, it's a root. */
|
|
2559
2862
|
declare type SeenRef = {
|
|
2560
|
-
$parent$: unknown | null;
|
|
2561
2863
|
$index$: number;
|
|
2562
|
-
$
|
|
2864
|
+
$parent$?: SeenRef | null;
|
|
2563
2865
|
};
|
|
2564
2866
|
|
|
2565
2867
|
/** @public */
|
|
@@ -2569,7 +2871,7 @@ declare interface SegmentEntryStrategy {
|
|
|
2569
2871
|
}
|
|
2570
2872
|
|
|
2571
2873
|
declare interface SerializationContext {
|
|
2572
|
-
$serialize$: () => void
|
|
2874
|
+
$serialize$: () => ValueOrPromise<void>;
|
|
2573
2875
|
$symbolToChunkResolver$: SymbolToChunkResolver;
|
|
2574
2876
|
/**
|
|
2575
2877
|
* Map from object to parent and index reference.
|
|
@@ -2581,49 +2883,65 @@ declare interface SerializationContext {
|
|
|
2581
2883
|
* - `{ parent, index }` - The parent object and the index within that parent.
|
|
2582
2884
|
* - `undefined` - Object has not been seen yet.
|
|
2583
2885
|
*/
|
|
2584
|
-
|
|
2886
|
+
getSeenRef: (obj: unknown) => SeenRef | undefined;
|
|
2887
|
+
/** Returns the root index of the object, if it is a root. Otherwise returns undefined. */
|
|
2585
2888
|
$hasRootId$: (obj: unknown) => number | undefined;
|
|
2586
2889
|
/**
|
|
2587
2890
|
* Root objects which need to be serialized.
|
|
2588
2891
|
*
|
|
2589
2892
|
* Roots are entry points into the object graph. Typically the roots are held by the listeners.
|
|
2590
2893
|
*
|
|
2591
|
-
* Returns
|
|
2592
|
-
* Format: "3 2 0" where each number is the index within its parent, from root to leaf.
|
|
2593
|
-
*/
|
|
2594
|
-
$addRoot$: (obj: unknown, parent?: unknown) => number;
|
|
2595
|
-
/**
|
|
2596
|
-
* Get root path of the object without creating a new root.
|
|
2597
|
-
*
|
|
2598
|
-
* This is used during serialization, as new roots can't be created during serialization.
|
|
2599
|
-
*
|
|
2600
|
-
* The function throws if the root was not found.
|
|
2894
|
+
* Returns the index of the root object.
|
|
2601
2895
|
*/
|
|
2602
|
-
$
|
|
2603
|
-
|
|
2896
|
+
$addRoot$: AddRootFn;
|
|
2897
|
+
/** Mark an object as seen during serialization. This is used to handle backreferences and cycles */
|
|
2898
|
+
$markSeen$: (obj: unknown, parent: SeenRef | undefined, index: number) => SeenRef;
|
|
2604
2899
|
$roots$: unknown[];
|
|
2605
|
-
$
|
|
2900
|
+
$promoteToRoot$: (ref: SeenRef, index?: number) => void;
|
|
2606
2901
|
$addSyncFn$($funcStr$: string | null, argsCount: number, fn: Function): number;
|
|
2607
2902
|
$isSsrNode$: (obj: unknown) => obj is SsrNode;
|
|
2608
2903
|
$isDomRef$: (obj: unknown) => obj is DomRef;
|
|
2609
|
-
$writer$:
|
|
2904
|
+
$writer$: StreamWriter;
|
|
2610
2905
|
$syncFns$: string[];
|
|
2611
2906
|
$eventQrls$: Set<QRL>;
|
|
2612
2907
|
$eventNames$: Set<string>;
|
|
2613
|
-
$resources$: Set<ResourceReturnInternal<unknown>>;
|
|
2614
2908
|
$renderSymbols$: Set<string>;
|
|
2615
2909
|
$storeProxyMap$: ObjToProxyMap;
|
|
2910
|
+
$eagerResume$: Set<unknown>;
|
|
2911
|
+
$resources$: Set<ResourceReturnInternal<any>>;
|
|
2616
2912
|
$getProp$: (obj: any, prop: string) => any;
|
|
2617
2913
|
$setProp$: (obj: any, prop: string, value: any) => void;
|
|
2618
2914
|
}
|
|
2619
2915
|
|
|
2916
|
+
declare const enum SerializationSignalFlags {
|
|
2917
|
+
SERIALIZATION_STRATEGY_NEVER = 8,
|
|
2918
|
+
SERIALIZATION_STRATEGY_ALWAYS = 16
|
|
2919
|
+
}
|
|
2920
|
+
|
|
2921
|
+
/**
|
|
2922
|
+
* Serialization strategy for computed and async signals. This determines whether to serialize their
|
|
2923
|
+
* value during SSR.
|
|
2924
|
+
*
|
|
2925
|
+
* - `never`: The value is never serialized. When the component is resumed, the value will be
|
|
2926
|
+
* recalculated when it is first read.
|
|
2927
|
+
* - `always`: The value is always serialized. This is the default.
|
|
2928
|
+
*
|
|
2929
|
+
* **IMPORTANT**: When you use `never`, your serialized HTML is smaller, but the recalculation will
|
|
2930
|
+
* trigger subscriptions, meaning that other signals using this signal will recalculate, even if
|
|
2931
|
+
* this signal didn't change.
|
|
2932
|
+
*
|
|
2933
|
+
* This is normally not a problem, but for async signals it may mean fetching something again.
|
|
2934
|
+
*
|
|
2935
|
+
* @public
|
|
2936
|
+
*/
|
|
2937
|
+
export declare type SerializationStrategy = 'never' | 'always';
|
|
2938
|
+
|
|
2620
2939
|
/**
|
|
2621
2940
|
* Serialize data to string using SerializationContext.
|
|
2622
2941
|
*
|
|
2623
|
-
* @param data - Data to serialize
|
|
2624
2942
|
* @internal
|
|
2625
2943
|
*/
|
|
2626
|
-
export declare function _serialize(data:
|
|
2944
|
+
export declare function _serialize<T>(data: T): Promise<string>;
|
|
2627
2945
|
|
|
2628
2946
|
/**
|
|
2629
2947
|
* Serialize and deserialize custom objects.
|
|
@@ -2686,9 +3004,9 @@ declare interface SerializerSignal<T> extends ComputedSignal<T> {
|
|
|
2686
3004
|
* @public
|
|
2687
3005
|
*/
|
|
2688
3006
|
declare class SerializerSignalImpl<T, S> extends ComputedSignalImpl<T> {
|
|
2689
|
-
constructor(container:
|
|
3007
|
+
constructor(container: _Container | null, argQrl: _QRLInternal<SerializerArg<T, S>>);
|
|
2690
3008
|
$didInitialize$: boolean;
|
|
2691
|
-
$computeIfNeeded$():
|
|
3009
|
+
$computeIfNeeded$(): void;
|
|
2692
3010
|
}
|
|
2693
3011
|
|
|
2694
3012
|
/**
|
|
@@ -2729,9 +3047,8 @@ declare type ServerQwikManifest = Pick<QwikManifest, 'manifestHash' | 'injection
|
|
|
2729
3047
|
export declare const setPlatform: (plt: CorePlatform) => CorePlatform;
|
|
2730
3048
|
|
|
2731
3049
|
/** @internal */
|
|
2732
|
-
export declare abstract class _SharedContainer implements
|
|
3050
|
+
export declare abstract class _SharedContainer implements _Container {
|
|
2733
3051
|
readonly $version$: string;
|
|
2734
|
-
readonly $scheduler$: Scheduler;
|
|
2735
3052
|
readonly $storeProxyMap$: ObjToProxyMap;
|
|
2736
3053
|
readonly $locale$: string;
|
|
2737
3054
|
readonly $getObjectById$: (id: number | string) => any;
|
|
@@ -2739,7 +3056,10 @@ export declare abstract class _SharedContainer implements Container {
|
|
|
2739
3056
|
$currentUniqueId$: number;
|
|
2740
3057
|
$instanceHash$: string | null;
|
|
2741
3058
|
$buildBase$: string | null;
|
|
2742
|
-
|
|
3059
|
+
$renderPromise$: Promise<void> | null;
|
|
3060
|
+
$resolveRenderPromise$: (() => void) | null;
|
|
3061
|
+
$pendingCount$: number;
|
|
3062
|
+
constructor(serverData: Record<string, any>, locale: string);
|
|
2743
3063
|
trackSignalValue<T>(signal: Signal, subscriber: HostElement, property: string, data: _SubscriptionData): T;
|
|
2744
3064
|
serializationCtxFactory(NodeConstructor: {
|
|
2745
3065
|
new (...rest: any[]): {
|
|
@@ -2750,8 +3070,9 @@ export declare abstract class _SharedContainer implements Container {
|
|
|
2750
3070
|
__brand__: 'DomRef';
|
|
2751
3071
|
};
|
|
2752
3072
|
} | null, symbolToChunkResolver: SymbolToChunkResolver, writer?: StreamWriter): SerializationContext;
|
|
3073
|
+
$checkPendingCount$(): void;
|
|
2753
3074
|
abstract ensureProjectionResolved(host: HostElement): void;
|
|
2754
|
-
abstract handleError(err: any, $host$: HostElement): void;
|
|
3075
|
+
abstract handleError(err: any, $host$: HostElement | null): void;
|
|
2755
3076
|
abstract getParentHost(host: HostElement): HostElement | null;
|
|
2756
3077
|
abstract setContext<T>(host: HostElement, context: ContextId<T>, value: T): void;
|
|
2757
3078
|
abstract resolveContext<T>(host: HostElement, contextId: ContextId<T>): T | undefined;
|
|
@@ -2777,15 +3098,22 @@ export declare interface Signal<T = any> extends ReadonlySignal<T> {
|
|
|
2777
3098
|
}
|
|
2778
3099
|
|
|
2779
3100
|
declare const enum SignalFlags {
|
|
2780
|
-
INVALID = 1
|
|
3101
|
+
INVALID = 1,
|
|
3102
|
+
RUN_EFFECTS = 2
|
|
2781
3103
|
}
|
|
2782
3104
|
|
|
2783
3105
|
declare class SignalImpl<T = any> implements Signal<T> {
|
|
2784
3106
|
$untrackedValue$: T;
|
|
2785
3107
|
/** Store a list of effects which are dependent on this signal. */
|
|
2786
|
-
$effects$:
|
|
2787
|
-
$container$:
|
|
2788
|
-
|
|
3108
|
+
$effects$: undefined | Set<EffectSubscription>;
|
|
3109
|
+
$container$: _Container | null;
|
|
3110
|
+
$wrappedSignal$: WrappedSignalImpl<T> | null;
|
|
3111
|
+
constructor(container: _Container | null, value: T);
|
|
3112
|
+
/**
|
|
3113
|
+
* Use this to force running subscribers, for example when the calculated value has mutated but
|
|
3114
|
+
* remained the same object
|
|
3115
|
+
*/
|
|
3116
|
+
force(): void;
|
|
2789
3117
|
get untrackedValue(): T;
|
|
2790
3118
|
set untrackedValue(value: T);
|
|
2791
3119
|
get value(): T;
|
|
@@ -2797,6 +3125,8 @@ declare class SignalImpl<T = any> implements Signal<T> {
|
|
|
2797
3125
|
};
|
|
2798
3126
|
}
|
|
2799
3127
|
|
|
3128
|
+
declare type SimpleSsrAttrValue = string | Signal<SimpleSsrAttrValue> | boolean | object | null;
|
|
3129
|
+
|
|
2800
3130
|
declare interface SimplifiedServerRequestEvent<T = unknown> {
|
|
2801
3131
|
url: URL;
|
|
2802
3132
|
locale: string | undefined;
|
|
@@ -3076,26 +3406,27 @@ declare type SsrAttrKey = string;
|
|
|
3076
3406
|
|
|
3077
3407
|
declare type SsrAttrs = Array<SsrAttrKey | SsrAttrValue>;
|
|
3078
3408
|
|
|
3079
|
-
declare type SsrAttrValue =
|
|
3409
|
+
declare type SsrAttrValue = SimpleSsrAttrValue | Promise<SimpleSsrAttrValue>;
|
|
3080
3410
|
|
|
3081
3411
|
/** @public */
|
|
3082
3412
|
export declare const SSRComment: FunctionComponent<{
|
|
3083
3413
|
data: string;
|
|
3084
3414
|
}>;
|
|
3085
3415
|
|
|
3086
|
-
declare interface SSRContainer extends
|
|
3416
|
+
declare interface SSRContainer extends _Container {
|
|
3087
3417
|
readonly tag: string;
|
|
3088
3418
|
readonly isHtml: boolean;
|
|
3419
|
+
readonly size: number;
|
|
3089
3420
|
readonly writer: StreamWriter;
|
|
3090
3421
|
readonly serializationCtx: SerializationContext;
|
|
3091
3422
|
readonly symbolToChunkResolver: SymbolToChunkResolver;
|
|
3092
3423
|
readonly resolvedManifest: ResolvedManifest;
|
|
3093
3424
|
additionalHeadNodes: Array<JSXNodeInternal>;
|
|
3094
3425
|
additionalBodyNodes: Array<JSXNodeInternal>;
|
|
3095
|
-
|
|
3426
|
+
write(text: string): void;
|
|
3096
3427
|
openContainer(): void;
|
|
3097
3428
|
closeContainer(): ValueOrPromise<void>;
|
|
3098
|
-
openElement(elementName: string, varAttrs: SsrAttrs | null, constAttrs?: SsrAttrs | null, currentFile?: string | null): string | undefined;
|
|
3429
|
+
openElement(elementName: string, key: string | null, varAttrs: SsrAttrs | null, constAttrs?: SsrAttrs | null, currentFile?: string | null): string | undefined;
|
|
3099
3430
|
closeElement(): ValueOrPromise<void>;
|
|
3100
3431
|
openFragment(attrs: SsrAttrs): void;
|
|
3101
3432
|
closeFragment(): void;
|
|
@@ -3104,7 +3435,7 @@ declare interface SSRContainer extends Container {
|
|
|
3104
3435
|
openComponent(attrs: SsrAttrs): void;
|
|
3105
3436
|
getComponentFrame(projectionDepth: number): ISsrComponentFrame | null;
|
|
3106
3437
|
getParentComponentFrame(): ISsrComponentFrame | null;
|
|
3107
|
-
closeComponent(): void
|
|
3438
|
+
closeComponent(): Promise<void>;
|
|
3108
3439
|
textNode(text: string): void;
|
|
3109
3440
|
htmlNode(rawHtml: string): void;
|
|
3110
3441
|
commentNode(text: string): void;
|
|
@@ -3115,6 +3446,8 @@ declare interface SSRContainer extends Container {
|
|
|
3115
3446
|
render(jsx: JSXOutput): Promise<void>;
|
|
3116
3447
|
emitPreloaderPre(): void;
|
|
3117
3448
|
emitQwikLoaderAtTopIfNeeded(): void;
|
|
3449
|
+
emitPatchDataIfNeeded(): void;
|
|
3450
|
+
addBackpatchEntry(ssrNodeId: string, attrName: string, serializedValue: string | boolean | null): void;
|
|
3118
3451
|
}
|
|
3119
3452
|
|
|
3120
3453
|
/** @public */
|
|
@@ -3130,6 +3463,10 @@ declare type SsrNode = {
|
|
|
3130
3463
|
[_EFFECT_BACK_REF]: Map<EffectProperty | string, EffectSubscription> | null;
|
|
3131
3464
|
};
|
|
3132
3465
|
|
|
3466
|
+
declare const enum SsrNodeFlags {
|
|
3467
|
+
Updatable = 1
|
|
3468
|
+
}
|
|
3469
|
+
|
|
3133
3470
|
/** @public */
|
|
3134
3471
|
export declare const SSRRaw: FunctionComponent<{
|
|
3135
3472
|
data: string;
|
|
@@ -3144,38 +3481,22 @@ export declare const SSRStreamBlock: FunctionComponent<{
|
|
|
3144
3481
|
}>;
|
|
3145
3482
|
|
|
3146
3483
|
/** @public */
|
|
3147
|
-
export declare type SSRStreamChildren = AsyncGenerator<JSXChildren, void, any> | ((stream:
|
|
3484
|
+
export declare type SSRStreamChildren = AsyncGenerator<JSXChildren, void, any> | ((stream: SSRStreamWriter) => Promise<void>) | (() => AsyncGenerator<JSXChildren, void, any>);
|
|
3148
3485
|
|
|
3149
3486
|
/** @public */
|
|
3150
3487
|
export declare type SSRStreamProps = {
|
|
3151
3488
|
children: SSRStreamChildren;
|
|
3152
3489
|
};
|
|
3153
3490
|
|
|
3491
|
+
/** @public */
|
|
3492
|
+
export declare interface SSRStreamWriter {
|
|
3493
|
+
write(chunk: JSXOutput): void;
|
|
3494
|
+
}
|
|
3495
|
+
|
|
3154
3496
|
declare type StopPropagation = {
|
|
3155
3497
|
[K in keyof HTMLElementEventMap as `stoppropagation:${K}`]?: boolean;
|
|
3156
3498
|
};
|
|
3157
3499
|
|
|
3158
|
-
declare const enum StoreFlags {
|
|
3159
|
-
NONE = 0,
|
|
3160
|
-
RECURSIVE = 1,
|
|
3161
|
-
IMMUTABLE = 2
|
|
3162
|
-
}
|
|
3163
|
-
|
|
3164
|
-
declare class StoreHandler implements ProxyHandler<StoreTarget> {
|
|
3165
|
-
$flags$: StoreFlags;
|
|
3166
|
-
$container$: Container | null;
|
|
3167
|
-
$effects$: null | Map<string | symbol, Set<EffectSubscription>>;
|
|
3168
|
-
constructor($flags$: StoreFlags, $container$: Container | null);
|
|
3169
|
-
toString(): string;
|
|
3170
|
-
get(target: StoreTarget, prop: string | symbol): any;
|
|
3171
|
-
/** In the case of oldValue and value are the same, the effects are not triggered. */
|
|
3172
|
-
set(target: StoreTarget, prop: string | symbol, value: any): boolean;
|
|
3173
|
-
deleteProperty(target: StoreTarget, prop: string | symbol): boolean;
|
|
3174
|
-
has(target: StoreTarget, prop: string | symbol): boolean;
|
|
3175
|
-
ownKeys(target: StoreTarget): ArrayLike<string | symbol>;
|
|
3176
|
-
getOwnPropertyDescriptor(target: StoreTarget, prop: string | symbol): PropertyDescriptor | undefined;
|
|
3177
|
-
}
|
|
3178
|
-
|
|
3179
3500
|
declare type StoreTarget = Record<string | symbol, any>;
|
|
3180
3501
|
|
|
3181
3502
|
/** @internal */
|
|
@@ -3481,18 +3802,19 @@ declare type SymbolToChunkResolver = (symbol: string) => string;
|
|
|
3481
3802
|
*/
|
|
3482
3803
|
export declare const sync$: <T extends Function>(fn: T) => SyncQRL<T>;
|
|
3483
3804
|
|
|
3805
|
+
declare const SYNC_QRL = "<sync>";
|
|
3806
|
+
|
|
3484
3807
|
/** @public */
|
|
3485
|
-
export declare
|
|
3808
|
+
export declare type SyncQRL<TYPE extends Function> = QRL<TYPE> & {
|
|
3486
3809
|
__brand__SyncQRL__: TYPE;
|
|
3487
|
-
/**
|
|
3488
|
-
* Resolve the QRL of closure and invoke it.
|
|
3489
|
-
*
|
|
3490
|
-
* @param args - Closure arguments.
|
|
3491
|
-
* @returns A return value of the closure.
|
|
3492
|
-
*/
|
|
3493
|
-
(...args: TYPE extends (...args: infer ARGS) => any ? ARGS : never): TYPE extends (...args: any[]) => infer RETURN ? RETURN : never;
|
|
3494
3810
|
resolved: TYPE;
|
|
3495
|
-
dev
|
|
3811
|
+
dev?: QRLDev | null;
|
|
3812
|
+
} & BivariantQrlFn<QrlArgs<TYPE>, QrlReturn<TYPE>>;
|
|
3813
|
+
|
|
3814
|
+
declare type SyncQRLInternal = _QRLInternal & SyncQRLSymbol;
|
|
3815
|
+
|
|
3816
|
+
declare interface SyncQRLSymbol {
|
|
3817
|
+
$symbol$: typeof SYNC_QRL;
|
|
3496
3818
|
}
|
|
3497
3819
|
|
|
3498
3820
|
declare type TableCellSpecialAttrs = {
|
|
@@ -3502,22 +3824,23 @@ declare type TableCellSpecialAttrs = {
|
|
|
3502
3824
|
valign?: 'top' | 'middle' | 'bottom' | 'baseline' | undefined;
|
|
3503
3825
|
};
|
|
3504
3826
|
|
|
3505
|
-
declare class Task<T = unknown, B = T> extends BackRef implements DescriptorBase<unknown, Signal<B
|
|
3827
|
+
declare class Task<T = unknown, B = T> extends BackRef implements DescriptorBase<unknown, Signal<B>> {
|
|
3506
3828
|
$flags$: number;
|
|
3507
3829
|
$index$: number;
|
|
3508
3830
|
$el$: HostElement;
|
|
3509
|
-
$qrl$:
|
|
3510
|
-
$state$: Signal<B> |
|
|
3511
|
-
$destroy$:
|
|
3512
|
-
constructor($flags$: number, $index$: number, $el$: HostElement, $qrl$:
|
|
3831
|
+
$qrl$: _QRLInternal<T>;
|
|
3832
|
+
$state$: Signal<B> | undefined;
|
|
3833
|
+
$destroy$: (() => void) | null;
|
|
3834
|
+
constructor($flags$: number, $index$: number, $el$: HostElement, $qrl$: _QRLInternal<T>, $state$: Signal<B> | undefined, $destroy$: (() => void) | null);
|
|
3513
3835
|
}
|
|
3514
3836
|
|
|
3515
3837
|
/**
|
|
3516
|
-
* Used internally as a
|
|
3838
|
+
* Used internally as a qwikloader event handler to schedule a task. The `this` context is the
|
|
3839
|
+
* captures part of the QRL, provided by qwikloader.
|
|
3517
3840
|
*
|
|
3518
3841
|
* @internal
|
|
3519
3842
|
*/
|
|
3520
|
-
export declare
|
|
3843
|
+
export declare function _task(this: string, _event: Event, element: Element): void;
|
|
3521
3844
|
|
|
3522
3845
|
/** @public */
|
|
3523
3846
|
export declare interface TaskCtx {
|
|
@@ -3530,21 +3853,18 @@ declare const TaskEvent = "qTask";
|
|
|
3530
3853
|
/** @public */
|
|
3531
3854
|
export declare type TaskFn = (ctx: TaskCtx) => ValueOrPromise<void | (() => void)>;
|
|
3532
3855
|
|
|
3856
|
+
/** @public */
|
|
3857
|
+
export declare interface TaskOptions {
|
|
3858
|
+
/** Block the rendering of the component until the task completes. Default is `true` */
|
|
3859
|
+
deferUpdates?: boolean;
|
|
3860
|
+
}
|
|
3861
|
+
|
|
3533
3862
|
/** @internal */
|
|
3534
|
-
export declare
|
|
3535
|
-
|
|
3536
|
-
|
|
3537
|
-
_VNode | null,
|
|
3538
|
-
|
|
3539
|
-
_VNode | null,
|
|
3540
|
-
///////////////// 2 - Previous sibling
|
|
3541
|
-
_VNode | null,
|
|
3542
|
-
///////////////// 3 - Next sibling
|
|
3543
|
-
Text | null | undefined,
|
|
3544
|
-
string
|
|
3545
|
-
] & {
|
|
3546
|
-
__brand__: 'TextVNode';
|
|
3547
|
-
};
|
|
3863
|
+
export declare class _TextVNode extends _VNode {
|
|
3864
|
+
node: Text | null;
|
|
3865
|
+
text: string | undefined;
|
|
3866
|
+
constructor(flags: _VNodeFlags, parent: _VNode | null, previousSibling: _VNode | null | undefined, nextSibling: _VNode | null | undefined, props: Props | null, node: Text | null, text: string | undefined);
|
|
3867
|
+
}
|
|
3548
3868
|
|
|
3549
3869
|
/**
|
|
3550
3870
|
* Used to signal to Qwik which state should be watched for changes.
|
|
@@ -3565,6 +3885,8 @@ string
|
|
|
3565
3885
|
* useTask$(({ track }) => {
|
|
3566
3886
|
* // Any signals or stores accessed inside the task will be tracked
|
|
3567
3887
|
* const count = track(() => store.count);
|
|
3888
|
+
* // For stores you can also pass the store and specify the property
|
|
3889
|
+
* track(store, 'count');
|
|
3568
3890
|
* // You can also pass a signal to track() directly
|
|
3569
3891
|
* const signalCount = track(signal);
|
|
3570
3892
|
* store.doubleCount = count + signalCount;
|
|
@@ -3631,12 +3953,22 @@ export declare interface Tracker {
|
|
|
3631
3953
|
<T extends object, P extends keyof T>(obj: T, prop: P): T[P];
|
|
3632
3954
|
}
|
|
3633
3955
|
|
|
3956
|
+
/** @internal */
|
|
3957
|
+
export declare const _UNINITIALIZED: unique symbol;
|
|
3958
|
+
|
|
3634
3959
|
/**
|
|
3635
|
-
*
|
|
3960
|
+
* Get the value of the expression without tracking listeners. A function will be invoked, signals
|
|
3961
|
+
* will return their value, and stores will be unwrapped (they return the backing object).
|
|
3636
3962
|
*
|
|
3963
|
+
* When you pass a function, you can also pass additional arguments that the function will receive.
|
|
3964
|
+
*
|
|
3965
|
+
* Note that stores are not unwrapped recursively.
|
|
3966
|
+
*
|
|
3967
|
+
* @param expr - The function or object to evaluate without tracking.
|
|
3968
|
+
* @param args - Additional arguments to pass when `expr` is a function.
|
|
3637
3969
|
* @public
|
|
3638
3970
|
*/
|
|
3639
|
-
export declare const untrack: <T>(
|
|
3971
|
+
export declare const untrack: <T, A extends any[]>(expr: ((...args: A) => T) | Signal<T> | T, ...args: A) => T;
|
|
3640
3972
|
|
|
3641
3973
|
declare type UnwantedKeys = keyof HTMLAttributesBase | keyof DOMAttributes<any> | keyof ARIAMixin | keyof GlobalEventHandlers | 'enterKeyHint' | 'innerText' | 'innerHTML' | 'outerHTML' | 'inputMode' | 'outerText' | 'nodeValue' | 'textContent';
|
|
3642
3974
|
|
|
@@ -3649,19 +3981,30 @@ declare type UnwantedKeys = keyof HTMLAttributesBase | keyof DOMAttributes<any>
|
|
|
3649
3981
|
export declare const unwrapStore: <T>(value: T) => T;
|
|
3650
3982
|
|
|
3651
3983
|
/**
|
|
3652
|
-
* Creates
|
|
3653
|
-
*
|
|
3654
|
-
*
|
|
3655
|
-
*
|
|
3984
|
+
* Creates an AsyncSignal which holds the result of the given async function. If the function uses
|
|
3985
|
+
* `track()` to track reactive state, and that state changes, the AsyncSignal is recalculated, and
|
|
3986
|
+
* if the result changed, all tasks which are tracking the AsyncSignal will be re-run and all
|
|
3987
|
+
* subscribers (components, tasks etc) that read the AsyncSignal will be updated.
|
|
3656
3988
|
*
|
|
3657
|
-
*
|
|
3989
|
+
* If the async function throws an error, the AsyncSignal will capture the error and set the `error`
|
|
3990
|
+
* property. The error can be cleared by re-running the async function successfully.
|
|
3991
|
+
*
|
|
3992
|
+
* While the async function is running, the `loading` property will be set to `true`. Once the
|
|
3993
|
+
* function completes, `loading` will be set to `false`.
|
|
3994
|
+
*
|
|
3995
|
+
* If the value has not yet been resolved, reading the AsyncSignal will throw a Promise, which will
|
|
3996
|
+
* retry the component or task once the value resolves.
|
|
3997
|
+
*
|
|
3998
|
+
* If the value has been resolved, but the async function is re-running, reading the AsyncSignal
|
|
3999
|
+
* will subscribe to it and return the last resolved value until the new value is ready. As soon as
|
|
4000
|
+
* the new value is ready, the subscribers will be updated.
|
|
3658
4001
|
*
|
|
3659
4002
|
* @public
|
|
3660
4003
|
*/
|
|
3661
|
-
export declare const
|
|
4004
|
+
export declare const useAsync$: <T>(qrl: AsyncFn<T>, options?: AsyncSignalOptions<T> | undefined) => AsyncSignal<T>;
|
|
3662
4005
|
|
|
3663
4006
|
/** @internal */
|
|
3664
|
-
export declare const
|
|
4007
|
+
export declare const useAsyncQrl: <T>(qrl: QRL<AsyncFn<T>>, options?: AsyncSignalOptions<T>) => AsyncSignal<T>;
|
|
3665
4008
|
|
|
3666
4009
|
/**
|
|
3667
4010
|
* Creates a computed signal which is calculated from the given function. A computed signal is a
|
|
@@ -3673,20 +4016,32 @@ export declare const useAsyncComputedQrl: <T>(qrl: QRL<AsyncComputedFn<T>>) => A
|
|
|
3673
4016
|
*
|
|
3674
4017
|
* @public
|
|
3675
4018
|
*/
|
|
3676
|
-
export declare const useComputed$: <T>(qrl: ComputedFn<T
|
|
4019
|
+
export declare const useComputed$: <T>(qrl: ComputedFn<T>, options?: ComputedOptions | undefined) => ComputedReturnType<T>;
|
|
3677
4020
|
|
|
3678
4021
|
/** @internal */
|
|
3679
|
-
export declare const useComputedQrl: <T>(qrl: QRL<ComputedFn<T
|
|
4022
|
+
export declare const useComputedQrl: <T>(qrl: QRL<ComputedFn<T>>, options?: ComputedOptions) => ComputedReturnType<T>;
|
|
3680
4023
|
|
|
3681
4024
|
/**
|
|
3682
4025
|
* Stores a value which is retained for the lifetime of the component. Subsequent calls to
|
|
3683
4026
|
* `useConstant` will always return the first value given.
|
|
3684
4027
|
*
|
|
3685
|
-
* If the value is a function, the function is invoked once to calculate the actual value.
|
|
4028
|
+
* If the value is a function, the function is invoked once to calculate the actual value. You can
|
|
4029
|
+
* then also pass arguments to call the function with, so that you don't need to create a new
|
|
4030
|
+
* function on every render.
|
|
4031
|
+
*
|
|
4032
|
+
* @example
|
|
4033
|
+
*
|
|
4034
|
+
* ```tsx
|
|
4035
|
+
* const fixedRandomValue = useConstant(() => Math.random);
|
|
4036
|
+
* const otherFixedRandomValue = useConstant(Math.random);
|
|
4037
|
+
*
|
|
4038
|
+
* const getConfig = (env: string) => { ... }
|
|
4039
|
+
* const config = useConstant(getConfig, environment);
|
|
4040
|
+
* ```
|
|
3686
4041
|
*
|
|
3687
4042
|
* @public
|
|
3688
4043
|
*/
|
|
3689
|
-
export declare const useConstant: <T>(value: (() => T) | T) => T;
|
|
4044
|
+
export declare const useConstant: <T, A extends any[]>(value: ((...args: A) => T) | T, ...args: A) => T;
|
|
3690
4045
|
|
|
3691
4046
|
declare interface UseContext {
|
|
3692
4047
|
<STATE, T>(context: ContextId<STATE>, transformer: (value: STATE) => T): T;
|
|
@@ -3809,6 +4164,7 @@ export declare const useId: () => string;
|
|
|
3809
4164
|
* NOTE: `useLexicalScope` method can only be used in the synchronous portion of the callback
|
|
3810
4165
|
* (before any `await` statements.)
|
|
3811
4166
|
*
|
|
4167
|
+
* @deprecated Use `_captures` instead.
|
|
3812
4168
|
* @internal
|
|
3813
4169
|
*/
|
|
3814
4170
|
export declare const useLexicalScope: <VARS extends any[]>() => VARS;
|
|
@@ -3819,6 +4175,8 @@ export declare const useLexicalScope: <VARS extends any[]>() => VARS;
|
|
|
3819
4175
|
* Used to programmatically add event listeners. Useful from custom `use*` methods, which do not
|
|
3820
4176
|
* have access to the JSX. Otherwise, it's adding a JSX listener in the `<div>` is a better idea.
|
|
3821
4177
|
*
|
|
4178
|
+
* Events are case sensitive.
|
|
4179
|
+
*
|
|
3822
4180
|
* @public
|
|
3823
4181
|
* @see `useOn`, `useOnWindow`, `useOnDocument`.
|
|
3824
4182
|
*/
|
|
@@ -3830,6 +4188,8 @@ export declare const useOn: <T extends KnownEventNames>(event: T | T[], eventQrl
|
|
|
3830
4188
|
* Used to programmatically add event listeners. Useful from custom `use*` methods, which do not
|
|
3831
4189
|
* have access to the JSX.
|
|
3832
4190
|
*
|
|
4191
|
+
* Events are case sensitive.
|
|
4192
|
+
*
|
|
3833
4193
|
* @public
|
|
3834
4194
|
* @see `useOn`, `useOnWindow`, `useOnDocument`.
|
|
3835
4195
|
*
|
|
@@ -3857,6 +4217,8 @@ export declare const useOnDocument: <T extends KnownEventNames>(event: T | T[],
|
|
|
3857
4217
|
* Used to programmatically add event listeners. Useful from custom `use*` methods, which do not
|
|
3858
4218
|
* have access to the JSX.
|
|
3859
4219
|
*
|
|
4220
|
+
* Events are case sensitive.
|
|
4221
|
+
*
|
|
3860
4222
|
* @public
|
|
3861
4223
|
* @see `useOn`, `useOnWindow`, `useOnDocument`.
|
|
3862
4224
|
*
|
|
@@ -3895,45 +4257,15 @@ export declare const useOnWindow: <T extends KnownEventNames>(event: T | T[], ev
|
|
|
3895
4257
|
* Be careful when using a `try/catch` statement in `useResource$`. If you catch the error and don't
|
|
3896
4258
|
* re-throw it (or a new Error), the resource status will never be `rejected`.
|
|
3897
4259
|
*
|
|
3898
|
-
*
|
|
3899
|
-
*
|
|
3900
|
-
*
|
|
3901
|
-
* city name changes.
|
|
3902
|
-
*
|
|
3903
|
-
* ```tsx
|
|
3904
|
-
* const Cmp = component$(() => {
|
|
3905
|
-
* const cityS = useSignal('');
|
|
3906
|
-
*
|
|
3907
|
-
* const weatherResource = useResource$(async ({ track, cleanup }) => {
|
|
3908
|
-
* const cityName = track(cityS);
|
|
3909
|
-
* const abortController = new AbortController();
|
|
3910
|
-
* cleanup(() => abortController.abort('cleanup'));
|
|
3911
|
-
* const res = await fetch(`http://weatherdata.com?city=${cityName}`, {
|
|
3912
|
-
* signal: abortController.signal,
|
|
3913
|
-
* });
|
|
3914
|
-
* const data = await res.json();
|
|
3915
|
-
* return data as { temp: number };
|
|
3916
|
-
* });
|
|
3917
|
-
*
|
|
3918
|
-
* return (
|
|
3919
|
-
* <div>
|
|
3920
|
-
* <input name="city" bind:value={cityS} />
|
|
3921
|
-
* <Resource
|
|
3922
|
-
* value={weatherResource}
|
|
3923
|
-
* onResolved={(weather) => {
|
|
3924
|
-
* return <div>Temperature: {weather.temp}</div>;
|
|
3925
|
-
* }}
|
|
3926
|
-
* />
|
|
3927
|
-
* </div>
|
|
3928
|
-
* );
|
|
3929
|
-
* });
|
|
3930
|
-
* ```
|
|
3931
|
-
*
|
|
4260
|
+
* @deprecated Use `useAsync$` instead, which is more powerful and flexible. `useResource$` is still
|
|
4261
|
+
* available for backward compatibility but it is recommended to migrate to `useAsync$` for new
|
|
4262
|
+
* code and when updating existing code.
|
|
3932
4263
|
* @public
|
|
4264
|
+
* @see useAsync$
|
|
3933
4265
|
* @see Resource
|
|
3934
4266
|
* @see ResourceReturn
|
|
3935
4267
|
*/
|
|
3936
|
-
export declare const useResource$: <T>(
|
|
4268
|
+
export declare const useResource$: <T>(qrl: ResourceFn<T>, opts?: ResourceOptions | undefined) => ResourceReturn<T>;
|
|
3937
4269
|
|
|
3938
4270
|
/** @internal */
|
|
3939
4271
|
export declare const useResourceQrl: <T>(qrl: QRL<ResourceFn<T>>, opts?: ResourceOptions) => ResourceReturn<T>;
|
|
@@ -4002,7 +4334,7 @@ export declare const useResourceQrl: <T>(qrl: QRL<ResourceFn<T>>, opts?: Resourc
|
|
|
4002
4334
|
export declare const useSerializer$: typeof createSerializer$;
|
|
4003
4335
|
|
|
4004
4336
|
/** @internal */
|
|
4005
|
-
export declare const useSerializerQrl: <T, S>(qrl: QRL<SerializerArg<T, S>>) =>
|
|
4337
|
+
export declare const useSerializerQrl: <T, S>(qrl: QRL<SerializerArg<T, S>>) => SerializerSignalImpl<T, S>;
|
|
4006
4338
|
|
|
4007
4339
|
/** @public */
|
|
4008
4340
|
export declare function useServerData<T>(key: string): T | undefined;
|
|
@@ -4016,14 +4348,61 @@ export declare interface UseSignal {
|
|
|
4016
4348
|
<T>(value: T | (() => T)): Signal<T>;
|
|
4017
4349
|
}
|
|
4018
4350
|
|
|
4019
|
-
/**
|
|
4351
|
+
/**
|
|
4352
|
+
* Creates an object with a single reactive `.value` property, that Qwik can track across
|
|
4353
|
+
* serializations.
|
|
4354
|
+
*
|
|
4355
|
+
* Use it to create state for your application. The object has a getter and setter to track reads
|
|
4356
|
+
* and writes of the `.value` property. When the value changes, any functions that read from it will
|
|
4357
|
+
* re-run.
|
|
4358
|
+
*
|
|
4359
|
+
* Prefer `useSignal` over `useStore` when possible, as it is more efficient.
|
|
4360
|
+
*
|
|
4361
|
+
* ### Example
|
|
4362
|
+
*
|
|
4363
|
+
* ```tsx
|
|
4364
|
+
* const Signals = component$(() => {
|
|
4365
|
+
* const counter = useSignal(1);
|
|
4366
|
+
* const text = useSignal('changeme');
|
|
4367
|
+
* const toggle = useSignal(false);
|
|
4368
|
+
*
|
|
4369
|
+
* // useSignal() can also accept a function to calculate the initial value
|
|
4370
|
+
* const state = useSignal(() => {
|
|
4371
|
+
* return expensiveInitialValue();
|
|
4372
|
+
* });
|
|
4373
|
+
*
|
|
4374
|
+
* return (
|
|
4375
|
+
* <div>
|
|
4376
|
+
* <button onClick$={() => counter.value++}>Counter: {counter.value}</button>
|
|
4377
|
+
* {
|
|
4378
|
+
* // pass signal values as the value, the optimizer will make it pass the signal
|
|
4379
|
+
* }
|
|
4380
|
+
* <Child state={state.value} />
|
|
4381
|
+
* {
|
|
4382
|
+
* // signals can be bound to inputs. A property named `bind:x` implies that the property
|
|
4383
|
+
* is a signal
|
|
4384
|
+
* }
|
|
4385
|
+
* <input type="text" bind:value={text} />
|
|
4386
|
+
* <input type="checkbox" bind:checked={toggle} />
|
|
4387
|
+
* </div>
|
|
4388
|
+
* );
|
|
4389
|
+
* });
|
|
4390
|
+
* ```
|
|
4391
|
+
*
|
|
4392
|
+
* @public
|
|
4393
|
+
*/
|
|
4020
4394
|
export declare const useSignal: UseSignal;
|
|
4021
4395
|
|
|
4022
4396
|
/**
|
|
4023
|
-
* Creates
|
|
4397
|
+
* Creates a reactive object that Qwik can track across serialization.
|
|
4398
|
+
*
|
|
4399
|
+
* Use it to create state for your application. The returned object is a Proxy that tracks reads and
|
|
4400
|
+
* writes. When any of the properties change, the functions that read those properties will re-run.
|
|
4024
4401
|
*
|
|
4025
|
-
*
|
|
4026
|
-
*
|
|
4402
|
+
* `Store`s are deep by default, meaning that any objects assigned to properties will also become
|
|
4403
|
+
* `Store`s. This includes arrays.
|
|
4404
|
+
*
|
|
4405
|
+
* Prefer `useSignal` over `useStore` when possible, as it is more efficient.
|
|
4027
4406
|
*
|
|
4028
4407
|
* ### Example
|
|
4029
4408
|
*
|
|
@@ -4203,10 +4582,10 @@ export declare const useStylesScopedQrl: (styles: QRL<string>) => UseStylesScope
|
|
|
4203
4582
|
* @public
|
|
4204
4583
|
* @see `Tracker`
|
|
4205
4584
|
*/
|
|
4206
|
-
export declare const useTask$: (fn: TaskFn) => void;
|
|
4585
|
+
export declare const useTask$: (fn: TaskFn, opts?: TaskOptions) => void;
|
|
4207
4586
|
|
|
4208
4587
|
/** @internal */
|
|
4209
|
-
export declare const useTaskQrl: (qrl: QRL<TaskFn
|
|
4588
|
+
export declare const useTaskQrl: (qrl: QRL<TaskFn>, opts?: TaskOptions) => void;
|
|
4210
4589
|
|
|
4211
4590
|
/**
|
|
4212
4591
|
* ```tsx
|
|
@@ -4236,6 +4615,13 @@ export declare const useVisibleTask$: (fn: TaskFn, opts?: OnVisibleTaskOptions)
|
|
|
4236
4615
|
/** @internal */
|
|
4237
4616
|
export declare const useVisibleTaskQrl: (qrl: QRL<TaskFn>, opts?: OnVisibleTaskOptions) => void;
|
|
4238
4617
|
|
|
4618
|
+
/**
|
|
4619
|
+
* Handles events for bind:value
|
|
4620
|
+
*
|
|
4621
|
+
* @internal
|
|
4622
|
+
*/
|
|
4623
|
+
export declare function _val(this: string | undefined, _: any, element: HTMLInputElement): void;
|
|
4624
|
+
|
|
4239
4625
|
/**
|
|
4240
4626
|
* Type representing a value which is either resolve or a promise.
|
|
4241
4627
|
*
|
|
@@ -4250,38 +4636,59 @@ export declare const _VAR_PROPS: unique symbol;
|
|
|
4250
4636
|
export declare const _verifySerializable: <T>(value: T, preMessage?: string) => T;
|
|
4251
4637
|
|
|
4252
4638
|
/**
|
|
4253
|
-
* 2.0.0-beta.
|
|
4639
|
+
* 2.0.0-beta.23-dev+03de42d
|
|
4254
4640
|
*
|
|
4255
4641
|
* @public
|
|
4256
4642
|
*/
|
|
4257
4643
|
export declare const version: string;
|
|
4258
4644
|
|
|
4259
4645
|
/** @internal */
|
|
4260
|
-
export declare
|
|
4261
|
-
|
|
4262
|
-
|
|
4263
|
-
_VNode | null
|
|
4264
|
-
|
|
4265
|
-
|
|
4266
|
-
/////////////// 2 - Previous sibling
|
|
4267
|
-
_VNode | null,
|
|
4268
|
-
/////////////// 3 - Next sibling
|
|
4269
|
-
_VNode | null,
|
|
4270
|
-
/////////////// 4 - First child
|
|
4271
|
-
_VNode | null,
|
|
4272
|
-
(string | null | boolean)[]
|
|
4273
|
-
] & {
|
|
4274
|
-
__brand__: 'FragmentNode' & 'HostElement';
|
|
4275
|
-
};
|
|
4646
|
+
export declare class _VirtualVNode extends _VNode {
|
|
4647
|
+
key: string | null;
|
|
4648
|
+
firstChild: _VNode | null | undefined;
|
|
4649
|
+
lastChild: _VNode | null | undefined;
|
|
4650
|
+
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);
|
|
4651
|
+
}
|
|
4276
4652
|
|
|
4277
4653
|
/** @public */
|
|
4278
4654
|
export declare type VisibleTaskStrategy = 'intersection-observer' | 'document-ready' | 'document-idle';
|
|
4279
4655
|
|
|
4280
4656
|
/** @internal */
|
|
4281
|
-
export declare
|
|
4657
|
+
export declare abstract class _VNode implements BackRef {
|
|
4658
|
+
flags: _VNodeFlags;
|
|
4659
|
+
parent: _VNode | null;
|
|
4660
|
+
previousSibling: _VNode | null | undefined;
|
|
4661
|
+
nextSibling: _VNode | null | undefined;
|
|
4662
|
+
props: Props | null;
|
|
4663
|
+
[_EFFECT_BACK_REF]: Map<any, any> | undefined;
|
|
4664
|
+
slotParent: _VNode | null;
|
|
4665
|
+
dirty: ChoreBits;
|
|
4666
|
+
dirtyChildren: _VNode[] | null;
|
|
4667
|
+
nextDirtyChildIndex: number;
|
|
4668
|
+
constructor(flags: _VNodeFlags, parent: _VNode | null, previousSibling: _VNode | null | undefined, nextSibling: _VNode | null | undefined, props: Props | null);
|
|
4669
|
+
toString(): string;
|
|
4670
|
+
}
|
|
4671
|
+
|
|
4672
|
+
/** @internal */
|
|
4673
|
+
export declare const _vnode_ensureElementInflated: (container: _Container, vnode: _VNode) => void;
|
|
4674
|
+
|
|
4675
|
+
/** @internal */
|
|
4676
|
+
export declare const _vnode_getAttrKeys: (container: _Container, vnode: _ElementVNode | _VirtualVNode) => string[];
|
|
4677
|
+
|
|
4678
|
+
/** @internal */
|
|
4679
|
+
export declare const _vnode_getFirstChild: (vnode: _VNode) => _VNode | null;
|
|
4680
|
+
|
|
4681
|
+
/** @internal */
|
|
4682
|
+
export declare const _vnode_isMaterialized: (vNode: _VNode) => boolean;
|
|
4683
|
+
|
|
4684
|
+
/** @internal */
|
|
4685
|
+
export declare const _vnode_isTextVNode: (vNode: _VNode) => vNode is _TextVNode;
|
|
4282
4686
|
|
|
4283
4687
|
/** @internal */
|
|
4284
|
-
export declare
|
|
4688
|
+
export declare const _vnode_isVirtualVNode: (vNode: _VNode) => vNode is _VirtualVNode;
|
|
4689
|
+
|
|
4690
|
+
/** @internal */
|
|
4691
|
+
export declare function _vnode_toString(this: _VNode | null, depth?: number, offset?: string, materialize?: boolean, siblings?: boolean, colorize?: boolean, container?: _Container | null): string;
|
|
4285
4692
|
|
|
4286
4693
|
/**
|
|
4287
4694
|
* Array of numbers which describes virtual nodes in the tree.
|
|
@@ -4349,40 +4756,25 @@ export declare const enum _VNodeFlags {
|
|
|
4349
4756
|
Element = 1,
|
|
4350
4757
|
Virtual = 2,
|
|
4351
4758
|
ELEMENT_OR_VIRTUAL_MASK = 3,
|
|
4759
|
+
Text = 4,
|
|
4352
4760
|
ELEMENT_OR_TEXT_MASK = 5,
|
|
4353
4761
|
TYPE_MASK = 7,
|
|
4354
4762
|
INFLATED_TYPE_MASK = 15,
|
|
4355
|
-
Text = 4,
|
|
4356
4763
|
Inflated = 8,
|
|
4357
4764
|
Resolved = 16,
|
|
4358
4765
|
Deleted = 32,
|
|
4359
|
-
|
|
4360
|
-
|
|
4766
|
+
HasIterationItems = 64,
|
|
4767
|
+
InflatedIterationItems = 128,
|
|
4768
|
+
Cursor = 256,
|
|
4769
|
+
NAMESPACE_MASK = 1536,
|
|
4770
|
+
NEGATED_NAMESPACE_MASK = -1537,
|
|
4361
4771
|
NS_html = 0,// http://www.w3.org/1999/xhtml
|
|
4362
|
-
NS_svg =
|
|
4363
|
-
NS_math =
|
|
4364
|
-
}
|
|
4365
|
-
|
|
4366
|
-
declare type VNodeJournal = Array<VNodeJournalOpCode | Document | Element | Text | string | boolean | null>;
|
|
4367
|
-
|
|
4368
|
-
/**
|
|
4369
|
-
* Fundamental DOM operations are:
|
|
4370
|
-
*
|
|
4371
|
-
* - Insert new DOM element/text
|
|
4372
|
-
* - Remove DOM element/text
|
|
4373
|
-
* - Set DOM element attributes
|
|
4374
|
-
* - Set text node value
|
|
4375
|
-
*/
|
|
4376
|
-
declare const enum VNodeJournalOpCode {
|
|
4377
|
-
SetText = 1,// ------ [SetAttribute, target, text]
|
|
4378
|
-
SetAttribute = 2,// - [SetAttribute, target, ...(key, values)]]
|
|
4379
|
-
HoistStyles = 3,// -- [HoistStyles, document]
|
|
4380
|
-
Remove = 4,// ------- [Insert, target(parent), ...nodes]
|
|
4381
|
-
Insert = 5
|
|
4772
|
+
NS_svg = 512,// http://www.w3.org/2000/svg
|
|
4773
|
+
NS_math = 1024
|
|
4382
4774
|
}
|
|
4383
4775
|
|
|
4384
4776
|
/** @internal */
|
|
4385
|
-
export declare const _waitUntilRendered: (
|
|
4777
|
+
export declare const _waitUntilRendered: (container: _Container) => Promise<void>;
|
|
4386
4778
|
|
|
4387
4779
|
/** @internal */
|
|
4388
4780
|
export declare function _walkJSX(ssr: SSRContainer, value: JSXOutput, options: {
|
|
@@ -4390,9 +4782,6 @@ export declare function _walkJSX(ssr: SSRContainer, value: JSXOutput, options: {
|
|
|
4390
4782
|
parentComponentFrame: ISsrComponentFrame | null;
|
|
4391
4783
|
}): Promise<void>;
|
|
4392
4784
|
|
|
4393
|
-
/** @internal */
|
|
4394
|
-
export declare const _weakSerialize: <T extends object>(input: T) => Partial<T>;
|
|
4395
|
-
|
|
4396
4785
|
/**
|
|
4397
4786
|
* Override the `getLocale` with `lang` within the `fn` execution.
|
|
4398
4787
|
*
|
|
@@ -4400,8 +4789,10 @@ export declare const _weakSerialize: <T extends object>(input: T) => Partial<T>;
|
|
|
4400
4789
|
*/
|
|
4401
4790
|
export declare function withLocale<T>(locale: string, fn: () => T): T;
|
|
4402
4791
|
|
|
4792
|
+
declare type WrappedProp<T extends object, P extends keyof T> = T extends Signal ? WrappedSignalImpl<PropType<T, P>> : PropType<T, P>;
|
|
4793
|
+
|
|
4403
4794
|
declare const enum WrappedSignalFlags {
|
|
4404
|
-
UNWRAP =
|
|
4795
|
+
UNWRAP = 4
|
|
4405
4796
|
}
|
|
4406
4797
|
|
|
4407
4798
|
declare class WrappedSignalImpl<T> extends SignalImpl<T> implements BackRef {
|
|
@@ -4409,18 +4800,13 @@ declare class WrappedSignalImpl<T> extends SignalImpl<T> implements BackRef {
|
|
|
4409
4800
|
$func$: (...args: any[]) => T;
|
|
4410
4801
|
$funcStr$: string | null;
|
|
4411
4802
|
$flags$: AllSignalFlags;
|
|
4412
|
-
$hostElement$: HostElement |
|
|
4413
|
-
|
|
4414
|
-
[
|
|
4415
|
-
|
|
4416
|
-
$invalidate$(): void;
|
|
4417
|
-
/**
|
|
4418
|
-
* Use this to force running subscribers, for example when the calculated value has mutated but
|
|
4419
|
-
* remained the same object.
|
|
4420
|
-
*/
|
|
4421
|
-
force(): void;
|
|
4803
|
+
$hostElement$: HostElement | undefined;
|
|
4804
|
+
[_EFFECT_BACK_REF]: Map<EffectProperty | string, EffectSubscription> | undefined;
|
|
4805
|
+
constructor(container: _Container | null, fn: (...args: any[]) => T, args: any[], fnStr: string | null, flags?: SignalFlags);
|
|
4806
|
+
invalidate(): void;
|
|
4422
4807
|
get untrackedValue(): T;
|
|
4423
|
-
$computeIfNeeded$():
|
|
4808
|
+
$computeIfNeeded$(): void;
|
|
4809
|
+
$unwrapIfSignal$(): SignalImpl<T> | WrappedSignalImpl<T>;
|
|
4424
4810
|
set value(_: any);
|
|
4425
4811
|
get value(): any;
|
|
4426
4812
|
}
|
|
@@ -4436,12 +4822,9 @@ declare class WrappedSignalImpl<T> extends SignalImpl<T> implements BackRef {
|
|
|
4436
4822
|
*
|
|
4437
4823
|
* @internal
|
|
4438
4824
|
*/
|
|
4439
|
-
export declare const _wrapProp: <T extends
|
|
4825
|
+
export declare const _wrapProp: <T extends object, P extends keyof T>(...args: [T, P?]) => WrappedProp<T, P>;
|
|
4440
4826
|
|
|
4441
4827
|
/** @internal @deprecated v1 compat */
|
|
4442
|
-
export declare const _wrapSignal: <T extends
|
|
4443
|
-
|
|
4444
|
-
/** @internal */
|
|
4445
|
-
export declare const _wrapStore: <T extends Record<any, any>, P extends keyof T>(obj: T, prop: P) => Signal<T>;
|
|
4828
|
+
export declare const _wrapSignal: <T extends object, P extends keyof T>(obj: T, prop: P) => T[P] | WrappedProp<T, P>;
|
|
4446
4829
|
|
|
4447
4830
|
export { }
|