pawajs 2.0.5 → 2.0.7

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/CHANGELOG.md CHANGED
@@ -22,4 +22,5 @@ CHANGELOG.md
22
22
  + version 1.5.2 - added function dependencies
23
23
  + version 2.0.1 -2.0.2 made runEffect to be global or component capability
24
24
  + version 2.0.3 integrating HMR system
25
- + version 2.0.4 experimental of hmr
25
+ + version 2.0.4 experimental of hmr
26
+ + version 2.0.5 - 2.0.6 experimental of hmr
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pawajs",
3
- "version": "2.0.5",
3
+ "version": "2.0.7",
4
4
  "type":"module",
5
5
  "description": "pawajs library (reactive web runtime) for easily building web ui, enhancing html element, micro frontend, spa etc ",
6
6
  "main": "index.js",
package/pawaElement.js CHANGED
@@ -19,6 +19,19 @@ export class PawaElement {
19
19
  constructor(element,context) {
20
20
  this.#context=context
21
21
  this.#el=element
22
+ // ── Bind every method that touches private fields ──
23
+ this.getChildrenTree = this.getChildrenTree.bind(this)
24
+ this.checkLazy = this.checkLazy.bind(this)
25
+ this.safeEval = this.safeEval.bind(this)
26
+ this.setPawaAttr = this.setPawaAttr.bind(this)
27
+ this.findPawaAttribute = this.findPawaAttribute.bind(this)
28
+ this.getNewElementByRemovingAttr = this.getNewElementByRemovingAttr.bind(this)
29
+ this.remove = this.remove.bind(this)
30
+ this.unMount = this.unMount.bind(this)
31
+ this.elementType = this.elementType.bind(this)
32
+ this.setProps = this.setProps.bind(this)
33
+ this.clearContext = this.clearContext.bind(this)
34
+ // ───────────────────────────────────────────
22
35
  const div=element.cloneNode(true)
23
36
  Object.assign(this, {
24
37
  _resetEffects: new Set(), _context: context, _avoidPawaRender: element.hasAttribute('pawa-avoid'),
@@ -78,9 +91,9 @@ export class PawaElement {
78
91
 
79
92
  }catch(error){
80
93
  throw new Error(`Error evaluating expression: ${expression}\n${error.message}`);
81
-
94
+ let element=this.#el || null
82
95
  __pawaDev.setError({
83
- el:this?._el,
96
+ el:element,
84
97
  msg:`from ${expression}`,
85
98
  directives:directive,
86
99
  stack:error.stack,
@@ -189,7 +202,7 @@ export class PawaElement {
189
202
  const animate=this._exitAnimation().then(async () => {
190
203
  await this._callUnmount()
191
204
  this._out = true
192
- this._el.remove()
205
+ this.#el.remove()
193
206
  if (callback) {
194
207
  callback()
195
208
  }
@@ -201,7 +214,7 @@ export class PawaElement {
201
214
  } else {
202
215
  this._callUnmount()
203
216
  this._out=true
204
- this._el.remove()
217
+ this.#el.remove()
205
218
  if (callback) {
206
219
  callback()
207
220
  }
@@ -225,9 +238,9 @@ export class PawaElement {
225
238
  func()
226
239
  })
227
240
  this._deleteEffects()
228
- Array.from(this._el.childNodes).forEach(child => {
241
+ Array.from(this.#el.childNodes).forEach(child => {
229
242
  if (child.nodeType === 1) {
230
- if (child?._el) {
243
+ if (child?._template) {
231
244
  child._out = true
232
245
  child._deleteEffects()
233
246
  child._callUnmount()