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

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 (51) hide show
  1. package/dist/build/package.json +1 -1
  2. package/dist/cli.cjs +2 -2
  3. package/dist/core-internal.d.ts +51 -13
  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.d.ts +1 -0
  17. package/dist/server.mjs +32 -16
  18. package/dist/starters/adapters/aws-lambda/adapters/aws-lambda/vite.config.mts +1 -1
  19. package/dist/starters/adapters/aws-lambda/src/entry_aws-lambda.tsx +1 -5
  20. package/dist/starters/adapters/azure-swa/adapters/azure-swa/vite.config.mts +1 -1
  21. package/dist/starters/adapters/azure-swa/src/entry.azure-swa.tsx +1 -2
  22. package/dist/starters/adapters/bun/adapters/bun/vite.config.mts +1 -1
  23. package/dist/starters/adapters/bun/src/entry.bun.ts +0 -2
  24. package/dist/starters/adapters/cloud-run/adapters/cloud-run/vite.config.mts +1 -1
  25. package/dist/starters/adapters/cloud-run/src/entry.cloud-run.tsx +0 -2
  26. package/dist/starters/adapters/cloudflare-pages/adapters/cloudflare-pages/vite.config.mts +1 -1
  27. package/dist/starters/adapters/cloudflare-pages/src/entry.cloudflare-pages.tsx +1 -2
  28. package/dist/starters/adapters/deno/adapters/deno/vite.config.mts +1 -1
  29. package/dist/starters/adapters/deno/src/entry.deno.ts +0 -2
  30. package/dist/starters/adapters/express/adapters/express/vite.config.mts +1 -1
  31. package/dist/starters/adapters/express/src/entry.express.tsx +0 -2
  32. package/dist/starters/adapters/fastify/adapters/fastify/vite.config.mts +1 -1
  33. package/dist/starters/adapters/fastify/src/plugins/fastify-qwik.ts +1 -2
  34. package/dist/starters/adapters/firebase/adapters/firebase/vite.config.mts +1 -1
  35. package/dist/starters/adapters/firebase/src/entry-firebase.tsx +1 -2
  36. package/dist/starters/adapters/netlify-edge/adapters/netlify-edge/vite.config.mts +1 -1
  37. package/dist/starters/adapters/netlify-edge/src/entry.netlify-edge.tsx +1 -2
  38. package/dist/starters/adapters/node-server/adapters/node-server/vite.config.mts +1 -1
  39. package/dist/starters/adapters/node-server/src/entry.node-server.tsx +0 -2
  40. package/dist/starters/adapters/{static/adapters/static → ssg/adapters/ssg}/vite.config.mts +2 -2
  41. package/dist/starters/adapters/ssg/package.json +19 -0
  42. package/dist/starters/adapters/vercel-edge/adapters/vercel-edge/vite.config.mts +1 -1
  43. package/dist/starters/adapters/vercel-edge/src/entry.vercel-edge.tsx +1 -2
  44. package/dist/starters/adapters/vercel-edge/vercel.json +1 -1
  45. package/dist/starters/features/localize/src/entry.ssr.tsx +17 -21
  46. package/dist/testing/index.cjs +183 -121
  47. package/dist/testing/index.mjs +176 -115
  48. package/dist/testing/package.json +1 -1
  49. package/package.json +2 -2
  50. package/dist/starters/adapters/static/package.json +0 -19
  51. /package/dist/starters/adapters/{static → ssg}/README.md +0 -0
package/dist/core.cjs 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.7-dev+2dd89a6
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
@@ -91,6 +91,9 @@
91
91
  const isFunction = (v) => {
92
92
  return typeof v === 'function';
93
93
  };
94
+ const isPrimitive = (v) => {
95
+ return typeof v !== 'object' && typeof v !== 'function' && v !== null && v !== undefined;
96
+ };
94
97
 
95
98
  const codeToText = (code, ...parts) => {
96
99
  if (qDev) {
@@ -215,9 +218,13 @@
215
218
  ']):not([q\\:container=' +
216
219
  "text" /* QContainerValue.TEXT */ +
217
220
  '])';
221
+ // Node namespaces
218
222
  const HTML_NS = 'http://www.w3.org/1999/xhtml';
219
223
  const SVG_NS = 'http://www.w3.org/2000/svg';
220
224
  const MATH_NS = 'http://www.w3.org/1998/Math/MathML';
225
+ // Attributes namespaces
226
+ const XLINK_NS = 'http://www.w3.org/1999/xlink';
227
+ const XML_NS = 'http://www.w3.org/XML/1998/namespace';
221
228
  const ResourceEvent = 'qResource';
222
229
  const RenderEvent = 'qRender';
223
230
  const TaskEvent = 'qTask';
@@ -1220,6 +1227,15 @@
1220
1227
  throw qError(11 /* QError.invalidContext */, [context]);
1221
1228
  }
1222
1229
  };
