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 47.1.0 to 48.0.0

86

dom-view.js

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

const rekeyMap = {
const attrToPropMap = {
class: 'className',

@@ -37,41 +37,2 @@ for: 'htmlFor'

const morphAttribute = (target, key, value, existing) => {
const firstChar = key.charAt(0)
const hasDash = ~key.indexOf('-')
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[key] = value
if (value != null) {
const document = target.ownerDocument
const listeners = readMeta(document)
if (!listeners[key]) {
listeners[key] = true
addListener(document, key)
}
}
} else if (existing && value == null) {
target.removeAttribute(key)
} else if (value != null && target.getAttribute(key) !== value) {
target.setAttribute(key, value)
}
}
const morph = (target, next, variables, existing = true, same = true) => {

@@ -113,14 +74,39 @@ const document = target.ownerDocument

if (attribute.key) {
morphAttribute(target, attribute.key, value, existing)
} else {
for (
let i = 0, keys = Object.keys(value), len = keys.length;
i < len;
i++
) {
const key = keys[i]
let key = attribute.key
morphAttribute(target, key, value[key], existing)
const firstChar = key.charAt(0)
const hasDash = ~key.indexOf('-')
if (firstChar === ':' || firstChar === '@') {
key = key.substring(1)
}
if (firstChar === ':' && !hasDash) {
key = attrToPropMap[key] ?? key
if (value == null) {
delete target[key]
} else if (target[key] !== value) {
target[key] = value
}
} else if (firstChar === '@') {
const meta = readMeta(target)
meta[key] = value
if (value != null) {
const document = target.ownerDocument
const listeners = readMeta(document)
if (!listeners[key]) {
listeners[key] = true
addListener(document, key)
}
}
} else if (existing && value == null) {
target.removeAttribute(key)
} else if (value != null && target.getAttribute(key) !== value) {
target.setAttribute(key, value)
}

@@ -127,0 +113,0 @@ }

@@ -210,18 +210,20 @@ const weakMap = new WeakMap()

if (constant) {
child.offsets.attributes++
if (key) {
if (constant) {
child.offsets.attributes++
child.attributes.unshift({
type: tokenTypes.constant,
key,
value
})
} else {
child.dynamic = true
child.attributes.unshift({
type: tokenTypes.constant,
key,
value
})
} else {
child.dynamic = true
child.attributes.push({
type: tokenTypes.variable,
key,
value
})
child.attributes.push({
type: tokenTypes.variable,
key,
value
})
}
}

@@ -228,0 +230,0 @@ }

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

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

@@ -32,25 +32,11 @@ import {escape} from './escape.js'

if (attribute.key) {
if (attribute.key.startsWith('@')) continue
if (attribute.key.startsWith('@')) continue
const hasColon = attribute.key.startsWith(':')
const hasColon = attribute.key.startsWith(':')
if (hasColon) {
attribute.key = attribute.key.substring(1)
}
if (hasColon) {
attribute.key = attribute.key.substring(1)
}
reducedAttributes.push(attribute)
} else {
for (let key of Object.keys(variables[attribute.value])) {
if (key.startsWith('@')) continue
const hasColon = key.startsWith(':')
if (hasColon) {
key = key.substring(1)
}
reducedAttributes.push({key, value: variables[attribute.value][key]})
}
}
reducedAttributes.push(attribute)
}

@@ -57,0 +43,0 @@

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