@ryupold/vode 1.5.1 → 1.5.2

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ryupold/vode",
3
- "version": "1.5.1",
3
+ "version": "1.5.2",
4
4
  "description": "a minimalist web framework",
5
5
  "author": "Michael Scherbakow (ryupold)",
6
6
  "license": "MIT",
@@ -26,17 +26,16 @@
26
26
  "homepage": "https://github.com/ryupold/vode#readme",
27
27
  "module": "index.ts",
28
28
  "scripts": {
29
- "build": "bun build index.ts --outfile dist/vode.mjs",
30
- "build-min": "bun build index.ts --outfile dist/vode.min.mjs --minify",
31
- "build-classic": "esbuild index.ts --outfile=dist/vode.js --bundle --global-name=V",
32
- "build-classic-min": "esbuild index.ts --outfile=dist/vode.min.js --bundle --global-name=V --minify",
33
- "release": "bun run build && bun run build-min && bun run build-classic && bun run build-classic-min",
29
+ "build": "esbuild index.ts --bundle --format=esm --outfile=dist/vode.mjs ",
30
+ "build-min": "esbuild index.ts --bundle --format=esm --minify --outfile=dist/vode.min.mjs",
31
+ "build-classic": "esbuild index.ts --outfile=dist/vode.js --bundle --format=iife --global-name=V",
32
+ "build-classic-min": "esbuild index.ts --outfile=dist/vode.min.js --bundle --format=iife --global-name=V --minify",
33
+ "release": "npm run build && npm run build-min && npm run build-classic && npm run build-classic-min",
34
34
  "publish": "npm publish --access public",
35
35
  "clean": "tsc -b --clean",
36
36
  "watch": "tsc -b -w"
37
37
  },
38
38
  "devDependencies": {
39
- "bun": "1.3.1",
40
39
  "esbuild": "0.25.12",
41
40
  "typescript": "5.9.3"
42
41
  }
package/src/vode.ts CHANGED
@@ -543,6 +543,11 @@ function render<S>(state: S, patch: Dispatch<S>, parent: Element, childIndex: nu
543
543
 
544
544
  patchProperties(state, patch, newNode, undefined, properties);
545
545
 
546
+ if (!!properties && 'catch' in properties) {
547
+ (<any>newVode).node['catch'] = null;
548
+ (<any>newVode).node.removeAttribute('catch');
549
+ }
550
+
546
551
  if (oldNode) {
547
552
  (<any>oldNode).onUnmount && patch((<any>oldNode).onUnmount(oldNode));
548
553
  oldNode.replaceWith(newNode);
@@ -574,24 +579,24 @@ function render<S>(state: S, patch: Dispatch<S>, parent: Element, childIndex: nu
574
579
  const newvode = <Vode<S>>newVode;
575
580
  const oldvode = <Vode<S>>oldVode;
576
581
 
577
- let hasProps = false;
582
+ const properties = props(newVode);
583
+ let hasProps = !!properties;
584
+ const oldProps = props(oldVode);
585
+
578
586
  if ((<any>newvode[1])?.__memo) {
579
587
  const prev = newvode[1] as any;
580
588
  newvode[1] = remember(state, newvode[1], oldvode[1]) as Vode<S>;
581
589
  if (prev !== newvode[1]) {
582
- const properties = props(newVode);
583
- patchProperties(state, patch, oldNode!, props(oldVode), properties);
584
- hasProps = !!properties;
590
+ patchProperties(state, patch, oldNode!, oldProps, properties);
585
591
  }
586
592
  }
587
593
  else {
588
- const properties = props(newVode);
589
- patchProperties(state, patch, oldNode!, props(oldVode), properties);
590
- hasProps = !!properties;
591
- if (hasProps && 'catch' in (properties!)) { //hold catch information only in vdom
592
- (<any>newVode).node['catch'] = null;
593
- (<any>newVode).node.removeAttribute('catch');
594
- }
594
+ patchProperties(state, patch, oldNode!, oldProps, properties);
595
+ }
596
+
597
+ if (!!properties?.catch && oldProps?.catch !== properties.catch) {
598
+ (<any>newVode).node['catch'] = null;
599
+ (<any>newVode).node.removeAttribute('catch');
595
600
  }
596
601
 
597
602
  const newKids = children(newVode);