Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@erickmerchant/framework

Package Overview
Dependencies
Maintainers
1
Versions
244
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@erickmerchant/framework - npm Package Compare versions

Comparing version 46.0.0 to 47.0.0

42

dom-view.js

@@ -31,13 +31,29 @@ import {tokenTypes} from './html.js'

const rekeyMap = {
class: 'className',
for: 'htmlFor'
}
const morphAttribute = (target, key, value, isExistingElement) => {
const remove = isExistingElement && value == null
const firstChar = key.charAt(0)
const hasDash = ~key.indexOf('-')
if (key.charAt(0) === '@') {
const type = key.substring(1)
if (firstChar === ':' || firstChar === '@') {
key = key.substring(1)
}
if (firstChar === ':' && !hasDash) {
key = rekeyMap[key] ?? key
if (value == null) {
delete target[key]
} else if (target[key] !== value) {
target[key] = value
}
} else if (firstChar === '@') {
const meta = readMeta(target)
meta[type] = value
meta[key] = value
if (!remove) {
if (value != null) {
const document = target.ownerDocument

@@ -47,14 +63,10 @@

if (!listeners[type]) {
listeners[type] = true
if (!listeners[key]) {
listeners[key] = true
addListener(document, type)
addListener(document, key)
}
}
} else if (remove) {
} else if (isExistingElement && value == null) {
target.removeAttribute(key)
} else if (value === true || value === false || key === 'value') {
if (target[key] !== value) {
target[key] = value
}
} else if (value != null && target.getAttribute(key) !== value) {

@@ -89,3 +101,3 @@ target.setAttribute(key, value)

if (isExistingElement && isSameView) {
attributeIndex = next.attributes.offset ?? 0
attributeIndex = next.offsets.attributes
}

@@ -126,3 +138,3 @@

if (isExistingElement && isSameView) {
childIndex = next.children.offset ?? 0
childIndex = next.offsets.children

@@ -129,0 +141,0 @@ childNode = target.childNodes[childIndex]

@@ -31,3 +31,2 @@ const weakMap = new WeakMap()

const tokens = []
let afterVar = false
const current = () => str.charAt(i)

@@ -62,4 +61,2 @@ const next = () => str.charAt(i + 1)

afterVar = false
tokens.push({

@@ -80,3 +77,3 @@ type: !end ? tokenTypes.tag : tokenTypes.endtag,

if (value.trim() || (afterVar && current() !== '<')) {
if (value.trim()) {
tokens.push({

@@ -166,4 +163,2 @@ type: tokenTypes.text,

if (index < vlength) {
afterVar = true
tokens.push({

@@ -185,3 +180,7 @@ type: tokenTypes.variable,

attributes: [],
children: []
children: [],
offsets: {
attributes: 0,
children: null
}
}

@@ -205,12 +204,8 @@

const firstChar = key.charAt(0)
const colon = ':' === firstChar
const special = ':' === firstChar || '@' === firstChar
if (colon) {
key = key.substring(1)
}
constant = token.type === tokenTypes.value
value = token.value
if (token.type === tokenTypes.variable && !colon && !html.dev) {
if (token.type === tokenTypes.variable && !special && !html.dev) {
value = variables[value]

@@ -222,3 +217,3 @@ constant = true

if (constant) {
if (child.attributes.offset != null) child.attributes.offset++
child.offsets.attributes++

@@ -233,5 +228,2 @@ child.attributes.unshift({

child.attributes.offset =
child.attributes.offset ?? child.attributes.length
child.attributes.push({

@@ -255,3 +247,3 @@ type: tokenTypes.variable,

child.dynamic = child.dynamic || dynamic
child.dynamic ||= dynamic
} else if (token.type === tokenTypes.text) {

@@ -265,3 +257,3 @@ child.children.push({

child.children.offset = child.children.offset ?? child.children.length
child.offsets.children ??= child.children.length

@@ -276,3 +268,3 @@ child.children.push({

if (child.dynamic) {
parent.children.offset = parent.children.offset ?? parent.children.length
parent.offsets.children ??= parent.children.length
}

@@ -282,2 +274,4 @@

child.offsets.children ??= child.children.length
return child.dynamic

@@ -296,2 +290,3 @@ }

const children = []
const offsets = {children: null}

@@ -304,3 +299,3 @@ for (;;) {

if (token.type === tokenTypes.tag) {
parse(tokens, {children}, token.value, variables)
parse(tokens, {children, offsets}, token.value, variables)
} else if (token.type === tokenTypes.text && token.value.trim()) {

@@ -307,0 +302,0 @@ throw createAssertionError(token.type, "'node'")

{
"name": "@erickmerchant/framework",
"version": "46.0.0",
"version": "47.0.0",
"description": "A front-end framework.",

@@ -5,0 +5,0 @@ "homepage": "https://github.com/erickmerchant/framework#readme",

@@ -90,3 +90,3 @@ import {escape} from './escape.js'

for (let c of child) {
c = c ?? ''
c ??= ''

@@ -93,0 +93,0 @@ descendants.push(c)

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc