@qwik.dev/core 2.0.0-beta.29 → 2.0.0-beta.30

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.
@@ -1,3 +1,3 @@
1
- const QWIK_LOADER = "const e=document,t=window,o=\"w\",r=\"d\",n=new Set,s=new Set([e]),i=new Map;let a,c;const l=(e,t)=>Array.from(e.querySelectorAll(t)),q=e=>{const t=[];return s.forEach(o=>t.push(...l(o,e))),t},d=(e,t,o,r=!1)=>e.addEventListener(t,o,{capture:r,passive:!1}),b=e=>{_(e),l(e,\"[q\\\\:shadowroot]\").forEach(e=>{const t=e.shadowRoot;t&&b(t)})},f=e=>e&&\"function\"==typeof e.then,p=t=>{if(void 0===t._qwikjson_){let o=(t===e.documentElement?e.body:t).lastElementChild;for(;o;){if(\"SCRIPT\"===o.tagName&&\"qwik/json\"===o.getAttribute(\"type\")){t._qwikjson_=JSON.parse(o.textContent.replace(/\\\\x3C(\\/?script)/gi,\"<$1\"));break}o=o.previousElementSibling}}},u=(e,t)=>new CustomEvent(e,{detail:t}),h=(t,o)=>{e.dispatchEvent(u(t,o))},m=e=>e.replace(/([A-Z-])/g,e=>\"-\"+e.toLowerCase()),v=e=>e.replace(/-./g,e=>e[1].toUpperCase()),w=e=>({scope:e.charAt(0),eventName:v(e.slice(2))}),y=async(t,o,r,n)=>{n&&(t.hasAttribute(\"preventdefault:\"+n)&&o.preventDefault(),t.hasAttribute(\"stoppropagation:\"+n)&&o.stopPropagation());const s=t._qDispatch?.[r];if(s){if(s.length)for(const e of s){const r=e?.(o,t);f(r)&&await r}return}const a=t.getAttribute(\"q-\"+r);if(a){const r=t.closest(\"[q\\\\:container]:not([q\\\\:container=html]):not([q\\\\:container=text])\"),n=r.getAttribute(\"q:base\"),s=new URL(n,e.baseURI);for(const c of a.split(\"|\")){const a=performance.now(),[l,q,d]=c.split(\"#\"),b={qBase:n,symbol:q,element:t,reqTime:a};let u,m,v;if(\"\"===l){const t=r.getAttribute(\"q:instance\");u=(e[\"qFuncs_\"+t]||[])[Number.parseInt(q)],u||(m=\"sync\",v=Error(\"sym:\"+q))}else{const e=`${q}|${n}|${l}`;if(u=i.get(e),!u){const t=new URL(l,s).href;try{const o=import(t);p(r),u=(await o)[q],u?(i.set(e,u),h(\"qsymbol\",b)):(m=\"no-symbol\",v=Error(`${q} not in ${t}`))}catch(e){m=\"async\",v=e}}}if(u){if(t.isConnected)try{const e=u.call(d,o,t);f(e)&&await e}catch(e){h(\"qerror\",{error:e,...b})}}else h(\"qerror\",{importError:m,error:v,...b}),console.error(v)}}},E=async e=>{const t=m(e.type),o=\"e:\"+t;let r=e.target;for(;r&&r.getAttribute;){const n=y(r,e,o,t),s=e.bubbles&&!e.cancelBubble;f(n)&&await n,r=s&&e.bubbles&&!e.cancelBubble?r.parentElement:null}},g=(e,t)=>{const o=m(t.type),r=e+\":\"+o;q(\"[q-\"+e+\"\\\\:\"+o+\"]\").forEach(e=>y(e,t,r,o))},A=async e=>{g(r,e)},C=e=>{g(o,e)},k=()=>{const o=e.readyState;if(\"interactive\"==o||\"complete\"==o){if(c=1,s.forEach(b),n.has(\"d:qinit\")){n.delete(\"d:qinit\");const e=u(\"qinit\");q(\"[q-d\\\\:qinit]\").forEach(t=>{y(t,e,\"d:qinit\"),t.removeAttribute(\"q-d:qinit\")})}n.has(\"d:qidle\")&&(n.delete(\"d:qidle\"),(t.requestIdleCallback??t.setTimeout).bind(t)(()=>{const e=u(\"qidle\");q(\"[q-d\\\\:qidle]\").forEach(t=>{y(t,e,\"d:qidle\"),t.removeAttribute(\"q-d:qidle\")})})),n.has(\"e:qvisible\")&&(a||(a=new IntersectionObserver(e=>{for(const t of e)t.isIntersecting&&(a.unobserve(t.target),y(t.target,u(\"qvisible\",t),\"e:qvisible\"))})),q(\"[q-e\\\\:qvisible]:not([q\\\\:observed])\").forEach(e=>{a.observe(e),e.setAttribute(\"q:observed\",\"true\")}))}},_=(...e)=>{for(const i of e)if(\"string\"==typeof i){if(!n.has(i)){n.add(i);const{scope:e,eventName:a}=w(i);e===o?d(t,a,C,!0):s.forEach(t=>d(t,a,e===r?A:E,!0)),1!==c||\"e:qvisible\"!==i&&\"d:qinit\"!==i&&\"d:qidle\"!==i||k()}}else s.has(i)||(n.forEach(e=>{const{scope:t,eventName:n}=w(e);t!==o&&d(i,n,t===r?A:E,!0)}),s.add(i))},S=t._qwikEv;S?.roots||(Array.isArray(S)?_(...S):_(\"e:click\",\"e:input\"),t._qwikEv={events:n,roots:s,push:_},d(e,\"readystatechange\",k),k())";
2
- const QWIK_LOADER_DEBUG = "const doc = document;\nconst win = window;\nconst windowPrefix = \"w\";\nconst documentPrefix = \"d\";\nconst events = /* @__PURE__ */ new Set();\nconst roots = /* @__PURE__ */ new Set([doc]);\nconst symbols = /* @__PURE__ */ new Map();\nlet observer;\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 addEventListener = (el, eventName, handler, capture = false) => el.addEventListener(eventName, handler, { capture, passive: false });\nconst findShadowRoots = (fragment) => {\n addEventOrRoot(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 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, { detail });\nconst emitEvent = (eventName, detail) => {\n doc.dispatchEvent(createEvent(eventName, detail));\n};\nconst camelToKebab = (str) => str.replace(/([A-Z-])/g, (a) => \"-\" + a.toLowerCase());\nconst kebabToCamel = (eventName) => eventName.replace(/-./g, (a) => a[1].toUpperCase());\nconst parseKebabEvent = (event) => ({\n scope: event.charAt(0),\n eventName: kebabToCamel(event.slice(2))\n});\nconst dispatch = async (element, ev, scopedKebabName, kebabName) => {\n if (kebabName) {\n if (element.hasAttribute(\"preventdefault:\" + kebabName)) {\n ev.preventDefault();\n }\n if (element.hasAttribute(\"stoppropagation:\" + kebabName)) {\n ev.stopPropagation();\n }\n }\n const handlers = element._qDispatch?.[scopedKebabName];\n if (handlers) {\n if (handlers.length) {\n for (const handler of handlers) {\n const result = handler?.(ev, element);\n if (isPromise(result)) {\n await result;\n }\n }\n }\n return;\n }\n const attrValue = element.getAttribute(\"q-\" + scopedKebabName);\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 base = new URL(qBase, doc.baseURI);\n for (const qrl of attrValue.split(\"|\")) {\n const reqTime = performance.now();\n const [chunk, symbol, capturedIds] = qrl.split(\"#\");\n const eventData = {\n qBase,\n symbol,\n element,\n reqTime\n };\n let handler;\n let importError;\n let error;\n if (chunk === \"\") {\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 const key = `${symbol}|${qBase}|${chunk}`;\n handler = symbols.get(key);\n if (!handler) {\n const href = new URL(chunk, base).href;\n try {\n const module = import(\n href\n );\n resolveContainer(container);\n handler = (await module)[symbol];\n if (!handler) {\n importError = \"no-symbol\";\n error = new Error(`${symbol} not in ${href}`);\n } else {\n symbols.set(key, handler);\n emitEvent(\"qsymbol\", eventData);\n }\n } catch (err) {\n importError = \"async\";\n error = err;\n }\n }\n }\n if (!handler) {\n emitEvent(\"qerror\", {\n importError,\n error,\n ...eventData\n });\n console.error(error);\n continue;\n }\n if (element.isConnected) {\n try {\n const result = handler.call(capturedIds, ev, element);\n if (isPromise(result)) {\n await result;\n }\n } catch (error2) {\n emitEvent(\"qerror\", { error: error2, ...eventData });\n }\n }\n }\n }\n};\nconst processElementEvent = async (ev) => {\n const kebabName = camelToKebab(ev.type);\n const scopedKebabName = \"e:\" + kebabName;\n let element = ev.target;\n while (element && element.getAttribute) {\n const results = dispatch(element, ev, scopedKebabName, kebabName);\n const doBubble = ev.bubbles && !ev.cancelBubble;\n if (isPromise(results)) {\n await results;\n }\n element = doBubble && ev.bubbles && !ev.cancelBubble ? element.parentElement : null;\n }\n};\nconst broadcast = (infix, ev) => {\n const kebabName = camelToKebab(ev.type);\n const scopedKebabName = infix + \":\" + kebabName;\n querySelectorAll(\"[q-\" + infix + \"\\\\:\" + kebabName + \"]\").forEach(\n (el) => dispatch(el, ev, scopedKebabName, kebabName)\n );\n};\nconst processDocumentEvent = async (ev) => {\n broadcast(documentPrefix, ev);\n};\nconst processWindowEvent = (ev) => {\n broadcast(windowPrefix, ev);\n};\nconst processReadyStateChange = () => {\n const readyState = doc.readyState;\n if (readyState == \"interactive\" || readyState == \"complete\") {\n hasInitialized = 1;\n roots.forEach(findShadowRoots);\n if (events.has(\"d:qinit\")) {\n events.delete(\"d:qinit\");\n const ev = createEvent(\"qinit\");\n querySelectorAll(\"[q-d\\\\:qinit]\").forEach((el) => {\n dispatch(el, ev, \"d:qinit\");\n el.removeAttribute(\"q-d:qinit\");\n });\n }\n if (events.has(\"d:qidle\")) {\n events.delete(\"d:qidle\");\n const riC = win.requestIdleCallback ?? win.setTimeout;\n riC.bind(win)(() => {\n const ev = createEvent(\"qidle\");\n querySelectorAll(\"[q-d\\\\:qidle]\").forEach((el) => {\n dispatch(el, ev, \"d:qidle\");\n el.removeAttribute(\"q-d:qidle\");\n });\n });\n }\n if (events.has(\"e:qvisible\")) {\n observer || (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), \"e:qvisible\");\n }\n }\n }));\n querySelectorAll(\"[q-e\\\\:qvisible]:not([q\\\\:observed])\").forEach((el) => {\n observer.observe(el);\n el.setAttribute(\"q:observed\", \"true\");\n });\n }\n }\n};\nconst addEventOrRoot = (...eventNames) => {\n for (const eventNameOrRoot of eventNames) {\n if (typeof eventNameOrRoot === \"string\") {\n if (!events.has(eventNameOrRoot)) {\n events.add(eventNameOrRoot);\n const { scope, eventName } = parseKebabEvent(eventNameOrRoot);\n if (scope === windowPrefix) {\n addEventListener(win, eventName, processWindowEvent, true);\n } else {\n roots.forEach(\n (root) => addEventListener(\n root,\n eventName,\n scope === documentPrefix ? processDocumentEvent : processElementEvent,\n true\n )\n );\n }\n if (hasInitialized === 1 && (eventNameOrRoot === \"e:qvisible\" || eventNameOrRoot === \"d:qinit\" || eventNameOrRoot === \"d:qidle\")) {\n processReadyStateChange();\n }\n }\n } else {\n if (!roots.has(eventNameOrRoot)) {\n events.forEach((kebabEventName) => {\n const { scope, eventName } = parseKebabEvent(kebabEventName);\n if (scope !== windowPrefix) {\n addEventListener(\n eventNameOrRoot,\n eventName,\n scope === documentPrefix ? processDocumentEvent : processElementEvent,\n true\n );\n }\n });\n roots.add(eventNameOrRoot);\n }\n }\n }\n};\nconst _qwikEv = win._qwikEv;\nif (!_qwikEv?.roots) {\n if (Array.isArray(_qwikEv)) {\n addEventOrRoot(..._qwikEv);\n } else {\n addEventOrRoot(\"e:click\", \"e:input\");\n }\n win._qwikEv = {\n events,\n roots,\n push: addEventOrRoot\n };\n addEventListener(doc, \"readystatechange\", processReadyStateChange);\n processReadyStateChange();\n}";
1
+ const QWIK_LOADER = "const e=document,t=window,o=\"w\",n=\"d\",r=new Set,s=new Set([e]),i=new Map;let a,c;const l=(e,t)=>Array.from(e.querySelectorAll(t)),q=e=>{const t=[];return s.forEach(o=>t.push(...l(o,e))),t},d=(e,t,o,n=!1)=>e.addEventListener(t,o,{capture:n,passive:!1}),b=e=>{_(e),l(e,\"[q\\\\:shadowroot]\").forEach(e=>{const t=e.shadowRoot;t&&b(t)})},f=e=>e&&\"function\"==typeof e.then,p=t=>{if(void 0===t._qwikjson_){let o=(t===e.documentElement?e.body:t).lastElementChild;for(;o;){if(\"SCRIPT\"===o.tagName&&\"qwik/json\"===o.getAttribute(\"type\")){t._qwikjson_=JSON.parse(o.textContent.replace(/\\\\x3C(\\/?script)/gi,\"<$1\"));break}o=o.previousElementSibling}}},u=(e,t)=>new CustomEvent(e,{detail:t}),h=(t,o)=>{e.dispatchEvent(u(t,o))},m=e=>e.replace(/([A-Z-])/g,e=>\"-\"+e.toLowerCase()),v=e=>e.replace(/-./g,e=>e[1].toUpperCase()),w=e=>({scope:e.charAt(0),eventName:v(e.slice(2))}),y=async(t,o,n,r)=>{r&&(t.hasAttribute(\"preventdefault:\"+r)&&o.preventDefault(),t.hasAttribute(\"stoppropagation:\"+r)&&o.stopPropagation());const s=t._qDispatch?.[n];if(s){if(\"function\"==typeof s){const e=s(o,t);f(e)&&await e}else if(s.length)for(let e=0;e<s.length;e++){const n=s[e],r=n?.(o,t);f(r)&&await r}return}const a=t.getAttribute(\"q-\"+n);if(a){const n=t.closest(\"[q\\\\:container]:not([q\\\\:container=html]):not([q\\\\:container=text])\"),r=n.getAttribute(\"q:base\"),s=new URL(r,e.baseURI);for(const c of a.split(\"|\")){const a=performance.now(),[l,q,d]=c.split(\"#\"),b={qBase:r,symbol:q,element:t,reqTime:a};let u,m,v;if(\"\"===l){const t=n.getAttribute(\"q:instance\");u=(e[\"qFuncs_\"+t]||[])[Number.parseInt(q)],u||(m=\"sync\",v=Error(\"sym:\"+q))}else{const e=`${q}|${r}|${l}`;if(u=i.get(e),!u){const t=new URL(l,s).href;try{const o=import(t);p(n),u=(await o)[q],u?(i.set(e,u),h(\"qsymbol\",b)):(m=\"no-symbol\",v=Error(`${q} not in ${t}`))}catch(e){m=\"async\",v=e}}}if(u){if(t.isConnected)try{const e=u.call(d,o,t);f(e)&&await e}catch(e){h(\"qerror\",{error:e,...b})}}else h(\"qerror\",{importError:m,error:v,...b}),console.error(v)}}},g=async e=>{const t=m(e.type),o=\"e:\"+t;let n=e.target;for(;n&&n.getAttribute;){const r=y(n,e,o,t),s=e.bubbles&&!e.cancelBubble;f(r)&&await r,n=s&&e.bubbles&&!e.cancelBubble?n.parentElement:null}},E=(e,t)=>{const o=m(t.type),n=e+\":\"+o;q(\"[q-\"+e+\"\\\\:\"+o+\"]\").forEach(e=>y(e,t,n,o))},A=async e=>{E(n,e)},C=e=>{E(o,e)},k=()=>{const o=e.readyState;if(\"interactive\"==o||\"complete\"==o){if(c=1,s.forEach(b),r.has(\"d:qinit\")){r.delete(\"d:qinit\");const e=u(\"qinit\");q(\"[q-d\\\\:qinit]\").forEach(t=>{y(t,e,\"d:qinit\"),t.removeAttribute(\"q-d:qinit\")})}r.has(\"d:qidle\")&&(r.delete(\"d:qidle\"),(t.requestIdleCallback??t.setTimeout).bind(t)(()=>{const e=u(\"qidle\");q(\"[q-d\\\\:qidle]\").forEach(t=>{y(t,e,\"d:qidle\"),t.removeAttribute(\"q-d:qidle\")})})),r.has(\"e:qvisible\")&&(a||(a=new IntersectionObserver(e=>{for(const t of e)t.isIntersecting&&(a.unobserve(t.target),y(t.target,u(\"qvisible\",t),\"e:qvisible\"))})),q(\"[q-e\\\\:qvisible]:not([q\\\\:observed])\").forEach(e=>{a.observe(e),e.setAttribute(\"q:observed\",\"true\")}))}},_=(...e)=>{for(let i=0;i<e.length;i++){const a=e[i];if(\"string\"==typeof a){if(!r.has(a)){r.add(a);const{scope:e,eventName:i}=w(a);e===o?d(t,i,C,!0):s.forEach(t=>d(t,i,e===n?A:g,!0)),1!==c||\"e:qvisible\"!==a&&\"d:qinit\"!==a&&\"d:qidle\"!==a||k()}}else s.has(a)||(r.forEach(e=>{const{scope:t,eventName:r}=w(e);t!==o&&d(a,r,t===n?A:g,!0)}),s.add(a))}},S=t._qwikEv;S?.roots||(Array.isArray(S)?_(...S):_(\"e:click\",\"e:input\"),t._qwikEv={events:r,roots:s,push:_},d(e,\"readystatechange\",k),k())";
2
+ const QWIK_LOADER_DEBUG = "const doc = document;\nconst win = window;\nconst windowPrefix = \"w\";\nconst documentPrefix = \"d\";\nconst events = /* @__PURE__ */ new Set();\nconst roots = /* @__PURE__ */ new Set([doc]);\nconst symbols = /* @__PURE__ */ new Map();\nlet observer;\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 addEventListener = (el, eventName, handler, capture = false) => el.addEventListener(eventName, handler, { capture, passive: false });\nconst findShadowRoots = (fragment) => {\n addEventOrRoot(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 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, { detail });\nconst emitEvent = (eventName, detail) => {\n doc.dispatchEvent(createEvent(eventName, detail));\n};\nconst camelToKebab = (str) => str.replace(/([A-Z-])/g, (a) => \"-\" + a.toLowerCase());\nconst kebabToCamel = (eventName) => eventName.replace(/-./g, (a) => a[1].toUpperCase());\nconst parseKebabEvent = (event) => ({\n scope: event.charAt(0),\n eventName: kebabToCamel(event.slice(2))\n});\nconst dispatch = async (element, ev, scopedKebabName, kebabName) => {\n if (kebabName) {\n if (element.hasAttribute(\"preventdefault:\" + kebabName)) {\n ev.preventDefault();\n }\n if (element.hasAttribute(\"stoppropagation:\" + kebabName)) {\n ev.stopPropagation();\n }\n }\n const handlers = element._qDispatch?.[scopedKebabName];\n if (handlers) {\n if (typeof handlers === \"function\") {\n const result = handlers(ev, element);\n if (isPromise(result)) {\n await result;\n }\n } else if (handlers.length) {\n for (let i = 0; i < handlers.length; i++) {\n const handler = handlers[i];\n const result = handler?.(ev, element);\n if (isPromise(result)) {\n await result;\n }\n }\n }\n return;\n }\n const attrValue = element.getAttribute(\"q-\" + scopedKebabName);\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 base = new URL(qBase, doc.baseURI);\n for (const qrl of attrValue.split(\"|\")) {\n const reqTime = performance.now();\n const [chunk, symbol, capturedIds] = qrl.split(\"#\");\n const eventData = {\n qBase,\n symbol,\n element,\n reqTime\n };\n let handler;\n let importError;\n let error;\n if (chunk === \"\") {\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 const key = `${symbol}|${qBase}|${chunk}`;\n handler = symbols.get(key);\n if (!handler) {\n const href = new URL(chunk, base).href;\n try {\n const module = import(\n href\n );\n resolveContainer(container);\n handler = (await module)[symbol];\n if (!handler) {\n importError = \"no-symbol\";\n error = new Error(`${symbol} not in ${href}`);\n } else {\n symbols.set(key, handler);\n emitEvent(\"qsymbol\", eventData);\n }\n } catch (err) {\n importError = \"async\";\n error = err;\n }\n }\n }\n if (!handler) {\n emitEvent(\"qerror\", {\n importError,\n error,\n ...eventData\n });\n console.error(error);\n continue;\n }\n if (element.isConnected) {\n try {\n const result = handler.call(capturedIds, ev, element);\n if (isPromise(result)) {\n await result;\n }\n } catch (error2) {\n emitEvent(\"qerror\", { error: error2, ...eventData });\n }\n }\n }\n }\n};\nconst processElementEvent = async (ev) => {\n const kebabName = camelToKebab(ev.type);\n const scopedKebabName = \"e:\" + kebabName;\n let element = ev.target;\n while (element && element.getAttribute) {\n const results = dispatch(element, ev, scopedKebabName, kebabName);\n const doBubble = ev.bubbles && !ev.cancelBubble;\n if (isPromise(results)) {\n await results;\n }\n element = doBubble && ev.bubbles && !ev.cancelBubble ? element.parentElement : null;\n }\n};\nconst broadcast = (infix, ev) => {\n const kebabName = camelToKebab(ev.type);\n const scopedKebabName = infix + \":\" + kebabName;\n querySelectorAll(\"[q-\" + infix + \"\\\\:\" + kebabName + \"]\").forEach(\n (el) => dispatch(el, ev, scopedKebabName, kebabName)\n );\n};\nconst processDocumentEvent = async (ev) => {\n broadcast(documentPrefix, ev);\n};\nconst processWindowEvent = (ev) => {\n broadcast(windowPrefix, ev);\n};\nconst processReadyStateChange = () => {\n const readyState = doc.readyState;\n if (readyState == \"interactive\" || readyState == \"complete\") {\n hasInitialized = 1;\n roots.forEach(findShadowRoots);\n if (events.has(\"d:qinit\")) {\n events.delete(\"d:qinit\");\n const ev = createEvent(\"qinit\");\n querySelectorAll(\"[q-d\\\\:qinit]\").forEach((el) => {\n dispatch(el, ev, \"d:qinit\");\n el.removeAttribute(\"q-d:qinit\");\n });\n }\n if (events.has(\"d:qidle\")) {\n events.delete(\"d:qidle\");\n const riC = win.requestIdleCallback ?? win.setTimeout;\n riC.bind(win)(() => {\n const ev = createEvent(\"qidle\");\n querySelectorAll(\"[q-d\\\\:qidle]\").forEach((el) => {\n dispatch(el, ev, \"d:qidle\");\n el.removeAttribute(\"q-d:qidle\");\n });\n });\n }\n if (events.has(\"e:qvisible\")) {\n observer || (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), \"e:qvisible\");\n }\n }\n }));\n querySelectorAll(\"[q-e\\\\:qvisible]:not([q\\\\:observed])\").forEach((el) => {\n observer.observe(el);\n el.setAttribute(\"q:observed\", \"true\");\n });\n }\n }\n};\nconst addEventOrRoot = (...eventNames) => {\n for (let i = 0; i < eventNames.length; i++) {\n const eventNameOrRoot = eventNames[i];\n if (typeof eventNameOrRoot === \"string\") {\n if (!events.has(eventNameOrRoot)) {\n events.add(eventNameOrRoot);\n const { scope, eventName } = parseKebabEvent(eventNameOrRoot);\n if (scope === windowPrefix) {\n addEventListener(win, eventName, processWindowEvent, true);\n } else {\n roots.forEach(\n (root) => addEventListener(\n root,\n eventName,\n scope === documentPrefix ? processDocumentEvent : processElementEvent,\n true\n )\n );\n }\n if (hasInitialized === 1 && (eventNameOrRoot === \"e:qvisible\" || eventNameOrRoot === \"d:qinit\" || eventNameOrRoot === \"d:qidle\")) {\n processReadyStateChange();\n }\n }\n } else {\n if (!roots.has(eventNameOrRoot)) {\n events.forEach((kebabEventName) => {\n const { scope, eventName } = parseKebabEvent(kebabEventName);\n if (scope !== windowPrefix) {\n addEventListener(\n eventNameOrRoot,\n eventName,\n scope === documentPrefix ? processDocumentEvent : processElementEvent,\n true\n );\n }\n });\n roots.add(eventNameOrRoot);\n }\n }\n }\n};\nconst _qwikEv = win._qwikEv;\nif (!_qwikEv?.roots) {\n if (Array.isArray(_qwikEv)) {\n addEventOrRoot(..._qwikEv);\n } else {\n addEventOrRoot(\"e:click\", \"e:input\");\n }\n win._qwikEv = {\n events,\n roots,\n push: addEventOrRoot\n };\n addEventListener(doc, \"readystatechange\", processReadyStateChange);\n processReadyStateChange();\n}";
3
3
  export { QWIK_LOADER, QWIK_LOADER_DEBUG };
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qwik.dev/core/loader",
3
- "version": "2.0.0-beta.29-dev+bc61b71",
3
+ "version": "2.0.0-beta.30-dev+5421ed4",
4
4
  "main": "index.mjs",
