@erickmerchant/framework
Advanced tools
Comparing version 43.1.1 to 43.1.2
@@ -138,3 +138,3 @@ import {tokenTypes} from './html.js' | ||
if (isExistingElement && isSameView) { | ||
attributeIndex = next.attributes.inset ?? 0 | ||
attributeIndex = next.attributes.offset ?? 0 | ||
} | ||
@@ -185,3 +185,3 @@ | ||
if (isExistingElement && isSameView) { | ||
childIndex = next.children.inset ?? 0 | ||
childIndex = next.children.offset ?? 0 | ||
@@ -188,0 +188,0 @@ childNode = target.childNodes[childIndex] |
71
html.js
@@ -173,3 +173,3 @@ const weakMap = new WeakMap() | ||
const parse = (tokens, parent, tag, variables) => { | ||
const parse = (nextToken, parent, tag, variables) => { | ||
const child = { | ||
@@ -183,39 +183,29 @@ tag, | ||
let current | ||
let token | ||
for (;;) { | ||
current = tokens.next() | ||
token = nextToken() | ||
if (current.done) break | ||
if (token == null || token === END) break | ||
const token = current.value | ||
if (token === END) { | ||
break | ||
} | ||
let next = token | ||
let key = false | ||
let firstChar | ||
let hasColon | ||
let hasAtSign | ||
let constant = false | ||
let value = token.value | ||
if (next.type === tokenTypes.key) { | ||
next = tokens.next()?.value | ||
if (token.type === tokenTypes.key) { | ||
key = token.value | ||
token = nextToken() | ||
firstChar = key.charAt(0) | ||
hasColon = ':' === firstChar | ||
hasAtSign = '@' === firstChar | ||
const firstChar = key.charAt(0) | ||
const colon = ':' === firstChar | ||
const atSign = '@' === firstChar | ||
if (hasColon) { | ||
key = token.value.substring(1) | ||
if (colon) { | ||
key = key.substring(1) | ||
} | ||
constant = next.type === tokenTypes.value | ||
value = next.value | ||
constant = token.type === tokenTypes.value | ||
value = token.value | ||
if (next.type === tokenTypes.variable && !hasColon && !hasAtSign) { | ||
if (token.type === tokenTypes.variable && !colon && !atSign) { | ||
value = variables[value] | ||
@@ -227,3 +217,3 @@ constant = true | ||
if (constant) { | ||
if (child.attributes.inset != null) child.attributes.inset++ | ||
if (child.attributes.offset != null) child.attributes.offset++ | ||
@@ -238,3 +228,4 @@ child.attributes.unshift({ | ||
child.attributes.inset = child.attributes.inset ?? child.attributes.length | ||
child.attributes.offset = | ||
child.attributes.offset ?? child.attributes.length | ||
@@ -250,12 +241,10 @@ child.attributes.push({ | ||
for (;;) { | ||
current = tokens.next() | ||
token = nextToken() | ||
if (current.done) break | ||
if (token == null) break | ||
const token = current.value | ||
if (token.type === tokenTypes.endtag && token.value === child.tag) { | ||
break | ||
} else if (token.type === tokenTypes.tag) { | ||
const dynamic = parse(tokens, child, token.value, variables) | ||
const dynamic = parse(nextToken, child, token.value, variables) | ||
@@ -271,3 +260,3 @@ child.dynamic = child.dynamic || dynamic | ||
child.children.inset = child.children.inset ?? child.children.length | ||
child.children.offset = child.children.offset ?? child.children.length | ||
@@ -282,3 +271,3 @@ child.children.push({ | ||
if (child.dynamic) { | ||
parent.children.inset = parent.children.inset ?? parent.children.length | ||
parent.children.offset = parent.children.offset ?? parent.children.length | ||
} | ||
@@ -300,13 +289,19 @@ | ||
const nextToken = () => { | ||
const token = tokens.next() | ||
if (token.done) return | ||
return token.value | ||
} | ||
const children = [] | ||
for (;;) { | ||
const current = tokens.next() | ||
const token = nextToken() | ||
if (current.done) break | ||
if (token == null) break | ||
const token = current.value | ||
if (token.type === tokenTypes.tag) { | ||
parse(tokens, {children}, token.value, variables) | ||
parse(nextToken, {children}, token.value, variables) | ||
} else if (token.type === tokenTypes.text && token.value.trim()) { | ||
@@ -313,0 +308,0 @@ throw createAssertionError(token.type, "'node'") |
{ | ||
"name": "@erickmerchant/framework", | ||
"version": "43.1.1", | ||
"version": "43.1.2", | ||
"description": "A front-end framework.", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/erickmerchant/framework#readme", |
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
18678
600