@qwik.dev/core 2.0.0-beta.5 → 2.0.0-beta.6

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.
Files changed (49) hide show
  1. package/dist/build/package.json +1 -1
  2. package/dist/cli.cjs +2 -2
  3. package/dist/core-internal.d.ts +49 -11
  4. package/dist/core.cjs +239 -105
  5. package/dist/core.cjs.map +1 -1
  6. package/dist/core.min.mjs +1 -1
  7. package/dist/core.mjs +224 -105
  8. package/dist/core.mjs.map +1 -1
  9. package/dist/core.prod.cjs +117 -63
  10. package/dist/core.prod.mjs +113 -58
  11. package/dist/loader/package.json +1 -1
  12. package/dist/optimizer.cjs +138 -202
  13. package/dist/optimizer.d.ts +9 -15
  14. package/dist/optimizer.mjs +129 -195
  15. package/dist/server.cjs +33 -16
  16. package/dist/server.mjs +32 -16
  17. package/dist/starters/adapters/aws-lambda/adapters/aws-lambda/vite.config.mts +1 -1
  18. package/dist/starters/adapters/aws-lambda/src/entry_aws-lambda.tsx +1 -5
  19. package/dist/starters/adapters/azure-swa/adapters/azure-swa/vite.config.mts +1 -1
  20. package/dist/starters/adapters/azure-swa/src/entry.azure-swa.tsx +1 -2
  21. package/dist/starters/adapters/bun/adapters/bun/vite.config.mts +1 -1
  22. package/dist/starters/adapters/bun/src/entry.bun.ts +0 -2
  23. package/dist/starters/adapters/cloud-run/adapters/cloud-run/vite.config.mts +1 -1
  24. package/dist/starters/adapters/cloud-run/src/entry.cloud-run.tsx +0 -2
  25. package/dist/starters/adapters/cloudflare-pages/adapters/cloudflare-pages/vite.config.mts +1 -1
  26. package/dist/starters/adapters/cloudflare-pages/src/entry.cloudflare-pages.tsx +1 -2
  27. package/dist/starters/adapters/deno/adapters/deno/vite.config.mts +1 -1
  28. package/dist/starters/adapters/deno/src/entry.deno.ts +0 -2
  29. package/dist/starters/adapters/express/adapters/express/vite.config.mts +1 -1
  30. package/dist/starters/adapters/express/src/entry.express.tsx +0 -2
  31. package/dist/starters/adapters/fastify/adapters/fastify/vite.config.mts +1 -1
  32. package/dist/starters/adapters/fastify/src/plugins/fastify-qwik.ts +1 -2
  33. package/dist/starters/adapters/firebase/adapters/firebase/vite.config.mts +1 -1
  34. package/dist/starters/adapters/firebase/src/entry-firebase.tsx +1 -2
  35. package/dist/starters/adapters/netlify-edge/adapters/netlify-edge/vite.config.mts +1 -1
  36. package/dist/starters/adapters/netlify-edge/src/entry.netlify-edge.tsx +1 -2
  37. package/dist/starters/adapters/node-server/adapters/node-server/vite.config.mts +1 -1
  38. package/dist/starters/adapters/node-server/src/entry.node-server.tsx +0 -2
  39. package/dist/starters/adapters/{static/adapters/static → ssg/adapters/ssg}/vite.config.mts +2 -2
  40. package/dist/starters/adapters/ssg/package.json +19 -0
  41. package/dist/starters/adapters/vercel-edge/adapters/vercel-edge/vite.config.mts +1 -1
  42. package/dist/starters/adapters/vercel-edge/src/entry.vercel-edge.tsx +1 -2
  43. package/dist/starters/adapters/vercel-edge/vercel.json +1 -1
  44. package/dist/testing/index.cjs +183 -121
  45. package/dist/testing/index.mjs +176 -115
  46. package/dist/testing/package.json +1 -1
  47. package/package.json +2 -2
  48. package/dist/starters/adapters/static/package.json +0 -19
  49. /package/dist/starters/adapters/{static → ssg}/README.md +0 -0
