@qwik.dev/core 2.0.0-beta.1 → 2.0.0-beta.3

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,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * @qwik.dev/core/testing 2.0.0-beta.1-dev+495e8d9
3
+ * @qwik.dev/core/testing 2.0.0-beta.3-dev+aa098fc
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
@@ -23066,6 +23066,7 @@ var isServerPlatform = () => {
23066
23066
  // packages/qwik/src/core/shared/qrl/qrl-class.ts
23067
23067
  import { isBrowser as isBrowser2, isDev as isDev5 } from "@qwik.dev/core/build";
23068
23068
  import { p as preload } from "@qwik.dev/core/preloader";
23069
+ var resolvedSymbol = Symbol("resolved");
23069
23070
  var createQRL = (chunk, symbol, symbolRef, symbolFn, capture, captureRef) => {
23070
23071
  if (qDev && qSerialize) {
23071
23072
  if (captureRef) {
@@ -23114,9 +23115,6 @@ var createQRL = (chunk, symbol, symbolRef, symbolFn, capture, captureRef) => {
23114
23115
  };
23115
23116
  return bound;
23116
23117
  }
23117
- const resolveLazy = (containerEl) => {
23118
- return symbolRef !== null ? symbolRef : resolve(containerEl);
23119
- };
23120
23118
  const wrapFn = (fn) => {
23121
23119
  if (typeof fn !== "function" || !capture?.length && !captureRef?.length) {
23122
23120
  return fn;
@@ -23141,7 +23139,10 @@ var createQRL = (chunk, symbol, symbolRef, symbolFn, capture, captureRef) => {
23141
23139
  return invoke.call(this, context, fn, ...args);
23142
23140
  };
23143
23141
  };
23144
- const resolve = async (containerEl) => {
23142
+ if (symbolFn && resolvedSymbol in symbolFn) {
23143
+ symbolRef = symbolFn[resolvedSymbol];
23144
+ }
23145
+ const resolve = symbolRef ? async () => symbolRef : async (containerEl) => {
23145
23146
  if (symbolRef !== null) {
23146
23147
  return symbolRef;
23147
23148
  }
@@ -23161,14 +23162,17 @@ var createQRL = (chunk, symbol, symbolRef, symbolFn, capture, captureRef) => {
23161
23162
  const start = now();
23162
23163
  const ctx = tryGetInvokeContext();
23163
23164
  if (symbolFn !== null) {
23164
- symbolRef = symbolFn().then(
23165
- (module) => qrl.resolved = wrapFn(symbolRef = module[symbol])
23166
- );
23165
+ symbolRef = symbolFn().then((module) => {
23166
+ const resolved = wrapFn(symbolRef = module[symbol]);
23167
+ symbolFn[resolvedSymbol] = resolved;
23168
+ qrl.resolved = resolved;
23169
+ return resolved;
23170
+ });
23167
23171
  } else {
23168
23172
  const imported = getPlatform().importSymbol(_containerEl, chunk, symbol);
23169
23173
  symbolRef = maybeThen(imported, (ref) => qrl.resolved = wrapFn(symbolRef = ref));
23170
23174
  }
23171
- if (typeof symbolRef === "object" && isPromise(symbolRef)) {
23175
+ if (isPromise(symbolRef)) {
23172
23176
  symbolRef.then(
23173
23177
  () => emitUsedSymbol(symbol, ctx?.$element$, start),
23174
23178
  (err) => {
@@ -23194,7 +23198,6 @@ var createQRL = (chunk, symbol, symbolRef, symbolFn, capture, captureRef) => {
23194
23198
  getHash: () => hash3,
23195
23199
  getCaptured: () => captureRef,
23196
23200
  resolve,
23197
- $resolveLazy$: resolveLazy,
23198
23201
  $setContainer$: setContainer,
23199
23202
  $chunk$: chunk,
23200
23203
  $symbol$: symbol,
@@ -24129,7 +24132,6 @@ var executeComponent = (container, renderHost, subscriptionHost, componentQRL, p
24129
24132
  if (!isInlineComponent) {
24130
24133
  container.setHostProp(renderHost, ELEMENT_SEQ_IDX, null);
24131
24134
  container.setHostProp(renderHost, USE_ON_LOCAL_SEQ_IDX, null);
24132
- container.setHostProp(renderHost, ELEMENT_PROPS, props);
24133
24135
  }
24134
24136
  if (vnode_isVNode(renderHost)) {
24135
24137
  clearAllEffects(container, renderHost);
@@ -25140,11 +25142,22 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
25140
25142
  shouldRender = true;
25141
25143
  }
25142
25144
  if (host) {
25143
- const vNodeProps = vnode_getProp(host, ELEMENT_PROPS, container.$getObjectById$);
25144
- shouldRender = shouldRender || propsDiffer(jsxProps, vNodeProps);
25145
+ let vNodeProps = vnode_getProp(host, ELEMENT_PROPS, container.$getObjectById$);
25146
+ const propsAreDifferent = propsDiffer(jsxProps, vNodeProps);
25147
+ shouldRender = shouldRender || propsAreDifferent;
25145
25148
  if (shouldRender) {
25149
+ if (propsAreDifferent) {
25150
+ if (vNodeProps) {
25151
+ vNodeProps[_CONST_PROPS] = jsxProps[_CONST_PROPS];
25152
+ vNodeProps[_VAR_PROPS] = jsxProps[_VAR_PROPS];
25153
+ } else if (jsxProps) {
25154
+ vnode_setProp(host, ELEMENT_PROPS, jsxProps);
25155
+ vNodeProps = jsxProps;
25156
+ }
25157
+ }
25158
+ vnode_setProp(host, OnRenderProp, componentQRL);
25146
25159
  host[0 /* flags */] &= ~32 /* Deleted */;
25147
- container.$scheduler$(6 /* COMPONENT */, host, componentQRL, jsxProps);
25160
+ container.$scheduler$(6 /* COMPONENT */, host, componentQRL, vNodeProps);
25148
25161
  }
25149
25162
  }
25150
25163
  descendContentToProject(jsxNode2.children, host);
@@ -25686,21 +25699,24 @@ var createScheduler = (container, scheduleDrain, journalFlush) => {
25686
25699
  {
25687
25700
  const target = chore.$target$;
25688
25701
  const effects = chore.$payload$;
25702
+ const ctx = newInvokeContext();
25703
+ ctx.$container$ = container;
25689
25704
  if (target instanceof ComputedSignalImpl || target instanceof WrappedSignalImpl) {
25690
25705
  const forceRunEffects = target.$forceRunEffects$;
25691
25706
  target.$forceRunEffects$ = false;
25692
- if (!target.$effects$?.size) {
25707
+ if (!effects?.size) {
25693
25708
  break;
25694
25709
  }
25695
- returnValue = retryOnPromise(() => {
25696
- if (target.$computeIfNeeded$() || forceRunEffects) {
25697
- triggerEffects(container, target, effects);
25710
+ returnValue = maybeThen(
25711
+ retryOnPromise(() => invoke.call(target, ctx, target.$computeIfNeeded$)),
25712
+ (didChange) => {
25713
+ if (didChange || forceRunEffects) {
25714
+ return retryOnPromise(() => triggerEffects(container, target, effects));
25715
+ }
25698
25716
  }
25699
- });
25717
+ );
25700
25718
  } else {
25701
- returnValue = retryOnPromise(() => {
25702
- triggerEffects(container, target, effects);
25703
- });
25719
+ returnValue = retryOnPromise(() => triggerEffects(container, target, effects));
25704
25720
  }
25705
25721
  }
25706
25722
  break;
@@ -25764,7 +25780,10 @@ var createScheduler = (container, scheduleDrain, journalFlush) => {
25764
25780
  if (idxDiff !== 0) {
25765
25781
  return idxDiff;
25766
25782
  }
25767
- if (a.$target$ !== b.$target$ || a.$payload$ !== b.$payload$) {
25783
+ if (a.$target$ !== b.$target$) {
25784
+ if (isQrl(a.$target$) && isQrl(b.$target$) && a.$target$.$hash$ === b.$target$.$hash$) {
25785
+ return 0;
25786
+ }
25768
25787
  return 1;
25769
25788
  }
25770
25789
  if (b === currentChore) {
@@ -25796,7 +25815,7 @@ var createScheduler = (container, scheduleDrain, journalFlush) => {
25796
25815
  return value;
25797
25816
  }
25798
25817
  const existing = sortedArray[idx];
25799
- if (existing.$type$ === 4 /* NODE_DIFF */) {
25818
+ if (existing.$payload$ !== value.$payload$) {
25800
25819
  existing.$payload$ = value.$payload$;
25801
25820
  }
25802
25821
  if (existing.$executed$) {
@@ -29640,11 +29659,14 @@ var processVNodeData2 = (vData, callback) => {
29640
29659
  let nextToConsumeIdx = 0;
29641
29660
  let ch = 0;
29642
29661
  let peekCh = 0;
29662
+ const getChar = (idx) => {
29663
+ return idx < vData.length ? vData.charCodeAt(idx) : 0;
29664
+ };
29643
29665
  const peek = () => {
29644
29666
  if (peekCh !== 0) {
29645
29667
  return peekCh;
29646
29668
  } else {
29647
- return peekCh = nextToConsumeIdx < vData.length ? vData.charCodeAt(nextToConsumeIdx) : 0;
29669
+ return peekCh = getChar(nextToConsumeIdx);
29648
29670
  }
29649
29671
  };
29650
29672
  const consume = () => {
@@ -29662,7 +29684,7 @@ var processVNodeData2 = (vData, callback) => {
29662
29684
  return vData.substring(start, nextToConsumeIdx);
29663
29685
  };
29664
29686
  while (peek() !== 0) {
29665
- callback(peek, consumeValue, consume, nextToConsumeIdx);
29687
+ callback(peek, consumeValue, consume, getChar, nextToConsumeIdx);
29666
29688
  }
29667
29689
  };
29668
29690
  var vnode_getNextSibling = (vnode) => {
@@ -29870,17 +29892,17 @@ function materializeFromVNodeData(vParent, vData, element, child) {
29870
29892
  let textIdx = 0;
29871
29893
  let combinedText = null;
29872
29894
  let container = null;
29873
- processVNodeData2(vData, (peek, consumeValue, consume, nextToConsumeIdx) => {
29895
+ processVNodeData2(vData, (peek, consumeValue, consume, getChar, nextToConsumeIdx) => {
29874
29896
  if (isNumber(peek())) {
29875
- while (!isElement2(child)) {
29897
+ while (!isElement2(child) || // We pretend that style element's don't exist as they can get moved out.
29898
+ // skip over style elements, as those need to be moved to the head
29899
+ // and are not included in the counts.
29900
+ isQStyleElement(child)) {
29876
29901
  child = fastNextSibling(child);
29877
29902
  if (!child) {
29878
29903
  throw qError(27 /* materializeVNodeDataError */, [vData, peek(), nextToConsumeIdx]);
29879
29904
  }
29880
29905
  }
29881
- while (isQStyleElement(child)) {
29882
- child = fastNextSibling(child);
29883
- }
29884
29906
  combinedText = null;
29885
29907
  previousTextNode = null;
29886
29908
  let value = 0;
@@ -29906,7 +29928,16 @@ function materializeFromVNodeData(vParent, vData, element, child) {
29906
29928
  } else if (peek() === VNodeDataChar.PROPS) {
29907
29929
  vnode_setAttr(null, vParent, ELEMENT_PROPS, consumeValue());
29908
29930
  } else if (peek() === VNodeDataChar.KEY) {
29909
- vnode_setAttr(null, vParent, ELEMENT_KEY, consumeValue());
29931
+ const isEscapedValue = getChar(nextToConsumeIdx + 1) === VNodeDataChar.SEPARATOR;
29932
+ let value;
29933
+ if (isEscapedValue) {
29934
+ consume();
29935
+ value = decodeURI(consumeValue());
29936
+ consume();
29937
+ } else {
29938
+ value = consumeValue();
29939
+ }
29940
+ vnode_setAttr(null, vParent, ELEMENT_KEY, value);
29910
29941
  } else if (peek() === VNodeDataChar.SEQ) {
29911
29942
  vnode_setAttr(null, vParent, ELEMENT_SEQ, consumeValue());
29912
29943
  } else if (peek() === VNodeDataChar.SEQ_IDX) {
@@ -29942,6 +29973,9 @@ function materializeFromVNodeData(vParent, vData, element, child) {
29942
29973
  } else if (peek() === VNodeDataChar.SLOT) {
29943
29974
  vnode_setAttr(null, vParent, QSlot, consumeValue());
29944
29975
  } else {
29976
+ while (isQStyleElement(child)) {
29977
+ child = fastNextSibling(child);
29978
+ }
29945
29979
  const textNode = child && fastNodeType(child) === /* Node.TEXT_NODE */
29946
29980
  3 ? child : null;
29947
29981
  if (combinedText === null) {
@@ -31494,8 +31528,8 @@ import {
31494
31528
  } from "../core.mjs";
31495
31529
  import { isDev as isDev10 } from "@qwik.dev/core/build";
31496
31530
  var SsrNode = class {
31497
- constructor(parentSsrNode, id, attrs, cleanupQueue, vnodeData) {
31498
- this.attrs = attrs;
31531
+ constructor(parentSsrNode, id, attributesIndex, cleanupQueue, vnodeData) {
31532
+ this.attributesIndex = attributesIndex;
31499
31533
  this.cleanupQueue = cleanupQueue;
31500
31534
  this.vnodeData = vnodeData;
31501
31535
  __publicField(this, "__brand__", "SsrNode");
@@ -31507,11 +31541,13 @@ var SsrNode = class {
31507
31541
  __publicField(this, "id");
31508
31542
  __publicField(this, "parentSsrNode");
31509
31543
  __publicField(this, "children", null);
31544
+ __publicField(this, "attrs");
31510
31545
  /** Local props which don't serialize; */
31511
31546
  __publicField(this, "localProps", null);
31512
31547
  this.parentSsrNode = parentSsrNode;
31513
31548
  this.parentSsrNode?.addChild(this);
31514
31549
  this.id = id;
31550
+ this.attrs = this.attributesIndex >= 0 ? this.vnodeData[this.attributesIndex] : _EMPTY_ARRAY;
31515
31551
  if (isDev10 && id.indexOf("undefined") != -1) {
31516
31552
  throw new Error(`Invalid SSR node id: ${id}`);
31517
31553
  }
@@ -31521,7 +31557,7 @@ var SsrNode = class {
31521
31557
  }
31522
31558
  setProp(name, value) {
31523
31559
  if (this.attrs === _EMPTY_ARRAY) {
31524
- this.attrs = [];
31560
+ this.setEmptyArrayAsVNodeDataAttributes();
31525
31561
  }
31526
31562
  if (name.startsWith(NON_SERIALIZABLE_MARKER_PREFIX)) {
31527
31563
  mapArray_set(this.localProps || (this.localProps = []), name, value, 0);
@@ -31532,6 +31568,17 @@ var SsrNode = class {
31532
31568
  this.cleanupQueue.push(value);
31533
31569
  }
31534
31570
  }
31571
+ setEmptyArrayAsVNodeDataAttributes() {
31572
+ if (this.attributesIndex >= 0) {
31573
+ this.vnodeData[this.attributesIndex] = [];
31574
+ this.attrs = this.vnodeData[this.attributesIndex];
31575
+ } else {
31576
+ const newAttributesIndex = this.vnodeData.length > 1 ? 1 : 0;
31577
+ this.vnodeData.splice(newAttributesIndex, 0, []);
31578
+ this.attributesIndex = newAttributesIndex;
31579
+ this.attrs = this.vnodeData[this.attributesIndex];
31580
+ }
31581
+ }
31535
31582
  getProp(name) {
31536
31583
  if (name.startsWith(NON_SERIALIZABLE_MARKER_PREFIX)) {
31537
31584
  return this.localProps ? mapArray_get(this.localProps, name, 0) : null;
@@ -31645,7 +31692,6 @@ var SsrComponentFrame = class {
31645
31692
  };
31646
31693
 
31647
31694
  // packages/qwik/src/server/vnode-data.ts
31648
- import { _EMPTY_ARRAY as _EMPTY_ARRAY2 } from "../core.mjs";
31649
31695
  var OPEN_FRAGMENT = Number.MAX_SAFE_INTEGER;
31650
31696
  var CLOSE_FRAGMENT = Number.MAX_SAFE_INTEGER - 1;
31651
31697
  var WRITE_ELEMENT_ATTRS = Number.MAX_SAFE_INTEGER - 2;
@@ -31682,12 +31728,12 @@ function vNodeData_openElement(vNodeData) {
31682
31728
  }
31683
31729
  function vNodeData_createSsrNodeReference(currentComponentNode, vNodeData, depthFirstElementIdx, cleanupQueue) {
31684
31730
  vNodeData[0] |= 8 /* REFERENCE */;
31685
- let fragmentAttrs = _EMPTY_ARRAY2;
31686
31731
  const stack2 = [-1];
31732
+ let attributesIndex = -1;
31687
31733
  for (let i = 1; i < vNodeData.length; i++) {
31688
31734
  const value = vNodeData[i];
31689
31735
  if (Array.isArray(value)) {
31690
- fragmentAttrs = value;
31736
+ attributesIndex = i;
31691
31737
  i++;
31692
31738
  if (vNodeData[i] !== WRITE_ELEMENT_ATTRS) {
31693
31739
  stack2[stack2.length - 1]++;
@@ -31695,7 +31741,6 @@ function vNodeData_createSsrNodeReference(currentComponentNode, vNodeData, depth
31695
31741
  }
31696
31742
  } else if (value === CLOSE_FRAGMENT) {
31697
31743
  stack2.pop();
31698
- fragmentAttrs = _EMPTY_ARRAY2;
31699
31744
  } else if (value < 0) {
31700
31745
  const numberOfElements = 0 - value;
31701
31746
  stack2[stack2.length - 1] += numberOfElements;
@@ -31712,7 +31757,7 @@ function vNodeData_createSsrNodeReference(currentComponentNode, vNodeData, depth
31712
31757
  }
31713
31758
  }
31714
31759
  }
31715
- return new SsrNode(currentComponentNode, refId, fragmentAttrs, cleanupQueue, vNodeData);
31760
+ return new SsrNode(currentComponentNode, refId, attributesIndex, cleanupQueue, vNodeData);
31716
31761
  }
31717
31762
  var ALPHANUMERIC = [];
31718
31763
  function encodeAsAlphanumeric(value) {
@@ -32457,6 +32502,7 @@ var SSRContainer = class extends _SharedContainer2 {
32457
32502
  for (let i = 0; i < fragmentAttrs.length; ) {
32458
32503
  const key = fragmentAttrs[i++];
32459
32504
  let value = fragmentAttrs[i++];
32505
+ let encodeValue = false;
32460
32506
  if (typeof value !== "string") {
32461
32507
  const rootId = addRoot(value);
32462
32508
  if (rootId === void 0) {
@@ -32478,6 +32524,7 @@ var SSRContainer = class extends _SharedContainer2 {
32478
32524
  write(VNodeDataChar.PROPS_CHAR);
32479
32525
  break;
32480
32526
  case ELEMENT_KEY:
32527
+ encodeValue = true;
32481
32528
  write(VNodeDataChar.KEY_CHAR);
32482
32529
  break;
32483
32530
  case ELEMENT_SEQ:
@@ -32504,7 +32551,15 @@ var SSRContainer = class extends _SharedContainer2 {
32504
32551
  write(key);
32505
32552
  write(VNodeDataChar.SEPARATOR_CHAR);
32506
32553
  }
32507
- write(value);
32554
+ const encodedValue = encodeValue ? encodeURI(value) : value;
32555
+ const isEncoded = encodeValue ? encodedValue !== value : false;
32556
+ if (isEncoded) {
32557
+ write(VNodeDataChar.SEPARATOR_CHAR);
32558
+ write(encodedValue);
32559
+ write(VNodeDataChar.SEPARATOR_CHAR);
32560
+ } else {
32561
+ write(value);
32562
+ }
32508
32563
  }
32509
32564
  }
32510
32565
  this.closeElement();
@@ -32593,7 +32648,7 @@ var SSRContainer = class extends _SharedContainer2 {
32593
32648
  if (unclaimedProjections.length) {
32594
32649
  const previousCurrentComponentNode = this.currentComponentNode;
32595
32650
  try {
32596
- this.openElement(QTemplate, ["style", "display:none"], null);
32651
+ this.openElement(QTemplate, ["hidden", true, "aria-hidden", "true"], null);
32597
32652
  let idx = 0;
32598
32653
  let ssrComponentNode = null;
32599
32654
  let ssrComponentFrame = null;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qwik.dev/core/testing",
3
- "version": "2.0.0-beta.1-dev+495e8d9",
3
+ "version": "2.0.0-beta.3-dev+aa098fc",
4
4
  "main": "index.mjs",
5
5
  "types": "index.d.ts",
6
6
  "private": true,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@qwik.dev/core",
3
3
  "description": "An open source framework for building instant loading web apps at any scale, without the extra effort.",
4
- "version": "2.0.0-beta.1",
4
+ "version": "2.0.0-beta.3",
5
5
  "author": "Qwik Team",
6
6
  "bin": {
7
7
  "qwik": "./qwik-cli.cjs"
@@ -9,16 +9,16 @@
9
9
  "bugs": "https://github.com/QwikDev/qwik/issues",
10
10
  "dependencies": {
11
11
  "csstype": "^3.1",
12
- "rollup": ">= 4.39.0"
12
+ "rollup": "^4.44.0"
13
13
  },
14
14
  "devDependencies": {
15
15
  "ignore": "5.3.1",
16
16
  "image-size": "1.1.1",
17
17
  "kleur": "4.1.5",
18
- "prettier": "3.4.2",
18
+ "prettier": "3.5.3",
19
19
  "ts-morph": "23.0.0",
20
- "vitest": "3.1.1",
21
- "@qwik.dev/core": "2.0.0-beta.1",
20
+ "vitest": "3.2.4",
21
+ "@qwik.dev/core": "2.0.0-beta.3",
22
22
  "@qwik.dev/dom": "2.1.19"
23
23
  },
24
24
  "engines": {
@@ -181,7 +181,7 @@
181
181
  "main": "./src/index.ts",
182
182
  "peerDependencies": {
183
183
  "prettier": "*",
184
- "vite": ">=5 <7",
184
+ "vite": ">=5 <8",
185
185
  "vitest": ">=2 <3"
186
186
  },
187
187
  "peerDependenciesMeta": {