@qwik.dev/core 2.0.0-beta.40 → 2.0.0-beta.41

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/core.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * @qwik.dev/core 2.0.0-beta.40-dev+a459d55
3
+ * @qwik.dev/core 2.0.0-beta.41-dev+4d04076
4
4
  * Copyright QwikDev. All Rights Reserved.
5
5
  * Use of this source code is governed by an MIT-style license that can be
6
6
  * found in the LICENSE file at https://github.com/QwikDev/qwik/blob/main/LICENSE
@@ -1266,7 +1266,7 @@ const COMMA = ',';
1266
1266
  *
1267
1267
  * @public
1268
1268
  */
1269
- const version = "2.0.0-beta.40-dev+a459d55";
1269
+ const version = "2.0.0-beta.41-dev+4d04076";
1270
1270
 
1271
1271
  const isNode = (value) => {
1272
1272
  return value && typeof value.nodeType === 'number';
@@ -2656,9 +2656,9 @@ class ComputedSignalImpl extends SignalImpl {
2656
2656
  super.value = result;
2657
2657
  }
2658
2658
  /**
2659
- * Invoke the compute fn with the ComputeCtx argument. CTX_ARG signals (useAsync$, useResource$)
2660
- * only track via its explicit track(). Computeds auto-track every synchronous read instead; after
2661
- * the first await they must use the explicit track() too.
2659
+ * Invoke the compute fn with the ComputeCtx argument. CTX_ARG signals (createAsyncQrl,
2660
+ * useResource$) only track via its explicit track(). Computeds auto-track every synchronous read
2661
+ * instead; after the first await they must use the explicit track() too.
2662
2662
  */
2663
2663
  $invokeComputeFn$(fn, job) {
2664
2664
  const computeFn = fn;
@@ -3043,14 +3043,6 @@ const createSignal = createSignal$1;
3043
3043
  * @public
3044
3044
  */
3045
3045
  const createComputed$ = /*#__PURE__*/ implicit$FirstArg(createComputedSignal);
3046
- /**
3047
- * Create a signal holding a `.value` which is calculated from the given async function (QRL). The
3048
- * standalone version of `useAsync$`.
3049
- *
3050
- * @deprecated Use `createComputed$` instead, it has async support now.
3051
- * @public
3052
- */
3053
- const createAsync$ = /*#__PURE__*/ implicit$FirstArg(createAsyncSignal);
3054
3046
  /**
3055
3047
  * Create a signal that holds a custom serializable value. See {@link useSerializer$} for more
3056
3048
  * details.
@@ -3784,11 +3776,38 @@ function getFileLocationFromJsx(jsxDev) {
3784
3776
  }
3785
3777
 
3786
3778
  const _hasOwnProperty$1 = Object.prototype.hasOwnProperty;
3779
+ const _propertyIsEnumerable = Object.prototype.propertyIsEnumerable;
3787
3780
  function isSlotProp(prop) {
3788
3781
  return !prop.startsWith('q:') && !prop.startsWith(NON_SERIALIZABLE_MARKER_PREFIX);
3789
3782
  }
3790
3783
  /** @internal */
3791
3784
  const _restProps = (props, omit = [], target = {}) => {
3785
+ // The optimizer can apply this transform to plain, non-component objects and
3786
+ // even primitives (e.g. destructuring a string). Guard `isPropsProxy`, whose
3787
+ // `in` check throws on primitives, then fall back to native object-rest
3788
+ // copying so the transform cannot silently lose data.
3789
+ if (!isObject(props) || !isPropsProxy(props)) {
3790
+ // Match native rest-destructuring: `({ ...rest }) => …` throws on nullish.
3791
+ if (props == null) {
3792
+ throw new TypeError(`Cannot destructure '${props}' as it is ${props}.`);
3793
+ }
3794
+ // Box primitives so they get native ToObject rest semantics (e.g. 'ab' -> {0:'a',1:'b'}).
3795
+ const source = Object(props);
3796
+ const keys = Reflect.ownKeys(source);
3797
+ for (let i = 0; i < keys.length; i++) {
3798
+ const key = keys[i];
3799
+ if (_propertyIsEnumerable.call(source, key) &&
3800
+ (typeof key === 'symbol' || !omit.includes(key))) {
3801
+ Object.defineProperty(target, key, {
3802
+ value: source[key],
3803
+ enumerable: true,
3804
+ configurable: true,
3805
+ writable: true,
3806
+ });
3807
+ }
3808
+ }
3809
+ return target;
3810
+ }
3792
3811
  let constPropsTarget = null;
3793
3812
  const constProps = props[_CONST_PROPS];
3794
3813
  if (constProps) {
@@ -12420,7 +12439,7 @@ const useResourceQrl = (qrl, opts) => {
12420
12439
  * const Cmp = component$(() => {
12421
12440
  * const city = useSignal('');
12422
12441
  *
12423
- * const weather = useAsync$(async ({ track, cleanup, abortSignal }) => {
12442
+ * const weather = useComputed$(async ({ track, cleanup, abortSignal }) => {
12424
12443
  * const cityName = track(city);
12425
12444
  * const res = await fetch(`http://weatherdata.com?city=${cityName}`, {
12426
12445
  * signal: abortSignal,
@@ -12434,7 +12453,7 @@ const useResourceQrl = (qrl, opts) => {
12434
12453
  * <input name="city" bind:value={city} />
12435
12454
  * <div>
12436
12455
  * Temperature:{' '}
12437
- * {weather.loading
12456
+ * {weather.pending
12438
12457
  * ? 'Loading...'
12439
12458
  * : weather.error
12440
12459
  * ? `Error: ${weather.error.message}`
@@ -12445,8 +12464,8 @@ const useResourceQrl = (qrl, opts) => {
12445
12464
  * });
12446
12465
  * ```
12447
12466
  *
12448
- * @deprecated Use `useAsync$` instead, which is more efficient, and has a more flexible API. Just
12449
- * read the `loading` and `error` properties from the returned signal to determine the status.
12467
+ * @deprecated Use `useComputed$` instead. Read the `pending` and `error` properties from the
12468
+ * returned signal to determine the status.
12450
12469
  * @public
12451
12470
  */
12452
12471
  const Resource = ({ value, onResolved, onPending, onRejected, }) => {
@@ -16587,13 +16606,13 @@ const _useStyles = (styleQrl, transform, scoped) => {
16587
16606
  return styleId;
16588
16607
  };
16589
16608
 
16590
- const creator$2 = (qrl, options) => {
16609
+ const creator$1 = (qrl, options) => {
16591
16610
  qrl.resolve();
16592
16611
  return createComputedSignal(qrl, options);
16593
16612
  };
16594
16613
  /** @internal */
16595
16614
  const useComputedQrl = (qrl, options) => {
16596
- return useConstant((creator$2), qrl, options);
16615
+ return useConstant((creator$1), qrl, options);
16597
16616
  };
16598
16617
  /**
16599
16618
  * Creates a computed signal which is calculated from the given function. A computed signal is a
@@ -16613,12 +16632,12 @@ const useComputedQrl = (qrl, options) => {
16613
16632
  */
16614
16633
  const useComputed$ = implicit$FirstArg(useComputedQrl);
16615
16634
 
16616
- const creator$1 = (qrl) => {
16635
+ const creator = (qrl) => {
16617
16636
  qrl.resolve();
16618
16637
  return createSerializerSignal(qrl);
16619
16638
  };
16620
16639
  /** @internal */
16621
- const useSerializerQrl = (qrl) => useConstant((creator$1), qrl);
16640
+ const useSerializerQrl = (qrl) => useConstant((creator), qrl);
16622
16641
  /**
16623
16642
  * Creates a signal which holds a custom serializable value. It requires that the value implements
16624
16643
  * the `CustomSerializable` type, which means having a function under the `[SerializeSymbol]`
@@ -16848,42 +16867,6 @@ const useTask$ = /*#__PURE__*/ implicit$FirstArg(useTaskQrl);
16848
16867
  // We need to cast to help out the api extractor
16849
16868
  const useVisibleTask$ = /*#__PURE__*/ implicit$FirstArg(useVisibleTaskQrl);
16850
16869
 
16851
- const creator = (qrl, options) => {
16852
- qrl.resolve();
16853
- return createAsyncSignal(qrl, options);
16854
- };
16855
- /**
16856
- * @deprecated Use `useComputed$` instead, it has async support now.
16857
- * @internal
16858
- */
16859
- const useAsyncQrl = (qrl, options) => {
16860
- return useConstant((creator), qrl, options);
16861
- };
16862
- /**
16863
- * Creates an AsyncSignal which holds the result of the given async function. If the function uses
16864
- * `track()` to track reactive state, and that state changes, the AsyncSignal is recalculated, and
16865
- * if the result changed, all tasks which are tracking the AsyncSignal will be re-run and all
16866
- * subscribers (components, tasks etc) that read the AsyncSignal will be updated.
16867
- *
16868
- * If the async function throws an error, the AsyncSignal will capture the error and set the `error`
16869
- * property. The error can be cleared by re-running the async function successfully.
16870
- *
16871
- * While the async function is running, the `loading` property will be set to `true`. Once the
16872
- * function completes, `loading` will be set to `false`.
16873
- *
16874
- * If the value has not yet been resolved, reading the AsyncSignal will throw a Promise, which will
16875
- * retry the component or task once the value resolves.
16876
- *
16877
- * If the value has been resolved, but the async function is re-running, reading the AsyncSignal
16878
- * will subscribe to it and return the last resolved value until the new value is ready. As soon as
16879
- * the new value is ready, the subscribers will be updated.
16880
- *
16881
- * @deprecated Use `useComputed$` instead, it has async support now. It auto-tracks synchronous
16882
- * reads; after the first `await`, use the provided `track()` like before.
16883
- * @public
16884
- */
16885
- const useAsync$ = implicit$FirstArg(useAsyncQrl);
16886
-
16887
16870
  /** @public */
16888
16871
  const useErrorBoundary = () => {
16889
16872
  const error = useStore({ error: undefined });
@@ -17333,5 +17316,5 @@ if (import.meta.hot) {
17333
17316
  });
17334
17317
  }
17335
17318
 
17336
- export { $, Each, Fragment, NoSerializeSymbol, PrefetchGraph, PrefetchServiceWorker, RenderOnce, Resource, Reveal, SSRComment, SSRRaw, SSRStream, SSRStreamBlock, SerializerSymbol, Show, SkipRender, Slot, Suspense, _CONST_PROPS, DomContainer as _DomContainer, _EFFECT_BACK_REF, ELEMENT_SEQ as _ELEMENT_SEQ, EMPTY_ARRAY as _EMPTY_ARRAY, EMPTY_OBJ as _EMPTY_OBJ, _IMMUTABLE, _SharedContainer, SubscriptionData as _SubscriptionData, SubscriptionPatch as _SubscriptionPatch, Task as _Task, _UNINITIALIZED, _VAR_PROPS, _addProjection, _captures, _chk, _createDeserializeContainer, createQRL as _createQRL, createStore as _createStore, delay as _delay, _deserialize, _dumpState, eachCmp as _eaC, eachCmpTask as _eaT, _executeSsrChores, _fnSignal, getAsyncLocalStorage as _getAsyncLocalStorage, _getConstProps, _getContextContainer, _getContextEvent, _getContextHostElement, getDomContainer as _getDomContainer, _getQContainerElement, getSubscriber as _getSubscriber, _getVarProps, _hasStoreEffects, _hmr, _injectAsyncSignalValue, invoke as _invoke, isJSXNode as _isJSXNode, isStore as _isStore, isStringifiable as _isStringifiable, isTask as _isTask, _jsxBranch, _jsxC, _jsxQ, _jsxS, _jsxSorted, _jsxSplit, mapApp_findIndx as _mapApp_findIndx, mapArray_get as _mapArray_get, mapArray_set as _mapArray_set, _markSignalAsExternallyOwned, newInvokeContext as _newInvokeContext, _noopQrl, _noopQrlDEV, preprocessState as _preprocessState, _qrlSync, qrlToString as _qrlToString, _qrlWithChunk, _qrlWithChunkDEV, revealCmp as _reC, revealCanReveal as _reR, revealCleanupTask as _reT, _regSymbol, _removeProjection, _res, _resolveContextWithoutSequentialScope, _restProps, retryOnPromise as _retryOnPromise, _rsc, _run, _serialize, setEvent as _setEvent, _setProjectionTarget, showCmp as _shC, showCmpTask as _shT, suspenseCmp as _suC, suspenseTask as _suT, scheduleTask as _task, _updateProjectionProps, _useHmr, _val, verifySerializable as _verifySerializable, vnode_ensureElementInflated as _vnode_ensureElementInflated, vnode_getAttrKeys as _vnode_getAttrKeys, vnode_getElementName as _vnode_getElementName, vnode_getFirstChild as _vnode_getFirstChild, vnode_getProp as _vnode_getProp, vnode_getVNodeForChildNode as _vnode_getVNodeForChildNode, vnode_insertBefore as _vnode_insertBefore, vnode_isElementVNode as _vnode_isElementVNode, vnode_isMaterialized as _vnode_isMaterialized, vnode_isTextVNode as _vnode_isTextVNode, vnode_isVirtualVNode as _vnode_isVirtualVNode, vnode_newVirtual as _vnode_newVirtual, vnode_remove as _vnode_remove, vnode_setProp as _vnode_setProp, vnode_toString as _vnode_toString, _waitUntilRendered, _walkJSX, _wrapProp, _wrapSignal, component$, componentQrl, createAsync$, createAsyncSignal as createAsyncQrl, createComputed$, createComputedSignal as createComputedQrl, createContextId, h as createElement, createSerializer$, createSerializerSignal as createSerializerQrl, createSignal, event$, eventQrl, forceStoreEffects, getClientManifest, getDomContainer, getLocale, getPlatform, h, implicit$FirstArg, inlinedQrl, inlinedQrlDEV, isSignal, jsx, jsxDEV, jsxs, noSerialize, qrl, qrlDEV, render, setPlatform, sync$, untrack, unwrapStore, useAsync$, useAsyncQrl, useComputed$, useComputedQrl, useConstant, useContext, useContextProvider, useErrorBoundary, useId, useLexicalScope, useOn, useOnDocument, useOnWindow, useResource$, useResourceQrl, useSerializer$, useSerializerQrl, useServerData, useSignal, useStore, useStyles$, useStylesQrl, useStylesScoped$, useStylesScopedQrl, useTask$, useTaskQrl, useVisibleTask$, useVisibleTaskQrl, version, withLocale };
17319
+ export { $, Each, Fragment, NoSerializeSymbol, PrefetchGraph, PrefetchServiceWorker, RenderOnce, Resource, Reveal, SSRComment, SSRRaw, SSRStream, SSRStreamBlock, SerializerSymbol, Show, SkipRender, Slot, Suspense, _CONST_PROPS, DomContainer as _DomContainer, _EFFECT_BACK_REF, ELEMENT_SEQ as _ELEMENT_SEQ, EMPTY_ARRAY as _EMPTY_ARRAY, EMPTY_OBJ as _EMPTY_OBJ, _IMMUTABLE, _SharedContainer, SubscriptionData as _SubscriptionData, SubscriptionPatch as _SubscriptionPatch, Task as _Task, _UNINITIALIZED, _VAR_PROPS, _addProjection, _captures, _chk, _createDeserializeContainer, createQRL as _createQRL, createStore as _createStore, delay as _delay, _deserialize, _dumpState, eachCmp as _eaC, eachCmpTask as _eaT, _executeSsrChores, _fnSignal, getAsyncLocalStorage as _getAsyncLocalStorage, _getConstProps, _getContextContainer, _getContextEvent, _getContextHostElement, getDomContainer as _getDomContainer, _getQContainerElement, getSubscriber as _getSubscriber, _getVarProps, _hasStoreEffects, _hmr, _injectAsyncSignalValue, invoke as _invoke, isJSXNode as _isJSXNode, isStore as _isStore, isStringifiable as _isStringifiable, isTask as _isTask, _jsxBranch, _jsxC, _jsxQ, _jsxS, _jsxSorted, _jsxSplit, mapApp_findIndx as _mapApp_findIndx, mapArray_get as _mapArray_get, mapArray_set as _mapArray_set, _markSignalAsExternallyOwned, newInvokeContext as _newInvokeContext, _noopQrl, _noopQrlDEV, preprocessState as _preprocessState, _qrlSync, qrlToString as _qrlToString, _qrlWithChunk, _qrlWithChunkDEV, revealCmp as _reC, revealCanReveal as _reR, revealCleanupTask as _reT, _regSymbol, _removeProjection, _res, _resolveContextWithoutSequentialScope, _restProps, retryOnPromise as _retryOnPromise, _rsc, _run, _serialize, setEvent as _setEvent, _setProjectionTarget, showCmp as _shC, showCmpTask as _shT, suspenseCmp as _suC, suspenseTask as _suT, scheduleTask as _task, _updateProjectionProps, _useHmr, _val, verifySerializable as _verifySerializable, vnode_ensureElementInflated as _vnode_ensureElementInflated, vnode_getAttrKeys as _vnode_getAttrKeys, vnode_getElementName as _vnode_getElementName, vnode_getFirstChild as _vnode_getFirstChild, vnode_getProp as _vnode_getProp, vnode_getVNodeForChildNode as _vnode_getVNodeForChildNode, vnode_insertBefore as _vnode_insertBefore, vnode_isElementVNode as _vnode_isElementVNode, vnode_isMaterialized as _vnode_isMaterialized, vnode_isTextVNode as _vnode_isTextVNode, vnode_isVirtualVNode as _vnode_isVirtualVNode, vnode_newVirtual as _vnode_newVirtual, vnode_remove as _vnode_remove, vnode_setProp as _vnode_setProp, vnode_toString as _vnode_toString, _waitUntilRendered, _walkJSX, _wrapProp, _wrapSignal, component$, componentQrl, createAsyncSignal as createAsyncQrl, createComputed$, createComputedSignal as createComputedQrl, createContextId, h as createElement, createSerializer$, createSerializerSignal as createSerializerQrl, createSignal, event$, eventQrl, forceStoreEffects, getClientManifest, getDomContainer, getLocale, getPlatform, h, implicit$FirstArg, inlinedQrl, inlinedQrlDEV, isSignal, jsx, jsxDEV, jsxs, noSerialize, qrl, qrlDEV, render, setPlatform, sync$, untrack, unwrapStore, useComputed$, useComputedQrl, useConstant, useContext, useContextProvider, useErrorBoundary, useId, useLexicalScope, useOn, useOnDocument, useOnWindow, useResource$, useResourceQrl, useSerializer$, useSerializerQrl, useServerData, useSignal, useStore, useStyles$, useStylesQrl, useStylesScoped$, useStylesScopedQrl, useTask$, useTaskQrl, useVisibleTask$, useVisibleTaskQrl, version, withLocale };
17337
17320
  //# sourceMappingURL=core.mjs.map