Comparing version 0.0.7 to 0.0.8
{ | ||
"name": "realdom", | ||
"version": "0.0.7", | ||
"version": "0.0.8", | ||
"author": "Fedot Kriutchenko <fodyadev@gmail.com>", | ||
@@ -5,0 +5,0 @@ "description": "", |
@@ -1,2 +0,1 @@ | ||
import { runWithState, getCurrentHandler } from './state.js'; | ||
import { argsToArray, isReactive, toString, kebab } from './common.js'; | ||
@@ -8,4 +7,4 @@ | ||
? (args[0] = tasks, effect(...args)) | ||
: Builder(effect, [...tasks, { names, args }], []), | ||
{ get: (_, k) => k === symbol | ||
: Builder(effect, [...tasks, { names, args }], []), { | ||
get: (_, k) => k === symbol | ||
? effect[k] | ||
@@ -35,3 +34,3 @@ : Builder(effect, tasks, [...names, k]) | ||
const textContent = Operator(true, (node, _, args) => { | ||
const textContent = Operator(isReactive, (node, _, args) => { | ||
node.textContent = toString(args); | ||
@@ -50,16 +49,14 @@ }); | ||
let child = init ? null : node.firstChild; | ||
const append = item => node.appendChild(item(symbol, null, init)); | ||
const apply = item => item(symbol, node, init); | ||
const hydrate = item => (item(symbol, child, init), child = child.nextSibling); | ||
for (const item of argsToArray(content)) switch (item[symbol]) { | ||
case 1: | ||
if (init) node.appendChild(item(symbol, null, init)); | ||
else (item(symbol, child, init), child = child.nextSibling); | ||
break; | ||
case 2: item(symbol, node, init); break; | ||
case 1: (init ? append : hydrate)(item); break; | ||
case 2: apply(item); break; | ||
default: | ||
if (tag === '' || tag === '!') textContent(item)(symbol, node, init); | ||
else if (init) | ||
node.appendChild(Element('')(textContent(item))(symbol, null, init)); | ||
else { | ||
textContent(item)(symbol, child, init); | ||
child = child.nextSibling; | ||
} | ||
const text = textContent(item); | ||
if (tag === '' || tag === '!') apply(text); | ||
else if (init) append(Element('')(text)); | ||
else hydrate(text); | ||
} | ||
@@ -66,0 +63,0 @@ return node; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3495
63