5
5
  "types": "index.d.ts",
6
6
  "private": true,
@@ -1,4 +1,9 @@
1
+ import { EntryStrategy } from '@qwik.dev/optimizer';
2
+ import { Optimizer } from '@qwik.dev/optimizer';
3
+ import { OptimizerOptions } from '@qwik.dev/optimizer';
1
4
  import type { Plugin as Plugin_2 } from 'vite';
5
+ import { TransformModule } from '@qwik.dev/optimizer';
6
+ import { TransformModuleInput } from '@qwik.dev/optimizer';
2
7
 
3
8
  /**
4
9
  * A function that returns a map of bundle names to their dependencies.
@@ -10,35 +15,6 @@ export declare type BundleGraphAdder = (manifest: QwikManifest) => Record<string
10
15
  dynamicImports?: string[];
11
16
  }>;
12
17
 
13
- /** @public */
14
- export declare interface ComponentEntryStrategy {
15
- type: 'component';
16
- manual?: Record<string, string>;
17
- }
18
-
19
- /** @public */
20
- export declare const createOptimizer: (optimizerOptions?: OptimizerOptions) => Promise<Optimizer>;
21
-
22
- /** @public */
23
- export declare interface Diagnostic {
24
- scope: string;
25
- category: DiagnosticCategory;
26
- code: string | null;
27
- file: string;
28
- message: string;
29
- highlights: SourceLocation[] | null;
30
- suggestions: string[] | null;
31
- }
32
-
33
- /** @public */
34
- export declare type DiagnosticCategory = 'error' | 'warning' | 'sourceError';
35
-
36
- /** @public */
37
- declare type EmitMode = 'dev' | 'prod' | 'lib' | 'hmr';
38
-
39
- /** @public */
40
- export declare type EntryStrategy = InlineEntryStrategy | HoistEntryStrategy | SingleEntryStrategy | HookEntryStrategy_2 | SegmentEntryStrategy | ComponentEntryStrategy | SmartEntryStrategy;
41
-
42
18
  /**
43
19
  * Use `__EXPERIMENTAL__.x` to check if feature `x` is enabled. It will be replaced with `true` or
44
20
  * `false` via an exact string replacement.
@@ -48,6 +24,8 @@ export declare type EntryStrategy = InlineEntryStrategy | HoistEntryStrategy | S
48
24
  * @public
49
25
  */