1230
+ /** @internal */
1231
+ const _resolveContextWithoutSequentialScope = (context) => {
1232
+ const iCtx = getInvokeContext();
1233
+ const hostElement = iCtx.$hostElement$;
1234
+ if (!hostElement) {
1235
+ return undefined;
1236
+ }
1237
+ return iCtx.$container$?.resolveContext(hostElement, context);
1238
+ };
1223
1239
 
1224
1240
  const ERROR_CONTEXT = /*#__PURE__*/ createContextId('qk-error');
1225
1241
  const isRecoverable = (err) => {
@@ -1236,7 +1252,7 @@
1236
1252
  *
1237
1253
  * @public
1238
1254
  */
1239
- const version = "2.0.0-beta.5-dev+8887f7e";
1255
+ const version = "2.0.0-beta.7-dev+2dd89a6";
1240
1256
 
1241
1257
  /** @internal */
1242
1258
  const EMPTY_ARRAY = [];
@@ -1395,6 +1411,52 @@
1395
1411
  return scheduler(2 /* ChoreType.RUN_QRL */, hostElement, runQrl, args);
1396
1412
  };
1397
1413
 
1414
+ /** @internal */
1415
+ const mapApp_findIndx = (array, key, start) => {
1416
+ assertTrue(start % 2 === 0, 'Expecting even number.');
1417
+ let bottom = start >> 1;
1418
+ let top = (array.length - 2) >> 1;
1419
+ while (bottom <= top) {
1420
+ const mid = bottom + ((top - bottom) >> 1);
1421
+ const midKey = array[mid << 1];
1422
+ if (midKey === key) {
1423
+ return mid << 1;
1424
+ }
1425
+ if (midKey < key) {
1426
+ bottom = mid + 1;
1427
+ }
1428
+ else {
1429
+ top = mid - 1;
1430
+ }
1431
+ }
1432
+ return (bottom << 1) ^ -1;
1433
+ };
1434
+ /** @internal */
1435
+ const mapArray_set = (array, key, value, start) => {
1436
+ const indx = mapApp_findIndx(array, key, start);
1437
+ if (indx >= 0) {
1438
+ if (value == null) {
1439
+ array.splice(indx, 2);
1440
+ }
1441
+ else {
1442
+ array[indx + 1] = value;
1443
+ }
1444
+ }
1445
+ else if (value != null) {
1446
+ array.splice(indx ^ -1, 0, key, value);
1447
+ }
1448
+ };
1449
+ /** @internal */
1450
+ const mapArray_get = (array, key, start) => {
1451
+ const indx = mapApp_findIndx(array, key, start);
1452
+ if (indx >= 0) {
1453
+ return array[indx + 1];
1454
+ }
1455
+ else {
1456
+ return null;
1457
+ }
1458
+ };
1459
+
1398
1460
  /** @internal */
1399
1461
  const _CONST_PROPS = Symbol('CONST');
1400
1462
  /** @internal */
@@ -1594,6 +1656,7 @@
1594
1656
  const unwrapStore = (value) => {
1595
1657
  return getStoreTarget(value) || value;
1596
1658
  };
1659
+ /** @internal */
1597
1660
  const isStore = (value) => {
1598
1661
  return STORE_TARGET in value;
1599
1662
  };
@@ -2462,66 +2525,71 @@
2462
2525
  return executeComponentWithPromiseExceptionRetry();
2463
2526
  };
2464
2527
  /**
2465
- * Stores the JSX output of the last execution of the component.
2466
- *
2467
- * Component can execute multiple times because:
2528
+ * Adds `useOn` events to the JSX output.
2468
2529
  *
2469
- * - Component can have multiple tasks
2470
- * - Tasks can track signals
2471
- * - Task A can change signal which causes Task B to rerun.
2472
- *
2473
- * So when executing a component we only care about its last JSX Output.
2530
+ * @param jsx The JSX output to modify.
2531
+ * @param useOnEvents The `useOn` events to add.
2532
+ * @returns The modified JSX output.
2474
2533
  */
