enigmatic 0.11.3 → 0.11.5
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/enigmatic.js +27 -25
- package/package.json +1 -1
package/enigmatic.js
CHANGED
|
@@ -70,7 +70,7 @@ w.element = (
|
|
|
70
70
|
}
|
|
71
71
|
set(o) {
|
|
72
72
|
o = beforeData(o)
|
|
73
|
-
w.flatten(o, this.template)
|
|
73
|
+
this.innerHTML = w.flatten(o, this.template)
|
|
74
74
|
return o
|
|
75
75
|
}
|
|
76
76
|
}
|
|
@@ -83,22 +83,22 @@ if (window.components) {
|
|
|
83
83
|
|
|
84
84
|
/////// State, data, and reactivity
|
|
85
85
|
w.state = new Proxy({}, {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
}
|
|
94
|
-
obj[prop] = value
|
|
95
|
-
return value
|
|
96
|
-
},
|
|
97
|
-
get: (obj, prop, receiver) => {
|
|
98
|
-
if (prop == '_all') return obj
|
|
99
|
-
return obj[prop]
|
|
86
|
+
set: (obj, prop, value) => {
|
|
87
|
+
console.log(prop, value)
|
|
88
|
+
if (this[prop] === value) {
|
|
89
|
+
return true
|
|
90
|
+
}
|
|
91
|
+
for (const e of $$(`[data=${prop}]`)) {
|
|
92
|
+
if (e.set) e.set(value)
|
|
100
93
|
}
|
|
94
|
+
obj[prop] = value
|
|
95
|
+
return value
|
|
96
|
+
},
|
|
97
|
+
get: (obj, prop, receiver) => {
|
|
98
|
+
if (prop == '_all') return obj
|
|
99
|
+
return obj[prop]
|
|
101
100
|
}
|
|
101
|
+
}
|
|
102
102
|
)
|
|
103
103
|
|
|
104
104
|
w.save = (obj, name) => {
|
|
@@ -145,19 +145,21 @@ w.start = async () => {
|
|
|
145
145
|
let dta = e.attr?.data
|
|
146
146
|
if (dta) {
|
|
147
147
|
console.log(`processing ${e}`)
|
|
148
|
-
if (e.
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
e.innerHTML
|
|
148
|
+
if (!e.set) {
|
|
149
|
+
if (e.innerHTML) {
|
|
150
|
+
e.template = e.innerHTML
|
|
151
|
+
if (e.innerHTML.match('{')) {
|
|
152
|
+
e.innerHTML = ''
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
e.set = (o) => {
|
|
156
|
+
e.innerHTML = w.flatten(o, e.template)
|
|
152
157
|
}
|
|
153
|
-
}
|
|
154
|
-
e.set = (o) => {
|
|
155
|
-
e.innerHTML = w.flatten(o, e.template)
|
|
156
158
|
}
|
|
157
159
|
if (e.attr?.value) {
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
160
|
+
let o = e.attr.value
|
|
161
|
+
try { o = JSON.parse(o) } catch (e) { }
|
|
162
|
+
w.state[dta] = o
|
|
161
163
|
}
|
|
162
164
|
}
|
|
163
165
|
})
|