package/dist/core.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * @qwik.dev/core 2.0.0-beta.5-dev+8887f7e
3
+ * @qwik.dev/core 2.0.0-beta.6-dev+c42693f
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
@@ -89,6 +89,9 @@ const isString = (v) => {
89
89
  const isFunction = (v) => {
90
90
  return typeof v === 'function';
91
91
  };
92
+ const isPrimitive = (v) => {
93
+ return typeof v !== 'object' && typeof v !== 'function' && v !== null && v !== undefined;
94
+ };
92
95
 
93
96
  const codeToText = (code, ...parts) => {
94
97
  if (qDev) {
@@ -213,9 +216,13 @@ const QContainerSelector = '[q\\:container]:not([q\\:container=' +
213
216
  ']):not([q\\:container=' +
214
217
  "text" /* QContainerValue.TEXT */ +
215
218
  '])';
219
+ // Node namespaces
216
220
  const HTML_NS = 'http://www.w3.org/1999/xhtml';
217
221
  const SVG_NS = 'http://www.w3.org/2000/svg';
218
222
  const MATH_NS = 'http://www.w3.org/1998/Math/MathML';
223
+ // Attributes namespaces
224
+ const XLINK_NS = 'http://www.w3.org/1999/xlink';
225
+ const XML_NS = 'http://www.w3.org/XML/1998/namespace';
219
226
  const ResourceEvent = 'qResource';
220
227
  const RenderEvent = 'qRender';
221
228
  const TaskEvent = 'qTask';
@@ -1218,6 +1225,15 @@ const validateContext = (context) => {
1218
1225
  throw qError(11 /* QError.invalidContext */, [context]);
1219
1226
  }
1220
1227
  };
1228
+ /** @internal */
1229
+ const _resolveContextWithoutSequentialScope = (context) => {
1230
+ const iCtx = getInvokeContext();
1231
+ const hostElement = iCtx.$hostElement$;
1232
+ if (!hostElement) {
1233
+ return undefined;
1234
+ }
1235
+ return iCtx.$container$?.resolveContext(hostElement, context);
1236
+ };
1221
1237
 
1222
1238
  const ERROR_CONTEXT = /*#__PURE__*/ createContextId('qk-error');
1223
1239
  const isRecoverable = (err) => {
@@ -1234,7 +1250,7 @@ const isRecoverable = (err) => {
1234
1250
  *
1235
1251
  * @public
1236
1252
  */
1237
- const version = "2.0.0-beta.5-dev+8887f7e";
1253
+ const version = "2.0.0-beta.6-dev+c42693f";
1238
1254
 
1239
1255
  /** @internal */
1240
1256
  const EMPTY_ARRAY = [];
@@ -1393,6 +1409,52 @@ const queueQRL = (...args) => {
1393
1409
  return scheduler(2 /* ChoreType.RUN_QRL */, hostElement, runQrl, args);
1394
1410
  };
1395
1411
 
1412
+ /** @internal */
1413
+ const mapApp_findIndx = (array, key, start) => {
1414
+ assertTrue(start % 2 === 0, 'Expecting even number.');
1415
+ let bottom = start >> 1;
1416
+ let top = (array.length - 2) >> 1;
1417
+ while (bottom <= top) {
1418
+ const mid = bottom + ((top - bottom) >> 1);
1419
+ const midKey = array[mid << 1];
1420
+ if (midKey === key) {
1421
+ return mid << 1;
1422
+ }
1423
+ if (midKey < key) {
1424
+ bottom = mid + 1;
1425
+ }
1426
+ else {
1427
+ top = mid - 1;
1428
+ }
1429
+ }
1430
+ return (bottom << 1) ^ -1;
1431
+ };
1432
+ /** @internal */
1433
+ const mapArray_set = (array, key, value, start) => {
1434
+ const indx = mapApp_findIndx(array, key, start);
1435
+ if (indx >= 0) {
1436
+ if (value == null) {
1437
+ array.splice(indx, 2);
1438
+ }
1439
+ else {
1440
+ array[indx + 1] = value;
1441
+ }
1442
+ }
1443
+ else if (value != null) {
1444
+ array.splice(indx ^ -1, 0, key, value);
1445
+ }
1446
+ };
1447
+ /** @internal */
1448
+ const mapArray_get = (array, key, start) => {
1449
+ const indx = mapApp_findIndx(array, key, start);
1450
+ if (indx >= 0) {
1451
+ return array[indx + 1];
1452
+ }
1453
+ else {
1454
+ return null;
1455
+ }
1456
+ };
1457
+
1396
1458
  /** @internal */
1397
1459
  const _CONST_PROPS = Symbol('CONST');
1398
1460
  /** @internal */
@@ -1592,6 +1654,7 @@ const getStoreTarget = (value) => {
1592
1654
  const unwrapStore = (value) => {
1593
1655
  return getStoreTarget(value) || value;
1594
1656
  };
1657
+ /** @internal */
1595
1658
  const isStore = (value) => {
1596
1659
  return STORE_TARGET in value;
1597
1660
  };
@@ -2460,66 +2523,71 @@ const executeComponent = (container, renderHost, subscriptionHost, componentQRL,
2460
2523
  return executeComponentWithPromiseExceptionRetry();
2461
2524
  };
2462
2525
  /**
2463
- * Stores the JSX output of the last execution of the component.
2464
- *
2465
- * Component can execute multiple times because:
2526
+ * Adds `useOn` events to the JSX output.
2466
2527
  *
2467
- * - Component can have multiple tasks
2468
- * - Tasks can track signals
2469
- * - Task A can change signal which causes Task B to rerun.
2470
- *
2471
- * So when executing a component we only care about its last JSX Output.
2528
+ * @param jsx The JSX output to modify.
2529
+ * @param useOnEvents The `useOn` events to add.
2530
+ * @returns The modified JSX output.
2472
2531
  */
2473
2532
  function addUseOnEvents(jsx, useOnEvents) {
2474
- const jsxElement = findFirstStringJSX(jsx);
2533
+ const jsxElement = findFirstElementNode(jsx);
2475
2534
  let jsxResult = jsx;
2535
+ const qVisibleEvent = 'onQvisible$';
2476
2536
  return maybeThen(jsxElement, (jsxElement) => {
2477
- let isInvisibleComponent = false;
2478
- if (!jsxElement) {
2479
- /**
2480
- * We did not find any jsx node with a string tag. This means that we should append:
2481
- *
2482
- * ```html
2483
- * <script type="placeholder" hidden on-document:qinit="..."></script>
2484
- * ```
2485
- *
2486
- * This is needed because use on events should have a node to attach them to.
2487
- */
2488
- isInvisibleComponent = true;
2489
- }
2537
+ // headless components are components that don't render a real DOM element
2538
+ const isHeadless = !jsxElement;
2539
+ // placeholder element is a <script> element that is used to add events to the document or window
2540
+ let placeholderElement = null;
2490
2541
  for (const key in useOnEvents) {
2491
2542
  if (Object.prototype.hasOwnProperty.call(useOnEvents, key)) {
2492
- if (isInvisibleComponent) {
2493
- if (key === 'onQvisible$') {
2494
- const [jsxElement, jsx] = addScriptNodeForInvisibleComponents(jsxResult);
2495
- jsxResult = jsx;
2496
- if (jsxElement) {
2497
- addUseOnEvent(jsxElement, 'document:onQinit$', useOnEvents[key]);
2543
+ let targetElement = jsxElement;
2544
+ let eventKey = key;
2545
+ if (isHeadless) {
2546
+ // if the component is headless, we need to add the event to the placeholder element
2547
+ if (key === qVisibleEvent ||
2548
+ key.startsWith("document:on" /* EventNameJSXScope.document */) ||
2549
+ key.startsWith("window:on" /* EventNameJSXScope.window */)) {
2550
+ if (!placeholderElement) {
2551
+ const [createdElement, newJsx] = injectPlaceholderElement(jsxResult);
2552
+ jsxResult = newJsx;
2553
+ placeholderElement = createdElement;
2498
2554
  }
2555
+ targetElement = placeholderElement;
2499
2556
  }
2500
- else if (key.startsWith('document:') || key.startsWith('window:')) {
2501
- const [jsxElement, jsx] = addScriptNodeForInvisibleComponents(jsxResult);
2502
- jsxResult = jsx;
2503
- if (jsxElement) {
2504
- addUseOnEvent(jsxElement, key, useOnEvents[key]);
2557
+ else {
2558
+ if (isDev) {
2559
+ logWarn('You are trying to add an event "' +
2560
+ key +
2561
+ '" using `useOn` hook, ' +
2562
+ 'but a node to which you can add an event is not found. ' +
2563
+ 'Please make sure that the component has a valid element node. ');
2505
2564
  }
2565
+ continue;
2506
2566
  }
2507
- else if (isDev) {
2567
+ }
2568
+ if (targetElement) {
2569
+ if (targetElement.type === 'script' && key === qVisibleEvent) {
2570
+ eventKey = 'document:onQinit$';
2508
2571
  logWarn('You are trying to add an event "' +
2509
2572
  key +
2510
- '" using `useOn` hook, ' +
2573
+ '" using `useVisibleTask$` hook, ' +
2511
2574
  'but a node to which you can add an event is not found. ' +
2512
- 'Please make sure that the component has a valid element node. ');
2575
+ 'Using document:onQinit$ instead.');
2513
2576
  }
2514
- }
2515
- else if (jsxElement) {
2516
- addUseOnEvent(jsxElement, key, useOnEvents[key]);
2577
+ addUseOnEvent(targetElement, eventKey, useOnEvents[key]);
2517
2578
  }
2518
2579
  }
2519
2580
  }
2520
2581
  return jsxResult;
2521
2582
  });
2522
2583
  }
2584
+ /**
2585
+ * Adds an event to the JSX element.
2586
+ *
2587
+ * @param jsxElement The JSX element to add the event to.
2588
+ * @param key The event name.
2589
+ * @param value The event value.
2590
+ */
2523
2591
  function addUseOnEvent(jsxElement, key, value) {
2524
2592
  let props = jsxElement.props;
2525
2593
  if (props === EMPTY_OBJ) {
@@ -2535,7 +2603,13 @@ function addUseOnEvent(jsxElement, key, value) {
2535
2603
  propValue.push(...value);
2536
2604
  props[key] = propValue;
2537
2605
  }
2538
- function findFirstStringJSX(jsx) {
2606
+ /**
2607
+ * Finds the first element node in the JSX output.
2608
+ *
2609
+ * @param jsx The JSX output to search.
2610
+ * @returns The first element node or null if no element node is found.
2611
+ */
2612
+ function findFirstElementNode(jsx) {
2539
2613
  const queue = [jsx];
2540
2614
  while (queue.length) {
2541
2615
  const jsx = queue.shift();
@@ -2545,44 +2619,69 @@ function findFirstStringJSX(jsx) {
2545
2619
  }
2546
2620
  queue.push(jsx.children);
2547
2621
  }
2548
- else if (Array.isArray(jsx)) {
2622
+ else if (isArray(jsx)) {
2549
2623
  queue.push(...jsx);
2550
2624
  }
2551
2625
  else if (isPromise(jsx)) {
2552
- return maybeThen(jsx, (jsx) => findFirstStringJSX(jsx));
2626
+ return maybeThen(jsx, (jsx) => findFirstElementNode(jsx));
2553
2627
  }
2554
2628
  else if (isSignal(jsx)) {
2555
- return findFirstStringJSX(untrack(() => jsx.value));
2629
+ return findFirstElementNode(untrack(() => jsx.value));
2556
2630
  }
2557
2631
  }
2558
2632
  return null;
2559
2633
  }
2560
- function addScriptNodeForInvisibleComponents(jsx) {
2634
+ /**
2635
+ * Injects a placeholder <script> element into the JSX output.
2636
+ *
2637
+ * This is necessary for headless components (components that don't render a real DOM element) to
2638
+ * have an anchor point for `useOn` event listeners that target the document or window.
2639
+ *
2640
+ * @param jsx The JSX output to modify.
2641
+ * @returns A tuple containing the created placeholder element and the modified JSX output.
2642
+ */
2643
+ function injectPlaceholderElement(jsx) {
2644
+ // For regular JSX nodes, we can append the placeholder to its children.
2561
2645
  if (isJSXNode(jsx)) {
2562
- const jsxElement = new JSXNodeImpl('script', {}, {
2563
- type: 'placeholder',
2564
- hidden: '',
2565
- }, null, 3);
2646
+ const placeholder = createPlaceholderScriptNode();
2647
+ // For slots, we can't add children, so we wrap them in a fragment.
2566
2648
  if (jsx.type === Slot) {
2567
- return [jsxElement, _jsxSorted(Fragment, null, null, [jsx, jsxElement], 0, null)];
2649
+ return [placeholder, _jsxSorted(Fragment, null, null, [jsx, placeholder], 0, null)];
2568
2650
  }
2569
2651
  if (jsx.children == null) {
2570
- jsx.children = jsxElement;
2652
+ jsx.children = placeholder;
2571
2653
  }
2572
- else if (Array.isArray(jsx.children)) {
2573
- jsx.children.push(jsxElement);
2654
+ else if (isArray(jsx.children)) {
2655
+ jsx.children.push(placeholder);
2574
2656
  }
2575
2657
  else {
2576
- jsx.children = [jsx.children, jsxElement];
2658
+ jsx.children = [jsx.children, placeholder];
2577
2659
  }
2578
- return [jsxElement, jsx];
2660
+ return [placeholder, jsx];
2579
2661
  }
2580
- else if (Array.isArray(jsx) && jsx.length) {
2581
- // get first element
2582
- const [jsxElement, _] = addScriptNodeForInvisibleComponents(jsx[0]);
2583
- return [jsxElement, jsx];
2662
+ // For primitives, we can't add children, so we wrap them in a fragment.
2663
+ if (isPrimitive(jsx)) {
2664
+ const placeholder = createPlaceholderScriptNode();
2665
+ return [placeholder, _jsxSorted(Fragment, null, null, [jsx, placeholder], 0, null)];
2584
2666
  }
2585
- return [null, null];
2667
+ // For an array of nodes, we inject the placeholder into the first element.
2668
+ if (isArray(jsx) && jsx.length > 0) {
2669
+ const [createdElement, _] = injectPlaceholderElement(jsx[0]);
2670
+ return [createdElement, jsx];
2671
+ }
2672
+ // For anything else we do nothing.
2673
+ return [null, jsx];
2674
+ }
2675
+ /**
2676
+ * Creates a <script> element with a placeholder type.
2677
+ *
2678
+ * @returns A <script> element with a placeholder type.
2679
+ */
2680
+ function createPlaceholderScriptNode() {
2681
+ return new JSXNodeImpl('script', {}, {
2682
+ type: 'placeholder',
2683
+ hidden: '',
2684
+ }, null, 3);
2586
2685
  }
2587
2686
 
2588
2687
  const applyInlineComponent = (ssr, componentHost, inlineComponentFunction, jsx) => {
@@ -3080,6 +3179,7 @@ class Task extends BackRef {
3080
3179
  this.$destroy$ = $destroy$;
3081
3180
  }
3082
3181
  }
3182
+ /** @internal */
3083
3183
  const isTask = (value) => {
3084
3184
  return value instanceof Task;
3085
3185
  };
@@ -3419,49 +3519,6 @@ const directGetPropsProxyProp = (jsx, prop) => {
3419
3519
  return (jsx.constProps && prop in jsx.constProps ? jsx.constProps[prop] : jsx.varProps[prop]);
3420
3520
  };
3421
3521
 
3422
- const mapApp_findIndx = (array, key, start) => {
3423
- assertTrue(start % 2 === 0, 'Expecting even number.');
3424
- let bottom = start >> 1;
3425
- let top = (array.length - 2) >> 1;
3426
- while (bottom <= top) {
3427
- const mid = bottom + ((top - bottom) >> 1);
3428
- const midKey = array[mid << 1];
3429
- if (midKey === key) {
3430
- return mid << 1;
3431
- }
3432
- if (midKey < key) {
3433
- bottom = mid + 1;
3434
- }
3435
- else {
3436
- top = mid - 1;
3437
- }
3438
- }
3439
- return (bottom << 1) ^ -1;
3440
- };
3441
- const mapArray_set = (array, key, value, start) => {
3442
- const indx = mapApp_findIndx(array, key, start);
3443
- if (indx >= 0) {
3444
- if (value == null) {
3445
- array.splice(indx, 2);
3446
- }
3447
- else {
3448
- array[indx + 1] = value;
3449
- }
3450
- }
3451
- else if (value != null) {
3452
- array.splice(indx ^ -1, 0, key, value);
3453
- }
3454
- };
3455
- const mapArray_get = (array, key, start) => {
3456
- const indx = mapApp_findIndx(array, key, start);
3457
- if (indx >= 0) {
3458
- return array[indx + 1];
3459
- }
3460
- else {
3461
- return null;
3462
- }
3463
- };
3464
-
3465
3522
  const isForeignObjectElement = (elementName) => {
3466
3523
  return isDev ? elementName.toLowerCase() === 'foreignobject' : elementName === 'foreignObject';
3467
3524
  };
@@ -3665,6 +3722,24 @@ function getNewElementNamespaceData(domParentVNode, tagOrVNode) {
3665
3722
  elementNamespaceFlag,
3666
3723
  };
3667
3724
  }
3725
+ function getAttributeNamespace(attributeName) {
3726
+ switch (attributeName) {
3727
+ case 'xlink:href':
3728
+ case 'xlink:actuate':
3729
+ case 'xlink:arcrole':
3730
+ case 'xlink:role':
3731
+ case 'xlink:show':
3732
+ case 'xlink:title':
3733
+ case 'xlink:type':
3734
+ return XLINK_NS;
3735
+ case 'xml:base':
3736
+ case 'xml:lang':
3737
+ case 'xml:space':
3738
+ return XML_NS;
3739
+ default:
3740
+ return null;
3741
+ }
3742
+ }
3668
3743
 
3669
3744
  function escapeHTML(html) {
3670
3745
  let escapedHTML = '';
@@ -4207,6 +4282,14 @@ const vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
4207
4282
  }
4208
4283
  value = serializeAttribute(key, value, scopedStyleIdPrefix);
4209
4284
  if (value != null) {
4285
+ if (vNewNode[0 /* VNodeProps.flags */] & 64 /* VNodeFlags.NS_svg */) {
4286
+ // only svg elements can have namespace attributes
4287
+ const namespace = getAttributeNamespace(key);
4288
+ if (namespace) {
4289
+ element.setAttributeNS(namespace, key, String(value));
4290
+ continue;
4291
+ }
4292
+ }
4210
4293
  element.setAttribute(key, String(value));
4211
4294
  }
4212
4295
  }
@@ -6842,6 +6925,7 @@ const vnode_isElementOrTextVNode = (vNode) => {
6842
6925
  const flag = vNode[0 /* VNodeProps.flags */];
6843
6926
  return (flag & 5 /* VNodeFlags.ELEMENT_OR_TEXT_MASK */) !== 0;
6844
6927
  };
6928
+ /** @internal */
6845
6929
  const vnode_isMaterialized = (vNode) => {
6846
6930
  assertDefined(vNode, 'Missing vNode');
6847
6931
  const flag = vNode[0 /* VNodeProps.flags */];
@@ -6849,11 +6933,13 @@ const vnode_isMaterialized = (vNode) => {
6849
6933
  vNode[4 /* ElementVNodeProps.firstChild */] !== undefined &&
6850
6934
  vNode[5 /* ElementVNodeProps.lastChild */] !== undefined);
6851
6935
  };
6936
+ /** @internal */
6852
6937
  const vnode_isTextVNode = (vNode) => {
6853
6938
  assertDefined(vNode, 'Missing vNode');
6854
6939
  const flag = vNode[0 /* VNodeProps.flags */];
6855
6940
  return (flag & 4 /* VNodeFlags.Text */) === 4 /* VNodeFlags.Text */;
6856
6941
  };
6942
+ /** @internal */
6857
6943
  const vnode_isVirtualVNode = (vNode) => {
6858
6944
  assertDefined(vNode, 'Missing vNode');
6859
6945
  const flag = vNode[0 /* VNodeProps.flags */];
@@ -6891,6 +6977,7 @@ const vnode_getNodeTypeName = (vNode) => {
6891
6977
  }
6892
6978
  return '<unknown>';
6893
6979
  };
6980
+ /** @internal */
6894
6981
  const vnode_ensureElementInflated = (vnode) => {
6895
6982
  const flags = vnode[0 /* VNodeProps.flags */];
6896
6983
  if ((flags & 15 /* VNodeFlags.INFLATED_TYPE_MASK */) === 1 /* VNodeFlags.Element */) {
@@ -7569,6 +7656,7 @@ const vnode_setText = (journal, textVNode, text) => {
7569
7656
  const textNode = textVNode[4 /* TextVNodeProps.node */];
7570
7657
  journal.push(1 /* VNodeJournalOpCode.SetText */, textNode, (textVNode[5 /* TextVNodeProps.text */] = text));
7571
7658
  };
7659
+ /** @internal */
7572
7660
  const vnode_getFirstChild = (vnode) => {
7573
7661
  if (vnode_isTextVNode(vnode)) {
7574
7662
  return null;
@@ -7876,12 +7964,14 @@ const processVNodeData = (vData, callback) => {
7876
7964
  callback(peek, consumeValue, consume, getChar, nextToConsumeIdx);
7877
7965
  }
7878
7966
  };
7967
+ /** @internal */
7879
7968
  const vnode_getNextSibling = (vnode) => {
7880
7969
  return vnode[3 /* VNodeProps.nextSibling */];
7881
7970
  };
7882
7971
  const vnode_getPreviousSibling = (vnode) => {
7883
7972
  return vnode[2 /* VNodeProps.previousSibling */];
7884
7973
  };
7974
+ /** @internal */
7885
7975
  const vnode_getAttrKeys = (vnode) => {
7886
7976
  const type = vnode[0 /* VNodeProps.flags */];
7887
7977
  if ((type & 3 /* VNodeFlags.ELEMENT_OR_VIRTUAL_MASK */) !== 0) {
@@ -7927,6 +8017,7 @@ const vnode_setAttr = (journal, vnode, key, value) => {
7927
8017
  }
7928
8018
  }
7929
8019
  };
8020
+ /** @internal */
7930
8021
  const vnode_getAttr = (vnode, key) => {
7931
8022
  const type = vnode[0 /* VNodeProps.flags */];
7932
8023
  if ((type & 3 /* VNodeFlags.ELEMENT_OR_VIRTUAL_MASK */) !== 0) {
@@ -7963,6 +8054,7 @@ const vnode_setProp = (vnode, key, value) => {
7963
8054
  props.splice(idx ^ -1, 0, key, value);
7964
8055
  }
7965
8056
  };
8057
+ /** @internal */
7966
8058
  const vnode_getPropStartIndex = (vnode) => {
7967
8059
  const type = vnode[0 /* VNodeProps.flags */] & 7 /* VNodeFlags.TYPE_MASK */;
7968
8060
  if (type === 1 /* VNodeFlags.Element */) {
@@ -7973,6 +8065,7 @@ const vnode_getPropStartIndex = (vnode) => {
7973
8065
  }
7974
8066
  throw qError(26 /* QError.invalidVNodeType */, [type]);
7975
8067
  };
8068
+ /** @internal */
7976
8069
  const vnode_getProps = (vnode) => {
7977
8070
  return vnode[vnode_getPropStartIndex(vnode)];
7978
8071
  };
@@ -8754,6 +8847,32 @@ const allocate = (container, typeId, value) => {
8754
8847
  case 11 /* TypeIds.RefVNode */:
8755
8848
  const vNode = retrieveVNodeOrDocument(container, value);
8756
8849
  if (vnode_isVNode(vNode)) {
8850
+ /**
8851
+ * If we have a ref, we need to ensure the element is materialized.
8852
+ *
8853
+ * Example:
8854
+ *
8855
+ * ```
8856
+ * const Cmp = component$(() => {
8857
+ * const element = useSignal<HTMLDivElement>();
8858
+ *
8859
+ * useVisibleTask$(() => {
8860
+ * element.value!.innerHTML = 'I am the innerHTML content!';
8861
+ * });
8862
+ *
8863
+ * return (
8864
+ * <div ref={element} />
8865
+ * );
8866
+ * });
8867
+ * ```
8868
+ *
8869
+ * If we don't materialize early element with ref property, and change element innerHTML it
8870
+ * will be applied to a vnode tree during the lazy materialization, and it is wrong.
8871
+ *
8872
+ * Next if we rerender component it will remove applied innerHTML, because the system thinks
8873
+ * it is a part of the vnode tree.
8874
+ */
8875
+ ensureMaterialized(vNode);
8757
8876
  return vnode_getNode(vNode);
8758
8877
  }
8759
8878
  else {
@@ -11733,5 +11852,5 @@ const PREFETCH_CODE = /*#__PURE__*/ ((c // Service worker container
11733
11852
  */
11734
11853
  const PrefetchGraph = (_opts = {}) => null;
11735
11854
 
11736
- export { $, Fragment, NoSerializeSymbol, PrefetchGraph, PrefetchServiceWorker, RenderOnce, Resource, SSRComment, SSRRaw, SSRStream, SSRStreamBlock, SerializerSymbol, SkipRender, Slot, _CONST_PROPS, DomContainer as _DomContainer, _EFFECT_BACK_REF, EMPTY_ARRAY as _EMPTY_ARRAY, _IMMUTABLE, _SharedContainer, SubscriptionData as _SubscriptionData, _UNINITIALIZED, _VAR_PROPS, _deserialize, dumpState as _dumpState, _fnSignal, _getContextContainer, _getContextElement, _getContextEvent, getDomContainer as _getDomContainer, _getQContainerElement, isJSXNode as _isJSXNode, isStringifiable as _isStringifiable, _jsxBranch, _jsxC, _jsxQ, _jsxS, _jsxSorted, _jsxSplit, _noopQrl, _noopQrlDEV, preprocessState as _preprocessState, _qrlSync, _regSymbol, _restProps, queueQRL as _run, _serializationWeakRef, _serialize, scheduleTask as _task, useInvokeContext as _useInvokeContext, verifySerializable as _verifySerializable, vnode_toString as _vnode_toString, _waitUntilRendered, _walkJSX, _wrapProp, _wrapSignal, component$, componentQrl, createAsyncComputed$, createAsyncComputedSignal as createAsyncComputedQrl, createComputed$, createComputedSignal as createComputedQrl, createContextId, h as createElement, createSerializer$, createSerializerSignal as createSerializerQrl, createSignal, event$, eventQrl, getDomContainer, getLocale, getPlatform, h, implicit$FirstArg, inlinedQrl, inlinedQrlDEV, isSignal, jsx, jsxDEV, jsx as jsxs, noSerialize, qrl, qrlDEV, render, setPlatform, sync$, untrack, unwrapStore, useAsyncComputed$, useAsyncComputedQrl, useComputed$, useComputedQrl, useConstant, useContext, useContextProvider, useErrorBoundary, useId, useLexicalScope, useOn, useOnDocument, useOnWindow, useResource$, useResourceQrl, useSerializer$, useSerializerQrl, useServerData, useSignal, useStore, useStyles$, useStylesQrl, useStylesScoped$, useStylesScopedQrl, useTask$, useTaskQrl, useVisibleTask$, useVisibleTaskQrl, version, withLocale };
11855
+ export { $, Fragment, NoSerializeSymbol, PrefetchGraph, PrefetchServiceWorker, RenderOnce, Resource, SSRComment, SSRRaw, SSRStream, SSRStreamBlock, SerializerSymbol, SkipRender, Slot, _CONST_PROPS, DomContainer as _DomContainer, _EFFECT_BACK_REF, EMPTY_ARRAY as _EMPTY_ARRAY, _IMMUTABLE, _SharedContainer, SubscriptionData as _SubscriptionData, _UNINITIALIZED, _VAR_PROPS, _deserialize, dumpState as _dumpState, _fnSignal, _getContextContainer, _getContextElement, _getContextEvent, getDomContainer as _getDomContainer, _getQContainerElement, isJSXNode as _isJSXNode, isStore as _isStore, isStringifiable as _isStringifiable, isTask as _isTask, _jsxBranch, _jsxC, _jsxQ, _jsxS, _jsxSorted, _jsxSplit, mapApp_findIndx as _mapApp_findIndx, mapArray_get as _mapArray_get, mapArray_set as _mapArray_set, _noopQrl, _noopQrlDEV, preprocessState as _preprocessState, _qrlSync, _regSymbol, _resolveContextWithoutSequentialScope, _restProps, queueQRL as _run, _serializationWeakRef, _serialize, scheduleTask as _task, verifySerializable as _verifySerializable, vnode_ensureElementInflated as _vnode_ensureElementInflated, vnode_getAttr as _vnode_getAttr, vnode_getAttrKeys as _vnode_getAttrKeys, vnode_getFirstChild as _vnode_getFirstChild, vnode_getNextSibling as _vnode_getNextSibling, vnode_getPropStartIndex as _vnode_getPropStartIndex, vnode_getProps as _vnode_getProps, vnode_isMaterialized as _vnode_isMaterialized, vnode_isTextVNode as _vnode_isTextVNode, vnode_isVirtualVNode as _vnode_isVirtualVNode, vnode_toString as _vnode_toString, _waitUntilRendered, _walkJSX, _wrapProp, _wrapSignal, component$, componentQrl, createAsyncComputed$, createAsyncComputedSignal as createAsyncComputedQrl, createComputed$, createComputedSignal as createComputedQrl, createContextId, h as createElement, createSerializer$, createSerializerSignal as createSerializerQrl, createSignal, event$, eventQrl, getDomContainer, getLocale, getPlatform, h, implicit$FirstArg, inlinedQrl, inlinedQrlDEV, isSignal, jsx, jsxDEV, jsx as jsxs, noSerialize, qrl, qrlDEV, render, setPlatform, sync$, untrack, unwrapStore, useAsyncComputed$, useAsyncComputedQrl, useComputed$, useComputedQrl, useConstant, useContext, useContextProvider, useErrorBoundary, useId, useLexicalScope, useOn, useOnDocument, useOnWindow, useResource$, useResourceQrl, useSerializer$, useSerializerQrl, useServerData, useSignal, useStore, useStyles$, useStylesQrl, useStylesScoped$, useStylesScopedQrl, useTask$, useTaskQrl, useVisibleTask$, useVisibleTaskQrl, version, withLocale };
11737
11856
  //# sourceMappingURL=core.mjs.map