2475
2534
  function addUseOnEvents(jsx, useOnEvents) {
2476
- const jsxElement = findFirstStringJSX(jsx);
2535
+ const jsxElement = findFirstElementNode(jsx);
2477
2536
  let jsxResult = jsx;
2537
+ const qVisibleEvent = 'onQvisible$';
2478
2538
  return maybeThen(jsxElement, (jsxElement) => {
2479
- let isInvisibleComponent = false;
2480
- if (!jsxElement) {
2481
- /**
2482
- * We did not find any jsx node with a string tag. This means that we should append:
2483
- *
2484
- * ```html
2485
- * <script type="placeholder" hidden on-document:qinit="..."></script>
2486
- * ```
2487
- *
2488
- * This is needed because use on events should have a node to attach them to.
2489
- */
2490
- isInvisibleComponent = true;
2491
- }
2539
+ // headless components are components that don't render a real DOM element
2540
+ const isHeadless = !jsxElement;
2541
+ // placeholder element is a <script> element that is used to add events to the document or window
2542
+ let placeholderElement = null;
2492
2543
  for (const key in useOnEvents) {
2493
2544
  if (Object.prototype.hasOwnProperty.call(useOnEvents, key)) {
2494
- if (isInvisibleComponent) {
2495
- if (key === 'onQvisible$') {
2496
- const [jsxElement, jsx] = addScriptNodeForInvisibleComponents(jsxResult);
2497
- jsxResult = jsx;
2498
- if (jsxElement) {
2499
- addUseOnEvent(jsxElement, 'document:onQinit$', useOnEvents[key]);
2545
+ let targetElement = jsxElement;
2546
+ let eventKey = key;
2547
+ if (isHeadless) {
2548
+ // if the component is headless, we need to add the event to the placeholder element
2549
+ if (key === qVisibleEvent ||
2550
+ key.startsWith("document:on" /* EventNameJSXScope.document */) ||
2551
+ key.startsWith("window:on" /* EventNameJSXScope.window */)) {
2552
+ if (!placeholderElement) {
2553
+ const [createdElement, newJsx] = injectPlaceholderElement(jsxResult);
2554
+ jsxResult = newJsx;
2555
+ placeholderElement = createdElement;
2500
2556
  }
2557
+ targetElement = placeholderElement;
2501
2558
  }
2502
- else if (key.startsWith('document:') || key.startsWith('window:')) {
2503
- const [jsxElement, jsx] = addScriptNodeForInvisibleComponents(jsxResult);
2504
- jsxResult = jsx;
2505
- if (jsxElement) {
2506
- addUseOnEvent(jsxElement, key, useOnEvents[key]);
2559
+ else {
2560
+ if (build.isDev) {
2561
+ logWarn('You are trying to add an event "' +
2562
+ key +
2563
+ '" using `useOn` hook, ' +
2564
+ 'but a node to which you can add an event is not found. ' +
2565
+ 'Please make sure that the component has a valid element node. ');
2507
2566
  }
2567
+ continue;
2508
2568
  }
2509
- else if (build.isDev) {
2569
+ }
2570
+ if (targetElement) {
2571
+ if (targetElement.type === 'script' && key === qVisibleEvent) {
2572
+ eventKey = 'document:onQinit$';
2510
2573
  logWarn('You are trying to add an event "' +
2511
2574
  key +
2512
- '" using `useOn` hook, ' +
2575
+ '" using `useVisibleTask$` hook, ' +
2513
2576
  'but a node to which you can add an event is not found. ' +
2514
- 'Please make sure that the component has a valid element node. ');
2577
+ 'Using document:onQinit$ instead.');
2515
2578
  }
2516
- }
2517
- else if (jsxElement) {
2518
- addUseOnEvent(jsxElement, key, useOnEvents[key]);
2579
+ addUseOnEvent(targetElement, eventKey, useOnEvents[key]);
2519
2580
  }
2520
2581
  }
2521
2582
  }
2522
2583
  return jsxResult;
2523
2584
  });
2524
2585
  }
2586
+ /**
2587
+ * Adds an event to the JSX element.
2588
+ *
2589
+ * @param jsxElement The JSX element to add the event to.
2590
+ * @param key The event name.
2591
+ * @param value The event value.
2592
+ */
2525
2593
  function addUseOnEvent(jsxElement, key, value) {
2526
2594
  let props = jsxElement.props;
2527
2595
  if (props === EMPTY_OBJ) {
@@ -2537,7 +2605,13 @@
2537
2605
  propValue.push(...value);
2538
2606
  props[key] = propValue;
2539
2607
  }
2540
- function findFirstStringJSX(jsx) {
2608
+ /**
2609
+ * Finds the first element node in the JSX output.
2610
+ *
2611
+ * @param jsx The JSX output to search.
2612
+ * @returns The first element node or null if no element node is found.
2613
+ */
2614
+ function findFirstElementNode(jsx) {
2541
2615
  const queue = [jsx];
2542
2616
  while (queue.length) {
2543
2617
  const jsx = queue.shift();
@@ -2547,44 +2621,69 @@
2547
2621
  }
2548
2622
  queue.push(jsx.children);
2549
2623
  }
2550
- else if (Array.isArray(jsx)) {
2624
+ else if (isArray(jsx)) {
2551
2625
  queue.push(...jsx);
2552
2626
  }
2553
2627
  else if (isPromise(jsx)) {
2554
- return maybeThen(jsx, (jsx) => findFirstStringJSX(jsx));
2628
+ return maybeThen(jsx, (jsx) => findFirstElementNode(jsx));
2555
2629
  }
2556
2630
  else if (isSignal(jsx)) {
2557
- return findFirstStringJSX(untrack(() => jsx.value));
2631
+ return findFirstElementNode(untrack(() => jsx.value));
2558
2632
  }
2559
2633
  }
2560
2634
  return null;
2561
2635
  }
2562
- function addScriptNodeForInvisibleComponents(jsx) {
2636
+ /**
2637
+ * Injects a placeholder <script> element into the JSX output.
2638
+ *
2639
+ * This is necessary for headless components (components that don't render a real DOM element) to
2640
+ * have an anchor point for `useOn` event listeners that target the document or window.
2641
+ *
2642
+ * @param jsx The JSX output to modify.
2643
+ * @returns A tuple containing the created placeholder element and the modified JSX output.
2644
+ */
2645
+ function injectPlaceholderElement(jsx) {
2646
+ // For regular JSX nodes, we can append the placeholder to its children.
2563
2647
  if (isJSXNode(jsx)) {
2564
- const jsxElement = new JSXNodeImpl('script', {}, {
2565
- type: 'placeholder',
2566
- hidden: '',
2567
- }, null, 3);
2648
+ const placeholder = createPlaceholderScriptNode();
2649
+ // For slots, we can't add children, so we wrap them in a fragment.
2568
2650
  if (jsx.type === Slot) {
2569
- return [jsxElement, _jsxSorted(Fragment, null, null, [jsx, jsxElement], 0, null)];
2651
+ return [placeholder, _jsxSorted(Fragment, null, null, [jsx, placeholder], 0, null)];
2570
2652
  }
2571
2653
  if (jsx.children == null) {
2572
- jsx.children = jsxElement;
2654
+ jsx.children = placeholder;
2573
2655
  }
2574
- else if (Array.isArray(jsx.children)) {
2575
- jsx.children.push(jsxElement);
2656
+ else if (isArray(jsx.children)) {
2657
+ jsx.children.push(placeholder);
2576
2658
  }
2577
2659
  else {
2578
- jsx.children = [jsx.children, jsxElement];
2660
+ jsx.children = [jsx.children, placeholder];
2579
2661
  }
2580
- return [jsxElement, jsx];
2662
+ return [placeholder, jsx];
2581
2663
  }
2582
- else if (Array.isArray(jsx) && jsx.length) {
2583
- // get first element
2584
- const [jsxElement, _] = addScriptNodeForInvisibleComponents(jsx[0]);
2585
- return [jsxElement, jsx];
2664
+ // For primitives, we can't add children, so we wrap them in a fragment.
2665
+ if (isPrimitive(jsx)) {
2666
+ const placeholder = createPlaceholderScriptNode();
2667
+ return [placeholder, _jsxSorted(Fragment, null, null, [jsx, placeholder], 0, null)];
2586
2668
  }
2587
- return [null, null];
2669
+ // For an array of nodes, we inject the placeholder into the first element.
2670
+ if (isArray(jsx) && jsx.length > 0) {
2671
+ const [createdElement, _] = injectPlaceholderElement(jsx[0]);
2672
+ return [createdElement, jsx];
2673
+ }
2674
+ // For anything else we do nothing.
2675
+ return [null, jsx];
2676
+ }
2677
+ /**
2678
+ * Creates a <script> element with a placeholder type.
2679
+ *
2680
+ * @returns A <script> element with a placeholder type.
2681
+ */
2682
+ function createPlaceholderScriptNode() {
2683
+ return new JSXNodeImpl('script', {}, {
2684
+ type: 'placeholder',
2685
+ hidden: '',
2686
+ }, null, 3);
2588
2687
  }
2589
2688
 
2590
2689
  const applyInlineComponent = (ssr, componentHost, inlineComponentFunction, jsx) => {
@@ -3082,6 +3181,7 @@
3082
3181
  this.$destroy$ = $destroy$;
3083
3182
  }
3084
3183
  }
3184
+ /** @internal */
3085
3185
  const isTask = (value) => {
3086
3186
  return value instanceof Task;
3087
3187
  };
@@ -3421,49 +3521,6 @@
3421
3521
  return (jsx.constProps && prop in jsx.constProps ? jsx.constProps[prop] : jsx.varProps[prop]);
3422
3522
  };
3423
3523
 
3424
- const mapApp_findIndx = (array, key, start) => {
3425
- assertTrue(start % 2 === 0, 'Expecting even number.');
3426
- let bottom = start >> 1;
3427
- let top = (array.length - 2) >> 1;
3428
- while (bottom <= top) {
3429
- const mid = bottom + ((top - bottom) >> 1);
3430
- const midKey = array[mid << 1];
3431
- if (midKey === key) {
3432
- return mid << 1;
3433
- }
3434
- if (midKey < key) {
3435
- bottom = mid + 1;
3436
- }
3437
- else {
3438
- top = mid - 1;
3439
- }
3440
- }
3441
- return (bottom << 1) ^ -1;
3442
- };
3443
- const mapArray_set = (array, key, value, start) => {
3444
- const indx = mapApp_findIndx(array, key, start);
3445
- if (indx >= 0) {
3446
- if (value == null) {
3447
- array.splice(indx, 2);
3448
- }
3449
- else {
3450
- array[indx + 1] = value;
3451
- }
3452
- }
3453
- else if (value != null) {
3454
- array.splice(indx ^ -1, 0, key, value);
3455
- }
3456
- };
3457
- const mapArray_get = (array, key, start) => {
3458
- const indx = mapApp_findIndx(array, key, start);
3459
- if (indx >= 0) {
3460
- return array[indx + 1];
3461
- }
3462
- else {
3463
- return null;
3464
- }
3465
- };
3466
-
3467
3524
  const isForeignObjectElement = (elementName) => {
3468
3525
  return build.isDev ? elementName.toLowerCase() === 'foreignobject' : elementName === 'foreignObject';
3469
3526
  };
@@ -3667,6 +3724,24 @@
3667
3724
  elementNamespaceFlag,
3668
3725
  };
3669
3726
  }
3727
+ function getAttributeNamespace(attributeName) {
3728
+ switch (attributeName) {
3729
+ case 'xlink:href':
3730
+ case 'xlink:actuate':
3731
+ case 'xlink:arcrole':
3732
+ case 'xlink:role':
3733
+ case 'xlink:show':
3734
+ case 'xlink:title':
3735
+ case 'xlink:type':
3736
+ return XLINK_NS;
3737
+ case 'xml:base':
3738
+ case 'xml:lang':
3739
+ case 'xml:space':
3740
+ return XML_NS;
3741
+ default:
3742
+ return null;
3743
+ }
3744
+ }
3670
3745
 
3671
3746
  function escapeHTML(html) {
3672
3747
  let escapedHTML = '';
@@ -4209,6 +4284,14 @@
4209
4284
  }
4210
4285
  value = serializeAttribute(key, value, scopedStyleIdPrefix);
4211
4286
  if (value != null) {
4287
+ if (vNewNode[0 /* VNodeProps.flags */] & 64 /* VNodeFlags.NS_svg */) {
4288
+ // only svg elements can have namespace attributes
4289
+ const namespace = getAttributeNamespace(key);
4290
+ if (namespace) {
4291
+ element.setAttributeNS(namespace, key, String(value));
4292
+ continue;
4293
+ }
4294
+ }
4212
4295
  element.setAttribute(key, String(value));
4213
4296
  }
4214
4297
  }
@@ -6844,6 +6927,7 @@
6844
6927
  const flag = vNode[0 /* VNodeProps.flags */];
6845
6928
  return (flag & 5 /* VNodeFlags.ELEMENT_OR_TEXT_MASK */) !== 0;
6846
6929
  };
6930
+ /** @internal */
6847
6931
  const vnode_isMaterialized = (vNode) => {
6848
6932
  assertDefined(vNode, 'Missing vNode');
6849
6933
  const flag = vNode[0 /* VNodeProps.flags */];
@@ -6851,11 +6935,13 @@
6851
6935
  vNode[4 /* ElementVNodeProps.firstChild */] !== undefined &&
6852
6936
  vNode[5 /* ElementVNodeProps.lastChild */] !== undefined);
6853
6937
  };
6938
+ /** @internal */
6854
6939
  const vnode_isTextVNode = (vNode) => {
6855
6940
  assertDefined(vNode, 'Missing vNode');
6856
6941
  const flag = vNode[0 /* VNodeProps.flags */];
6857
6942
  return (flag & 4 /* VNodeFlags.Text */) === 4 /* VNodeFlags.Text */;
6858
6943
  };
6944
+ /** @internal */
6859
6945
  const vnode_isVirtualVNode = (vNode) => {
6860
6946
  assertDefined(vNode, 'Missing vNode');
6861
6947
  const flag = vNode[0 /* VNodeProps.flags */];
@@ -6893,6 +6979,7 @@
6893
6979
  }
6894
6980
  return '<unknown>';
6895
6981
  };
6982
+ /** @internal */
6896
6983
  const vnode_ensureElementInflated = (vnode) => {
6897
6984
  const flags = vnode[0 /* VNodeProps.flags */];
6898
6985
  if ((flags & 15 /* VNodeFlags.INFLATED_TYPE_MASK */) === 1 /* VNodeFlags.Element */) {
@@ -7571,6 +7658,7 @@
7571
7658
  const textNode = textVNode[4 /* TextVNodeProps.node */];
7572
7659
  journal.push(1 /* VNodeJournalOpCode.SetText */, textNode, (textVNode[5 /* TextVNodeProps.text */] = text));
7573
7660
  };
7661
+ /** @internal */
7574
7662
  const vnode_getFirstChild = (vnode) => {
7575
7663
  if (vnode_isTextVNode(vnode)) {
7576
7664
  return null;
@@ -7878,12 +7966,14 @@
7878
7966
  callback(peek, consumeValue, consume, getChar, nextToConsumeIdx);
7879
7967
  }
7880
7968
  };
7969
+ /** @internal */
7881
7970
  const vnode_getNextSibling = (vnode) => {
7882
7971
  return vnode[3 /* VNodeProps.nextSibling */];
7883
7972
  };
7884
7973
  const vnode_getPreviousSibling = (vnode) => {
7885
7974
  return vnode[2 /* VNodeProps.previousSibling */];
7886
7975
  };
7976
+ /** @internal */
7887
7977
  const vnode_getAttrKeys = (vnode) => {
7888
7978
  const type = vnode[0 /* VNodeProps.flags */];
7889
7979
  if ((type & 3 /* VNodeFlags.ELEMENT_OR_VIRTUAL_MASK */) !== 0) {
@@ -7929,6 +8019,7 @@
7929
8019
  }
7930
8020
  }
7931
8021
  };
8022
+ /** @internal */
7932
8023
  const vnode_getAttr = (vnode, key) => {
7933
8024
  const type = vnode[0 /* VNodeProps.flags */];
7934
8025
  if ((type & 3 /* VNodeFlags.ELEMENT_OR_VIRTUAL_MASK */) !== 0) {
@@ -7965,6 +8056,7 @@
7965
8056
  props.splice(idx ^ -1, 0, key, value);
7966
8057
  }
7967
8058
  };
8059
+ /** @internal */
7968
8060
  const vnode_getPropStartIndex = (vnode) => {
7969
8061
  const type = vnode[0 /* VNodeProps.flags */] & 7 /* VNodeFlags.TYPE_MASK */;
7970
8062
  if (type === 1 /* VNodeFlags.Element */) {
@@ -7975,6 +8067,7 @@
7975
8067
  }
7976
8068
  throw qError(26 /* QError.invalidVNodeType */, [type]);
7977
8069
  };
8070
+ /** @internal */
7978
8071
  const vnode_getProps = (vnode) => {
7979
8072
  return vnode[vnode_getPropStartIndex(vnode)];
7980
8073
  };
@@ -8756,6 +8849,32 @@
8756
8849
  case 11 /* TypeIds.RefVNode */:
8757
8850
  const vNode = retrieveVNodeOrDocument(container, value);
8758
8851
  if (vnode_isVNode(vNode)) {
8852
+ /**
8853
+ * If we have a ref, we need to ensure the element is materialized.
8854
+ *
8855
+ * Example:
8856
+ *
8857
+ * ```
8858
+ * const Cmp = component$(() => {
8859
+ * const element = useSignal<HTMLDivElement>();
8860
+ *
8861
+ * useVisibleTask$(() => {
8862
+ * element.value!.innerHTML = 'I am the innerHTML content!';
8863
+ * });
8864
+ *
8865
+ * return (
8866
+ * <div ref={element} />
8867
+ * );
8868
+ * });
8869
+ * ```
8870
+ *
8871
+ * If we don't materialize early element with ref property, and change element innerHTML it
8872
+ * will be applied to a vnode tree during the lazy materialization, and it is wrong.
8873
+ *
8874
+ * Next if we rerender component it will remove applied innerHTML, because the system thinks
8875
+ * it is a part of the vnode tree.
8876
+ */
8877
+ ensureMaterialized(vNode);
8759
8878
  return vnode_getNode(vNode);
8760
8879
  }
8761
8880
  else {
@@ -11779,25 +11898,40 @@
11779
11898
  exports._getDomContainer = getDomContainer;
11780
11899
  exports._getQContainerElement = _getQContainerElement;
11781
11900
  exports._isJSXNode = isJSXNode;
11901
+ exports._isStore = isStore;
11782
11902
  exports._isStringifiable = isStringifiable;
11903
+ exports._isTask = isTask;
11783
11904
  exports._jsxBranch = _jsxBranch;
11784
11905
  exports._jsxC = _jsxC;
11785
11906
  exports._jsxQ = _jsxQ;
11786
11907
  exports._jsxS = _jsxS;
11787
11908
  exports._jsxSorted = _jsxSorted;
11788
11909
  exports._jsxSplit = _jsxSplit;
11910
+ exports._mapApp_findIndx = mapApp_findIndx;
11911
+ exports._mapArray_get = mapArray_get;
11912
+ exports._mapArray_set = mapArray_set;
11789
11913
  exports._noopQrl = _noopQrl;
11790
11914
  exports._noopQrlDEV = _noopQrlDEV;
11791
11915
  exports._preprocessState = preprocessState;
11792
11916
  exports._qrlSync = _qrlSync;
11793
11917
  exports._regSymbol = _regSymbol;
11918
+ exports._resolveContextWithoutSequentialScope = _resolveContextWithoutSequentialScope;
11794
11919
  exports._restProps = _restProps;
11795
11920
  exports._run = queueQRL;
11796
11921
  exports._serializationWeakRef = _serializationWeakRef;
11797
11922
  exports._serialize = _serialize;
11798
11923
  exports._task = scheduleTask;
11799
- exports._useInvokeContext = useInvokeContext;
11800
11924
  exports._verifySerializable = verifySerializable;
11925
+ exports._vnode_ensureElementInflated = vnode_ensureElementInflated;
11926
+ exports._vnode_getAttr = vnode_getAttr;
11927
+ exports._vnode_getAttrKeys = vnode_getAttrKeys;
11928
+ exports._vnode_getFirstChild = vnode_getFirstChild;
11929
+ exports._vnode_getNextSibling = vnode_getNextSibling;
11930
+ exports._vnode_getPropStartIndex = vnode_getPropStartIndex;
11931
+ exports._vnode_getProps = vnode_getProps;
11932
+ exports._vnode_isMaterialized = vnode_isMaterialized;
11933
+ exports._vnode_isTextVNode = vnode_isTextVNode;
11934
+ exports._vnode_isVirtualVNode = vnode_isVirtualVNode;
11801
11935
  exports._vnode_toString = vnode_toString;
11802
11936
  exports._waitUntilRendered = _waitUntilRendered;
11803
11937
  exports._walkJSX = _walkJSX;