@vesk/vesk-cli 0.2.57 → 0.2.58

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 (2) hide show
  1. package/dist/cli.js +45 -2
  2. package/package.json +5 -5
package/dist/cli.js CHANGED
@@ -31669,6 +31669,18 @@ function generateComponent(comp, importedNames = /* @__PURE__ */ new Set(), hydr
31669
31669
  `(typeof __hydrate.takeSkipK === 'function' ? __hydrate.takeSkipK() : 0)`
31670
31670
  );
31671
31671
  }
31672
+ if (ctx2.hydrate) {
31673
+ const bodyNodes = comp.body.filter((node) => !(node instanceof TrackDecl));
31674
+ const slotless = (node) => node instanceof StaticNode || node instanceof TextNode || node instanceof RuntimeStatement || node instanceof DynamicBinding && node.kind === "text";
31675
+ const claimless = bodyNodes.every((node) => slotless(node) && !claimsWalkerNode(ctx2, node));
31676
+ if (claimless) {
31677
+ const slots = bodyNodes.filter((node) => node instanceof StaticNode).length;
31678
+ for (let i = 0; i < slots; i++) {
31679
+ ctx2.push(indent2(`__hydrate.claimOnly(undefined, ${i === 0 && topBudget ? topBudget : "0"});`));
31680
+ if (i === 0 && topBudget) ctx2.push(indent2(`${topBudget} = 0;`));
31681
+ }
31682
+ }
31683
+ }
31672
31684
  for (const node of comp.body) {
31673
31685
  if (node instanceof TrackDecl) continue;
31674
31686
  const v = emitNode(ctx2, node, tracked2, null, void 0, "__components", topPendingSkip, topBudget || void 0);
@@ -31693,7 +31705,16 @@ function generateComponent(comp, importedNames = /* @__PURE__ */ new Set(), hydr
31693
31705
  ctx2.push(indent2(`if ($mount === null) $mount = document.createDocumentFragment();`));
31694
31706
  ctx2.push(indent2(`return __pendingChild || $mount;`));
31695
31707
  } else {
31696
- ctx2.push(indent2(`return __pendingChild || $root;`));
31708
+ const hasBareSlot = comp.body.some((node) => node instanceof SlotNode);
31709
+ if (hasBareSlot) {
31710
+ ctx2.push(indent2(`if (__pendingChild !== null && __pendingChild !== undefined) {`));
31711
+ ctx2.push(indent2(` if (typeof __pendingChild.then === 'function') return __pendingChild.then((__c) => { $root.appendChild(toDomNode(__c)); return $root; });`));
31712
+ ctx2.push(indent2(` const __c = toDomNode(__pendingChild);`));
31713
+ ctx2.push(indent2(` if ($root.childNodes.length === 0) return __c;`));
31714
+ ctx2.push(indent2(` $root.appendChild(__c);`));
31715
+ ctx2.push(indent2(`}`));
31716
+ }
31717
+ ctx2.push(indent2(hasBareSlot ? `return $root;` : `return __pendingChild || $root;`));
31697
31718
  }
31698
31719
  ctx2.push(indent2(`} finally {`));
31699
31720
  ctx2.push(indent2(` setActiveComponent(__prev);`));
@@ -53616,6 +53637,19 @@ function generateComponent2(comp, importedNames = /* @__PURE__ */ new Set(), hyd
53616
53637
  if (ctx2.markerless && ctx2.hydrate) {
53617
53638
  topBudget = regionBudgetVar2(ctx2, 0, void 0, `(typeof __hydrate.takeSkipK === 'function' ? __hydrate.takeSkipK() : 0)`);
53618
53639
  }
53640
+ if (ctx2.hydrate) {
53641
+ const bodyNodes = comp.body.filter((node) => !(node instanceof TrackDecl));
53642
+ const slotless = (node) => node instanceof StaticNode || node instanceof TextNode || node instanceof RuntimeStatement || node instanceof DynamicBinding && node.kind === "text";
53643
+ const claimless = bodyNodes.every((node) => slotless(node) && !claimsWalkerNode2(ctx2, node));
53644
+ if (claimless) {
53645
+ const slots = bodyNodes.filter((node) => node instanceof StaticNode).length;
53646
+ for (let i = 0; i < slots; i++) {
53647
+ ctx2.push(indent3(`__hydrate.claimOnly(undefined, ${i === 0 && topBudget ? topBudget : "0"});`));
53648
+ if (i === 0 && topBudget)
53649
+ ctx2.push(indent3(`${topBudget} = 0;`));
53650
+ }
53651
+ }
53652
+ }
53619
53653
  for (const node of comp.body) {
53620
53654
  if (node instanceof TrackDecl)
53621
53655
  continue;
@@ -53644,7 +53678,16 @@ function generateComponent2(comp, importedNames = /* @__PURE__ */ new Set(), hyd
53644
53678
  ctx2.push(indent3(`if ($mount === null) $mount = document.createDocumentFragment();`));
53645
53679
  ctx2.push(indent3(`return __pendingChild || $mount;`));
53646
53680
  } else {
53647
- ctx2.push(indent3(`return __pendingChild || $root;`));
53681
+ const hasBareSlot = comp.body.some((node) => node instanceof SlotNode);
53682
+ if (hasBareSlot) {
53683
+ ctx2.push(indent3(`if (__pendingChild !== null && __pendingChild !== undefined) {`));
53684
+ ctx2.push(indent3(` if (typeof __pendingChild.then === 'function') return __pendingChild.then((__c) => { $root.appendChild(toDomNode(__c)); return $root; });`));
53685
+ ctx2.push(indent3(` const __c = toDomNode(__pendingChild);`));
53686
+ ctx2.push(indent3(` if ($root.childNodes.length === 0) return __c;`));
53687
+ ctx2.push(indent3(` $root.appendChild(__c);`));
53688
+ ctx2.push(indent3(`}`));
53689
+ }
53690
+ ctx2.push(indent3(hasBareSlot ? `return $root;` : `return __pendingChild || $root;`));
53648
53691
  }
53649
53692
  ctx2.push(indent3(`} finally {`));
53650
53693
  ctx2.push(indent3(` setActiveComponent(__prev);`));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vesk/vesk-cli",
3
- "version": "0.2.57",
3
+ "version": "0.2.58",
4
4
  "type": "module",
5
5
  "description": "Vesk — compiler-first framework for the post-VDOM web. vesk dev, vesk build.",
6
6
  "bin": {
@@ -8,10 +8,10 @@
8
8
  },
9
9
  "main": "./dist/cli.js",
10
10
  "dependencies": {
11
- "@vesk/adapter": "^0.2.57",
12
- "@vesk/compiler": "^0.2.57",
13
- "@vesk/plugin-tailwind": "^0.2.57",
14
- "@vesk/runtime": "^0.2.57",
11
+ "@vesk/adapter": "^0.2.58",
12
+ "@vesk/compiler": "^0.2.58",
13
+ "@vesk/plugin-tailwind": "^0.2.58",
14
+ "@vesk/runtime": "^0.2.58",
15
15
  "esrap": "^2.3.0",
16
16
  "typescript": "^5.8.0",
17
17
  "ws": "^8.18.0",