50
26
  export declare enum ExperimentalFeatures {
27
+ /** Enable the Each keyed-list primitive */
28
+ each = "each",
51
29
  /** Enable the usePreventNavigate hook */
52
30
  preventNavigate = "preventNavigate",
53
31
  /** Enable the Valibot form validation */
@@ -71,25 +49,6 @@ export declare interface GlobalInjections {
71
49
  location: 'head' | 'body';
72
50
  }
73
51
 
74
- /** @public */
75
- declare interface HoistEntryStrategy {
76
- type: 'hoist';
77
- }
78
-
79
- /** @deprecated Use SegmentStrategy instead */
80
- declare interface HookEntryStrategy_2 {
81
- type: 'hook';
82
- manual?: Record<string, string>;
83
- }
84
-
85
- /** @public */
86
- export declare interface InlineEntryStrategy {
87
- type: 'inline';
88
- }
89
-
90
- /** @public */
91
- export declare type MinifyMode = 'simplify' | 'none';
92
-
93
52
  declare interface NormalizedQwikPluginOptions extends Omit<Required<QwikPluginOptions>, 'input' | 'vendorRoots' | 'srcInputs' | 'experimental'> {
94
53
  input: string[] | {
95
54
  [entry: string]: string;
@@ -97,35 +56,6 @@ declare interface NormalizedQwikPluginOptions extends Omit<Required<QwikPluginOp
97
56
  experimental: Record<keyof typeof ExperimentalFeatures, boolean> | undefined;
98
57
  }
99
58
 
100
- /** @public */
101
- export declare interface Optimizer {
102
- /** Transforms the input code string, does not access the file system. */
103
- transformModules(opts: TransformModulesOptions): Promise<TransformOutput>;
104
- /** Optimizer system use. This can be updated with a custom file system. */
105
- sys: OptimizerSystem;
106
- }
107
-
108
- /** @public */
109
- export declare interface OptimizerOptions {
110
- sys?: OptimizerSystem;
111
- binding?: any;
112
- /** Inline the global styles if they're smaller than this */
113
- inlineStylesUpToBytes?: number;
114
- /** Enable sourcemaps */
115
- sourcemap?: boolean;
116
- }
117
-
118
- /** @public */
119
- export declare interface OptimizerSystem {
120
- cwd: () => string;
121
- env: SystemEnvironment;
122
- os: string;
123
- dynamicImport: (path: string) => Promise<any>;
124
- strictDynamicImport: (path: string) => Promise<any>;
125
- getInputFiles?: (rootDir: string) => Promise<TransformModuleInput[]>;
126
- path: Path;
127
- }
128
-
129
59
  /**
130
60
  * Workaround to make the api be defined in the type.
131
61
  *
@@ -136,36 +66,6 @@ declare type P<T> = Plugin_2<T> & {
136
66
  config: Extract<Plugin_2<T>['config'], Function>;
137
67
  };
138
68
 
139
- /** @public */
140
- export declare interface Path {
141
- resolve(...paths: string[]): string;
142
- normalize(path: string): string;
143
- isAbsolute(path: string): boolean;
144
- join(...paths: string[]): string;
145
- relative(from: string, to: string): string;
146
- dirname(path: string): string;
147
- basename(path: string, ext?: string): string;
148
- extname(path: string): string;
149
- format(pathObject: {
150
- root: string;
151
- dir: string;
152
- base: string;
153
- ext: string;
154
- name: string;
155
- }): string;
156
- parse(path: string): {
157
- root: string;
158
- dir: string;
159
- base: string;
160
- ext: string;
161
- name: string;
162
- };
163
- readonly sep: string;
164
- readonly delimiter: string;
165
- readonly win32: null;
166
- readonly posix: Path;
167
- }
168
-
169
69
  /** @public */
170
70
  export declare interface QwikAsset {
171
71
  /** Name of the asset */
@@ -629,36 +529,6 @@ export declare interface ResolvedManifest {
629
529
  bundleGraph?: QwikBundleGraph;
630
530
  }
631
531
 
632
- /** @public */
633
- declare interface SegmentAnalysis {
634
- origin: string;
635
- name: string;
636
- entry: string | null;
637
- displayName: string;
638
- hash: string;
639
- canonicalFilename: string;
640
- extension: string;
641
- parent: string | null;
642
- ctxKind: 'eventHandler' | 'function';
643
- ctxName: string;
644
- captures: boolean;
645
- loc: [number, number];
646
- /** The parameter names if it's a function with parameters */
647
- paramNames?: string[];
648
- /** The transformed names of scoped variables, if any */
649
- captureNames?: string[];
650
- }
651
- export { SegmentAnalysis as HookAnalysis }
652
- export { SegmentAnalysis }
653
-
654
- /** @public */
655
- declare interface SegmentEntryStrategy {
656
- type: 'segment';
657
- manual?: Record<string, string>;
658
- }
659
- export { SegmentEntryStrategy as HookEntryStrategy }
660
- export { SegmentEntryStrategy }
661
-
662
532
  /**
663
533
  * The manifest values that are needed for SSR.
664
534
  *
@@ -666,99 +536,13 @@ export { SegmentEntryStrategy }
666
536
  */
667
537
  export declare type ServerQwikManifest = Pick<QwikManifest, 'manifestHash' | 'injections' | 'bundleGraph' | 'bundleGraphAsset' | 'mapping' | 'preloader' | 'core' | 'qwikLoader'>;
668
538
 
669
- /** @public */
670
- export declare interface SingleEntryStrategy {
671
- type: 'single';
672
- manual?: Record<string, string>;
673
- }
674
-
675
- /** @public */
676
- export declare interface SmartEntryStrategy {
677
- type: 'smart';
678
- manual?: Record<string, string>;
679
- }
680
-
681
- /** @public */
682
- export declare interface SourceLocation {
683
- hi: number;
684
- lo: number;
685
- startLine: number;
686
- startCol: number;
687
- endLine: number;
688
- endCol: number;
689
- }
690
-
691
- /** @public */
692
- export declare type SourceMapsOption = 'external' | 'inline' | undefined | null;
693
-
694
539
  /** @public */
695
540
  export declare type SymbolMapper = Record<string, readonly [symbol: string, chunk: string]>;
696
541
 
697
- /** @alpha @deprecated No longer needed, it is automatic now */
698
- export declare const symbolMapper: undefined;
699
-
700
542
  /** @public */
701
543
  export declare type SymbolMapperFn = (symbolName: string, mapper: SymbolMapper | undefined, parent?: string) => readonly [symbol: string, chunk: string] | undefined;
702
544
 
703
- /** @public */
704
- export declare type SystemEnvironment = 'node' | 'deno' | 'bun' | 'webworker' | 'browsermain' | 'unknown';
705
-
706
- /** @public */
707
- export declare interface TransformModule {
708
- path: string;
709
- isEntry: boolean;
710
- code: string;
711
- map: string | null;
712
- segment: SegmentAnalysis | null;
713
- origPath: string | null;
714
- }
715
-
716
- /** @public */
717
- export declare interface TransformModuleInput {
718
- path: string;
719
- devPath?: string;
720
- code: string;
721
- }
722
-
723
- /** @public */
724
- export declare interface TransformModulesOptions extends TransformOptions {
725
- input: TransformModuleInput[];
726
- }
727
-
728
- /** @public */
729
- export declare interface TransformOptions {
730
- srcDir: string;
731
- rootDir?: string;
732
- entryStrategy?: EntryStrategy;
733
- minify?: MinifyMode;
734
- sourceMaps?: boolean;
735
- transpileTs?: boolean;
736
- transpileJsx?: boolean;
737
- preserveFilenames?: boolean;
738
- explicitExtensions?: boolean;
739
- mode?: EmitMode;
740
- scope?: string;
741
- stripExports?: string[];
742
- regCtxName?: string[];
743
- stripCtxName?: string[];
744
- stripEventHandlers?: boolean;
745
- isServer?: boolean;
746
- }
747
545
 
748
- /** @public */
749
- export declare interface TransformOutput {
750
- modules: TransformModule[];
751
- diagnostics: Diagnostic[];
752
- isTypeScript: boolean;
753
- isJsx: boolean;
754
- }
755
-
756
- /** @public */
757
- export declare type TranspileOption = boolean | undefined | null;
758
-
759
- /** @public */
760
- export declare const versions: {
761
- qwik: string;
762
- };
546
+ export * from "@qwik.dev/optimizer";
763
547
 
764
548
  export { }