@daz4126/helium 0.4.0 → 0.5.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.
- package/helium.js +20 -0
- package/package.json +1 -1
package/helium.js
CHANGED
|
@@ -5,6 +5,11 @@ export default function helium(data = {}) {
|
|
|
5
5
|
document.body;
|
|
6
6
|
const [bindings, refs] = [new Map(), new Map()];
|
|
7
7
|
const $ = (selector) => document.querySelector(selector);
|
|
8
|
+
const html = (string) => {
|
|
9
|
+
const temp = document.createElement("template");
|
|
10
|
+
temp.innerHTML = string;
|
|
11
|
+
return temp.content.firstChild;
|
|
12
|
+
};
|
|
8
13
|
const state = new Proxy(data, {
|
|
9
14
|
get(target, prop) {
|
|
10
15
|
return target[prop];
|
|
@@ -36,6 +41,7 @@ export default function helium(data = {}) {
|
|
|
36
41
|
"$data",
|
|
37
42
|
"$event",
|
|
38
43
|
"$el",
|
|
44
|
+
"$html",
|
|
39
45
|
...Object.keys(data),
|
|
40
46
|
...[...refs.keys()],
|
|
41
47
|
`with($data) { ${withReturn ? "return" : ""} (${expr.trim()}) }`,
|
|
@@ -90,6 +96,7 @@ export default function helium(data = {}) {
|
|
|
90
96
|
state,
|
|
91
97
|
{},
|
|
92
98
|
el,
|
|
99
|
+
html,
|
|
93
100
|
...Object.values(data),
|
|
94
101
|
...[...refs.values()],
|
|
95
102
|
),
|
|
@@ -164,6 +171,7 @@ export default function helium(data = {}) {
|
|
|
164
171
|
state,
|
|
165
172
|
undefined,
|
|
166
173
|
el,
|
|
174
|
+
html,
|
|
167
175
|
...Object.values(data),
|
|
168
176
|
...[...refs.values()],
|
|
169
177
|
);
|
|
@@ -220,6 +228,7 @@ export default function helium(data = {}) {
|
|
|
220
228
|
state,
|
|
221
229
|
e,
|
|
222
230
|
el,
|
|
231
|
+
html,
|
|
223
232
|
...Object.values(data),
|
|
224
233
|
...[...refs.values()],
|
|
225
234
|
);
|
|
@@ -247,3 +256,14 @@ export default function helium(data = {}) {
|
|
|
247
256
|
}
|
|
248
257
|
processElements(root);
|
|
249
258
|
}
|
|
259
|
+
|
|
260
|
+
helium({
|
|
261
|
+
appendTo: (el) =>
|
|
262
|
+
el.append(
|
|
263
|
+
html(`<p :class="count > 3 && 'danger'" @click=$el.remove()>OG!!</p>`),
|
|
264
|
+
),
|
|
265
|
+
open: false,
|
|
266
|
+
placeholder: "test placehodler",
|
|
267
|
+
count: 0,
|
|
268
|
+
name: "",
|
|
269
|
+
});
|