pawajs 1.4.23 → 1.4.24
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 +2 -1
- package/index.js +6 -3
- package/normal/component.js +16 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -9,4 +9,5 @@ CHANGELOG.md
|
|
|
9
9
|
+ version 1.4.18 - 1.4.19 fixed issue with component inside template and added event modifiers
|
|
10
10
|
+ version 1.4.19 - 1.4.21 made runEffect Global
|
|
11
11
|
+ version 1.4.22 fixed merger if when the ssr render else and else render down in pawajs engine
|
|
12
|
-
+ version 1.4.23
|
|
12
|
+
+ version 1.4.23 fixed _context from production
|
|
13
|
+
+ version 1.4.24 - add HMR mapping
|
package/index.js
CHANGED
|
@@ -187,7 +187,8 @@ let stateContext = {
|
|
|
187
187
|
_template: '',
|
|
188
188
|
_serializedData:{},
|
|
189
189
|
_static: [],
|
|
190
|
-
_id:""
|
|
190
|
+
_id:"",
|
|
191
|
+
hmr:false
|
|
191
192
|
}
|
|
192
193
|
|
|
193
194
|
export const getCurrentContext = () => {
|
|
@@ -559,6 +560,7 @@ export const setStateContext = (context) => {
|
|
|
559
560
|
stateContext._template = ''
|
|
560
561
|
stateContext._resume = false
|
|
561
562
|
stateContext._suspense=''
|
|
563
|
+
stateContext._hmr=false
|
|
562
564
|
stateContext._hook={
|
|
563
565
|
beforeMount:[],
|
|
564
566
|
reactiveEffect:[],
|
|
@@ -739,6 +741,7 @@ const stateWatch = (callback, dependencies) => {
|
|
|
739
741
|
export const restoreContext = (state_context) => {
|
|
740
742
|
stateContext = state_context._formerContext
|
|
741
743
|
}
|
|
744
|
+
export const HmrComponentMap=new Map()
|
|
742
745
|
/**
|
|
743
746
|
*
|
|
744
747
|
* @param {PawaElement|HTMLElement} el
|
|
@@ -1141,8 +1144,8 @@ export const render = (el, contexts = {}, notRender, isName) => {
|
|
|
1141
1144
|
render(child, context, number, isName)
|
|
1142
1145
|
})
|
|
1143
1146
|
el._callMount()
|
|
1144
|
-
el.
|
|
1145
|
-
|
|
1147
|
+
if (el.hasAttribute('p:c') && !el.hasAttribute('p-async')) {
|
|
1148
|
+
el._clearContext()
|
|
1146
1149
|
el.removeAttribute('p:c')
|
|
1147
1150
|
}
|
|
1148
1151
|
}
|
package/normal/component.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {propsValidator, setPawaDevError, pawaWayRemover, checkKeywordsExistence, sanitizeTemplate } from '../utils.js';
|
|
2
2
|
import {PawaElement,PawaComment} from '../pawaElement.js';
|
|
3
|
-
import {keepContext,render} from '../index.js'
|
|
3
|
+
import {keepContext,render, HmrComponentMap } from '../index.js'
|
|
4
4
|
import {createEffect} from '../reactive.js'
|
|
5
5
|
export const normal_component=(el,stateContext,setStateContext,mapsPlugin,formerStateContext,pawaContext,stateWatch)=>{
|
|
6
6
|
const compoBeforeCall=mapsPlugin.compoBeforeCall
|
|
@@ -79,6 +79,21 @@ export const normal_component=(el,stateContext,setStateContext,mapsPlugin,former
|
|
|
79
79
|
let compo
|
|
80
80
|
let awaits=false
|
|
81
81
|
let suspense=''
|
|
82
|
+
if (__pawaDev.tool) {
|
|
83
|
+
const id= crypto.randomUUID()
|
|
84
|
+
if (HmrComponentMap.has(stateContexts._name)) {
|
|
85
|
+
HmrComponentMap.get(stateContexts._name).push({id:id,template:el._template,el:el,stateContext:stateContexts})
|
|
86
|
+
}else{
|
|
87
|
+
HmrComponentMap.set(stateContexts._name,[{id:id,template:el._template,el:el,stateContext:stateContexts}])
|
|
88
|
+
}
|
|
89
|
+
el._setUnMount(()=>{
|
|
90
|
+
const array=HmrComponentMap.get(stateContexts._name)
|
|
91
|
+
if(array){
|
|
92
|
+
const index=array.findIndex(item => item.id === id)
|
|
93
|
+
if(index !== -1) array.splice(index,1)
|
|
94
|
+
}
|
|
95
|
+
})
|
|
96
|
+
}
|
|
82
97
|
try {
|
|
83
98
|
if(done){
|
|
84
99
|
const compoCall=component.component(app)
|