bimba-cli 0.5.2 → 0.5.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/serve.js +8 -32
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bimba-cli",
3
- "version": "0.5.2",
3
+ "version": "0.5.3",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/HeapVoid/bimba.git"
package/serve.js CHANGED
@@ -67,11 +67,10 @@ const hmrClient = `
67
67
  _hotTags = [];
68
68
 
69
69
  import('/' + file + '?t=' + Date.now()).then(() => {
70
- const updatedTags = _hotTags.slice();
71
70
  _hotTags = [];
72
71
 
73
- // Always remove duplicate root elements. Re-importing a module with a
74
- // fresh ?t= query causes top-level code (e.g. imba.mount()) to run again,
72
+ // Remove duplicate root elements. Re-importing a module with a fresh
73
+ // ?t= query causes top-level code (e.g. imba.mount()) to run again,
75
74
  // which can append a second copy of the root tag to body.
76
75
  const seen = new Set();
77
76
  [...document.body.children].forEach(el => {
@@ -80,35 +79,12 @@ const hmrClient = `
80
79
  else seen.add(tag);
81
80
  });
82
81
 
83
- // JS changed: find all instances of the updated tag types, reset their
84
- // render output (innerHTML), then let imba re-render from current state.
85
- //
86
- // innerHTML = '' removes rendered DOM children but does NOT touch instance
87
- // properties so el.active, el.selectedTab etc. survive.
88
- //
89
- // We also clear any symbol keys that point to DOM Nodes (Imba's render
90
- // cache) so the new render method (which uses new module-scoped symbols)
91
- // starts clean and doesn't leave orphaned nodes.
92
-
93
- const toReset = new Set();
94
-
95
- updatedTags.forEach(tagName => {
96
- document.querySelectorAll(tagName).forEach(el => {
97
- toReset.add(el);
98
- });
99
- });
100
-
101
- toReset.forEach(el => {
102
- // Clear Imba render cache (symbol → Node mappings)
103
- Object.getOwnPropertySymbols(el).forEach(s => {
104
- try { if (el[s] instanceof Node) el[s] = undefined; } catch(_) {}
105
- });
106
- el.innerHTML = '';
107
- });
108
-
109
- if (toReset.size > 0 && typeof imba !== 'undefined') {
110
- imba.commit();
111
- }
82
+ // Let Imba re-render in place from the patched prototypes. We do NOT
83
+ // touch instance DOM (no innerHTML reset, no symbol cleanup) that
84
+ // would destroy rendered children like open popups / dropdowns and
85
+ // collapse any transient UI state. Prototype patching already makes
86
+ // the next render use the new methods; imba.commit() triggers it.
87
+ if (typeof imba !== 'undefined') imba.commit();
112
88
  });
113
89
  }
114
90