@qwik.dev/core 2.0.0-beta.7 → 2.0.0-beta.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bindings/qwik.darwin-arm64.node +0 -0
- package/bindings/qwik.darwin-x64.node +0 -0
- package/bindings/qwik.linux-x64-gnu.node +0 -0
- package/bindings/qwik.win32-x64-msvc.node +0 -0
- package/bindings/qwik_wasm_bg.wasm +0 -0
- package/dist/backpatch/index.cjs +6 -0
- package/dist/backpatch/index.d.ts +2 -0
- package/dist/backpatch/index.mjs +5 -0
- package/dist/backpatch/package.json +8 -0
- package/dist/backpatch-executor.debug.js +34 -0
- package/dist/backpatch-executor.js +1 -0
- package/dist/build/package.json +1 -1
- package/dist/cli.cjs +17 -17
- package/dist/core-internal.d.ts +112 -56
- package/dist/core.cjs +1022 -469
- package/dist/core.cjs.map +1 -1
- package/dist/core.min.mjs +1 -1
- package/dist/core.mjs +1018 -469
- package/dist/core.mjs.map +1 -1
- package/dist/core.prod.cjs +654 -361
- package/dist/core.prod.mjs +729 -373
- 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 +78 -76
- package/dist/optimizer.mjs +78 -78
- package/dist/qwikloader.debug.js +0 -13
- package/dist/qwikloader.js +1 -1
- package/dist/server.cjs +217 -63
- package/dist/server.d.ts +9 -0
- package/dist/server.mjs +213 -63
- package/dist/starters/features/auth/package.json +1 -1
- package/dist/starters/features/localize/package.json +3 -3
- package/dist/starters/features/pandacss/package.json +1 -1
- package/dist/starters/features/playwright/playwright-report/index.html +943 -903
- package/dist/starters/features/postcss/postcss.config.js +1 -1
- package/dist/starters/features/tailwind/package.json +2 -2
- package/dist/starters/features/tailwind/prettier.config.js +10 -0
- package/dist/starters/features/tailwind-v3/package.json +1 -1
- package/dist/starters/features/tailwind-v3/prettier.config.js +10 -0
- package/dist/testing/index.cjs +3826 -952
- package/dist/testing/index.d.ts +972 -1
- package/dist/testing/index.mjs +3811 -946
- package/dist/testing/package.json +1 -1
- package/package.json +8 -6
- package/dist/starters/features/tailwind/.prettierrc.js +0 -3
package/dist/loader/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const QWIK_LOADER = "const t=document,e=window,n=new Set,o=new Set([t]);let r;const s=(t,e)=>Array.from(t.querySelectorAll(e)),
|
|
2
|
-
const QWIK_LOADER_DEBUG = "const doc = document;\nconst win = window;\nconst events = /* @__PURE__ */ new Set();\nconst roots = /* @__PURE__ */ new Set([doc]);\nlet hasInitialized;\nconst nativeQuerySelectorAll = (root, selector) => Array.from(root.querySelectorAll(selector));\nconst querySelectorAll = (query) => {\n const elements = [];\n roots.forEach((root) => elements.push(...nativeQuerySelectorAll(root, query)));\n return elements;\n};\nconst findShadowRoots = (fragment) => {\n processEventOrNode(fragment);\n nativeQuerySelectorAll(fragment, \"[q\\\\:shadowroot]\").forEach((parent) => {\n const shadowRoot = parent.shadowRoot;\n shadowRoot && findShadowRoots(shadowRoot);\n });\n};\nconst isPromise = (promise) => promise && typeof promise.then === \"function\";\
|
|
1
|
+
const QWIK_LOADER = "const t=document,e=window,n=new Set,o=new Set([t]);let r;const s=(t,e)=>Array.from(t.querySelectorAll(e)),a=t=>{const e=[];return o.forEach(n=>e.push(...s(n,t))),e},i=t=>{m(t),s(t,\"[q\\\\:shadowroot]\").forEach(t=>{const e=t.shadowRoot;e&&i(e)})},c=t=>t&&\"function\"==typeof t.then,l=(t,e,n=e.type)=>{a(\"[on\"+t+\"\\\\:\"+n+\"]\").forEach(o=>{u(o,t,e,n)})},f=e=>{if(void 0===e._qwikjson_){let n=(e===t.documentElement?t.body:e).lastElementChild;for(;n;){if(\"SCRIPT\"===n.tagName&&\"qwik/json\"===n.getAttribute(\"type\")){e._qwikjson_=JSON.parse(n.textContent.replace(/\\\\x3C(\\/?script)/gi,\"<$1\"));break}n=n.previousElementSibling}}},p=(t,e)=>new CustomEvent(t,{detail:e}),u=async(e,n,o,r=o.type)=>{const s=\"on\"+n+\":\"+r;e.hasAttribute(\"preventdefault:\"+r)&&o.preventDefault(),e.hasAttribute(\"stoppropagation:\"+r)&&o.stopPropagation();const a=e._qc_,i=a&&a.li.filter(t=>t[0]===s);if(i&&i.length>0){for(const t of i){const n=t[1].getFn([e,o],()=>e.isConnected)(o,e),r=o.cancelBubble;c(n)&&await n,r&&o.stopPropagation()}return}const l=e.getAttribute(s),p=e.qDispatchEvent;if(p)return p(o,n);if(l){const n=e.closest(\"[q\\\\:container]:not([q\\\\:container=html]):not([q\\\\:container=text])\"),r=n.getAttribute(\"q:base\"),s=n.getAttribute(\"q:version\")||\"unknown\",a=n.getAttribute(\"q:manifest-hash\")||\"dev\",i=new URL(r,t.baseURI);for(const p of l.split(\"\\n\")){const l=new URL(p,i),u=l.href,q=l.hash.replace(/^#?([^?[|]*).*$/,\"$1\")||\"default\",h=performance.now();let _,d,y;const m=p.startsWith(\"#\"),w={qBase:r,qManifest:a,qVersion:s,href:u,symbol:q,element:e,reqTime:h};if(m){const e=n.getAttribute(\"q:instance\");_=(t[\"qFuncs_\"+e]||[])[Number.parseInt(q)],_||(d=\"sync\",y=Error(\"sym:\"+q))}else{b(\"qsymbol\",w);const t=l.href.split(\"#\")[0];try{const e=import(t);f(n),_=(await e)[q],_||(d=\"no-symbol\",y=Error(`${q} not in ${t}`))}catch(t){d||(d=\"async\"),y=t}}if(!_){b(\"qerror\",{importError:d,error:y,...w}),console.error(y);break}const g=t.__q_context__;if(e.isConnected)try{t.__q_context__=[e,o,l];const n=_(o,e);c(n)&&await n}catch(t){b(\"qerror\",{error:t,...w})}finally{t.__q_context__=g}}}},b=(e,n)=>{t.dispatchEvent(p(e,n))},q=t=>t.replace(/([A-Z])/g,t=>\"-\"+t.toLowerCase()),h=async t=>{let e=q(t.type),n=t.target;for(l(\"-document\",t,e);n&&n.getAttribute;){const o=u(n,\"\",t,e);let r=t.cancelBubble;c(o)&&await o,r||(r=r||t.cancelBubble||n.hasAttribute(\"stoppropagation:\"+t.type)),n=t.bubbles&&!0!==r?n.parentElement:null}},_=t=>{l(\"-window\",t,q(t.type))},d=()=>{var s;const c=t.readyState;if(!r&&(\"interactive\"==c||\"complete\"==c)&&(o.forEach(i),r=1,b(\"qinit\"),(null!=(s=e.requestIdleCallback)?s:e.setTimeout).bind(e)(()=>b(\"qidle\")),n.has(\"qvisible\"))){const t=a(\"[on\\\\:qvisible]\"),e=new IntersectionObserver(t=>{for(const n of t)n.isIntersecting&&(e.unobserve(n.target),u(n.target,\"\",p(\"qvisible\",n)))});t.forEach(t=>e.observe(t))}},y=(t,e,n,o=!1)=>{t.addEventListener(e,n,{capture:o,passive:!1})},m=(...t)=>{for(const r of t)\"string\"==typeof r?n.has(r)||(o.forEach(t=>y(t,r,h,!0)),y(e,r,_,!0),n.add(r)):o.has(r)||(n.forEach(t=>y(r,t,h,!0)),o.add(r))};if(!(\"__q_context__\"in t)){t.__q_context__=0;const r=e.qwikevents;r&&(Array.isArray(r)?m(...r):m(\"click\",\"input\")),e.qwikevents={events:n,roots:o,push:m},y(t,\"readystatechange\",d),d()}";
|
|
2
|
+
const QWIK_LOADER_DEBUG = "const doc = document;\nconst win = window;\nconst events = /* @__PURE__ */ new Set();\nconst roots = /* @__PURE__ */ new Set([doc]);\nlet hasInitialized;\nconst nativeQuerySelectorAll = (root, selector) => Array.from(root.querySelectorAll(selector));\nconst querySelectorAll = (query) => {\n const elements = [];\n roots.forEach((root) => elements.push(...nativeQuerySelectorAll(root, query)));\n return elements;\n};\nconst findShadowRoots = (fragment) => {\n processEventOrNode(fragment);\n nativeQuerySelectorAll(fragment, \"[q\\\\:shadowroot]\").forEach((parent) => {\n const shadowRoot = parent.shadowRoot;\n shadowRoot && findShadowRoots(shadowRoot);\n });\n};\nconst isPromise = (promise) => promise && typeof promise.then === \"function\";\nconst broadcast = (infix, ev, type = ev.type) => {\n querySelectorAll(\"[on\" + infix + \"\\\\:\" + type + \"]\").forEach((el) => {\n dispatch(el, infix, ev, type);\n });\n};\nconst resolveContainer = (containerEl) => {\n if (containerEl._qwikjson_ === void 0) {\n const parentJSON = containerEl === doc.documentElement ? doc.body : containerEl;\n let script = parentJSON.lastElementChild;\n while (script) {\n if (script.tagName === \"SCRIPT\" && script.getAttribute(\"type\") === \"qwik/json\") {\n containerEl._qwikjson_ = JSON.parse(\n script.textContent.replace(/\\\\x3C(\\/?script)/gi, \"<$1\")\n );\n break;\n }\n script = script.previousElementSibling;\n }\n }\n};\nconst createEvent = (eventName, detail) => new CustomEvent(eventName, {\n detail\n});\nconst dispatch = async (element, scope, ev, eventName = ev.type) => {\n const attrName = \"on\" + scope + \":\" + eventName;\n if (element.hasAttribute(\"preventdefault:\" + eventName)) {\n ev.preventDefault();\n }\n if (element.hasAttribute(\"stoppropagation:\" + eventName)) {\n ev.stopPropagation();\n }\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 if (isPromise(results)) {\n await results;\n }\n if (cancelBubble) {\n ev.stopPropagation();\n }\n }\n return;\n }\n const attrValue = element.getAttribute(attrName);\n const qDispatchEvent = element.qDispatchEvent;\n if (qDispatchEvent) {\n return qDispatchEvent(ev, scope);\n }\n if (attrValue) {\n const container = element.closest(\n \"[q\\\\:container]:not([q\\\\:container=html]):not([q\\\\:container=text])\"\n );\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,\n qManifest,\n qVersion,\n href,\n symbol,\n element,\n 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(\"sym:\" + symbol);\n }\n } else {\n emitEvent(\"qsymbol\", eventData);\n const uri = url.href.split(\"#\")[0];\n try {\n const module = import(\n uri\n );\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\", {\n importError,\n error,\n ...eventData\n });\n console.error(error);\n break;\n }\n const previousCtx = doc.__q_context__;\n if (element.isConnected) {\n try {\n doc.__q_context__ = [element, ev, url];\n const results = handler(ev, element);\n if (isPromise(results)) {\n await results;\n }\n } catch (error2) {\n emitEvent(\"qerror\", { error: error2, ...eventData });\n } finally {\n doc.__q_context__ = previousCtx;\n }\n }\n }\n }\n};\nconst emitEvent = (eventName, detail) => {\n doc.dispatchEvent(createEvent(eventName, detail));\n};\nconst camelToKebab = (str) => str.replace(/([A-Z])/g, (a) => \"-\" + a.toLowerCase());\nconst 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 if (isPromise(results)) {\n await results;\n }\n cancelBubble || (cancelBubble = cancelBubble || ev.cancelBubble || element.hasAttribute(\"stoppropagation:\" + ev.type));\n element = ev.bubbles && cancelBubble !== true ? element.parentElement : null;\n }\n};\nconst processWindowEvent = (ev) => {\n broadcast(\"-window\", ev, camelToKebab(ev.type));\n};\nconst processReadyStateChange = () => {\n var _a;\n const readyState = doc.readyState;\n if (!hasInitialized && (readyState == \"interactive\" || readyState == \"complete\")) {\n roots.forEach(findShadowRoots);\n hasInitialized = 1;\n emitEvent(\"qinit\");\n const riC = (_a = win.requestIdleCallback) != null ? _a : win.setTimeout;\n riC.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};\nconst addEventListener = (el, eventName, handler, capture = false) => {\n el.addEventListener(eventName, handler, { capture, passive: false });\n};\nconst processEventOrNode = (...eventNames) => {\n for (const eventNameOrNode of eventNames) {\n if (typeof eventNameOrNode === \"string\") {\n if (!events.has(eventNameOrNode)) {\n roots.forEach(\n (root) => addEventListener(root, eventNameOrNode, processDocumentEvent, true)\n );\n addEventListener(win, eventNameOrNode, processWindowEvent, true);\n events.add(eventNameOrNode);\n }\n } else {\n if (!roots.has(eventNameOrNode)) {\n events.forEach(\n (eventName) => addEventListener(eventNameOrNode, eventName, processDocumentEvent, true)\n );\n roots.add(eventNameOrNode);\n }\n }\n }\n};\nif (!(\"__q_context__\" in doc)) {\n doc.__q_context__ = 0;\n const qwikevents = win.qwikevents;\n if (qwikevents) {\n if (Array.isArray(qwikevents)) {\n processEventOrNode(...qwikevents);\n } else {\n processEventOrNode(\"click\", \"input\");\n }\n }\n win.qwikevents = {\n events,\n roots,\n push: processEventOrNode\n };\n addEventListener(doc, \"readystatechange\", processReadyStateChange);\n processReadyStateChange();\n}";
|
|
3
3
|
exports.QWIK_LOADER = QWIK_LOADER;
|
|
4
4
|
exports.QWIK_LOADER_DEBUG = QWIK_LOADER_DEBUG;
|
package/dist/loader/index.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
const QWIK_LOADER = "const t=document,e=window,n=new Set,o=new Set([t]);let r;const s=(t,e)=>Array.from(t.querySelectorAll(e)),
|
|
2
|
-
const QWIK_LOADER_DEBUG = "const doc = document;\nconst win = window;\nconst events = /* @__PURE__ */ new Set();\nconst roots = /* @__PURE__ */ new Set([doc]);\nlet hasInitialized;\nconst nativeQuerySelectorAll = (root, selector) => Array.from(root.querySelectorAll(selector));\nconst querySelectorAll = (query) => {\n const elements = [];\n roots.forEach((root) => elements.push(...nativeQuerySelectorAll(root, query)));\n return elements;\n};\nconst findShadowRoots = (fragment) => {\n processEventOrNode(fragment);\n nativeQuerySelectorAll(fragment, \"[q\\\\:shadowroot]\").forEach((parent) => {\n const shadowRoot = parent.shadowRoot;\n shadowRoot && findShadowRoots(shadowRoot);\n });\n};\nconst isPromise = (promise) => promise && typeof promise.then === \"function\";\
|
|
1
|
+
const QWIK_LOADER = "const t=document,e=window,n=new Set,o=new Set([t]);let r;const s=(t,e)=>Array.from(t.querySelectorAll(e)),a=t=>{const e=[];return o.forEach(n=>e.push(...s(n,t))),e},i=t=>{m(t),s(t,\"[q\\\\:shadowroot]\").forEach(t=>{const e=t.shadowRoot;e&&i(e)})},c=t=>t&&\"function\"==typeof t.then,l=(t,e,n=e.type)=>{a(\"[on\"+t+\"\\\\:\"+n+\"]\").forEach(o=>{u(o,t,e,n)})},f=e=>{if(void 0===e._qwikjson_){let n=(e===t.documentElement?t.body:e).lastElementChild;for(;n;){if(\"SCRIPT\"===n.tagName&&\"qwik/json\"===n.getAttribute(\"type\")){e._qwikjson_=JSON.parse(n.textContent.replace(/\\\\x3C(\\/?script)/gi,\"<$1\"));break}n=n.previousElementSibling}}},p=(t,e)=>new CustomEvent(t,{detail:e}),u=async(e,n,o,r=o.type)=>{const s=\"on\"+n+\":\"+r;e.hasAttribute(\"preventdefault:\"+r)&&o.preventDefault(),e.hasAttribute(\"stoppropagation:\"+r)&&o.stopPropagation();const a=e._qc_,i=a&&a.li.filter(t=>t[0]===s);if(i&&i.length>0){for(const t of i){const n=t[1].getFn([e,o],()=>e.isConnected)(o,e),r=o.cancelBubble;c(n)&&await n,r&&o.stopPropagation()}return}const l=e.getAttribute(s),p=e.qDispatchEvent;if(p)return p(o,n);if(l){const n=e.closest(\"[q\\\\:container]:not([q\\\\:container=html]):not([q\\\\:container=text])\"),r=n.getAttribute(\"q:base\"),s=n.getAttribute(\"q:version\")||\"unknown\",a=n.getAttribute(\"q:manifest-hash\")||\"dev\",i=new URL(r,t.baseURI);for(const p of l.split(\"\\n\")){const l=new URL(p,i),u=l.href,q=l.hash.replace(/^#?([^?[|]*).*$/,\"$1\")||\"default\",h=performance.now();let _,d,y;const m=p.startsWith(\"#\"),w={qBase:r,qManifest:a,qVersion:s,href:u,symbol:q,element:e,reqTime:h};if(m){const e=n.getAttribute(\"q:instance\");_=(t[\"qFuncs_\"+e]||[])[Number.parseInt(q)],_||(d=\"sync\",y=Error(\"sym:\"+q))}else{b(\"qsymbol\",w);const t=l.href.split(\"#\")[0];try{const e=import(t);f(n),_=(await e)[q],_||(d=\"no-symbol\",y=Error(`${q} not in ${t}`))}catch(t){d||(d=\"async\"),y=t}}if(!_){b(\"qerror\",{importError:d,error:y,...w}),console.error(y);break}const g=t.__q_context__;if(e.isConnected)try{t.__q_context__=[e,o,l];const n=_(o,e);c(n)&&await n}catch(t){b(\"qerror\",{error:t,...w})}finally{t.__q_context__=g}}}},b=(e,n)=>{t.dispatchEvent(p(e,n))},q=t=>t.replace(/([A-Z])/g,t=>\"-\"+t.toLowerCase()),h=async t=>{let e=q(t.type),n=t.target;for(l(\"-document\",t,e);n&&n.getAttribute;){const o=u(n,\"\",t,e);let r=t.cancelBubble;c(o)&&await o,r||(r=r||t.cancelBubble||n.hasAttribute(\"stoppropagation:\"+t.type)),n=t.bubbles&&!0!==r?n.parentElement:null}},_=t=>{l(\"-window\",t,q(t.type))},d=()=>{var s;const c=t.readyState;if(!r&&(\"interactive\"==c||\"complete\"==c)&&(o.forEach(i),r=1,b(\"qinit\"),(null!=(s=e.requestIdleCallback)?s:e.setTimeout).bind(e)(()=>b(\"qidle\")),n.has(\"qvisible\"))){const t=a(\"[on\\\\:qvisible]\"),e=new IntersectionObserver(t=>{for(const n of t)n.isIntersecting&&(e.unobserve(n.target),u(n.target,\"\",p(\"qvisible\",n)))});t.forEach(t=>e.observe(t))}},y=(t,e,n,o=!1)=>{t.addEventListener(e,n,{capture:o,passive:!1})},m=(...t)=>{for(const r of t)\"string\"==typeof r?n.has(r)||(o.forEach(t=>y(t,r,h,!0)),y(e,r,_,!0),n.add(r)):o.has(r)||(n.forEach(t=>y(r,t,h,!0)),o.add(r))};if(!(\"__q_context__\"in t)){t.__q_context__=0;const r=e.qwikevents;r&&(Array.isArray(r)?m(...r):m(\"click\",\"input\")),e.qwikevents={events:n,roots:o,push:m},y(t,\"readystatechange\",d),d()}";
|
|
2
|
+
const QWIK_LOADER_DEBUG = "const doc = document;\nconst win = window;\nconst events = /* @__PURE__ */ new Set();\nconst roots = /* @__PURE__ */ new Set([doc]);\nlet hasInitialized;\nconst nativeQuerySelectorAll = (root, selector) => Array.from(root.querySelectorAll(selector));\nconst querySelectorAll = (query) => {\n const elements = [];\n roots.forEach((root) => elements.push(...nativeQuerySelectorAll(root, query)));\n return elements;\n};\nconst findShadowRoots = (fragment) => {\n processEventOrNode(fragment);\n nativeQuerySelectorAll(fragment, \"[q\\\\:shadowroot]\").forEach((parent) => {\n const shadowRoot = parent.shadowRoot;\n shadowRoot && findShadowRoots(shadowRoot);\n });\n};\nconst isPromise = (promise) => promise && typeof promise.then === \"function\";\nconst broadcast = (infix, ev, type = ev.type) => {\n querySelectorAll(\"[on\" + infix + \"\\\\:\" + type + \"]\").forEach((el) => {\n dispatch(el, infix, ev, type);\n });\n};\nconst resolveContainer = (containerEl) => {\n if (containerEl._qwikjson_ === void 0) {\n const parentJSON = containerEl === doc.documentElement ? doc.body : containerEl;\n let script = parentJSON.lastElementChild;\n while (script) {\n if (script.tagName === \"SCRIPT\" && script.getAttribute(\"type\") === \"qwik/json\") {\n containerEl._qwikjson_ = JSON.parse(\n script.textContent.replace(/\\\\x3C(\\/?script)/gi, \"<$1\")\n );\n break;\n }\n script = script.previousElementSibling;\n }\n }\n};\nconst createEvent = (eventName, detail) => new CustomEvent(eventName, {\n detail\n});\nconst dispatch = async (element, scope, ev, eventName = ev.type) => {\n const attrName = \"on\" + scope + \":\" + eventName;\n if (element.hasAttribute(\"preventdefault:\" + eventName)) {\n ev.preventDefault();\n }\n if (element.hasAttribute(\"stoppropagation:\" + eventName)) {\n ev.stopPropagation();\n }\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 if (isPromise(results)) {\n await results;\n }\n if (cancelBubble) {\n ev.stopPropagation();\n }\n }\n return;\n }\n const attrValue = element.getAttribute(attrName);\n const qDispatchEvent = element.qDispatchEvent;\n if (qDispatchEvent) {\n return qDispatchEvent(ev, scope);\n }\n if (attrValue) {\n const container = element.closest(\n \"[q\\\\:container]:not([q\\\\:container=html]):not([q\\\\:container=text])\"\n );\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,\n qManifest,\n qVersion,\n href,\n symbol,\n element,\n 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(\"sym:\" + symbol);\n }\n } else {\n emitEvent(\"qsymbol\", eventData);\n const uri = url.href.split(\"#\")[0];\n try {\n const module = import(\n uri\n );\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\", {\n importError,\n error,\n ...eventData\n });\n console.error(error);\n break;\n }\n const previousCtx = doc.__q_context__;\n if (element.isConnected) {\n try {\n doc.__q_context__ = [element, ev, url];\n const results = handler(ev, element);\n if (isPromise(results)) {\n await results;\n }\n } catch (error2) {\n emitEvent(\"qerror\", { error: error2, ...eventData });\n } finally {\n doc.__q_context__ = previousCtx;\n }\n }\n }\n }\n};\nconst emitEvent = (eventName, detail) => {\n doc.dispatchEvent(createEvent(eventName, detail));\n};\nconst camelToKebab = (str) => str.replace(/([A-Z])/g, (a) => \"-\" + a.toLowerCase());\nconst 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 if (isPromise(results)) {\n await results;\n }\n cancelBubble || (cancelBubble = cancelBubble || ev.cancelBubble || element.hasAttribute(\"stoppropagation:\" + ev.type));\n element = ev.bubbles && cancelBubble !== true ? element.parentElement : null;\n }\n};\nconst processWindowEvent = (ev) => {\n broadcast(\"-window\", ev, camelToKebab(ev.type));\n};\nconst processReadyStateChange = () => {\n var _a;\n const readyState = doc.readyState;\n if (!hasInitialized && (readyState == \"interactive\" || readyState == \"complete\")) {\n roots.forEach(findShadowRoots);\n hasInitialized = 1;\n emitEvent(\"qinit\");\n const riC = (_a = win.requestIdleCallback) != null ? _a : win.setTimeout;\n riC.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};\nconst addEventListener = (el, eventName, handler, capture = false) => {\n el.addEventListener(eventName, handler, { capture, passive: false });\n};\nconst processEventOrNode = (...eventNames) => {\n for (const eventNameOrNode of eventNames) {\n if (typeof eventNameOrNode === \"string\") {\n if (!events.has(eventNameOrNode)) {\n roots.forEach(\n (root) => addEventListener(root, eventNameOrNode, processDocumentEvent, true)\n );\n addEventListener(win, eventNameOrNode, processWindowEvent, true);\n events.add(eventNameOrNode);\n }\n } else {\n if (!roots.has(eventNameOrNode)) {\n events.forEach(\n (eventName) => addEventListener(eventNameOrNode, eventName, processDocumentEvent, true)\n );\n roots.add(eventNameOrNode);\n }\n }\n }\n};\nif (!(\"__q_context__\" in doc)) {\n doc.__q_context__ = 0;\n const qwikevents = win.qwikevents;\n if (qwikevents) {\n if (Array.isArray(qwikevents)) {\n processEventOrNode(...qwikevents);\n } else {\n processEventOrNode(\"click\", \"input\");\n }\n }\n win.qwikevents = {\n events,\n roots,\n push: processEventOrNode\n };\n addEventListener(doc, \"readystatechange\", processReadyStateChange);\n processReadyStateChange();\n}";
|
|
3
3
|
export { QWIK_LOADER, QWIK_LOADER_DEBUG };
|
package/dist/loader/package.json
CHANGED
package/dist/optimizer.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* @qwik.dev/core/optimizer 2.0.0-beta.
|
|
3
|
+
* @qwik.dev/core/optimizer 2.0.0-beta.9-dev+6b582c7
|
|
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
|
|
@@ -1257,7 +1257,7 @@ globalThis.qwikOptimizer = function(module) {
|
|
|
1257
1257
|
}
|
|
1258
1258
|
};
|
|
1259
1259
|
var versions = {
|
|
1260
|
-
qwik: "2.0.0-beta.
|
|
1260
|
+
qwik: "2.0.0-beta.9-dev+6b582c7"
|
|
1261
1261
|
};
|
|
1262
1262
|
async function getSystem() {
|
|
1263
1263
|
const sysEnv = getEnv();
|
|
@@ -2944,8 +2944,8 @@ globalThis.qwikOptimizer = function(module) {
|
|
|
2944
2944
|
});
|
|
2945
2945
|
return err;
|
|
2946
2946
|
}
|
|
2947
|
-
var QWIK_LOADER_DEFAULT_MINIFIED = 'const t=document,e=window,n=new Set,o=new Set([t]);let r;const s=(t,e)=>Array.from(t.querySelectorAll(e)),
|
|
2948
|
-
var QWIK_LOADER_DEFAULT_DEBUG = 'const doc = document;\nconst win = window;\nconst events = /* @__PURE__ */ new Set();\nconst roots = /* @__PURE__ */ new Set([doc]);\nlet hasInitialized;\nconst nativeQuerySelectorAll = (root, selector) => Array.from(root.querySelectorAll(selector));\nconst querySelectorAll = (query) => {\n const elements = [];\n roots.forEach((root) => elements.push(...nativeQuerySelectorAll(root, query)));\n return elements;\n};\nconst findShadowRoots = (fragment) => {\n processEventOrNode(fragment);\n nativeQuerySelectorAll(fragment, "[q\\\\:shadowroot]").forEach((parent) => {\n const shadowRoot = parent.shadowRoot;\n shadowRoot && findShadowRoots(shadowRoot);\n });\n};\nconst isPromise = (promise) => promise && typeof promise.then === "function";\
|
|
2947
|
+
var QWIK_LOADER_DEFAULT_MINIFIED = 'const t=document,e=window,n=new Set,o=new Set([t]);let r;const s=(t,e)=>Array.from(t.querySelectorAll(e)),a=t=>{const e=[];return o.forEach(n=>e.push(...s(n,t))),e},i=t=>{m(t),s(t,"[q\\\\:shadowroot]").forEach(t=>{const e=t.shadowRoot;e&&i(e)})},c=t=>t&&"function"==typeof t.then,l=(t,e,n=e.type)=>{a("[on"+t+"\\\\:"+n+"]").forEach(o=>{u(o,t,e,n)})},f=e=>{if(void 0===e._qwikjson_){let n=(e===t.documentElement?t.body:e).lastElementChild;for(;n;){if("SCRIPT"===n.tagName&&"qwik/json"===n.getAttribute("type")){e._qwikjson_=JSON.parse(n.textContent.replace(/\\\\x3C(\\/?script)/gi,"<$1"));break}n=n.previousElementSibling}}},p=(t,e)=>new CustomEvent(t,{detail:e}),u=async(e,n,o,r=o.type)=>{const s="on"+n+":"+r;e.hasAttribute("preventdefault:"+r)&&o.preventDefault(),e.hasAttribute("stoppropagation:"+r)&&o.stopPropagation();const a=e._qc_,i=a&&a.li.filter(t=>t[0]===s);if(i&&i.length>0){for(const t of i){const n=t[1].getFn([e,o],()=>e.isConnected)(o,e),r=o.cancelBubble;c(n)&&await n,r&&o.stopPropagation()}return}const l=e.getAttribute(s),p=e.qDispatchEvent;if(p)return p(o,n);if(l){const n=e.closest("[q\\\\:container]:not([q\\\\:container=html]):not([q\\\\:container=text])"),r=n.getAttribute("q:base"),s=n.getAttribute("q:version")||"unknown",a=n.getAttribute("q:manifest-hash")||"dev",i=new URL(r,t.baseURI);for(const p of l.split("\\n")){const l=new URL(p,i),u=l.href,q=l.hash.replace(/^#?([^?[|]*).*$/,"$1")||"default",h=performance.now();let _,d,y;const m=p.startsWith("#"),w={qBase:r,qManifest:a,qVersion:s,href:u,symbol:q,element:e,reqTime:h};if(m){const e=n.getAttribute("q:instance");_=(t["qFuncs_"+e]||[])[Number.parseInt(q)],_||(d="sync",y=Error("sym:"+q))}else{b("qsymbol",w);const t=l.href.split("#")[0];try{const e=import(t);f(n),_=(await e)[q],_||(d="no-symbol",y=Error(`${q} not in ${t}`))}catch(t){d||(d="async"),y=t}}if(!_){b("qerror",{importError:d,error:y,...w}),console.error(y);break}const g=t.__q_context__;if(e.isConnected)try{t.__q_context__=[e,o,l];const n=_(o,e);c(n)&&await n}catch(t){b("qerror",{error:t,...w})}finally{t.__q_context__=g}}}},b=(e,n)=>{t.dispatchEvent(p(e,n))},q=t=>t.replace(/([A-Z])/g,t=>"-"+t.toLowerCase()),h=async t=>{let e=q(t.type),n=t.target;for(l("-document",t,e);n&&n.getAttribute;){const o=u(n,"",t,e);let r=t.cancelBubble;c(o)&&await o,r||(r=r||t.cancelBubble||n.hasAttribute("stoppropagation:"+t.type)),n=t.bubbles&&!0!==r?n.parentElement:null}},_=t=>{l("-window",t,q(t.type))},d=()=>{var s;const c=t.readyState;if(!r&&("interactive"==c||"complete"==c)&&(o.forEach(i),r=1,b("qinit"),(null!=(s=e.requestIdleCallback)?s:e.setTimeout).bind(e)(()=>b("qidle")),n.has("qvisible"))){const t=a("[on\\\\:qvisible]"),e=new IntersectionObserver(t=>{for(const n of t)n.isIntersecting&&(e.unobserve(n.target),u(n.target,"",p("qvisible",n)))});t.forEach(t=>e.observe(t))}},y=(t,e,n,o=!1)=>{t.addEventListener(e,n,{capture:o,passive:!1})},m=(...t)=>{for(const r of t)"string"==typeof r?n.has(r)||(o.forEach(t=>y(t,r,h,!0)),y(e,r,_,!0),n.add(r)):o.has(r)||(n.forEach(t=>y(r,t,h,!0)),o.add(r))};if(!("__q_context__"in t)){t.__q_context__=0;const r=e.qwikevents;r&&(Array.isArray(r)?m(...r):m("click","input")),e.qwikevents={events:n,roots:o,push:m},y(t,"readystatechange",d),d()}';
|
|
2948
|
+
var QWIK_LOADER_DEFAULT_DEBUG = 'const doc = document;\nconst win = window;\nconst events = /* @__PURE__ */ new Set();\nconst roots = /* @__PURE__ */ new Set([doc]);\nlet hasInitialized;\nconst nativeQuerySelectorAll = (root, selector) => Array.from(root.querySelectorAll(selector));\nconst querySelectorAll = (query) => {\n const elements = [];\n roots.forEach((root) => elements.push(...nativeQuerySelectorAll(root, query)));\n return elements;\n};\nconst findShadowRoots = (fragment) => {\n processEventOrNode(fragment);\n nativeQuerySelectorAll(fragment, "[q\\\\:shadowroot]").forEach((parent) => {\n const shadowRoot = parent.shadowRoot;\n shadowRoot && findShadowRoots(shadowRoot);\n });\n};\nconst isPromise = (promise) => promise && typeof promise.then === "function";\nconst broadcast = (infix, ev, type = ev.type) => {\n querySelectorAll("[on" + infix + "\\\\:" + type + "]").forEach((el) => {\n dispatch(el, infix, ev, type);\n });\n};\nconst resolveContainer = (containerEl) => {\n if (containerEl._qwikjson_ === void 0) {\n const parentJSON = containerEl === doc.documentElement ? doc.body : containerEl;\n let script = parentJSON.lastElementChild;\n while (script) {\n if (script.tagName === "SCRIPT" && script.getAttribute("type") === "qwik/json") {\n containerEl._qwikjson_ = JSON.parse(\n script.textContent.replace(/\\\\x3C(\\/?script)/gi, "<$1")\n );\n break;\n }\n script = script.previousElementSibling;\n }\n }\n};\nconst createEvent = (eventName, detail) => new CustomEvent(eventName, {\n detail\n});\nconst dispatch = async (element, scope, ev, eventName = ev.type) => {\n const attrName = "on" + scope + ":" + eventName;\n if (element.hasAttribute("preventdefault:" + eventName)) {\n ev.preventDefault();\n }\n if (element.hasAttribute("stoppropagation:" + eventName)) {\n ev.stopPropagation();\n }\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 if (isPromise(results)) {\n await results;\n }\n if (cancelBubble) {\n ev.stopPropagation();\n }\n }\n return;\n }\n const attrValue = element.getAttribute(attrName);\n const qDispatchEvent = element.qDispatchEvent;\n if (qDispatchEvent) {\n return qDispatchEvent(ev, scope);\n }\n if (attrValue) {\n const container = element.closest(\n "[q\\\\:container]:not([q\\\\:container=html]):not([q\\\\:container=text])"\n );\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,\n qManifest,\n qVersion,\n href,\n symbol,\n element,\n 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("sym:" + symbol);\n }\n } else {\n emitEvent("qsymbol", eventData);\n const uri = url.href.split("#")[0];\n try {\n const module = import(\n uri\n );\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", {\n importError,\n error,\n ...eventData\n });\n console.error(error);\n break;\n }\n const previousCtx = doc.__q_context__;\n if (element.isConnected) {\n try {\n doc.__q_context__ = [element, ev, url];\n const results = handler(ev, element);\n if (isPromise(results)) {\n await results;\n }\n } catch (error2) {\n emitEvent("qerror", { error: error2, ...eventData });\n } finally {\n doc.__q_context__ = previousCtx;\n }\n }\n }\n }\n};\nconst emitEvent = (eventName, detail) => {\n doc.dispatchEvent(createEvent(eventName, detail));\n};\nconst camelToKebab = (str) => str.replace(/([A-Z])/g, (a) => "-" + a.toLowerCase());\nconst 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 if (isPromise(results)) {\n await results;\n }\n cancelBubble || (cancelBubble = cancelBubble || ev.cancelBubble || element.hasAttribute("stoppropagation:" + ev.type));\n element = ev.bubbles && cancelBubble !== true ? element.parentElement : null;\n }\n};\nconst processWindowEvent = (ev) => {\n broadcast("-window", ev, camelToKebab(ev.type));\n};\nconst processReadyStateChange = () => {\n var _a;\n const readyState = doc.readyState;\n if (!hasInitialized && (readyState == "interactive" || readyState == "complete")) {\n roots.forEach(findShadowRoots);\n hasInitialized = 1;\n emitEvent("qinit");\n const riC = (_a = win.requestIdleCallback) != null ? _a : win.setTimeout;\n riC.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};\nconst addEventListener = (el, eventName, handler, capture = false) => {\n el.addEventListener(eventName, handler, { capture, passive: false });\n};\nconst processEventOrNode = (...eventNames) => {\n for (const eventNameOrNode of eventNames) {\n if (typeof eventNameOrNode === "string") {\n if (!events.has(eventNameOrNode)) {\n roots.forEach(\n (root) => addEventListener(root, eventNameOrNode, processDocumentEvent, true)\n );\n addEventListener(win, eventNameOrNode, processWindowEvent, true);\n events.add(eventNameOrNode);\n }\n } else {\n if (!roots.has(eventNameOrNode)) {\n events.forEach(\n (eventName) => addEventListener(eventNameOrNode, eventName, processDocumentEvent, true)\n );\n roots.add(eventNameOrNode);\n }\n }\n }\n};\nif (!("__q_context__" in doc)) {\n doc.__q_context__ = 0;\n const qwikevents = win.qwikevents;\n if (qwikevents) {\n if (Array.isArray(qwikevents)) {\n processEventOrNode(...qwikevents);\n } else {\n processEventOrNode("click", "input");\n }\n }\n win.qwikevents = {\n events,\n roots,\n push: processEventOrNode\n };\n addEventListener(doc, "readystatechange", processReadyStateChange);\n processReadyStateChange();\n}';
|
|
2949
2949
|
var import_bmp = __toESM(require_bmp(), 1);
|
|
2950
2950
|
var import_cur = __toESM(require_cur(), 1);
|
|
2951
2951
|
var import_dds = __toESM(require_dds(), 1);
|
|
@@ -3209,7 +3209,7 @@ globalThis.qwikOptimizer = function(module) {
|
|
|
3209
3209
|
init(45, 49);
|
|
3210
3210
|
init(46, 49);
|
|
3211
3211
|
init(47, 49);
|
|
3212
|
-
var click_to_component_default = "<style>\n #qwik-inspector-overlay {\n position: fixed;\n background: rgba(24, 182, 246, 0.27);\n pointer-events: none;\n box-sizing: border-box;\n border: 2px solid rgba(172, 126, 244, 0.46);\n border-radius: 4px;\n contain: strict;\n cursor: pointer;\n z-index: 999999;\n }\n #qwik-inspector-info-popup {\n position: fixed;\n bottom: 10px;\n right: 10px;\n font-family: monospace;\n background: #000000c2;\n color: white;\n padding: 10px 20px;\n border-radius: 8px;\n box-shadow:\n 0 20px 25px -5px rgb(0 0 0 / 34%),\n 0 8px 10px -6px rgb(0 0 0 / 24%);\n backdrop-filter: blur(4px);\n -webkit-animation: fadeOut 0.3s 3s ease-in-out forwards;\n animation: fadeOut 0.3s 3s ease-in-out forwards;\n z-index: 999999;\n contain: layout;\n }\n #qwik-inspector-info-popup p {\n margin: 0px;\n }\n @-webkit-keyframes fadeOut {\n 0% {\n opacity: 1;\n }\n 100% {\n opacity: 0;\n }\n }\n\n @keyframes fadeOut {\n 0% {\n opacity: 1;\n }\n 100% {\n opacity: 0;\n visibility: hidden;\n }\n }\n</style>\n<div id=\"qwik-inspector-info-popup\" aria-hidden=\"true\">Click-to-Source</div>\n<script>\n (function () {\n const inspectAttribute = 'data-qwik-inspector';\n const hotKeys = globalThis.qwikdevtools.hotKeys;\n const srcDir = globalThis.qwikdevtools.srcDir;\n document.querySelector('#qwik-inspector-info-popup').textContent =\n `Click-to-Source: ${hotKeys.join(' + ')}`;\n console.debug(\n '%c🔍 Qwik Click-To-Source',\n 'background: #564CE0; color: white; padding: 2px 3px; border-radius: 2px; font-size: 0.8em;',\n `Hold-press the '${hotKeys.join(' + ')}' key${\n (hotKeys.length > 1 && 's') || ''\n } and click a component to jump directly to the source code in your IDE!`\n );\n window.__qwik_inspector_state = {\n pressedKeys: new Set(),\n };\n const origin = 'http://local.local';\n const body = document.body;\n const overlay = document.createElement('div');\n overlay.id = 'qwik-inspector-overlay';\n overlay.setAttribute('aria-hidden', 'true');\n body.appendChild(overlay);\n\n function findContainer(el) {\n if (el && el instanceof Element) {\n return el.closest(`[${inspectAttribute}]`);\n }\n return null;\n }\n\n document.addEventListener(\n 'keydown',\n (event) => {\n window.__qwik_inspector_state.pressedKeys.add(event.code);\n updateOverlay();\n },\n { capture: true }\n );\n\n document.addEventListener(\n 'keyup',\n (event) => {\n window.__qwik_inspector_state.pressedKeys.delete(event.code);\n updateOverlay();\n },\n { capture: true }\n );\n\n window.addEventListener(\n 'blur',\n (event) => {\n window.__qwik_inspector_state.pressedKeys.clear();\n updateOverlay();\n },\n { capture: true }\n );\n\n document.addEventListener(\n 'mouseover',\n (event) => {\n const target = findContainer(event.target);\n if (target) {\n window.__qwik_inspector_state.hoveredElement = target;\n } else {\n window.__qwik_inspector_state.hoveredElement = undefined;\n }\n updateOverlay();\n },\n { capture: true }\n );\n\n document.addEventListener(\n 'click',\n (event) => {\n if (isActive()) {\n window.__qwik_inspector_state.pressedKeys.clear();\n const target = findContainer(event.target);\n if (target) {\n event.preventDefault();\n const inspectUrl = target.getAttribute(inspectAttribute);\n if (inspectUrl !== 'false') {\n body.style.setProperty('cursor', 'progress');\n qwikOpenInEditor(inspectUrl);\n }\n }\n }\n },\n { capture: true }\n );\n\n globalThis.qwikOpenInEditor = function (path) {\n const isWindows = navigator.platform.includes('Win');\n const resolvedURL = new URL(path, isWindows ? origin : srcDir);\n
|
|
3212
|
+
var click_to_component_default = "<style>\n #qwik-inspector-overlay {\n position: fixed;\n background: rgba(24, 182, 246, 0.27);\n pointer-events: none;\n box-sizing: border-box;\n border: 2px solid rgba(172, 126, 244, 0.46);\n border-radius: 4px;\n contain: strict;\n cursor: pointer;\n z-index: 999999;\n }\n\n #qwik-inspector-info-popup {\n position: fixed;\n bottom: 10px;\n right: 10px;\n font-family: monospace;\n background: #000000c2;\n color: white;\n padding: 10px 20px;\n border-radius: 8px;\n box-shadow:\n 0 20px 25px -5px rgb(0 0 0 / 34%),\n 0 8px 10px -6px rgb(0 0 0 / 24%);\n backdrop-filter: blur(4px);\n -webkit-animation: fadeOut 0.3s 3s ease-in-out forwards;\n animation: fadeOut 0.3s 3s ease-in-out forwards;\n z-index: 999999;\n contain: layout;\n }\n\n #qwik-inspector-info-popup p {\n margin: 0px;\n }\n\n @-webkit-keyframes fadeOut {\n 0% {\n opacity: 1;\n }\n\n 100% {\n opacity: 0;\n }\n }\n\n @keyframes fadeOut {\n 0% {\n opacity: 1;\n }\n\n 100% {\n opacity: 0;\n visibility: hidden;\n }\n }\n</style>\n<div id=\"qwik-inspector-info-popup\" aria-hidden=\"true\">Click-to-Source</div>\n<script>\n (function () {\n const inspectAttribute = 'data-qwik-inspector';\n const hotKeys = globalThis.qwikdevtools.hotKeys;\n const srcDir = globalThis.qwikdevtools.srcDir;\n document.querySelector('#qwik-inspector-info-popup').textContent =\n `Click-to-Source: ${hotKeys.join(' + ')}`;\n console.debug(\n '%c🔍 Qwik Click-To-Source',\n 'background: #564CE0; color: white; padding: 2px 3px; border-radius: 2px; font-size: 0.8em;',\n `Hold-press the '${hotKeys.join(' + ')}' key${\n (hotKeys.length > 1 && 's') || ''\n } and click a component to jump directly to the source code in your IDE!`\n );\n window.__qwik_inspector_state = {\n pressedKeys: new Set(),\n };\n const origin = 'http://local.local';\n const body = document.body;\n const overlay = document.createElement('div');\n overlay.id = 'qwik-inspector-overlay';\n overlay.setAttribute('aria-hidden', 'true');\n body.appendChild(overlay);\n\n function findContainer(el) {\n if (el && el instanceof Element) {\n return el.closest(`[${inspectAttribute}]`);\n }\n return null;\n }\n\n document.addEventListener(\n 'keydown',\n (event) => {\n window.__qwik_inspector_state.pressedKeys.add(event.code);\n updateOverlay();\n },\n { capture: true }\n );\n\n document.addEventListener(\n 'keyup',\n (event) => {\n window.__qwik_inspector_state.pressedKeys.delete(event.code);\n updateOverlay();\n },\n { capture: true }\n );\n\n window.addEventListener(\n 'blur',\n (event) => {\n window.__qwik_inspector_state.pressedKeys.clear();\n updateOverlay();\n },\n { capture: true }\n );\n\n document.addEventListener(\n 'mouseover',\n (event) => {\n const target = findContainer(event.target);\n if (target) {\n window.__qwik_inspector_state.hoveredElement = target;\n } else {\n window.__qwik_inspector_state.hoveredElement = undefined;\n }\n updateOverlay();\n },\n { capture: true }\n );\n\n document.addEventListener(\n 'click',\n (event) => {\n if (isActive()) {\n window.__qwik_inspector_state.pressedKeys.clear();\n const target = findContainer(event.target);\n if (target) {\n event.preventDefault();\n const inspectUrl = target.getAttribute(inspectAttribute);\n if (inspectUrl !== 'false') {\n body.style.setProperty('cursor', 'progress');\n qwikOpenInEditor(inspectUrl);\n }\n }\n }\n },\n { capture: true }\n );\n\n globalThis.qwikOpenInEditor = function (path) {\n const isWindows = navigator.platform.includes('Win');\n const resolvedURL = new URL(path, isWindows ? origin : srcDir);\n let filePath =\n resolvedURL.protocol === 'file:' && resolvedURL.pathname.startsWith('/')\n ? resolvedURL.pathname.slice(1)\n : resolvedURL.pathname.startsWith('/@fs/')\n ? resolvedURL.pathname.slice(isWindows ? 5 : 4)\n : resolvedURL.pathname;\n if (filePath.startsWith('/src/')) {\n const prefix = isWindows ? srcDir : srcDir.replace('http://local.local', '');\n filePath = prefix + filePath.slice(4);\n }\n const params = new URLSearchParams();\n params.set('file', filePath);\n fetch('/__open-in-editor?' + params.toString());\n };\n document.addEventListener(\n 'contextmenu',\n (event) => {\n if (isActive()) {\n window.__qwik_inspector_state.pressedKeys.clear();\n const target = findContainer(event.target);\n if (target) {\n event.preventDefault();\n }\n }\n },\n { capture: true }\n );\n\n function updateOverlay() {\n const hoverElement = window.__qwik_inspector_state.hoveredElement;\n if (hoverElement && isActive()) {\n const rect = hoverElement.getBoundingClientRect();\n overlay.style.setProperty('height', rect.height + 'px');\n overlay.style.setProperty('width', rect.width + 'px');\n overlay.style.setProperty('top', rect.top + 'px');\n overlay.style.setProperty('left', rect.left + 'px');\n overlay.style.setProperty('visibility', 'visible');\n body.style.setProperty('cursor', 'pointer');\n } else {\n overlay.style.setProperty('height', '0px');\n overlay.style.setProperty('width', '0px');\n overlay.style.setProperty('visibility', 'hidden');\n body.style.removeProperty('cursor');\n }\n }\n\n function checkKeysArePressed() {\n const activeKeys = Array.from(window.__qwik_inspector_state.pressedKeys).map((key) =>\n key ? key.replace(/(Left|Right)$/g, '') : undefined\n );\n return hotKeys.every((key) => activeKeys.includes(key));\n }\n\n function isActive() {\n return checkKeysArePressed();\n }\n window.addEventListener('resize', updateOverlay);\n document.addEventListener('scroll', updateOverlay);\n })();\n<\/script>\n";
|
|
3213
3213
|
var error_host_default = "<script>\n document.addEventListener('qerror', (ev) => {\n const ErrorOverlay = customElements.get('vite-error-overlay');\n if (!ErrorOverlay) {\n return;\n }\n const err = ev.detail.error;\n const overlay = new ErrorOverlay(err);\n document.body.appendChild(overlay);\n });\n<\/script>\n<script>\n /**\n * Usage:\n *\n * <errored-host></errored-host>\n */\n class ErroredHost extends HTMLElement {\n get _root() {\n return this.shadowRoot || this;\n }\n\n constructor() {\n super();\n const self = this;\n\n this.state = {};\n if (!this.props) {\n this.props = {};\n }\n\n this.componentProps = ['children', 'error'];\n\n // used to keep track of all nodes created by show/for\n this.nodesToDestroy = [];\n // batch updates\n this.pendingUpdate = false;\n\n this.attachShadow({ mode: 'open' });\n }\n\n destroyAnyNodes() {\n // destroy current view template refs before rendering again\n this.nodesToDestroy.forEach((el) => el.remove());\n this.nodesToDestroy = [];\n }\n\n connectedCallback() {\n this.getAttributeNames().forEach((attr) => {\n const jsVar = attr.replace(/-/g, '');\n const regexp = new RegExp(jsVar, 'i');\n this.componentProps.forEach((prop) => {\n if (regexp.test(prop)) {\n const attrValue = this.getAttribute(attr);\n if (this.props[prop] !== attrValue) {\n this.props[prop] = attrValue;\n }\n }\n });\n });\n\n this._root.innerHTML = `\n\n <template data-el=\"show-errored-host\">\n <div class=\"error\">\n <template data-el=\"div-errored-host-2\">\n \x3c!-- String(props.error) --\x3e\n </template>\n </div>\n </template>\n\n <div class=\"arrow\">👇 Uncaught error happened here 👇\n <span class=\"dev-tools\">DevTools: Cmd+Alt+I</span>\n </div>\n <div class=\"div\">\n <slot></slot>\n </div>\n\n <style>\n .error {\n border-radius: 5px 5px 0px 0;\n background: black;\n color: white;\n font-family: monospace;\n font-size: 12px;\n margin: 0;\n padding: 10px;\n }\n .arrow {\n background: #f47e81;\n color: black;\n font-size: 14px;\n padding: 10px;\n text-align: center;\n font-family: sans-serif;\n }\n .dev-tools {\n background: red;\n padding: 2px 5px;\n border-radius: 3px;\n font-weight: 800;\n }\n .div {\n outline: 5px solid red;\n border-radius: 10px;\n }\n </style>`;\n this.pendingUpdate = true;\n\n this.render();\n this.onMount();\n this.pendingUpdate = false;\n this.update();\n }\n\n showContent(el) {\n // https://developer.mozilla.org/en-US/docs/Web/API/HTMLTemplateElement/content\n // grabs the content of a node that is between <template> tags\n // iterates through child nodes to register all content including text elements\n // attaches the content after the template\n\n const elementFragment = el.content.cloneNode(true);\n const children = Array.from(elementFragment.childNodes);\n children.forEach((child) => {\n if (el?.scope) {\n child.scope = el.scope;\n }\n if (el?.context) {\n child.context = el.context;\n }\n this.nodesToDestroy.push(child);\n });\n el.after(elementFragment);\n }\n\n onMount() {}\n\n onUpdate() {}\n\n update() {\n if (this.pendingUpdate === true) {\n return;\n }\n this.pendingUpdate = true;\n this.render();\n this.onUpdate();\n this.pendingUpdate = false;\n }\n\n render() {\n // re-rendering needs to ensure that all nodes generated by for/show are refreshed\n this.destroyAnyNodes();\n this.updateBindings();\n }\n\n updateBindings() {\n this._root.querySelectorAll(\"[data-el='show-errored-host']\").forEach((el) => {\n const whenCondition = this.props.error;\n if (whenCondition) {\n this.showContent(el);\n }\n });\n\n this._root.querySelectorAll(\"[data-el='div-errored-host-2']\").forEach((el) => {\n this.renderTextNode(el, String(this.props.error));\n });\n }\n\n // Helper to render content\n renderTextNode(el, text) {\n const textNode = document.createTextNode(text);\n if (el?.scope) {\n textNode.scope = el.scope;\n }\n if (el?.context) {\n textNode.context = el.context;\n }\n el.after(textNode);\n this.nodesToDestroy.push(el.nextSibling);\n }\n }\n\n customElements.define('errored-host', ErroredHost);\n<\/script>\n";
|
|
3214
3214
|
var image_size_runtime_default = "<style>\n [data-qwik-cls] {\n outline: 2px solid red;\n }\n [data-qwik-cls]::after {\n position: absolute;\n font-size: 12px;\n content: 'CLS ' attr(data-qwik-cls);\n font-family: monospace;\n font-weight: bold;\n background: red;\n color: white;\n margin: -2px;\n padding: 1px;\n line-height: 1;\n pointer-events: none;\n }\n #qwik-image-warning-container {\n position: absolute !important;\n top: 0 !important;\n left: 0 !important;\n width: 0 !important;\n overflow: visible !important;\n height: 0 !important;\n pointer-events: none !important;\n contain: size layout style content;\n z-index: 1;\n }\n</style>\n<template id=\"qwik-image-warning-template\">\n <style>\n :host {\n position: absolute;\n border: 1px solid red;\n pointer-events: none;\n z-index: 1;\n contain: layout size;\n }\n\n #icon {\n border: 0;\n margin: 5px;\n color: black;\n max-width: 100%;\n width: 20px;\n background: yellow;\n border-radius: 100%;\n height: 20px;\n padding: 3px;\n pointer-events: all;\n cursor: pointer;\n }\n\n #icon svg {\n width: 100%;\n height: auto;\n pointer-events: none;\n }\n\n dialog {\n padding: 0;\n border: 0;\n margin: 0 5px;\n background: #ffffe8;\n color: black;\n width: 250px;\n font-size: 11px;\n position: absolute;\n inset-inline-start: unset;\n inset-inline-end: unset;\n border-radius: 5px;\n pointer-events: all;\n overflow: hidden;\n box-shadow: 0px -2px 20px 0px #0000002e;\n z-index: 10000;\n }\n\n .top {\n bottom: calc(100% + 5px);\n }\n .bottom {\n top: 40px;\n }\n .right {\n inset-inline-start: 0;\n inset-inline-end: unset;\n }\n .left {\n inset-inline-start: unset;\n inset-inline-end: calc(100% - 40px);\n }\n\n .content {\n padding: 5px;\n }\n\n #loc {\n background: #2e3801;\n color: #d2d2d2;\n font-family: monospace;\n padding: 3px 5px;\n pointer-events: all;\n margin: 0;\n border: 0;\n cursor: pointer;\n font-size: 11px;\n width: calc(100% - 24px);\n text-overflow: ellipsis;\n overflow: hidden;\n display: block;\n direction: rtl;\n text-align: right;\n }\n #loc:hover {\n background: #3a4a01;\n }\n\n pre {\n background: #f1fb8e;\n padding: 5px;\n margin: 5px 0;\n border-radius: 3px;\n user-select: none;\n }\n\n pre span {\n user-select: all;\n }\n\n a {\n text-decoration: underline;\n }\n\n #close {\n border: 0;\n width: 25px;\n height: 25px;\n position: absolute;\n right: 0;\n top: 0;\n background: #ffe14f;\n color: black;\n font-weight: 900;\n padding: 0;\n margin: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n line-height: 1;\n cursor: pointer;\n }\n #close:hover {\n background: #ffeb6f;\n }\n\n #action-btn {\n border: 2px solid #18ae00;\n padding: 2px 4px;\n background: #50ff50;\n border-radius: 5px;\n color: #0c5500;\n font-weight: 800;\n font-size: 10px;\n cursor: pointer;\n }\n\n p {\n margin: 5px 0;\n }\n\n h2 {\n font-weight: 900;\n margin: 10px 0;\n }\n </style>\n <button id=\"icon\" type=\"button\" aria-label=\"Open image dev dialog\">\n <svg width=\"32\" height=\"32\" viewBox=\"0 0 24 24\">\n <path\n fill=\"currentColor\"\n d=\"M2.725 21q-.275 0-.5-.138t-.35-.362q-.125-.225-.138-.488t.138-.512l9.25-16q.15-.25.388-.375T12 3q.25 0 .488.125t.387.375l9.25 16q.15.25.138.513t-.138.487q-.125.225-.35.363t-.5.137H2.725ZM12 18q.425 0 .713-.288T13 17q0-.425-.288-.713T12 16q-.425 0-.713.288T11 17q0 .425.288.713T12 18Zm0-3q.425 0 .713-.288T13 14v-3q0-.425-.288-.713T12 10q-.425 0-.713.288T11 11v3q0 .425.288.713T12 15Z\"\n />\n </svg>\n </button>\n <dialog>\n <form method=\"dialog\">\n <button id=\"close\" type=\"submit\" aria-label=\"Close\">X</button>\n </form>\n <button id=\"loc\"></button>\n <div class=\"content\">\n <h2 id=\"title\"></h2>\n <p id=\"message\"></p>\n <p class=\"action-container\"></p>\n </div>\n </dialog>\n</template>\n<div id=\"qwik-image-warning-container\"></div>\n<script>\n (function () {\n function getPositionClasses(target) {\n const { x, y } = target.getBoundingClientRect();\n const windowWidth = window.innerWidth;\n let horizontal = 'right';\n let vertical = 'bottom';\n if (x > windowWidth - 260) {\n horizontal = 'left';\n }\n return `${vertical} ${horizontal}`;\n }\n class ImageWarning extends HTMLElement {\n #actionFn = null;\n constructor() {\n super();\n this.attachShadow({ mode: 'open' });\n this.shadowRoot.appendChild(\n document.importNode(document.getElementById('qwik-image-warning-template').content, true)\n );\n const dialog = this.shadowRoot.querySelector('dialog');\n\n this.shadowRoot.addEventListener('click', async (ev) => {\n const target = ev.target;\n if (target.nodeName === 'BUTTON') {\n if (target.id === 'action-btn') {\n if (this.#actionFn) {\n this.#actionFn();\n dialog.close();\n }\n } else if (target.id === 'icon') {\n if (dialog.open) {\n dialog.close();\n } else {\n dialog.className = getPositionClasses(target);\n dialog.show();\n }\n } else if (target.id === 'loc' && target.dataset.url) {\n globalThis.qwikOpenInEditor(target.dataset.url);\n }\n }\n });\n }\n\n set loc(value) {\n const anchor = this.shadowRoot.querySelector('#loc');\n anchor.textContent = value;\n if (globalThis.qwikOpenInEditor) {\n anchor.dataset.url = value;\n }\n }\n\n set header(value) {\n this.shadowRoot.querySelector('#title').textContent = value;\n }\n\n set message(value) {\n this.shadowRoot.querySelector('#message').innerHTML = value;\n }\n\n set actionFn(value) {\n this.#actionFn = value;\n }\n set actionName(value) {\n if (value) {\n this.shadowRoot.querySelector('.action-container').innerHTML =\n `<button id=\"action-btn\" type=\"button\">${value}</button>`;\n }\n }\n }\n customElements.define('image-warning', ImageWarning);\n\n const shiftsMap = new Map();\n const visibleNodes = new Map();\n const imageContainer = document.querySelector('#qwik-image-warning-container');\n let skip = false;\n\n async function _getInfo(originalSrc) {\n // Put all supported protocols here, see also packages/qwik/src/optimizer/src/plugins/image-size-server.ts\n if (!/^(https?|file|capacitor):/.test(originalSrc)) {\n return undefined;\n }\n const url = new URL('/__image_info', location.href);\n url.searchParams.set('url', originalSrc);\n const res = await fetch(url);\n if (res.ok) {\n return await res.json();\n } else {\n return null;\n }\n }\n\n const map = new Map();\n function getInfo(originalSrc) {\n let p = map.get(originalSrc);\n if (typeof p === 'undefined') {\n p = _getInfo(originalSrc);\n map.set(originalSrc, p);\n }\n return p;\n }\n function isDefinedUnit(value) {\n return value.endsWith('px');\n }\n async function doImg(node) {\n const scrollX = window.scrollX;\n const scrollY = window.scrollY;\n const rect = node.getBoundingClientRect();\n const originalSrc = node.currentSrc;\n const info = await getInfo(originalSrc);\n let overlay = visibleNodes.get(node);\n const wideScreen = window.innerWidth > 500;\n if (info && wideScreen) {\n let layoutInvalidation = false;\n const loc = node.getAttribute('data-qwik-inspector');\n const browserArea = rect.width * rect.height;\n if (!node.hasAttribute('width') || !node.hasAttribute('height')) {\n skip = true;\n const computedStyles = getComputedStyle(node);\n const hasAspect = computedStyles.getPropertyValue('aspect-ratio').toString() !== 'auto';\n const hasWidth = isDefinedUnit(computedStyles.getPropertyValue('width').toString());\n const hasHeight = isDefinedUnit(computedStyles.getPropertyValue('height').toString());\n const isAbsolute = computedStyles.getPropertyValue('position').toString() === 'absolute';\n layoutInvalidation =\n browserArea > 1000 && !isAbsolute && !hasAspect && (!hasWidth || !hasHeight);\n }\n const realArea = info.width && info.height;\n const threshholdArea = realArea * 0.5;\n const tooBig = browserArea < threshholdArea && info.type !== 'svg';\n skip = false;\n if (layoutInvalidation || tooBig) {\n if (!overlay) {\n overlay = document.createElement('image-warning');\n imageContainer.appendChild(overlay);\n visibleNodes.set(node, overlay);\n }\n overlay.style.top = rect.top + scrollY + 'px';\n overlay.style.left = rect.left + scrollX + 'px';\n overlay.style.width = rect.width + 'px';\n overlay.style.height = rect.height + 'px';\n overlay.info = info;\n overlay.loc = loc;\n if (layoutInvalidation) {\n const clipBoard = `width=\"${info.width}\" height=\"${info.height}\"`;\n overlay.header = 'Perf: layout shift';\n overlay.message = `Image\\'s size is unknown until it\\'s loaded, <a href=\"https://web.dev/cls/\" target=\"_blank\" rel=\"noopener noreferrer\">causing layout shift</a>.</p><p>To solve this problem set the width/height in the img tag:</p><pre><img <span>${clipBoard}</span></pre>`;\n const uniqueLoc =\n document.querySelectorAll('[data-qwik-inspector=\"' + loc + '\"]').length === 1;\n if (loc) {\n if (uniqueLoc) {\n overlay.actionName = 'Auto fix';\n overlay.actionFn = async () => {\n const url = new URL('/__image_fix', location.href);\n url.searchParams.set('loc', loc);\n url.searchParams.set('width', info.width);\n url.searchParams.set('height', info.height);\n if (!node.srcset) {\n url.searchParams.set('src', node.currentSrc);\n url.searchParams.set('currentHref', location.href);\n }\n await fetch(url, {\n method: 'POST',\n });\n };\n } else {\n overlay.actionName = 'Open in editor';\n overlay.actionFn = async () => {\n await navigator.clipboard.writeText(clipBoard);\n globalThis.qwikOpenInEditor(loc);\n };\n }\n }\n } else if (tooBig) {\n overlay.header = 'Perf: properly size image';\n overlay.message = `The image is too big, <a href=\"https://developer.chrome.com/en/docs/lighthouse/performance/uses-responsive-images/\" target=\"_blank\" rel=\"noopener noreferrer\">hurting performance</a>, it should be resized to the size it\\'s displayed at. The image dimensions are ${info.width} x ${info.height} but it\\'s displayed at ${rect.width}x${rect.height}.</p>`;\n }\n return;\n }\n }\n\n if (overlay) {\n overlay.remove();\n visibleNodes.delete(node);\n }\n }\n\n async function updateImg(node) {\n const overlay = visibleNodes.get(node);\n if (!node.isConnected) {\n if (overlay) {\n overlay.remove();\n visibleNodes.delete(node);\n }\n } else if (node.complete) {\n doImg(node);\n }\n }\n\n const resizeObserver = new ResizeObserver((entries) => {\n if (!skip) {\n for (const entry of entries) {\n updateImg(entry.target);\n }\n }\n });\n\n const observer = new MutationObserver((entry) => {\n for (const mutation of entry) {\n for (const node of mutation.addedNodes) {\n if (node.nodeName === 'IMG') {\n resizeObserver.observe(node);\n } else if (node.nodeType === 1) {\n node.querySelectorAll('img').forEach((img) => {\n resizeObserver.observe(img);\n });\n }\n }\n for (const node of mutation.removedNodes) {\n if (node.nodeName === 'IMG') {\n updateImg(node);\n resizeObserver.unobserve(node);\n } else if (node.nodeType === 1) {\n node.querySelectorAll('img').forEach((img) => {\n updateImg(img);\n resizeObserver.unobserve(img);\n });\n }\n }\n }\n });\n let perfObserver;\n let DCLS = 0;\n const activate = () => {\n setTimeout(() => {\n if (perfObserver) {\n perfObserver.disconnect();\n if (DCLS > 0.005) {\n console.error('Detected Layout Shift during page load', DCLS);\n }\n }\n observer.observe(document.body, {\n childList: true,\n subtree: true,\n });\n document.body.querySelectorAll('img').forEach((node) => {\n resizeObserver.observe(node);\n });\n }, 100);\n };\n if (document.readyState === 'complete') {\n activate();\n } else {\n window.addEventListener('load', activate);\n }\n const pageAccessedByReload =\n performance?.navigation.type === 1 ||\n performance\n .getEntriesByType('navigation')\n .map((nav) => nav.type)\n .includes('reload');\n if (typeof PerformanceObserver !== 'undefined' && !pageAccessedByReload) {\n const shiftsMap = new Map();\n perfObserver = new PerformanceObserver((list) => {\n list.getEntries().forEach((entry) => {\n if (entry.hadRecentInput) {\n return; // Ignore shifts after recent input.\n }\n if (entry.value > 0.006) {\n for (const source of entry.sources) {\n if (\n source.node &&\n source.node.nodeType === 1 &&\n source.node.nodeName !== 'IMAGE-WARNING'\n ) {\n source.node.setAttribute('data-qwik-cls', Number(entry.value).toFixed(3));\n }\n }\n }\n DCLS += entry.value;\n });\n });\n perfObserver.observe({ type: 'layout-shift', buffered: true });\n }\n })();\n<\/script>\n";
|
|
3215
3215
|
var perf_warning_default = "<script>\n if (!window.__qwikViteLog) {\n window.__qwikViteLog = true;\n console.debug(\n '%c⭐️ Qwik Dev SSR Mode',\n 'background: #0c75d2; color: white; padding: 2px 3px; border-radius: 2px; font-size: 0.8em;',\n \"App is running in SSR development mode!\\n - Additional JS is loaded by Vite for debugging and live reloading\\n - Rendering performance might not be optimal\\n - Delayed interactivity because prefetching is disabled\\n - Vite dev bundles do not represent production output\\n\\nProduction build can be tested running 'npm run preview'\"\n );\n }\n<\/script>\n";
|
|
@@ -3512,7 +3512,6 @@ globalThis.qwikOptimizer = function(module) {
|
|
|
3512
3512
|
async config(viteConfig, viteEnv) {
|
|
3513
3513
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
|
|
3514
3514
|
await qwikPlugin.init();
|
|
3515
|
-
const sys = qwikPlugin.getSys();
|
|
3516
3515
|
const path = qwikPlugin.getPath();
|
|
3517
3516
|
let target;
|
|
3518
3517
|
target = (null == (_a = viteConfig.build) ? void 0 : _a.ssr) || "ssr" === viteEnv.mode ? "ssr" : "lib" === viteEnv.mode ? "lib" : "test" === viteEnv.mode ? "test" : "client";
|
|
@@ -3532,7 +3531,6 @@ globalThis.qwikOptimizer = function(module) {
|
|
|
3532
3531
|
const clientInput = "client" === target ? null == (_d = qwikViteOpts.client) ? void 0 : _d.input : void 0;
|
|
3533
3532
|
let input = (null == (_f = null == (_e = viteConfig.build) ? void 0 : _e.rollupOptions) ? void 0 : _f.input) || clientInput || ssrInput;
|
|
3534
3533
|
input && "string" === typeof input && (input = [ input ]);
|
|
3535
|
-
const shouldFindVendors = !qwikViteOpts.disableVendorScan && ("lib" !== target || "serve" === viteCommand);
|
|
3536
3534
|
viteAssetsDir = null == (_g = viteConfig.build) ? void 0 : _g.assetsDir;
|
|
3537
3535
|
const useAssetsDir = "client" === target && !!viteAssetsDir && "_astro" !== viteAssetsDir;
|
|
3538
3536
|
const pluginOpts = {
|
|
@@ -3570,8 +3568,6 @@ globalThis.qwikOptimizer = function(module) {
|
|
|
3570
3568
|
clientDevInput = "string" === typeof (null == (_q = qwikViteOpts.client) ? void 0 : _q.devInput) ? path.resolve(opts.rootDir, qwikViteOpts.client.devInput) : opts.srcDir ? path.resolve(opts.srcDir, CLIENT_DEV_INPUT) : path.resolve(opts.rootDir, "src", CLIENT_DEV_INPUT);
|
|
3571
3569
|
clientDevInput = qwikPlugin.normalizePath(clientDevInput);
|
|
3572
3570
|
}
|
|
3573
|
-
const vendorRoots = shouldFindVendors ? await findQwikRoots(sys, sys.cwd()) : [];
|
|
3574
|
-
const vendorIds = vendorRoots.map(v => v.id);
|
|
3575
3571
|
const isDevelopment = "development" === buildMode;
|
|
3576
3572
|
const qDevKey = "globalThis.qDev";
|
|
3577
3573
|
const qTestKey = "globalThis.qTest";
|
|
@@ -3582,11 +3578,11 @@ globalThis.qwikOptimizer = function(module) {
|
|
|
3582
3578
|
const qSerialize = (null == (_t = null == viteConfig ? void 0 : viteConfig.define) ? void 0 : _t[qSerializeKey]) ?? isDevelopment;
|
|
3583
3579
|
const updatedViteConfig = {
|
|
3584
3580
|
ssr: {
|
|
3585
|
-
noExternal: [ QWIK_CORE_ID, QWIK_CORE_INTERNAL_ID, QWIK_CORE_SERVER, QWIK_BUILD_ID
|
|
3581
|
+
noExternal: [ QWIK_CORE_ID, QWIK_CORE_INTERNAL_ID, QWIK_CORE_SERVER, QWIK_BUILD_ID ]
|
|
3586
3582
|
},
|
|
3587
3583
|
envPrefix: [ "VITE_", "PUBLIC_" ],
|
|
3588
3584
|
resolve: {
|
|
3589
|
-
dedupe: [ ...DEDUPE
|
|
3585
|
+
dedupe: [ ...DEDUPE ],
|
|
3590
3586
|
conditions: "production" === buildMode && "client" === target ? [ "min" ] : [],
|
|
3591
3587
|
alias: {
|
|
3592
3588
|
"@builder.io/qwik": "@qwik.dev/core",
|
|
@@ -3597,6 +3593,7 @@ globalThis.qwikOptimizer = function(module) {
|
|
|
3597
3593
|
"@builder.io/qwik/jsx-dev-runtime": "@qwik.dev/core/jsx-dev-runtime",
|
|
3598
3594
|
"@builder.io/qwik/optimizer": "@qwik.dev/core/optimizer",
|
|
3599
3595
|
"@builder.io/qwik/loader": "@qwik.dev/core/loader",
|
|
3596
|
+
"@builder.io/qwik/backpatch": "@qwik.dev/core/backpatch",
|
|
3600
3597
|
"@builder.io/qwik/cli": "@qwik.dev/core/cli",
|
|
3601
3598
|
"@builder.io/qwik/testing": "@qwik.dev/core/testing"
|
|
3602
3599
|
}
|
|
@@ -3606,7 +3603,7 @@ globalThis.qwikOptimizer = function(module) {
|
|
|
3606
3603
|
jsx: "automatic"
|
|
3607
3604
|
},
|
|
3608
3605
|
optimizeDeps: {
|
|
3609
|
-
exclude: [ QWIK_CORE_ID, QWIK_CORE_INTERNAL_ID, QWIK_CORE_SERVER, QWIK_JSX_RUNTIME_ID, QWIK_JSX_DEV_RUNTIME_ID, QWIK_BUILD_ID, QWIK_CLIENT_MANIFEST_ID,
|
|
3606
|
+
exclude: [ QWIK_CORE_ID, QWIK_CORE_INTERNAL_ID, QWIK_CORE_SERVER, QWIK_JSX_RUNTIME_ID, QWIK_JSX_DEV_RUNTIME_ID, QWIK_BUILD_ID, QWIK_CLIENT_MANIFEST_ID, "@builder.io/qwik", "@builder.io/qwik-city" ]
|
|
3610
3607
|
},
|
|
3611
3608
|
build: {
|
|
3612
3609
|
modulePreload: false,
|
|
@@ -3850,7 +3847,75 @@ globalThis.qwikOptimizer = function(module) {
|
|
|
3850
3847
|
}
|
|
3851
3848
|
}
|
|
3852
3849
|
};
|
|
3853
|
-
return [ vitePluginPre, vitePluginPost ];
|
|
3850
|
+
return [ vitePluginPre, vitePluginPost, checkExternals() ];
|
|
3851
|
+
}
|
|
3852
|
+
async function checkExternals() {
|
|
3853
|
+
let fs;
|
|
3854
|
+
let path;
|
|
3855
|
+
try {
|
|
3856
|
+
fs = await import("node:fs").then(m => m.promises);
|
|
3857
|
+
path = await import("node:path");
|
|
3858
|
+
} catch {
|
|
3859
|
+
return;
|
|
3860
|
+
}
|
|
3861
|
+
const seen = new Set;
|
|
3862
|
+
let rootDir;
|
|
3863
|
+
const core2 = "@qwik-dev/core";
|
|
3864
|
+
const core1 = "@builder.io/qwik";
|
|
3865
|
+
async function isQwikDep(dep, dir) {
|
|
3866
|
+
var _a, _b, _c, _d;
|
|
3867
|
+
while (dir) {
|
|
3868
|
+
const pkg = path.join(dir, "node_modules", dep, "package.json");
|
|
3869
|
+
try {
|
|
3870
|
+
await fs.access(pkg);
|
|
3871
|
+
const data = await fs.readFile(pkg, {
|
|
3872
|
+
encoding: "utf-8"
|
|
3873
|
+
});
|
|
3874
|
+
const json = JSON.parse(data);
|
|
3875
|
+
if (json.qwik || (null == (_a = json.dependencies) ? void 0 : _a[core2]) || (null == (_b = json.peerDependencies) ? void 0 : _b[core2]) || (null == (_c = json.dependencies) ? void 0 : _c[core1]) || (null == (_d = json.peerDependencies) ? void 0 : _d[core1])) {
|
|
3876
|
+
return true;
|
|
3877
|
+
}
|
|
3878
|
+
return false;
|
|
3879
|
+
} catch {}
|
|
3880
|
+
const nextRoot = path.dirname(dir);
|
|
3881
|
+
if (nextRoot === dir) {
|
|
3882
|
+
break;
|
|
3883
|
+
}
|
|
3884
|
+
dir = nextRoot;
|
|
3885
|
+
}
|
|
3886
|
+
return false;
|
|
3887
|
+
}
|
|
3888
|
+
return {
|
|
3889
|
+
name: "checkQwikExternals",
|
|
3890
|
+
enforce: "pre",
|
|
3891
|
+
configResolved: config => {
|
|
3892
|
+
rootDir = config.root;
|
|
3893
|
+
},
|
|
3894
|
+
resolveId: {
|
|
3895
|
+
order: "pre",
|
|
3896
|
+
async handler(source, importer, options) {
|
|
3897
|
+
if (!options.ssr || /^([./]|node:|[^a-z])/.test(source) || seen.has(source)) {
|
|
3898
|
+
return;
|
|
3899
|
+
}
|
|
3900
|
+
const packageName = (source.startsWith("@") ? source.split("/").slice(0, 2).join("/") : source.split("/")[0]).split("?")[0];
|
|
3901
|
+
if (seen.has(packageName)) {
|
|
3902
|
+
return;
|
|
3903
|
+
}
|
|
3904
|
+
seen.add(source);
|
|
3905
|
+
seen.add(packageName);
|
|
3906
|
+
const result = await this.resolve(packageName, importer, {
|
|
3907
|
+
...options,
|
|
3908
|
+
skipSelf: true
|
|
3909
|
+
});
|
|
3910
|
+
if ((null == result ? void 0 : result.external) && await isQwikDep(packageName, importer ? path.dirname(importer) : rootDir)) {
|
|
3911
|
+
throw new Error(`\n==============\n${packageName} is being treated as an external dependency, but it should be included in the server bundle, because it uses Qwik.\nPlease add the package to "ssr.noExternal" in the Vite config. \n==============`);
|
|
3912
|
+
}
|
|
3913
|
+
if (packageName === source) {
|
|
3914
|
+
return result;
|
|
3915
|
+
}
|
|
3916
|
+
}
|
|
3917
|
+
}
|
|
3918
|
+
};
|
|
3854
3919
|
}
|
|
3855
3920
|
var ANSI_COLOR = {
|
|
3856
3921
|
Black: "[30m",
|
|
@@ -3884,69 +3949,6 @@ globalThis.qwikOptimizer = function(module) {
|
|
|
3884
3949
|
const qwikLoader = JSON.stringify(opts.debug ? QWIK_LOADER_DEFAULT_DEBUG : QWIK_LOADER_DEFAULT_MINIFIED);
|
|
3885
3950
|
return `// Qwik Vite Dev Module\nimport { render as qwikRender } from '@qwik.dev/core';\n\nexport async function render(document, rootNode, opts) {\n\n await qwikRender(document, rootNode, opts);\n\n let qwikLoader = document.getElementById('qwikloader');\n if (!qwikLoader) {\n qwikLoader = document.createElement('script');\n qwikLoader.id = 'qwikloader';\n qwikLoader.innerHTML = ${qwikLoader};\n const parent = document.head ?? document.body ?? document.documentElement;\n parent.appendChild(qwikLoader);\n }\n\n if (!window.__qwikViteLog) {\n window.__qwikViteLog = true;\n console.debug("%c⭐️ Qwik Client Mode","background: #0c75d2; color: white; padding: 2px 3px; border-radius: 2px; font-size: 0.8em;","Do not use this mode in production!\\n - No portion of the application is pre-rendered on the server\\n - All of the application is running eagerly in the browser\\n - Optimizer/Serialization/Deserialization code is not exercised!");\n }\n}`;
|
|
3886
3951
|
}
|
|
3887
|
-
async function findDepPkgJsonPath(sys, dep, parent) {
|
|
3888
|
-
const fs = await sys.dynamicImport("node:fs");
|
|
3889
|
-
let root = parent;
|
|
3890
|
-
while (root) {
|
|
3891
|
-
const pkg = sys.path.join(root, "node_modules", dep, "package.json");
|
|
3892
|
-
try {
|
|
3893
|
-
await fs.promises.access(pkg);
|
|
3894
|
-
return fs.promises.realpath(pkg);
|
|
3895
|
-
} catch {}
|
|
3896
|
-
const nextRoot = sys.path.dirname(root);
|
|
3897
|
-
if (nextRoot === root) {
|
|
3898
|
-
break;
|
|
3899
|
-
}
|
|
3900
|
-
root = nextRoot;
|
|
3901
|
-
}
|
|
3902
|
-
return;
|
|
3903
|
-
}
|
|
3904
|
-
var findQwikRoots = async (sys, packageJsonDir) => {
|
|
3905
|
-
const paths = new Map;
|
|
3906
|
-
if ("node" === sys.env || "bun" === sys.env) {
|
|
3907
|
-
const fs = await sys.dynamicImport("node:fs");
|
|
3908
|
-
let prevPackageJsonDir;
|
|
3909
|
-
do {
|
|
3910
|
-
try {
|
|
3911
|
-
const data = await fs.promises.readFile(sys.path.join(packageJsonDir, "package.json"), {
|
|
3912
|
-
encoding: "utf-8"
|
|
3913
|
-
});
|
|
3914
|
-
try {
|
|
3915
|
-
const packageJson = JSON.parse(data);
|
|
3916
|
-
const dependencies = packageJson.dependencies;
|
|
3917
|
-
const devDependencies = packageJson.devDependencies;
|
|
3918
|
-
const packages = [];
|
|
3919
|
-
"object" === typeof dependencies && packages.push(...Object.keys(dependencies));
|
|
3920
|
-
"object" === typeof devDependencies && packages.push(...Object.keys(devDependencies));
|
|
3921
|
-
const basedir = sys.cwd();
|
|
3922
|
-
await Promise.all(packages.map(async id => {
|
|
3923
|
-
const pkgJsonPath = await findDepPkgJsonPath(sys, id, basedir);
|
|
3924
|
-
if (pkgJsonPath) {
|
|
3925
|
-
const pkgJsonContent = await fs.promises.readFile(pkgJsonPath, "utf-8");
|
|
3926
|
-
const pkgJson = JSON.parse(pkgJsonContent);
|
|
3927
|
-
const qwikPath = pkgJson.qwik;
|
|
3928
|
-
if (!qwikPath) {
|
|
3929
|
-
return;
|
|
3930
|
-
}
|
|
3931
|
-
const allPaths = Array.isArray(qwikPath) ? qwikPath : [ qwikPath ];
|
|
3932
|
-
for (const p of allPaths) {
|
|
3933
|
-
paths.set(await fs.promises.realpath(sys.path.resolve(sys.path.dirname(pkgJsonPath), p)), id);
|
|
3934
|
-
}
|
|
3935
|
-
}
|
|
3936
|
-
}));
|
|
3937
|
-
} catch (e) {
|
|
3938
|
-
console.error(e);
|
|
3939
|
-
}
|
|
3940
|
-
} catch {}
|
|
3941
|
-
prevPackageJsonDir = packageJsonDir;
|
|
3942
|
-
packageJsonDir = sys.path.dirname(packageJsonDir);
|
|
3943
|
-
} while (packageJsonDir !== prevPackageJsonDir);
|
|
3944
|
-
}
|
|
3945
|
-
return Array.from(paths).map(([path, id]) => ({
|
|
3946
|
-
path: path,
|
|
3947
|
-
id: id
|
|
3948
|
-
}));
|
|
3949
|
-
};
|
|
3950
3952
|
var VITE_CLIENT_MODULE = "@qwik.dev/core/vite-client";
|
|
3951
3953
|
var CLIENT_DEV_INPUT = "entry.dev";
|
|
3952
3954
|
var symbolMapper = void 0;
|