@lvce-editor/virtual-dom 6.1.0 → 6.2.0

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/index.js +1 -33
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -695,38 +695,6 @@ const propertyToAttribute = {
695
695
 
696
696
  // Style properties that need to be set on element.style
697
697
  const styleProperties = new Set(['width', 'height', 'top', 'left', 'marginTop', 'paddingLeft', 'paddingRight']);
698
-
699
- // TODO merge this with the setProp function
700
-
701
- const setAttribute = ($Element, key, value) => {
702
- // Handle width/height for images (set as attributes, not style)
703
- if ((key === 'width' || key === 'height') && $Element instanceof HTMLImageElement) {
704
- // @ts-ignore - dynamic property access
705
- $Element[key] = value;
706
- return;
707
- }
708
-
709
- // Handle style properties
710
- if (styleProperties.has(key)) {
711
- // @ts-ignore - dynamic style property access
712
- $Element.style[key] = typeof value === 'number' ? `${value}px` : value;
713
- return;
714
- }
715
-
716
- // Handle aria attributes - map camelCase to hyphenated form
717
- if (key in propertyToAttribute) {
718
- $Element.setAttribute(propertyToAttribute[key], value);
719
- return;
720
- }
721
-
722
- // Use property assignment for known DOM properties, attribute for others
723
- if (key in $Element) {
724
- // @ts-ignore - dynamic property access
725
- $Element[key] = value;
726
- } else {
727
- $Element.setAttribute(key, value);
728
- }
729
- };
730
698
  const removeAttribute = ($Element, key) => {
731
699
  // Handle style properties
732
700
  if (styleProperties.has(key)) {
@@ -793,7 +761,7 @@ const applyPatch = ($Element, patches, eventMap = {}) => {
793
761
  $Current = replace($Current, patch.nodes, eventMap);
794
762
  break;
795
763
  case SetAttribute:
796
- setAttribute($Current, patch.key, patch.value);
764
+ setProp($Current, patch.key, patch.value, eventMap);
797
765
  break;
798
766
  case SetText:
799
767
  setText($Current, patch.value);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/virtual-dom",
3
- "version": "6.1.0",
3
+ "version": "6.2.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/lvce-editor/virtual-dom.git"