@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/build/package.json +1 -1
- package/dist/cli.cjs +1384 -761
- package/dist/core-internal.d.ts +14 -1
- package/dist/core.cjs +66 -58
- package/dist/core.cjs.map +1 -1
- package/dist/core.min.mjs +1 -1
- package/dist/core.mjs +66 -58
- package/dist/core.mjs.map +1 -1
- package/dist/core.prod.cjs +49 -42
- package/dist/core.prod.mjs +51 -45
- package/dist/insights/index.qwik.cjs +1 -1
- package/dist/insights/index.qwik.mjs +1 -1
- package/dist/loader/index.cjs +2 -2
- package/dist/loader/index.mjs +2 -2
- package/dist/loader/package.json +1 -1
- package/dist/optimizer.cjs +49 -47
- package/dist/optimizer.mjs +51 -50
- package/dist/prefetch/package.json +1 -1
- package/dist/qwikloader.debug.js +1 -0
- package/dist/qwikloader.js +2 -2
- package/dist/server.cjs +72 -50
- package/dist/server.mjs +72 -50
- package/dist/starters/features/auth/package.json +3 -1
- package/dist/starters/features/drizzle/package.json +2 -1
- package/dist/starters/features/postcss/package.json +3 -0
- package/dist/starters/features/prisma/package.json +2 -1
- package/dist/starters/features/tailwind/package.json +3 -0
- package/dist/starters/features/turso/package.json +4 -1
- package/dist/testing/index.cjs +68 -46
- package/dist/testing/index.mjs +68 -46
- package/dist/testing/package.json +1 -1
- package/package.json +4 -2
package/dist/optimizer.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* @qwik.dev/core/optimizer 2.0.0-alpha.
|
|
3
|
+
* @qwik.dev/core/optimizer 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
|
|
@@ -1226,7 +1226,7 @@ globalThis.qwikOptimizer = function(module) {
|
|
|
1226
1226
|
}
|
|
1227
1227
|
var QWIK_BINDING_MAP = {};
|
|
1228
1228
|
var versions = {
|
|
1229
|
-
qwik: "2.0.0-alpha.
|
|
1229
|
+
qwik: "2.0.0-alpha.2-dev+58b6f8d"
|
|
1230
1230
|
};
|
|
1231
1231
|
async function getSystem() {
|
|
1232
1232
|
const sysEnv = getEnv();
|
|
@@ -2529,8 +2529,8 @@ globalThis.qwikOptimizer = function(module) {
|
|
|
2529
2529
|
});
|
|
2530
2530
|
return err;
|
|
2531
2531
|
}
|
|
2532
|
-
var QWIK_LOADER_DEFAULT_MINIFIED = '(()=>{var e=Object.defineProperty,t=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,
|
|
2533
|
-
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})()';
|
|
2532
|
+
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)})()';
|
|
2533
|
+
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})()';
|
|
2534
2534
|
var import_bmp = __toESM(require_bmp(), 1);
|
|
2535
2535
|
var import_cur = __toESM(require_cur(), 1);
|
|
2536
2536
|
var import_dds = __toESM(require_dds(), 1);
|
|
@@ -3198,8 +3198,8 @@ globalThis.qwikOptimizer = function(module) {
|
|
|
3198
3198
|
}
|
|
3199
3199
|
return subscriptionRemoved;
|
|
3200
3200
|
}
|
|
3201
|
-
var DEBUG = false;
|
|
3202
3201
|
var NEEDS_COMPUTATION = Symbol("invalid");
|
|
3202
|
+
var DEBUG = false;
|
|
3203
3203
|
var log = (...args) => console.log("SIGNAL", ...args.map(qwikDebugToString));
|
|
3204
3204
|
var throwIfQRLNotResolved = qrl2 => {
|
|
3205
3205
|
const resolved = qrl2.resolved;
|
|
@@ -3558,6 +3558,13 @@ globalThis.qwikOptimizer = function(module) {
|
|
|
3558
3558
|
if (prop === STORE_TARGET) {
|
|
3559
3559
|
return true;
|
|
3560
3560
|
}
|
|
3561
|
+
if ("string" === typeof prop) {
|
|
3562
|
+
const ctx = tryGetInvokeContext();
|
|
3563
|
+
if (ctx) {
|
|
3564
|
+
const effectSubscriber = ctx.$effectSubscriber$;
|
|
3565
|
+
effectSubscriber && addEffect(target, Array.isArray(target) ? STORE_ARRAY_PROP : prop, this, effectSubscriber);
|
|
3566
|
+
}
|
|
3567
|
+
}
|
|
3561
3568
|
return Object.prototype.hasOwnProperty.call(target, prop);
|
|
3562
3569
|
}
|
|
3563
3570
|
ownKeys(target) {
|
|
@@ -4996,7 +5003,7 @@ globalThis.qwikOptimizer = function(module) {
|
|
|
4996
5003
|
const bHost = b.$host$;
|
|
4997
5004
|
if (aHost !== bHost && null !== aHost && null !== bHost) {
|
|
4998
5005
|
if (!vnode_isVNode(aHost) || !vnode_isVNode(bHost)) {
|
|
4999
|
-
const errorMessage =
|
|
5006
|
+
const errorMessage = `SERVER: during HTML streaming, re-running tasks on a different host is not allowed.\n You are attempting to change a state that has already been streamed to the client.\n This can lead to inconsistencies between Server-Side Rendering (SSR) and Client-Side Rendering (CSR).\n Problematic Node: ${aHost.toString()}`;
|
|
5000
5007
|
shouldThrowOnHostMismatch && throwErrorAndStop(errorMessage);
|
|
5001
5008
|
logWarn(errorMessage);
|
|
5002
5009
|
return null;
|
|
@@ -5079,7 +5086,7 @@ globalThis.qwikOptimizer = function(module) {
|
|
|
5079
5086
|
}));
|
|
5080
5087
|
console.log(lines.join("\n ") + "\n");
|
|
5081
5088
|
}
|
|
5082
|
-
var version = "2.0.0-alpha.
|
|
5089
|
+
var version = "2.0.0-alpha.2-dev+58b6f8d";
|
|
5083
5090
|
var _SharedContainer = class {
|
|
5084
5091
|
$version$;
|
|
5085
5092
|
$scheduler$;
|
|
@@ -5102,8 +5109,8 @@ globalThis.qwikOptimizer = function(module) {
|
|
|
5102
5109
|
trackSignalValue(signal, subscriber, property, data) {
|
|
5103
5110
|
return trackSignal((() => signal.value), subscriber, property, this, data);
|
|
5104
5111
|
}
|
|
5105
|
-
serializationCtxFactory(NodeConstructor, symbolToChunkResolver, writer, prepVNodeData) {
|
|
5106
|
-
return createSerializationContext(NodeConstructor, symbolToChunkResolver, this.getHostProp.bind(this), this.setHostProp.bind(this), this.$storeProxyMap$, writer, prepVNodeData);
|
|
5112
|
+
serializationCtxFactory(NodeConstructor, DomRefConstructor, symbolToChunkResolver, writer, prepVNodeData) {
|
|
5113
|
+
return createSerializationContext(NodeConstructor, DomRefConstructor, symbolToChunkResolver, this.getHostProp.bind(this), this.setHostProp.bind(this), this.$storeProxyMap$, writer, prepVNodeData);
|
|
5107
5114
|
}
|
|
5108
5115
|
};
|
|
5109
5116
|
var VNodeDataSeparator = {
|
|
@@ -7480,12 +7487,7 @@ globalThis.qwikOptimizer = function(module) {
|
|
|
7480
7487
|
container.element && qrl2.$setContainer$(container.element);
|
|
7481
7488
|
return qrl2;
|
|
7482
7489
|
}
|
|
7483
|
-
var
|
|
7484
|
-
constructor(id) {
|
|
7485
|
-
this.id = id;
|
|
7486
|
-
}
|
|
7487
|
-
};
|
|
7488
|
-
var createSerializationContext = (NodeConstructor, symbolToChunkResolver, getProp, setProp, storeProxyMap, writer, prepVNodeData) => {
|
|
7490
|
+
var createSerializationContext = (NodeConstructor, DomRefConstructor, symbolToChunkResolver, getProp, setProp, storeProxyMap, writer, prepVNodeData) => {
|
|
7489
7491
|
if (!writer) {
|
|
7490
7492
|
const buffer = [];
|
|
7491
7493
|
writer = {
|
|
@@ -7509,11 +7511,13 @@ globalThis.qwikOptimizer = function(module) {
|
|
|
7509
7511
|
return id;
|
|
7510
7512
|
};
|
|
7511
7513
|
const isSsrNode = NodeConstructor ? obj => obj instanceof NodeConstructor : () => false;
|
|
7514
|
+
const isDomRef = DomRefConstructor ? obj => obj instanceof DomRefConstructor : () => false;
|
|
7512
7515
|
return {
|
|
7513
7516
|
$serialize$() {
|
|
7514
7517
|
serialize(this);
|
|
7515
7518
|
},
|
|
7516
7519
|
$isSsrNode$: isSsrNode,
|
|
7520
|
+
$isDomRef$: isDomRef,
|
|
7517
7521
|
$symbolToChunkResolver$: symbolToChunkResolver,
|
|
7518
7522
|
$wasSeen$: $wasSeen$,
|
|
7519
7523
|
$roots$: roots,
|
|
@@ -7603,6 +7607,8 @@ globalThis.qwikOptimizer = function(module) {
|
|
|
7603
7607
|
discoveredValues.push(obj.$el$, obj.$qrl$, obj.$state$, obj.$effectDependencies$);
|
|
7604
7608
|
} else if (isSsrNode(obj)) {
|
|
7605
7609
|
discoveredValues.push(obj.vnodeData);
|
|
7610
|
+
} else if (isDomRef(obj)) {
|
|
7611
|
+
discoveredValues.push(obj.id);
|
|
7606
7612
|
} else if (isJSXNode(obj)) {
|
|
7607
7613
|
discoveredValues.push(obj.type, obj.props, obj.constProps, obj.children);
|
|
7608
7614
|
} else if (Array.isArray(obj)) {
|
|
@@ -7655,7 +7661,7 @@ globalThis.qwikOptimizer = function(module) {
|
|
|
7655
7661
|
};
|
|
7656
7662
|
var promiseResults = new WeakMap;
|
|
7657
7663
|
function serialize(serializationContext) {
|
|
7658
|
-
const {$writer$: $writer$, $isSsrNode$: $isSsrNode$, $setProp$: $setProp$, $storeProxyMap$: $storeProxyMap$} = serializationContext;
|
|
7664
|
+
const {$writer$: $writer$, $isSsrNode$: $isSsrNode$, $isDomRef$: $isDomRef$, $setProp$: $setProp$, $storeProxyMap$: $storeProxyMap$} = serializationContext;
|
|
7659
7665
|
let depth = -1;
|
|
7660
7666
|
let writeType = false;
|
|
7661
7667
|
const output = (type, value) => {
|
|
@@ -7787,14 +7793,10 @@ globalThis.qwikOptimizer = function(module) {
|
|
|
7787
7793
|
}
|
|
7788
7794
|
output(13, out);
|
|
7789
7795
|
}
|
|
7790
|
-
} else if (value
|
|
7796
|
+
} else if ($isDomRef$(value)) {
|
|
7791
7797
|
output(9, value.id);
|
|
7792
7798
|
} else if (value instanceof Signal) {
|
|
7793
|
-
|
|
7794
|
-
if ($isSsrNode$(v)) {
|
|
7795
|
-
serializationContext.$addRoot$(v);
|
|
7796
|
-
v = new DomVRef(v.id);
|
|
7797
|
-
}
|
|
7799
|
+
const v = value instanceof ComputedSignal && (value.$invalid$ || fastSkipSerialize(value.$untrackedValue$)) ? NEEDS_COMPUTATION : value.$untrackedValue$;
|
|
7798
7800
|
if (value instanceof WrappedSignal) {
|
|
7799
7801
|
output(23, [ ...serializeWrappingFn(serializationContext, value), value.$effectDependencies$, v, ...value.$effects$ || [] ]);
|
|
7800
7802
|
} else if (value instanceof ComputedSignal) {
|
|
@@ -8104,14 +8106,36 @@ globalThis.qwikOptimizer = function(module) {
|
|
|
8104
8106
|
}
|
|
8105
8107
|
let _containerEl;
|
|
8106
8108
|
const qrl2 = async function(...args) {
|
|
8107
|
-
const
|
|
8108
|
-
const result = await
|
|
8109
|
+
const boundedFn = bindFnToContext.call(this, tryGetInvokeContext());
|
|
8110
|
+
const result = await boundedFn(...args);
|
|
8109
8111
|
return result;
|
|
8110
8112
|
};
|
|
8111
8113
|
const setContainer = el => {
|
|
8112
8114
|
_containerEl || (_containerEl = el);
|
|
8113
8115
|
return _containerEl;
|
|
8114
8116
|
};
|
|
8117
|
+
function bindFnToContext(currentCtx, beforeFn) {
|
|
8118
|
+
return (...args) => maybeThen(resolveLazy(), (fn => {
|
|
8119
|
+
if (!isFunction(fn)) {
|
|
8120
|
+
throw qError(QError_qrlIsNotFunction);
|
|
8121
|
+
}
|
|
8122
|
+
if (beforeFn && false === beforeFn()) {
|
|
8123
|
+
return;
|
|
8124
|
+
}
|
|
8125
|
+
const context = createOrReuseInvocationContext(currentCtx);
|
|
8126
|
+
const prevQrl = context.$qrl$;
|
|
8127
|
+
const prevEvent = context.$event$;
|
|
8128
|
+
context.$qrl$ = qrl2;
|
|
8129
|
+
context.$event$ ||= this;
|
|
8130
|
+
try {
|
|
8131
|
+
return invoke.call(this, context, fn, ...args);
|
|
8132
|
+
} finally {
|
|
8133
|
+
context.$qrl$ = prevQrl;
|
|
8134
|
+
context.$event$ = prevEvent;
|
|
8135
|
+
}
|
|
8136
|
+
}));
|
|
8137
|
+
}
|
|
8138
|
+
const resolveLazy = containerEl => null !== symbolRef ? symbolRef : resolve(containerEl);
|
|
8115
8139
|
const wrapFn = fn => {
|
|
8116
8140
|
if ("function" !== typeof fn || !(null == capture ? void 0 : capture.length) && !(null == captureRef ? void 0 : captureRef.length)) {
|
|
8117
8141
|
return fn;
|
|
@@ -8154,28 +8178,6 @@ globalThis.qwikOptimizer = function(module) {
|
|
|
8154
8178
|
}));
|
|
8155
8179
|
return symbolRef;
|
|
8156
8180
|
};
|
|
8157
|
-
const resolveLazy = containerEl => null !== symbolRef ? symbolRef : resolve(containerEl);
|
|
8158
|
-
function invokeFn(currentCtx, beforeFn) {
|
|
8159
|
-
return (...args) => maybeThen(resolveLazy(), (f => {
|
|
8160
|
-
if (!isFunction(f)) {
|
|
8161
|
-
throw qError(QError_qrlIsNotFunction);
|
|
8162
|
-
}
|
|
8163
|
-
if (beforeFn && false === beforeFn()) {
|
|
8164
|
-
return;
|
|
8165
|
-
}
|
|
8166
|
-
const context = createOrReuseInvocationContext(currentCtx);
|
|
8167
|
-
const prevQrl = context.$qrl$;
|
|
8168
|
-
const prevEvent = context.$event$;
|
|
8169
|
-
context.$qrl$ = qrl2;
|
|
8170
|
-
context.$event$ ||= this;
|
|
8171
|
-
try {
|
|
8172
|
-
return invoke.call(this, context, f, ...args);
|
|
8173
|
-
} finally {
|
|
8174
|
-
context.$qrl$ = prevQrl;
|
|
8175
|
-
context.$event$ = prevEvent;
|
|
8176
|
-
}
|
|
8177
|
-
}));
|
|
8178
|
-
}
|
|
8179
8181
|
const createOrReuseInvocationContext = invoke2 => null == invoke2 ? newInvokeContext() : isArray(invoke2) ? newInvokeContextFromTuple(invoke2) : invoke2;
|
|
8180
8182
|
const resolvedSymbol = refSymbol ?? symbol;
|
|
8181
8183
|
const hash = getSymbolHash(resolvedSymbol);
|
|
@@ -8190,7 +8192,7 @@ globalThis.qwikOptimizer = function(module) {
|
|
|
8190
8192
|
$symbol$: symbol,
|
|
8191
8193
|
$refSymbol$: refSymbol,
|
|
8192
8194
|
$hash$: hash,
|
|
8193
|
-
getFn:
|
|
8195
|
+
getFn: bindFnToContext,
|
|
8194
8196
|
$capture$: capture,
|
|
8195
8197
|
$captureRef$: captureRef,
|
|
8196
8198
|
dev: null,
|
package/dist/optimizer.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* @qwik.dev/core/optimizer 2.0.0-alpha.
|
|
3
|
+
* @qwik.dev/core/optimizer 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
|
|
@@ -1260,7 +1260,7 @@ function createPath(opts = {}) {
|
|
|
1260
1260
|
var QWIK_BINDING_MAP = {};
|
|
1261
1261
|
|
|
1262
1262
|
var versions = {
|
|
1263
|
-
qwik: "2.0.0-alpha.
|
|
1263
|
+
qwik: "2.0.0-alpha.2-dev+58b6f8d"
|
|
1264
1264
|
};
|
|
1265
1265
|
|
|
1266
1266
|
async function getSystem() {
|
|
@@ -2570,9 +2570,9 @@ function createRollupError2(id, diagnostic) {
|
|
|
2570
2570
|
return err;
|
|
2571
2571
|
}
|
|
2572
2572
|
|
|
2573
|
-
var QWIK_LOADER_DEFAULT_MINIFIED = '(()=>{var e=Object.defineProperty,t=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,
|
|
2573
|
+
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)})()';
|
|
2574
2574
|
|
|
2575
|
-
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})()';
|
|
2575
|
+
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})()';
|
|
2576
2576
|
|
|
2577
2577
|
var import_bmp = __toESM(require_bmp(), 1);
|
|
2578
2578
|
|
|
@@ -3279,7 +3279,7 @@ function setLocale(locale) {
|
|
|
3279
3279
|
}
|
|
3280
3280
|
|
|
3281
3281
|
var versions3 = {
|
|
3282
|
-
qwik: "2.0.0-alpha.
|
|
3282
|
+
qwik: "2.0.0-alpha.2-dev+58b6f8d",
|
|
3283
3283
|
qwikDom: globalThis.QWIK_DOM_VERSION
|
|
3284
3284
|
};
|
|
3285
3285
|
|
|
@@ -3446,10 +3446,10 @@ function clearEffects(subscriber, value) {
|
|
|
3446
3446
|
return subscriptionRemoved;
|
|
3447
3447
|
}
|
|
3448
3448
|
|
|
3449
|
-
var DEBUG = false;
|
|
3450
|
-
|
|
3451
3449
|
var NEEDS_COMPUTATION = Symbol("invalid");
|
|
3452
3450
|
|
|
3451
|
+
var DEBUG = false;
|
|
3452
|
+
|
|
3453
3453
|
var log = (...args) => console.log("SIGNAL", ...args.map(qwikDebugToString));
|
|
3454
3454
|
|
|
3455
3455
|
var throwIfQRLNotResolved = qrl2 => {
|
|
@@ -3829,6 +3829,13 @@ var StoreHandler = class {
|
|
|
3829
3829
|
if (prop === STORE_TARGET) {
|
|
3830
3830
|
return true;
|
|
3831
3831
|
}
|
|
3832
|
+
if ("string" === typeof prop) {
|
|
3833
|
+
const ctx = tryGetInvokeContext();
|
|
3834
|
+
if (ctx) {
|
|
3835
|
+
const effectSubscriber = ctx.$effectSubscriber$;
|
|
3836
|
+
effectSubscriber && addEffect(target, Array.isArray(target) ? STORE_ARRAY_PROP : prop, this, effectSubscriber);
|
|
3837
|
+
}
|
|
3838
|
+
}
|
|
3832
3839
|
return Object.prototype.hasOwnProperty.call(target, prop);
|
|
3833
3840
|
}
|
|
3834
3841
|
ownKeys(target) {
|
|
@@ -5328,7 +5335,7 @@ function choreComparator(a, b, shouldThrowOnHostMismatch) {
|
|
|
5328
5335
|
const bHost = b.$host$;
|
|
5329
5336
|
if (aHost !== bHost && null !== aHost && null !== bHost) {
|
|
5330
5337
|
if (!vnode_isVNode(aHost) || !vnode_isVNode(bHost)) {
|
|
5331
|
-
const errorMessage =
|
|
5338
|
+
const errorMessage = `SERVER: during HTML streaming, re-running tasks on a different host is not allowed.\n You are attempting to change a state that has already been streamed to the client.\n This can lead to inconsistencies between Server-Side Rendering (SSR) and Client-Side Rendering (CSR).\n Problematic Node: ${aHost.toString()}`;
|
|
5332
5339
|
shouldThrowOnHostMismatch && throwErrorAndStop(errorMessage);
|
|
5333
5340
|
logWarn(errorMessage);
|
|
5334
5341
|
return null;
|
|
@@ -5415,7 +5422,7 @@ function debugTrace(action, arg, currentChore, queue) {
|
|
|
5415
5422
|
console.log(lines.join("\n ") + "\n");
|
|
5416
5423
|
}
|
|
5417
5424
|
|
|
5418
|
-
var version = "2.0.0-alpha.
|
|
5425
|
+
var version = "2.0.0-alpha.2-dev+58b6f8d";
|
|
5419
5426
|
|
|
5420
5427
|
var _SharedContainer = class {
|
|
5421
5428
|
constructor(scheduleDrain, journalFlush, serverData, locale) {
|
|
@@ -5439,8 +5446,8 @@ var _SharedContainer = class {
|
|
|
5439
5446
|
trackSignalValue(signal, subscriber, property, data) {
|
|
5440
5447
|
return trackSignal((() => signal.value), subscriber, property, this, data);
|
|
5441
5448
|
}
|
|
5442
|
-
serializationCtxFactory(NodeConstructor, symbolToChunkResolver, writer, prepVNodeData) {
|
|
5443
|
-
return createSerializationContext(NodeConstructor, symbolToChunkResolver, this.getHostProp.bind(this), this.setHostProp.bind(this), this.$storeProxyMap$, writer, prepVNodeData);
|
|
5449
|
+
serializationCtxFactory(NodeConstructor, DomRefConstructor, symbolToChunkResolver, writer, prepVNodeData) {
|
|
5450
|
+
return createSerializationContext(NodeConstructor, DomRefConstructor, symbolToChunkResolver, this.getHostProp.bind(this), this.setHostProp.bind(this), this.$storeProxyMap$, writer, prepVNodeData);
|
|
5444
5451
|
}
|
|
5445
5452
|
};
|
|
5446
5453
|
|
|
@@ -7988,13 +7995,7 @@ function inflateQRL(container, qrl2) {
|
|
|
7988
7995
|
return qrl2;
|
|
7989
7996
|
}
|
|
7990
7997
|
|
|
7991
|
-
var
|
|
7992
|
-
constructor(id) {
|
|
7993
|
-
this.id = id;
|
|
7994
|
-
}
|
|
7995
|
-
};
|
|
7996
|
-
|
|
7997
|
-
var createSerializationContext = (NodeConstructor, symbolToChunkResolver, getProp, setProp, storeProxyMap, writer, prepVNodeData) => {
|
|
7998
|
+
var createSerializationContext = (NodeConstructor, DomRefConstructor, symbolToChunkResolver, getProp, setProp, storeProxyMap, writer, prepVNodeData) => {
|
|
7998
7999
|
if (!writer) {
|
|
7999
8000
|
const buffer = [];
|
|
8000
8001
|
writer = {
|
|
@@ -8018,11 +8019,13 @@ var createSerializationContext = (NodeConstructor, symbolToChunkResolver, getPro
|
|
|
8018
8019
|
return id;
|
|
8019
8020
|
};
|
|
8020
8021
|
const isSsrNode = NodeConstructor ? obj => obj instanceof NodeConstructor : () => false;
|
|
8022
|
+
const isDomRef = DomRefConstructor ? obj => obj instanceof DomRefConstructor : () => false;
|
|
8021
8023
|
return {
|
|
8022
8024
|
$serialize$() {
|
|
8023
8025
|
serialize(this);
|
|
8024
8026
|
},
|
|
8025
8027
|
$isSsrNode$: isSsrNode,
|
|
8028
|
+
$isDomRef$: isDomRef,
|
|
8026
8029
|
$symbolToChunkResolver$: symbolToChunkResolver,
|
|
8027
8030
|
$wasSeen$: $wasSeen$,
|
|
8028
8031
|
$roots$: roots,
|
|
@@ -8112,6 +8115,8 @@ var createSerializationContext = (NodeConstructor, symbolToChunkResolver, getPro
|
|
|
8112
8115
|
discoveredValues.push(obj.$el$, obj.$qrl$, obj.$state$, obj.$effectDependencies$);
|
|
8113
8116
|
} else if (isSsrNode(obj)) {
|
|
8114
8117
|
discoveredValues.push(obj.vnodeData);
|
|
8118
|
+
} else if (isDomRef(obj)) {
|
|
8119
|
+
discoveredValues.push(obj.id);
|
|
8115
8120
|
} else if (isJSXNode(obj)) {
|
|
8116
8121
|
discoveredValues.push(obj.type, obj.props, obj.constProps, obj.children);
|
|
8117
8122
|
} else if (Array.isArray(obj)) {
|
|
@@ -8166,7 +8171,7 @@ var createSerializationContext = (NodeConstructor, symbolToChunkResolver, getPro
|
|
|
8166
8171
|
var promiseResults = new WeakMap;
|
|
8167
8172
|
|
|
8168
8173
|
function serialize(serializationContext) {
|
|
8169
|
-
const {$writer$: $writer$, $isSsrNode$: $isSsrNode$, $setProp$: $setProp$, $storeProxyMap$: $storeProxyMap$} = serializationContext;
|
|
8174
|
+
const {$writer$: $writer$, $isSsrNode$: $isSsrNode$, $isDomRef$: $isDomRef$, $setProp$: $setProp$, $storeProxyMap$: $storeProxyMap$} = serializationContext;
|
|
8170
8175
|
let depth = -1;
|
|
8171
8176
|
let writeType = false;
|
|
8172
8177
|
const output = (type, value) => {
|
|
@@ -8297,14 +8302,10 @@ function serialize(serializationContext) {
|
|
|
8297
8302
|
}
|
|
8298
8303
|
output(13, out);
|
|
8299
8304
|
}
|
|
8300
|
-
} else if (value
|
|
8305
|
+
} else if ($isDomRef$(value)) {
|
|
8301
8306
|
output(9, value.id);
|
|
8302
8307
|
} else if (value instanceof Signal) {
|
|
8303
|
-
|
|
8304
|
-
if ($isSsrNode$(v)) {
|
|
8305
|
-
serializationContext.$addRoot$(v);
|
|
8306
|
-
v = new DomVRef(v.id);
|
|
8307
|
-
}
|
|
8308
|
+
const v = value instanceof ComputedSignal && (value.$invalid$ || fastSkipSerialize(value.$untrackedValue$)) ? NEEDS_COMPUTATION : value.$untrackedValue$;
|
|
8308
8309
|
if (value instanceof WrappedSignal) {
|
|
8309
8310
|
output(23, [ ...serializeWrappingFn(serializationContext, value), value.$effectDependencies$, v, ...value.$effects$ || [] ]);
|
|
8310
8311
|
} else if (value instanceof ComputedSignal) {
|
|
@@ -8632,14 +8633,36 @@ var createQRL = (chunk, symbol, symbolRef, symbolFn, capture, captureRef, refSym
|
|
|
8632
8633
|
}
|
|
8633
8634
|
let _containerEl;
|
|
8634
8635
|
const qrl2 = async function(...args) {
|
|
8635
|
-
const
|
|
8636
|
-
const result = await
|
|
8636
|
+
const boundedFn = bindFnToContext.call(this, tryGetInvokeContext());
|
|
8637
|
+
const result = await boundedFn(...args);
|
|
8637
8638
|
return result;
|
|
8638
8639
|
};
|
|
8639
8640
|
const setContainer = el => {
|
|
8640
8641
|
_containerEl || (_containerEl = el);
|
|
8641
8642
|
return _containerEl;
|
|
8642
8643
|
};
|
|
8644
|
+
function bindFnToContext(currentCtx, beforeFn) {
|
|
8645
|
+
return (...args) => maybeThen(resolveLazy(), (fn => {
|
|
8646
|
+
if (!isFunction(fn)) {
|
|
8647
|
+
throw qError(QError_qrlIsNotFunction);
|
|
8648
|
+
}
|
|
8649
|
+
if (beforeFn && false === beforeFn()) {
|
|
8650
|
+
return;
|
|
8651
|
+
}
|
|
8652
|
+
const context = createOrReuseInvocationContext(currentCtx);
|
|
8653
|
+
const prevQrl = context.$qrl$;
|
|
8654
|
+
const prevEvent = context.$event$;
|
|
8655
|
+
context.$qrl$ = qrl2;
|
|
8656
|
+
context.$event$ || (context.$event$ = this);
|
|
8657
|
+
try {
|
|
8658
|
+
return invoke.call(this, context, fn, ...args);
|
|
8659
|
+
} finally {
|
|
8660
|
+
context.$qrl$ = prevQrl;
|
|
8661
|
+
context.$event$ = prevEvent;
|
|
8662
|
+
}
|
|
8663
|
+
}));
|
|
8664
|
+
}
|
|
8665
|
+
const resolveLazy = containerEl => null !== symbolRef ? symbolRef : resolve(containerEl);
|
|
8643
8666
|
const wrapFn = fn => {
|
|
8644
8667
|
if ("function" !== typeof fn || !capture?.length && !captureRef?.length) {
|
|
8645
8668
|
return fn;
|
|
@@ -8682,28 +8705,6 @@ var createQRL = (chunk, symbol, symbolRef, symbolFn, capture, captureRef, refSym
|
|
|
8682
8705
|
}));
|
|
8683
8706
|
return symbolRef;
|
|
8684
8707
|
};
|
|
8685
|
-
const resolveLazy = containerEl => null !== symbolRef ? symbolRef : resolve(containerEl);
|
|
8686
|
-
function invokeFn(currentCtx, beforeFn) {
|
|
8687
|
-
return (...args) => maybeThen(resolveLazy(), (f => {
|
|
8688
|
-
if (!isFunction(f)) {
|
|
8689
|
-
throw qError(QError_qrlIsNotFunction);
|
|
8690
|
-
}
|
|
8691
|
-
if (beforeFn && false === beforeFn()) {
|
|
8692
|
-
return;
|
|
8693
|
-
}
|
|
8694
|
-
const context = createOrReuseInvocationContext(currentCtx);
|
|
8695
|
-
const prevQrl = context.$qrl$;
|
|
8696
|
-
const prevEvent = context.$event$;
|
|
8697
|
-
context.$qrl$ = qrl2;
|
|
8698
|
-
context.$event$ || (context.$event$ = this);
|
|
8699
|
-
try {
|
|
8700
|
-
return invoke.call(this, context, f, ...args);
|
|
8701
|
-
} finally {
|
|
8702
|
-
context.$qrl$ = prevQrl;
|
|
8703
|
-
context.$event$ = prevEvent;
|
|
8704
|
-
}
|
|
8705
|
-
}));
|
|
8706
|
-
}
|
|
8707
8708
|
const createOrReuseInvocationContext = invoke2 => null == invoke2 ? newInvokeContext() : isArray(invoke2) ? newInvokeContextFromTuple(invoke2) : invoke2;
|
|
8708
8709
|
const resolvedSymbol = refSymbol ?? symbol;
|
|
8709
8710
|
const hash = getSymbolHash(resolvedSymbol);
|
|
@@ -8718,7 +8719,7 @@ var createQRL = (chunk, symbol, symbolRef, symbolFn, capture, captureRef, refSym
|
|
|
8718
8719
|
$symbol$: symbol,
|
|
8719
8720
|
$refSymbol$: refSymbol,
|
|
8720
8721
|
$hash$: hash,
|
|
8721
|
-
getFn:
|
|
8722
|
+
getFn: bindFnToContext,
|
|
8722
8723
|
$capture$: capture,
|
|
8723
8724
|
$captureRef$: captureRef,
|
|
8724
8725
|
dev: null,
|
package/dist/qwikloader.debug.js
CHANGED
|
@@ -60,6 +60,7 @@
|
|
|
60
60
|
const dispatch = async (element, scope, ev, eventName = ev.type) => {
|
|
61
61
|
const attrName = "on" + scope + ":" + eventName;
|
|
62
62
|
element.hasAttribute("preventdefault:" + eventName) && ev.preventDefault();
|
|
63
|
+
element.hasAttribute("stoppropagation:" + eventName) && ev.stopPropagation();
|
|
63
64
|
const ctx = element._qc_;
|
|
64
65
|
const relevantListeners = ctx && ctx.li.filter((li => li[0] === attrName));
|
|
65
66
|
if (relevantListeners && relevantListeners.length > 0) {
|