@qwikdev/astro
Advanced tools
Comparing version 0.7.8 to 0.7.9
{ | ||
"name": "@qwikdev/astro", | ||
"description": "Use Qwik components and Resumability within Astro", | ||
"version": "0.7.8", | ||
"version": "0.7.9", | ||
"contributors": [ | ||
@@ -6,0 +6,0 @@ { |
@@ -18,2 +18,12 @@ import { type JSXNode, jsx } from "@builder.io/qwik"; | ||
/** | ||
* Because inline components are very much like normal functions, it's hard to distinguish them from normal functions. | ||
* | ||
* We currently identify them through the jsx transform function call. | ||
* | ||
* In Qwik v1, the identifiers are _jsxQ - _jsxC - _jsxS | ||
* | ||
* In Qwik v2, it is jsxsplit and I believe jsxSorted | ||
* | ||
*/ | ||
function isInlineComponent(component: unknown): boolean { | ||
@@ -24,4 +34,5 @@ if (typeof component !== "function") { | ||
const codeStr = component?.toString().toLowerCase(); | ||
const qwikJsxIdentifiers = ["_jsxq", "_jsxc", "_jsxs", "jsxsplit"]; | ||
return ( | ||
(codeStr.includes("_jsxq") || codeStr.includes("jsxsplit")) && | ||
qwikJsxIdentifiers.some((id) => codeStr.includes(id)) && | ||
component.name !== "QwikComponent" | ||
@@ -176,6 +187,5 @@ ); | ||
isClientRouter && | ||
isQwikLoaderNeeded && | ||
htmlWithRerun + | ||
` | ||
<script data-qwik-astro-client-router>document.addEventListener('astro:after-swap',()=>{const e=document.querySelectorAll('[on\\\\:qvisible]');if(e.length){const o=new IntersectionObserver(e=>{e.forEach(e=>{e.isIntersecting&&(e.target.dispatchEvent(new CustomEvent('qvisible')),o.unobserve(e.target))})});e.forEach(e=>o.observe(e))}});</script> | ||
${isQwikLoaderNeeded ? `<script data-qwik-astro-client-router>document.addEventListener('astro:after-swap',()=>{const e=document.querySelectorAll('[on\\\\:qvisible]');if(e.length){const o=new IntersectionObserver(e=>{e.forEach(e=>{e.isIntersecting&&(e.target.dispatchEvent(new CustomEvent('qvisible')),o.unobserve(e.target))})});e.forEach(e=>o.observe(e))}});</script>` : ""} | ||
`; | ||
@@ -182,0 +192,0 @@ |
37132
495