@qwik.dev/core 2.0.0-alpha.1 → 2.0.0-alpha.2

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/server.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * @qwik.dev/core/server 2.0.0-alpha.1-dev+10f5414
3
+ * @qwik.dev/core/server 2.0.0-alpha.2-dev+58b6f8d
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
@@ -647,6 +647,12 @@ __publicField(SsrNode, "ELEMENT_NODE", 1);
647
647
  __publicField(SsrNode, "TEXT_NODE", 3);
648
648
  __publicField(SsrNode, "DOCUMENT_NODE", 9);
649
649
  __publicField(SsrNode, "DOCUMENT_FRAGMENT_NODE", 11);
650
+ var DomRef = class {
651
+ /** @id is the same id as for SsrNode */
652
+ constructor(id) {
653
+ this.id = id;
654
+ }
655
+ };
650
656
  var SsrComponentFrame = class {
651
657
  constructor(componentNode) {
652
658
  this.componentNode = componentNode;
@@ -945,7 +951,7 @@ function getBuildBase(opts) {
945
951
  return `${import.meta.env.BASE_URL}build/`;
946
952
  }
947
953
  var versions = {
948
- qwik: "2.0.0-alpha.1-dev+10f5414",
954
+ qwik: "2.0.0-alpha.2-dev+58b6f8d",
949
955
  qwikDom: "2.1.19"
950
956
  };
951
957
 
@@ -1140,6 +1146,20 @@ var StoreHandler = class {
1140
1146
  if (prop === STORE_TARGET) {
1141
1147
  return true;
1142
1148
  }
1149
+ if (typeof prop === "string") {
1150
+ const ctx = tryGetInvokeContext();
1151
+ if (ctx) {
1152
+ const effectSubscriber = ctx.$effectSubscriber$;
1153
+ if (effectSubscriber) {
1154
+ addEffect(
1155
+ target,
1156
+ Array.isArray(target) ? STORE_ARRAY_PROP : prop,
1157
+ this,
1158
+ effectSubscriber
1159
+ );
1160
+ }
1161
+ }
1162
+ }
1143
1163
  return Object.prototype.hasOwnProperty.call(target, prop);
1144
1164
  }
1145
1165
  ownKeys(target) {
@@ -2829,7 +2849,10 @@ function choreComparator(a, b, shouldThrowOnHostMismatch) {
2829
2849
  return hostDiff;
2830
2850
  }
2831
2851
  } else {
2832
- const errorMessage = "SERVER: during HTML streaming, it is not possible to cause a re-run of tasks on a different host";
2852
+ const errorMessage = `SERVER: during HTML streaming, re-running tasks on a different host is not allowed.
2853
+ You are attempting to change a state that has already been streamed to the client.
2854
+ This can lead to inconsistencies between Server-Side Rendering (SSR) and Client-Side Rendering (CSR).
2855
+ Problematic Node: ${aHost.toString()}`;
2833
2856
  if (shouldThrowOnHostMismatch) {
2834
2857
  throwErrorAndStop(errorMessage);
2835
2858
  }
@@ -2999,9 +3022,11 @@ var isTask = (value) => {
2999
3022
  return value instanceof Task;
3000
3023
  };
3001
3024
 
3025
+ // packages/qwik/src/core/signal/flags.ts
3026
+ var NEEDS_COMPUTATION = Symbol("invalid");
3027
+
3002
3028
  // packages/qwik/src/core/signal/signal.ts
3003
3029
  var DEBUG3 = false;
3004
- var NEEDS_COMPUTATION = Symbol("invalid");
3005
3030
  var log2 = (...args) => console.log("SIGNAL", ...args.map(qwikDebugToString));
3006
3031
  var throwIfQRLNotResolved = (qrl) => {
3007
3032
  const resolved = qrl.resolved;
@@ -3334,7 +3359,7 @@ var WrappedSignal = class extends Signal {
3334
3359
  };
3335
3360
 
3336
3361
  // packages/qwik/src/core/version.ts
3337
- var version = "2.0.0-alpha.1-dev+10f5414";
3362
+ var version = "2.0.0-alpha.2-dev+58b6f8d";
3338
3363
 
3339
3364
  // packages/qwik/src/core/shared/shared-container.ts
3340
3365
  var _SharedContainer = class {
@@ -3361,9 +3386,10 @@ var _SharedContainer = class {
3361
3386
  trackSignalValue(signal, subscriber, property, data) {
3362
3387
  return trackSignal(() => signal.value, subscriber, property, this, data);
3363
3388
  }
3364
- serializationCtxFactory(NodeConstructor, symbolToChunkResolver, writer, prepVNodeData) {
3389
+ serializationCtxFactory(NodeConstructor, DomRefConstructor, symbolToChunkResolver, writer, prepVNodeData) {
3365
3390
  return createSerializationContext(
3366
3391
  NodeConstructor,
3392
+ DomRefConstructor,
3367
3393
  symbolToChunkResolver,
3368
3394
  this.getHostProp.bind(this),
3369
3395
  this.setHostProp.bind(this),
@@ -6243,12 +6269,7 @@ function inflateQRL(container, qrl) {
6243
6269
  }
6244
6270
  return qrl;
6245
6271
  }
6246
- var DomVRef = class {
6247
- constructor(id) {
6248
- this.id = id;
6249
- }
6250
- };
6251
- var createSerializationContext = (NodeConstructor, symbolToChunkResolver, getProp, setProp, storeProxyMap, writer, prepVNodeData) => {
6272
+ var createSerializationContext = (NodeConstructor, DomRefConstructor, symbolToChunkResolver, getProp, setProp, storeProxyMap, writer, prepVNodeData) => {
6252
6273
  if (!writer) {
6253
6274
  const buffer = [];
6254
6275
  writer = {
@@ -6272,11 +6293,13 @@ var createSerializationContext = (NodeConstructor, symbolToChunkResolver, getPro
6272
6293
  return id;
6273
6294
  };
6274
6295
  const isSsrNode = NodeConstructor ? (obj) => obj instanceof NodeConstructor : () => false;
6296
+ const isDomRef = DomRefConstructor ? (obj) => obj instanceof DomRefConstructor : () => false;
6275
6297
  return {
6276
6298
  $serialize$() {
6277
6299
  serialize(this);
6278
6300
  },
6279
6301
  $isSsrNode$: isSsrNode,
6302
+ $isDomRef$: isDomRef,
6280
6303
  $symbolToChunkResolver$: symbolToChunkResolver,
6281
6304
  $wasSeen$,
6282
6305
  $roots$: roots,
@@ -6385,6 +6408,8 @@ var createSerializationContext = (NodeConstructor, symbolToChunkResolver, getPro
6385
6408
  discoveredValues.push(obj.$el$, obj.$qrl$, obj.$state$, obj.$effectDependencies$);
6386
6409
  } else if (isSsrNode(obj)) {
6387
6410
  discoveredValues.push(obj.vnodeData);
6411
+ } else if (isDomRef(obj)) {
6412
+ discoveredValues.push(obj.id);
6388
6413
  } else if (isJSXNode2(obj)) {
6389
6414
  discoveredValues.push(obj.type, obj.props, obj.constProps, obj.children);
6390
6415
  } else if (Array.isArray(obj)) {
@@ -6439,7 +6464,7 @@ var createSerializationContext = (NodeConstructor, symbolToChunkResolver, getPro
6439
6464
  };
6440
6465
  var promiseResults = /* @__PURE__ */ new WeakMap();
6441
6466
  function serialize(serializationContext) {
6442
- const { $writer$, $isSsrNode$, $setProp$, $storeProxyMap$ } = serializationContext;
6467
+ const { $writer$, $isSsrNode$, $isDomRef$, $setProp$, $storeProxyMap$ } = serializationContext;
6443
6468
  let depth = -1;
6444
6469
  let writeType = false;
6445
6470
  const output = (type, value) => {
@@ -6607,14 +6632,10 @@ function serialize(serializationContext) {
6607
6632
  }
6608
6633
  output(13 /* Object */, out);
6609
6634
  }
6610
- } else if (value instanceof DomVRef) {
6635
+ } else if ($isDomRef$(value)) {
6611
6636
  output(9 /* RefVNode */, value.id);
6612
6637
  } else if (value instanceof Signal) {
6613
- let v = value instanceof ComputedSignal && (value.$invalid$ || fastSkipSerialize(value.$untrackedValue$)) ? NEEDS_COMPUTATION : value.$untrackedValue$;
6614
- if ($isSsrNode$(v)) {
6615
- serializationContext.$addRoot$(v);
6616
- v = new DomVRef(v.id);
6617
- }
6638
+ const v = value instanceof ComputedSignal && (value.$invalid$ || fastSkipSerialize(value.$untrackedValue$)) ? NEEDS_COMPUTATION : value.$untrackedValue$;
6618
6639
  if (value instanceof WrappedSignal) {
6619
6640
  output(23 /* WrappedSignal */, [
6620
6641
  ...serializeWrappingFn(serializationContext, value),
@@ -7000,8 +7021,8 @@ var createQRL = (chunk, symbol, symbolRef, symbolFn, capture, captureRef, refSym
7000
7021
  }
7001
7022
  let _containerEl;
7002
7023
  const qrl = async function(...args) {
7003
- const fn = invokeFn.call(this, tryGetInvokeContext());
7004
- const result = await fn(...args);
7024
+ const boundedFn = bindFnToContext.call(this, tryGetInvokeContext());
7025
+ const result = await boundedFn(...args);
7005
7026
  return result;
7006
7027
  };
7007
7028
  const setContainer = (el) => {
@@ -7010,6 +7031,30 @@ var createQRL = (chunk, symbol, symbolRef, symbolFn, capture, captureRef, refSym
7010
7031
  }
7011
7032
  return _containerEl;
7012
7033
  };
7034
+ function bindFnToContext(currentCtx, beforeFn) {
7035
+ return (...args) => maybeThen(resolveLazy(), (fn) => {
7036
+ if (!isFunction(fn)) {
7037
+ throw qError(QError_qrlIsNotFunction);
7038
+ }
7039
+ if (beforeFn && beforeFn() === false) {
7040
+ return;
7041
+ }
7042
+ const context = createOrReuseInvocationContext(currentCtx);
7043
+ const prevQrl = context.$qrl$;
7044
+ const prevEvent = context.$event$;
7045
+ context.$qrl$ = qrl;
7046
+ context.$event$ || (context.$event$ = this);
7047
+ try {
7048
+ return invoke.call(this, context, fn, ...args);
7049
+ } finally {
7050
+ context.$qrl$ = prevQrl;
7051
+ context.$event$ = prevEvent;
7052
+ }
7053
+ });
7054
+ }
7055
+ const resolveLazy = (containerEl) => {
7056
+ return symbolRef !== null ? symbolRef : resolve(containerEl);
7057
+ };
7013
7058
  const wrapFn = (fn) => {
7014
7059
  if (typeof fn !== "function" || !capture?.length && !captureRef?.length) {
7015
7060
  return fn;
@@ -7059,30 +7104,6 @@ var createQRL = (chunk, symbol, symbolRef, symbolFn, capture, captureRef, refSym
7059
7104
  }
7060
7105
  return symbolRef;
7061
7106
  };
7062
- const resolveLazy = (containerEl) => {
7063
- return symbolRef !== null ? symbolRef : resolve(containerEl);
7064
- };
7065
- function invokeFn(currentCtx, beforeFn) {
7066
- return (...args) => maybeThen(resolveLazy(), (f) => {
7067
- if (!isFunction(f)) {
7068
- throw qError(QError_qrlIsNotFunction);
7069
- }
7070
- if (beforeFn && beforeFn() === false) {
7071
- return;
7072
- }
7073
- const context = createOrReuseInvocationContext(currentCtx);
7074
- const prevQrl = context.$qrl$;
7075
- const prevEvent = context.$event$;
7076
- context.$qrl$ = qrl;
7077
- context.$event$ || (context.$event$ = this);
7078
- try {
7079
- return invoke.call(this, context, f, ...args);
7080
- } finally {
7081
- context.$qrl$ = prevQrl;
7082
- context.$event$ = prevEvent;
7083
- }
7084
- });
7085
- }
7086
7107
  const createOrReuseInvocationContext = (invoke2) => {
7087
7108
  if (invoke2 == null) {
7088
7109
  return newInvokeContext();
@@ -7105,7 +7126,7 @@ var createQRL = (chunk, symbol, symbolRef, symbolFn, capture, captureRef, refSym
7105
7126
  $symbol$: symbol,
7106
7127
  $refSymbol$: refSymbol,
7107
7128
  $hash$: hash2,
7108
- getFn: invokeFn,
7129
+ getFn: bindFnToContext,
7109
7130
  $capture$: capture,
7110
7131
  $captureRef$: captureRef,
7111
7132
  dev: null,
@@ -7816,6 +7837,7 @@ var SSRContainer = class extends _SharedContainer2 {
7816
7837
  };
7817
7838
  this.serializationCtx = this.serializationCtxFactory(
7818
7839
  SsrNode,
7840
+ DomRef,
7819
7841
  this.symbolToChunkResolver,
7820
7842
  opts.writer,
7821
7843
  (vNodeData) => this.addVNodeToSerializationRoots(vNodeData)
@@ -8579,10 +8601,10 @@ var SSRContainer = class extends _SharedContainer2 {
8579
8601
  if (key === "ref") {
8580
8602
  const lastNode = this.getLastNode();
8581
8603
  if (isSignal2(value)) {
8582
- value.value = lastNode;
8604
+ value.value = new DomRef(lastNode.id);
8583
8605
  continue;
8584
8606
  } else if (typeof value === "function") {
8585
- value(lastNode);
8607
+ value(new DomRef(lastNode.id));
8586
8608
  continue;
8587
8609
  }
8588
8610
  }
@@ -8856,8 +8878,8 @@ function resolveManifest(manifest) {
8856
8878
  var Q_FUNCS_PREFIX = 'document["qFuncs_HASH"]=';
8857
8879
 
8858
8880
  // packages/qwik/src/server/scripts.ts
8859
- var QWIK_LOADER_DEFAULT_MINIFIED = '(()=>{var e=Object.defineProperty,t=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable,o=(t,n,r)=>n in t?e(t,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[n]=r,s=(e,s)=>{for(var a in s||(s={}))n.call(s,a)&&o(e,a,s[a]);if(t)for(var a of t(s))r.call(s,a)&&o(e,a,s[a]);return e};((e,t)=>{const n="__q_context__",r=window,o=new Set,a=new Set([e]),c="replace",i="forEach",l="target",f="getAttribute",p="isConnected",b="qvisible",u="_qwikjson_",h=(e,t)=>Array.from(e.querySelectorAll(t)),y=e=>{const t=[];return a.forEach((n=>t.push(...h(n,e)))),t},d=e=>{S(e),h(e,"[q\\\\:shadowroot]").forEach((e=>{const t=e.shadowRoot;t&&d(t)}))},q=e=>e&&"function"==typeof e.then,m=(e,t,n=t.type)=>{y("[on"+e+"\\\\:"+n+"]")[i]((r=>E(r,e,t,n)))},w=t=>{if(void 0===t[u]){let n=(t===e.documentElement?e.body:t).lastElementChild;for(;n;){if("SCRIPT"===n.tagName&&"qwik/json"===n[f]("type")){t[u]=JSON.parse(n.textContent[c](/\\\\x3C(\\/?script)/gi,"<$1"));break}n=n.previousElementSibling}}},v=(e,t)=>new CustomEvent(e,{detail:t}),E=async(t,r,o,a=o.type)=>{const i="on"+r+":"+a;t.hasAttribute("preventdefault:"+a)&&o.preventDefault();const l=t._qc_,b=l&&l.li.filter((e=>e[0]===i));if(b&&b.length>0){for(const e of b){const n=e[1].getFn([t,o],(()=>t[p]))(o,t),r=o.cancelBubble;q(n)&&await n,r&&o.stopPropagation()}return}const u=t.qDispatchEvent;if(u)return u(o,r);const h=t[f](i);if(h){const r=t.closest("[q\\\\:container]:not([q\\\\:container=html]):not([q\\\\:container=text])"),a=r[f]("q:base"),i=r[f]("q:version")||"unknown",l=r[f]("q:manifest-hash")||"dev",b=new URL(a,e.baseURI);for(const f of h.split("\\n")){const u=new URL(f,b),h=u.href,y=u.hash[c](/^#?([^?[|]*).*$/,"$1")||"default",d=performance.now();let m,v,E;const _=f.startsWith("#"),A={qBase:a,qManifest:l,qVersion:i,href:h,symbol:y,element:t,reqTime:d};if(_){const t=r.getAttribute("q:instance");m=(e["qFuncs_"+t]||[])[Number.parseInt(y)],m||(v="sync",E=Error("sync handler error for symbol: "+y))}else{const e=u.href.split("#")[0];try{const t=import(e);w(r),m=(await t)[y],m||(v="no-symbol",E=Error(`${y} not in ${e}`))}catch(e){v||(v="async"),E=e}}if(!m){g("qerror",s({importError:v,error:E},A)),console.error(E);break}const k=e[n];if(t[p]){const r=async(a=0)=>{try{e[n]=[t,o,u],_||g("qsymbol",s({},A));const r=m(o,t);q(r)&&await r}catch(e){q(e)&&a<100?e.then((()=>r(a++))):g("qerror",s({error:e},A))}finally{e[n]=k}};r()}}}},g=(t,n)=>{e.dispatchEvent(v(t,n))},_=e=>e[c](/([A-Z])/g,(e=>"-"+e.toLowerCase())),A=async e=>{let t=_(e.type),n=e[l];for(m("-document",e,t);n&&n[f];){const r=E(n,"",e,t);let o=e.cancelBubble;q(r)&&await r,o=o||e.cancelBubble||n.hasAttribute("stoppropagation:"+e.type),n=e.bubbles&&!0!==o?n.parentElement:null}},k=e=>{m("-window",e,_(e.type))},C=()=>{var n;const s=e.readyState;if(!t&&("interactive"==s||"complete"==s)&&(a.forEach(d),t=1,g("qinit"),(null!=(n=r.requestIdleCallback)?n:r.setTimeout).bind(r)((()=>g("qidle"))),o.has(b))){const e=y("[on\\\\:"+b+"]"),t=new IntersectionObserver((e=>{for(const n of e)n.isIntersecting&&(t.unobserve(n[l]),E(n[l],"",v(b,n)))}));e[i]((e=>t.observe(e)))}},O=(e,t,n,r=!1)=>e.addEventListener(t,n,{capture:r,passive:!1}),S=(...e)=>{for(const t of e)"string"==typeof t?o.has(t)||(a.forEach((e=>O(e,t,A,!0))),O(r,t,k,!0),o.add(t)):a.has(t)||(o.forEach((e=>O(t,e,A,!0))),a.add(t))};if(!(n in e)){e[n]=0;const t=r.qwikevents;Array.isArray(t)&&S(...t),r.qwikevents={events:o,roots:a,push:S},O(e,"readystatechange",C),C()}})(document)})()';
8860
- var QWIK_LOADER_DEFAULT_DEBUG = '(() => {\n var __defProp = Object.defineProperty;\n var __getOwnPropSymbols = Object.getOwnPropertySymbols;\n var __hasOwnProp = Object.prototype.hasOwnProperty;\n var __propIsEnum = Object.prototype.propertyIsEnumerable;\n var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, {\n enumerable: !0,\n configurable: !0,\n writable: !0,\n value: value\n }) : obj[key] = value;\n var __spreadValues = (a, b) => {\n for (var prop in b || (b = {})) {\n __hasOwnProp.call(b, prop) && __defNormalProp(a, prop, b[prop]);\n }\n if (__getOwnPropSymbols) {\n for (var prop of __getOwnPropSymbols(b)) {\n __propIsEnum.call(b, prop) && __defNormalProp(a, prop, b[prop]);\n }\n }\n return a;\n };\n ((doc, hasInitialized) => {\n const Q_CONTEXT = "__q_context__";\n const win = window;\n const events = new Set;\n const roots = new Set([ doc ]);\n const nativeQuerySelectorAll = (root, selector) => Array.from(root.querySelectorAll(selector));\n const querySelectorAll = query => {\n const elements = [];\n roots.forEach((root => elements.push(...nativeQuerySelectorAll(root, query))));\n return elements;\n };\n const findShadowRoots = fragment => {\n processEventOrNode(fragment);\n nativeQuerySelectorAll(fragment, "[q\\\\:shadowroot]").forEach((parent => {\n const shadowRoot = parent.shadowRoot;\n shadowRoot && findShadowRoots(shadowRoot);\n }));\n };\n const isPromise = promise => promise && "function" == typeof promise.then;\n const broadcast = (infix, ev, type = ev.type) => {\n querySelectorAll("[on" + infix + "\\\\:" + type + "]").forEach((el => dispatch(el, infix, ev, type)));\n };\n const resolveContainer = containerEl => {\n if (void 0 === containerEl._qwikjson_) {\n let script = (containerEl === doc.documentElement ? doc.body : containerEl).lastElementChild;\n while (script) {\n if ("SCRIPT" === script.tagName && "qwik/json" === script.getAttribute("type")) {\n containerEl._qwikjson_ = JSON.parse(script.textContent.replace(/\\\\x3C(\\/?script)/gi, "<$1"));\n break;\n }\n script = script.previousElementSibling;\n }\n }\n };\n const createEvent = (eventName, detail) => new CustomEvent(eventName, {\n detail: detail\n });\n const dispatch = async (element, scope, ev, eventName = ev.type) => {\n const attrName = "on" + scope + ":" + eventName;\n element.hasAttribute("preventdefault:" + eventName) && ev.preventDefault();\n const ctx = element._qc_;\n const relevantListeners = ctx && ctx.li.filter((li => li[0] === attrName));\n if (relevantListeners && relevantListeners.length > 0) {\n for (const listener of relevantListeners) {\n const results = listener[1].getFn([ element, ev ], (() => element.isConnected))(ev, element);\n const cancelBubble = ev.cancelBubble;\n isPromise(results) && await results;\n cancelBubble && ev.stopPropagation();\n }\n return;\n }\n const qDispatchEvent = element.qDispatchEvent;\n if (qDispatchEvent) {\n return qDispatchEvent(ev, scope);\n }\n const attrValue = element.getAttribute(attrName);\n if (attrValue) {\n const container = element.closest("[q\\\\:container]:not([q\\\\:container=html]):not([q\\\\:container=text])");\n const qBase = container.getAttribute("q:base");\n const qVersion = container.getAttribute("q:version") || "unknown";\n const qManifest = container.getAttribute("q:manifest-hash") || "dev";\n const base = new URL(qBase, doc.baseURI);\n for (const qrl of attrValue.split("\\n")) {\n const url = new URL(qrl, base);\n const href = url.href;\n const symbol = url.hash.replace(/^#?([^?[|]*).*$/, "$1") || "default";\n const reqTime = performance.now();\n let handler;\n let importError;\n let error;\n const isSync = qrl.startsWith("#");\n const eventData = {\n qBase: qBase,\n qManifest: qManifest,\n qVersion: qVersion,\n href: href,\n symbol: symbol,\n element: element,\n reqTime: reqTime\n };\n if (isSync) {\n const hash = container.getAttribute("q:instance");\n handler = (doc["qFuncs_" + hash] || [])[Number.parseInt(symbol)];\n if (!handler) {\n importError = "sync";\n error = new Error("sync handler error for symbol: " + symbol);\n }\n } else {\n const uri = url.href.split("#")[0];\n try {\n const module = import(\n uri);\n resolveContainer(container);\n handler = (await module)[symbol];\n if (!handler) {\n importError = "no-symbol";\n error = new Error(`${symbol} not in ${uri}`);\n }\n } catch (err) {\n importError || (importError = "async");\n error = err;\n }\n }\n if (!handler) {\n emitEvent("qerror", __spreadValues({\n importError: importError,\n error: error\n }, eventData));\n console.error(error);\n break;\n }\n const previousCtx = doc[Q_CONTEXT];\n if (element.isConnected) {\n const handleEvent = async (retryCount = 0) => {\n try {\n doc[Q_CONTEXT] = [ element, ev, url ];\n isSync || emitEvent("qsymbol", __spreadValues({}, eventData));\n const results = handler(ev, element);\n isPromise(results) && await results;\n } catch (error2) {\n isPromise(error2) && retryCount < 100 ? error2.then((() => handleEvent(retryCount++))) : emitEvent("qerror", __spreadValues({\n error: error2\n }, eventData));\n } finally {\n doc[Q_CONTEXT] = previousCtx;\n }\n };\n handleEvent();\n }\n }\n }\n };\n const emitEvent = (eventName, detail) => {\n doc.dispatchEvent(createEvent(eventName, detail));\n };\n const camelToKebab = str => str.replace(/([A-Z])/g, (a => "-" + a.toLowerCase()));\n const processDocumentEvent = async ev => {\n let type = camelToKebab(ev.type);\n let element = ev.target;\n broadcast("-document", ev, type);\n while (element && element.getAttribute) {\n const results = dispatch(element, "", ev, type);\n let cancelBubble = ev.cancelBubble;\n isPromise(results) && await results;\n cancelBubble = cancelBubble || ev.cancelBubble || element.hasAttribute("stoppropagation:" + ev.type);\n element = ev.bubbles && !0 !== cancelBubble ? element.parentElement : null;\n }\n };\n const processWindowEvent = ev => {\n broadcast("-window", ev, camelToKebab(ev.type));\n };\n const processReadyStateChange = () => {\n var _a;\n const readyState = doc.readyState;\n if (!hasInitialized && ("interactive" == readyState || "complete" == readyState)) {\n roots.forEach(findShadowRoots);\n hasInitialized = 1;\n emitEvent("qinit");\n (null != (_a = win.requestIdleCallback) ? _a : win.setTimeout).bind(win)((() => emitEvent("qidle")));\n if (events.has("qvisible")) {\n const results = querySelectorAll("[on\\\\:qvisible]");\n const observer = new IntersectionObserver((entries => {\n for (const entry of entries) {\n if (entry.isIntersecting) {\n observer.unobserve(entry.target);\n dispatch(entry.target, "", createEvent("qvisible", entry));\n }\n }\n }));\n results.forEach((el => observer.observe(el)));\n }\n }\n };\n const addEventListener = (el, eventName, handler, capture = !1) => el.addEventListener(eventName, handler, {\n capture: capture,\n passive: !1\n });\n const processEventOrNode = (...eventNames) => {\n for (const eventNameOrNode of eventNames) {\n if ("string" == typeof eventNameOrNode) {\n if (!events.has(eventNameOrNode)) {\n roots.forEach((root => addEventListener(root, eventNameOrNode, processDocumentEvent, !0)));\n addEventListener(win, eventNameOrNode, processWindowEvent, !0);\n events.add(eventNameOrNode);\n }\n } else if (!roots.has(eventNameOrNode)) {\n events.forEach((eventName => addEventListener(eventNameOrNode, eventName, processDocumentEvent, !0)));\n roots.add(eventNameOrNode);\n }\n }\n };\n if (!(Q_CONTEXT in doc)) {\n doc[Q_CONTEXT] = 0;\n const qwikevents = win.qwikevents;\n Array.isArray(qwikevents) && processEventOrNode(...qwikevents);\n win.qwikevents = {\n events: events,\n roots: roots,\n push: processEventOrNode\n };\n addEventListener(doc, "readystatechange", processReadyStateChange);\n processReadyStateChange();\n }\n })(document);\n})()';
8881
+ var QWIK_LOADER_DEFAULT_MINIFIED = '(()=>{var e=Object.defineProperty,t=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,o=Object.prototype.propertyIsEnumerable,r=(t,n,o)=>n in t?e(t,n,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[n]=o,s=(e,s)=>{for(var a in s||(s={}))n.call(s,a)&&r(e,a,s[a]);if(t)for(var a of t(s))o.call(s,a)&&r(e,a,s[a]);return e};((e,t)=>{const n="__q_context__",o=window,r=new Set,a=new Set([e]),i="replace",c="forEach",l="target",f="getAttribute",p="isConnected",b="qvisible",u="_qwikjson_",h=(e,t)=>Array.from(e.querySelectorAll(t)),y=e=>{const t=[];return a.forEach((n=>t.push(...h(n,e)))),t},d=e=>{S(e),h(e,"[q\\\\:shadowroot]").forEach((e=>{const t=e.shadowRoot;t&&d(t)}))},q=e=>e&&"function"==typeof e.then,m=(e,t,n=t.type)=>{y("[on"+e+"\\\\:"+n+"]")[c]((o=>g(o,e,t,n)))},w=t=>{if(void 0===t[u]){let n=(t===e.documentElement?e.body:t).lastElementChild;for(;n;){if("SCRIPT"===n.tagName&&"qwik/json"===n[f]("type")){t[u]=JSON.parse(n.textContent[i](/\\\\x3C(\\/?script)/gi,"<$1"));break}n=n.previousElementSibling}}},v=(e,t)=>new CustomEvent(e,{detail:t}),g=async(t,o,r,a=r.type)=>{const c="on"+o+":"+a;t.hasAttribute("preventdefault:"+a)&&r.preventDefault(),t.hasAttribute("stoppropagation:"+a)&&r.stopPropagation();const l=t._qc_,b=l&&l.li.filter((e=>e[0]===c));if(b&&b.length>0){for(const e of b){const n=e[1].getFn([t,r],(()=>t[p]))(r,t),o=r.cancelBubble;q(n)&&await n,o&&r.stopPropagation()}return}const u=t.qDispatchEvent;if(u)return u(r,o);const h=t[f](c);if(h){const o=t.closest("[q\\\\:container]:not([q\\\\:container=html]):not([q\\\\:container=text])"),a=o[f]("q:base"),c=o[f]("q:version")||"unknown",l=o[f]("q:manifest-hash")||"dev",b=new URL(a,e.baseURI);for(const f of h.split("\\n")){const u=new URL(f,b),h=u.href,y=u.hash[i](/^#?([^?[|]*).*$/,"$1")||"default",d=performance.now();let m,v,g;const A=f.startsWith("#"),_={qBase:a,qManifest:l,qVersion:c,href:h,symbol:y,element:t,reqTime:d};if(A){const t=o.getAttribute("q:instance");m=(e["qFuncs_"+t]||[])[Number.parseInt(y)],m||(v="sync",g=Error("sync handler error for symbol: "+y))}else{const e=u.href.split("#")[0];try{const t=import(e);w(o),m=(await t)[y],m||(v="no-symbol",g=Error(`${y} not in ${e}`))}catch(e){v||(v="async"),g=e}}if(!m){E("qerror",s({importError:v,error:g},_)),console.error(g);break}const k=e[n];if(t[p]){const o=async(a=0)=>{try{e[n]=[t,r,u],A||E("qsymbol",s({},_));const o=m(r,t);q(o)&&await o}catch(e){q(e)&&a<100?e.then((()=>o(a++))):E("qerror",s({error:e},_))}finally{e[n]=k}};o()}}}},E=(t,n)=>{e.dispatchEvent(v(t,n))},A=e=>e[i](/([A-Z])/g,(e=>"-"+e.toLowerCase())),_=async e=>{let t=A(e.type),n=e[l];for(m("-document",e,t);n&&n[f];){const o=g(n,"",e,t);let r=e.cancelBubble;q(o)&&await o,r=r||e.cancelBubble||n.hasAttribute("stoppropagation:"+e.type),n=e.bubbles&&!0!==r?n.parentElement:null}},k=e=>{m("-window",e,A(e.type))},C=()=>{var n;const s=e.readyState;if(!t&&("interactive"==s||"complete"==s)&&(a.forEach(d),t=1,E("qinit"),(null!=(n=o.requestIdleCallback)?n:o.setTimeout).bind(o)((()=>E("qidle"))),r.has(b))){const e=y("[on\\\\:"+b+"]"),t=new IntersectionObserver((e=>{for(const n of e)n.isIntersecting&&(t.unobserve(n[l]),g(n[l],"",v(b,n)))}));e[c]((e=>t.observe(e)))}},O=(e,t,n,o=!1)=>e.addEventListener(t,n,{capture:o,passive:!1}),S=(...e)=>{for(const t of e)"string"==typeof t?r.has(t)||(a.forEach((e=>O(e,t,_,!0))),O(o,t,k,!0),r.add(t)):a.has(t)||(r.forEach((e=>O(t,e,_,!0))),a.add(t))};if(!(n in e)){e[n]=0;const t=o.qwikevents;Array.isArray(t)&&S(...t),o.qwikevents={events:r,roots:a,push:S},O(e,"readystatechange",C),C()}})(document)})()';
8882
+ var QWIK_LOADER_DEFAULT_DEBUG = '(() => {\n var __defProp = Object.defineProperty;\n var __getOwnPropSymbols = Object.getOwnPropertySymbols;\n var __hasOwnProp = Object.prototype.hasOwnProperty;\n var __propIsEnum = Object.prototype.propertyIsEnumerable;\n var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, {\n enumerable: !0,\n configurable: !0,\n writable: !0,\n value: value\n }) : obj[key] = value;\n var __spreadValues = (a, b) => {\n for (var prop in b || (b = {})) {\n __hasOwnProp.call(b, prop) && __defNormalProp(a, prop, b[prop]);\n }\n if (__getOwnPropSymbols) {\n for (var prop of __getOwnPropSymbols(b)) {\n __propIsEnum.call(b, prop) && __defNormalProp(a, prop, b[prop]);\n }\n }\n return a;\n };\n ((doc, hasInitialized) => {\n const Q_CONTEXT = "__q_context__";\n const win = window;\n const events = new Set;\n const roots = new Set([ doc ]);\n const nativeQuerySelectorAll = (root, selector) => Array.from(root.querySelectorAll(selector));\n const querySelectorAll = query => {\n const elements = [];\n roots.forEach((root => elements.push(...nativeQuerySelectorAll(root, query))));\n return elements;\n };\n const findShadowRoots = fragment => {\n processEventOrNode(fragment);\n nativeQuerySelectorAll(fragment, "[q\\\\:shadowroot]").forEach((parent => {\n const shadowRoot = parent.shadowRoot;\n shadowRoot && findShadowRoots(shadowRoot);\n }));\n };\n const isPromise = promise => promise && "function" == typeof promise.then;\n const broadcast = (infix, ev, type = ev.type) => {\n querySelectorAll("[on" + infix + "\\\\:" + type + "]").forEach((el => dispatch(el, infix, ev, type)));\n };\n const resolveContainer = containerEl => {\n if (void 0 === containerEl._qwikjson_) {\n let script = (containerEl === doc.documentElement ? doc.body : containerEl).lastElementChild;\n while (script) {\n if ("SCRIPT" === script.tagName && "qwik/json" === script.getAttribute("type")) {\n containerEl._qwikjson_ = JSON.parse(script.textContent.replace(/\\\\x3C(\\/?script)/gi, "<$1"));\n break;\n }\n script = script.previousElementSibling;\n }\n }\n };\n const createEvent = (eventName, detail) => new CustomEvent(eventName, {\n detail: detail\n });\n const dispatch = async (element, scope, ev, eventName = ev.type) => {\n const attrName = "on" + scope + ":" + eventName;\n element.hasAttribute("preventdefault:" + eventName) && ev.preventDefault();\n element.hasAttribute("stoppropagation:" + eventName) && ev.stopPropagation();\n const ctx = element._qc_;\n const relevantListeners = ctx && ctx.li.filter((li => li[0] === attrName));\n if (relevantListeners && relevantListeners.length > 0) {\n for (const listener of relevantListeners) {\n const results = listener[1].getFn([ element, ev ], (() => element.isConnected))(ev, element);\n const cancelBubble = ev.cancelBubble;\n isPromise(results) && await results;\n cancelBubble && ev.stopPropagation();\n }\n return;\n }\n const qDispatchEvent = element.qDispatchEvent;\n if (qDispatchEvent) {\n return qDispatchEvent(ev, scope);\n }\n const attrValue = element.getAttribute(attrName);\n if (attrValue) {\n const container = element.closest("[q\\\\:container]:not([q\\\\:container=html]):not([q\\\\:container=text])");\n const qBase = container.getAttribute("q:base");\n const qVersion = container.getAttribute("q:version") || "unknown";\n const qManifest = container.getAttribute("q:manifest-hash") || "dev";\n const base = new URL(qBase, doc.baseURI);\n for (const qrl of attrValue.split("\\n")) {\n const url = new URL(qrl, base);\n const href = url.href;\n const symbol = url.hash.replace(/^#?([^?[|]*).*$/, "$1") || "default";\n const reqTime = performance.now();\n let handler;\n let importError;\n let error;\n const isSync = qrl.startsWith("#");\n const eventData = {\n qBase: qBase,\n qManifest: qManifest,\n qVersion: qVersion,\n href: href,\n symbol: symbol,\n element: element,\n reqTime: reqTime\n };\n if (isSync) {\n const hash = container.getAttribute("q:instance");\n handler = (doc["qFuncs_" + hash] || [])[Number.parseInt(symbol)];\n if (!handler) {\n importError = "sync";\n error = new Error("sync handler error for symbol: " + symbol);\n }\n } else {\n const uri = url.href.split("#")[0];\n try {\n const module = import(\n uri);\n resolveContainer(container);\n handler = (await module)[symbol];\n if (!handler) {\n importError = "no-symbol";\n error = new Error(`${symbol} not in ${uri}`);\n }\n } catch (err) {\n importError || (importError = "async");\n error = err;\n }\n }\n if (!handler) {\n emitEvent("qerror", __spreadValues({\n importError: importError,\n error: error\n }, eventData));\n console.error(error);\n break;\n }\n const previousCtx = doc[Q_CONTEXT];\n if (element.isConnected) {\n const handleEvent = async (retryCount = 0) => {\n try {\n doc[Q_CONTEXT] = [ element, ev, url ];\n isSync || emitEvent("qsymbol", __spreadValues({}, eventData));\n const results = handler(ev, element);\n isPromise(results) && await results;\n } catch (error2) {\n isPromise(error2) && retryCount < 100 ? error2.then((() => handleEvent(retryCount++))) : emitEvent("qerror", __spreadValues({\n error: error2\n }, eventData));\n } finally {\n doc[Q_CONTEXT] = previousCtx;\n }\n };\n handleEvent();\n }\n }\n }\n };\n const emitEvent = (eventName, detail) => {\n doc.dispatchEvent(createEvent(eventName, detail));\n };\n const camelToKebab = str => str.replace(/([A-Z])/g, (a => "-" + a.toLowerCase()));\n const processDocumentEvent = async ev => {\n let type = camelToKebab(ev.type);\n let element = ev.target;\n broadcast("-document", ev, type);\n while (element && element.getAttribute) {\n const results = dispatch(element, "", ev, type);\n let cancelBubble = ev.cancelBubble;\n isPromise(results) && await results;\n cancelBubble = cancelBubble || ev.cancelBubble || element.hasAttribute("stoppropagation:" + ev.type);\n element = ev.bubbles && !0 !== cancelBubble ? element.parentElement : null;\n }\n };\n const processWindowEvent = ev => {\n broadcast("-window", ev, camelToKebab(ev.type));\n };\n const processReadyStateChange = () => {\n var _a;\n const readyState = doc.readyState;\n if (!hasInitialized && ("interactive" == readyState || "complete" == readyState)) {\n roots.forEach(findShadowRoots);\n hasInitialized = 1;\n emitEvent("qinit");\n (null != (_a = win.requestIdleCallback) ? _a : win.setTimeout).bind(win)((() => emitEvent("qidle")));\n if (events.has("qvisible")) {\n const results = querySelectorAll("[on\\\\:qvisible]");\n const observer = new IntersectionObserver((entries => {\n for (const entry of entries) {\n if (entry.isIntersecting) {\n observer.unobserve(entry.target);\n dispatch(entry.target, "", createEvent("qvisible", entry));\n }\n }\n }));\n results.forEach((el => observer.observe(el)));\n }\n }\n };\n const addEventListener = (el, eventName, handler, capture = !1) => el.addEventListener(eventName, handler, {\n capture: capture,\n passive: !1\n });\n const processEventOrNode = (...eventNames) => {\n for (const eventNameOrNode of eventNames) {\n if ("string" == typeof eventNameOrNode) {\n if (!events.has(eventNameOrNode)) {\n roots.forEach((root => addEventListener(root, eventNameOrNode, processDocumentEvent, !0)));\n addEventListener(win, eventNameOrNode, processWindowEvent, !0);\n events.add(eventNameOrNode);\n }\n } else if (!roots.has(eventNameOrNode)) {\n events.forEach((eventName => addEventListener(eventNameOrNode, eventName, processDocumentEvent, !0)));\n roots.add(eventNameOrNode);\n }\n }\n };\n if (!(Q_CONTEXT in doc)) {\n doc[Q_CONTEXT] = 0;\n const qwikevents = win.qwikevents;\n Array.isArray(qwikevents) && processEventOrNode(...qwikevents);\n win.qwikevents = {\n events: events,\n roots: roots,\n push: processEventOrNode\n };\n addEventListener(doc, "readystatechange", processReadyStateChange);\n processReadyStateChange();\n }\n })(document);\n})()';
8861
8883
  function getQwikLoaderScript(opts = {}) {
8862
8884
  return opts.debug ? QWIK_LOADER_DEFAULT_DEBUG : QWIK_LOADER_DEFAULT_MINIFIED;
8863
8885
  }
@@ -9,12 +9,14 @@
9
9
  ],
10
10
  "nextSteps": {
11
11
  "lines": [
12
+ " Please add `optimizeDeps: { include: ['@auth/core'] }`",
13
+ " to your vite.config.ts file.",
12
14
  " Have a look at the docs for more info: ",
13
15
  " https://qwik.dev/docs/integrations/authjs/"
14
16
  ]
15
17
  }
16
18
  },
17
19
  "devDependencies": {
18
- "@auth/qwik": "0.2.2"
20
+ "@auth/qwik": "0.5.4"
19
21
  }
20
22
  }
@@ -22,7 +22,8 @@
22
22
  " Check out the Drizzle docs for more info:",
23
23
  " - https://orm.drizzle.team/docs/overview"
24
24
  ]
25
- }
25
+ },
26
+ "alwaysInRoot": []
26
27
  },
27
28
  "devDependencies": {
28
29
  "@types/better-sqlite3": "^7.6.9",
@@ -7,6 +7,9 @@
7
7
  "docs": [
8
8
  "https://qwik.dev/integrations/integration/postcss/",
9
9
  "https://github.com/postcss/postcss-load-config"
10
+ ],
11
+ "alwaysInRoot": [
12
+ ".vscode"
10
13
  ]
11
14
  },
12
15
  "devDependencies": {
@@ -20,7 +20,8 @@
20
20
  " Check out the Prisma docs for more info:",
21
21
  " - https://www.prisma.io/docs/getting-started"
22
22
  ]
23
- }
23
+ },
24
+ "alwaysInRoot": []
24
25
  },
25
26
  "devDependencies": {
26
27
  "@prisma/client": "5.3.1",
@@ -7,6 +7,9 @@
7
7
  "docs": [
8
8
  "https://qwik.dev/integrations/integration/tailwind/",
9
9
  "https://tailwindcss.com/docs/utility-first"
10
+ ],
11
+ "alwaysInRoot": [
12
+ ".vscode"
10
13
  ]
11
14
  },
12
15
  "devDependencies": {
@@ -19,7 +19,10 @@
19
19
  " To get an authentication token for the database, run:",
20
20
  " turso db tokens create <db-name>"
21
21
  ]
22
- }
22
+ },
23
+ "alwaysInRoot": [
24
+ ".env.local"
25
+ ]
23
26
  },
24
27
  "dependencies": {
25
28
  "@libsql/client": "latest"
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * @qwik.dev/core/testing 2.0.0-alpha.1-dev+10f5414
3
+ * @qwik.dev/core/testing 2.0.0-alpha.2-dev+58b6f8d
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
@@ -23077,9 +23077,11 @@ function clearEffects(subscriber, value) {
23077
23077
  return subscriptionRemoved;
23078
23078
  }
23079
23079
 
23080
+ // packages/qwik/src/core/signal/flags.ts
23081
+ var NEEDS_COMPUTATION = Symbol("invalid");
23082
+
23080
23083
  // packages/qwik/src/core/signal/signal.ts
23081
23084
  var DEBUG = false;
23082
- var NEEDS_COMPUTATION = Symbol("invalid");
23083
23085
  var log = (...args) => console.log("SIGNAL", ...args.map(qwikDebugToString));
23084
23086
  var throwIfQRLNotResolved = (qrl2) => {
23085
23087
  const resolved = qrl2.resolved;
@@ -23615,6 +23617,20 @@ var StoreHandler = class {
23615
23617
  if (prop === STORE_TARGET) {
23616
23618
  return true;
23617
23619
  }
23620
+ if (typeof prop === "string") {
23621
+ const ctx = tryGetInvokeContext();
23622
+ if (ctx) {
23623
+ const effectSubscriber = ctx.$effectSubscriber$;
23624
+ if (effectSubscriber) {
23625
+ addEffect(
23626
+ target,
23627
+ Array.isArray(target) ? STORE_ARRAY_PROP : prop,
23628
+ this,
23629
+ effectSubscriber
23630
+ );
23631
+ }
23632
+ }
23633
+ }
23618
23634
  return Object.prototype.hasOwnProperty.call(target, prop);
23619
23635
  }
23620
23636
  ownKeys(target) {
@@ -25245,7 +25261,10 @@ function choreComparator(a, b, shouldThrowOnHostMismatch) {
25245
25261
  return hostDiff;
25246
25262
  }
25247
25263
  } else {
25248
- const errorMessage = "SERVER: during HTML streaming, it is not possible to cause a re-run of tasks on a different host";
25264
+ const errorMessage = `SERVER: during HTML streaming, re-running tasks on a different host is not allowed.
25265
+ You are attempting to change a state that has already been streamed to the client.
25266
+ This can lead to inconsistencies between Server-Side Rendering (SSR) and Client-Side Rendering (CSR).
25267
+ Problematic Node: ${aHost.toString()}`;
25249
25268
  if (shouldThrowOnHostMismatch) {
25250
25269
  throwErrorAndStop(errorMessage);
25251
25270
  }
@@ -25360,9 +25379,10 @@ var _SharedContainer = class {
25360
25379
  trackSignalValue(signal, subscriber, property, data) {
25361
25380
  return trackSignal(() => signal.value, subscriber, property, this, data);
25362
25381
  }
25363
- serializationCtxFactory(NodeConstructor, symbolToChunkResolver, writer, prepVNodeData) {
25382
+ serializationCtxFactory(NodeConstructor, DomRefConstructor, symbolToChunkResolver, writer, prepVNodeData) {
25364
25383
  return createSerializationContext(
25365
25384
  NodeConstructor,
25385
+ DomRefConstructor,
25366
25386
  symbolToChunkResolver,
25367
25387
  this.getHostProp.bind(this),
25368
25388
  this.setHostProp.bind(this),
@@ -27891,6 +27911,12 @@ var SsrNode = class {
27891
27911
  return `SSRNode [<${this.id}> ${stringifiedAttrs}]`;
27892
27912
  }
27893
27913
  };
27914
+ var DomRef = class {
27915
+ /** @id is the same id as for SsrNode */
27916
+ constructor(id) {
27917
+ this.id = id;
27918
+ }
27919
+ };
27894
27920
  var SsrComponentFrame = class {
27895
27921
  constructor(componentNode) {
27896
27922
  this.componentNode = componentNode;
@@ -28505,12 +28531,7 @@ function inflateQRL(container, qrl2) {
28505
28531
  }
28506
28532
  return qrl2;
28507
28533
  }
28508
- var DomVRef = class {
28509
- constructor(id) {
28510
- this.id = id;
28511
- }
28512
- };
28513
- var createSerializationContext = (NodeConstructor, symbolToChunkResolver, getProp, setProp, storeProxyMap, writer, prepVNodeData) => {
28534
+ var createSerializationContext = (NodeConstructor, DomRefConstructor, symbolToChunkResolver, getProp, setProp, storeProxyMap, writer, prepVNodeData) => {
28514
28535
  if (!writer) {
28515
28536
  const buffer = [];
28516
28537
  writer = {
@@ -28534,11 +28555,13 @@ var createSerializationContext = (NodeConstructor, symbolToChunkResolver, getPro
28534
28555
  return id;
28535
28556
  };
28536
28557
  const isSsrNode = NodeConstructor ? (obj) => obj instanceof NodeConstructor : () => false;
28558
+ const isDomRef = DomRefConstructor ? (obj) => obj instanceof DomRefConstructor : () => false;
28537
28559
  return {
28538
28560
  $serialize$() {
28539
28561
  serialize(this);
28540
28562
  },
28541
28563
  $isSsrNode$: isSsrNode,
28564
+ $isDomRef$: isDomRef,
28542
28565
  $symbolToChunkResolver$: symbolToChunkResolver,
28543
28566
  $wasSeen$,
28544
28567
  $roots$: roots,
@@ -28647,6 +28670,8 @@ var createSerializationContext = (NodeConstructor, symbolToChunkResolver, getPro
28647
28670
  discoveredValues.push(obj.$el$, obj.$qrl$, obj.$state$, obj.$effectDependencies$);
28648
28671
  } else if (isSsrNode(obj)) {
28649
28672
  discoveredValues.push(obj.vnodeData);
28673
+ } else if (isDomRef(obj)) {
28674
+ discoveredValues.push(obj.id);
28650
28675
  } else if (isJSXNode(obj)) {
28651
28676
  discoveredValues.push(obj.type, obj.props, obj.constProps, obj.children);
28652
28677
  } else if (Array.isArray(obj)) {
@@ -28701,7 +28726,7 @@ var createSerializationContext = (NodeConstructor, symbolToChunkResolver, getPro
28701
28726
  };
28702
28727
  var promiseResults = /* @__PURE__ */ new WeakMap();
28703
28728
  function serialize(serializationContext) {
28704
- const { $writer$, $isSsrNode$, $setProp$, $storeProxyMap$ } = serializationContext;
28729
+ const { $writer$, $isSsrNode$, $isDomRef$, $setProp$, $storeProxyMap$ } = serializationContext;
28705
28730
  let depth = -1;
28706
28731
  let writeType = false;
28707
28732
  const output = (type, value) => {
@@ -28870,14 +28895,10 @@ function serialize(serializationContext) {
28870
28895
  }
28871
28896
  output(13 /* Object */, out);
28872
28897
  }
28873
- } else if (value instanceof DomVRef) {
28898
+ } else if ($isDomRef$(value)) {
28874
28899
  output(9 /* RefVNode */, value.id);
28875
28900
  } else if (value instanceof Signal) {
28876
- let v = value instanceof ComputedSignal && (value.$invalid$ || fastSkipSerialize(value.$untrackedValue$)) ? NEEDS_COMPUTATION : value.$untrackedValue$;
28877
- if ($isSsrNode$(v)) {
28878
- serializationContext.$addRoot$(v);
28879
- v = new DomVRef(v.id);
28880
- }
28901
+ const v = value instanceof ComputedSignal && (value.$invalid$ || fastSkipSerialize(value.$untrackedValue$)) ? NEEDS_COMPUTATION : value.$untrackedValue$;
28881
28902
  if (value instanceof WrappedSignal) {
28882
28903
  output(23 /* WrappedSignal */, [
28883
28904
  ...serializeWrappingFn(serializationContext, value),
@@ -29372,8 +29393,8 @@ var createQRL = (chunk, symbol, symbolRef, symbolFn, capture, captureRef, refSym
29372
29393
  }
29373
29394
  let _containerEl;
29374
29395
  const qrl2 = async function(...args) {
29375
- const fn = invokeFn.call(this, tryGetInvokeContext());
29376
- const result = await fn(...args);
29396
+ const boundedFn = bindFnToContext.call(this, tryGetInvokeContext());
29397
+ const result = await boundedFn(...args);
29377
29398
  return result;
29378
29399
  };
29379
29400
  const setContainer = (el) => {
@@ -29382,6 +29403,30 @@ var createQRL = (chunk, symbol, symbolRef, symbolFn, capture, captureRef, refSym
29382
29403
  }
29383
29404
  return _containerEl;
29384
29405
  };
29406
+ function bindFnToContext(currentCtx, beforeFn) {
29407
+ return (...args) => maybeThen(resolveLazy(), (fn) => {
29408
+ if (!isFunction(fn)) {
29409
+ throw qError(QError_qrlIsNotFunction);
29410
+ }
29411
+ if (beforeFn && beforeFn() === false) {
29412
+ return;
29413
+ }
29414
+ const context = createOrReuseInvocationContext(currentCtx);
29415
+ const prevQrl = context.$qrl$;
29416
+ const prevEvent = context.$event$;
29417
+ context.$qrl$ = qrl2;
29418
+ context.$event$ ||= this;
29419
+ try {
29420
+ return invoke.call(this, context, fn, ...args);
29421
+ } finally {
29422
+ context.$qrl$ = prevQrl;
29423
+ context.$event$ = prevEvent;
29424
+ }
29425
+ });
29426
+ }
29427
+ const resolveLazy = (containerEl) => {
29428
+ return symbolRef !== null ? symbolRef : resolve(containerEl);
29429
+ };
29385
29430
  const wrapFn = (fn) => {
29386
29431
  if (typeof fn !== "function" || !(capture == null ? void 0 : capture.length) && !(captureRef == null ? void 0 : captureRef.length)) {
29387
29432
  return fn;
@@ -29431,30 +29476,6 @@ var createQRL = (chunk, symbol, symbolRef, symbolFn, capture, captureRef, refSym
29431
29476
  }
29432
29477
  return symbolRef;
29433
29478
  };
29434
- const resolveLazy = (containerEl) => {
29435
- return symbolRef !== null ? symbolRef : resolve(containerEl);
29436
- };
29437
- function invokeFn(currentCtx, beforeFn) {
29438
- return (...args) => maybeThen(resolveLazy(), (f) => {
29439
- if (!isFunction(f)) {
29440
- throw qError(QError_qrlIsNotFunction);
29441
- }
29442
- if (beforeFn && beforeFn() === false) {
29443
- return;
29444
- }
29445
- const context = createOrReuseInvocationContext(currentCtx);
29446
- const prevQrl = context.$qrl$;
29447
- const prevEvent = context.$event$;
29448
- context.$qrl$ = qrl2;
29449
- context.$event$ ||= this;
29450
- try {
29451
- return invoke.call(this, context, f, ...args);
29452
- } finally {
29453
- context.$qrl$ = prevQrl;
29454
- context.$event$ = prevEvent;
29455
- }
29456
- });
29457
- }
29458
29479
  const createOrReuseInvocationContext = (invoke2) => {
29459
29480
  if (invoke2 == null) {
29460
29481
  return newInvokeContext();
@@ -29477,7 +29498,7 @@ var createQRL = (chunk, symbol, symbolRef, symbolFn, capture, captureRef, refSym
29477
29498
  $symbol$: symbol,
29478
29499
  $refSymbol$: refSymbol,
29479
29500
  $hash$: hash3,
29480
- getFn: invokeFn,
29501
+ getFn: bindFnToContext,
29481
29502
  $capture$: capture,
29482
29503
  $captureRef$: captureRef,
29483
29504
  dev: null,
@@ -31160,6 +31181,7 @@ var SSRContainer = class extends import_core5._SharedContainer {
31160
31181
  };
31161
31182
  this.serializationCtx = this.serializationCtxFactory(
31162
31183
  SsrNode,
31184
+ DomRef,
31163
31185
  this.symbolToChunkResolver,
31164
31186
  opts.writer,
31165
31187
  (vNodeData) => this.addVNodeToSerializationRoots(vNodeData)
@@ -31933,10 +31955,10 @@ var SSRContainer = class extends import_core5._SharedContainer {
31933
31955
  if (key === "ref") {
31934
31956
  const lastNode = this.getLastNode();
31935
31957
  if ((0, import_core5.isSignal)(value)) {
31936
- value.value = lastNode;
31958
+ value.value = new DomRef(lastNode.id);
31937
31959
  continue;
31938
31960
  } else if (typeof value === "function") {
31939
- value(lastNode);
31961
+ value(new DomRef(lastNode.id));
31940
31962
  continue;
31941
31963
  }
31942
31964
  }