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 41.4.0 to 41.5.0

155

main.js

@@ -34,8 +34,2 @@ const svgNamespace = 'http://www.w3.org/2000/svg'

const writeMeta = (target, meta) => {
if (meta._read) {
weakMap.set(target, meta)
}
}
const getNextSibling = (current) => current?.nextSibling

@@ -97,3 +91,2 @@

isSameView,
forceAppend,
listeners

@@ -103,3 +96,3 @@ ) => {

const append = forceAppend || childNode == null
const append = childNode == null

@@ -145,5 +138,3 @@ let replace = false

if (forceAppend && childNode) {
childNode.before(currentChild)
} else if (append) {
if (append) {
target.append(currentChild)

@@ -166,4 +157,2 @@ } else if (replace) {

const hasExistingAttributes = target.attributes.length
if (attributesLength) {

@@ -185,3 +174,7 @@ for (let i = 0, length = attributesLength; i < length; i++) {

} else {
for (const key of Object.keys(value)) {
const keys = Object.keys(value)
for (let i = 0, len = keys.length; i < len; i++) {
const key = keys[i]
morphAttribute(target, key, value[key], meta, listeners)

@@ -196,3 +189,3 @@

if (!isSameView && hasExistingAttributes) {
if (!isSameView) {
for (const attr of target.attributes) {

@@ -208,6 +201,2 @@ if (!~attrNames.indexOf(attr.name)) {

let keys
let prevKeys
if (childrenLength) {

@@ -233,5 +222,2 @@ let deopt = !isSameView

let keyIndex = 0
let lengthDifference
for (let grand of child) {

@@ -242,28 +228,2 @@ grand = resolve(grand)

let keysMatch = true
if (grand.key != null) {
if (!keys) {
keys = {}
readMeta(target, meta)
prevKeys = meta.keys?.[variableValue] ?? {}
}
if (!keys[variableValue]) {
keys[variableValue] = []
}
keys[variableValue].push(grand.key)
keysMatch = prevKeys[keyIndex] === grand.key
grand = grand.value
lengthDifference = child.length - prevKeys.length
}
keyIndex++
if (grand.type == null) {

@@ -273,24 +233,5 @@ grand = {type: 'text', value: grand}

if (!keysMatch && lengthDifference < 0 && childNode != null) {
lengthDifference++
const extraNode = childNode
childNode = childNode.nextSibling
extraNode.remove()
}
if (isSameView && grand.view != null && !grand.dynamic) {
childNode = getNextSibling(childNode)
} else {
const forceAppend =
!keysMatch && lengthDifference > 0 && childNode
if (forceAppend) {
lengthDifference--
keyIndex--
}
childNode = morphChild(

@@ -302,3 +243,2 @@ target,

isSameView,
forceAppend,
listeners

@@ -315,3 +255,2 @@ )

isSameView,
false,
listeners

@@ -324,26 +263,28 @@ )

if (keys) {
meta.keys = keys
}
if (childNode) {
while (childNode.nextSibling) {
childNode.nextSibling.remove()
}
let nextChild
childNode.remove()
do {
nextChild = getNextSibling(childNode)
childNode.remove()
childNode = nextChild
} while (childNode)
}
writeMeta(target, meta)
if (meta._read) {
weakMap.set(target, meta)
}
}
const morphRoot = (target, next, listeners) => {
if (next.view === 0) {
return
}
const meta = readMeta(target)
const isSameView = next.view === 0 || next.view === meta.view
const isSameView = next.view === meta.view
if (isSameView && next.view != null && !next.dynamic) {
return
}
if (!isSameView) {

@@ -387,6 +328,5 @@ meta.view = next.view

const isSpaceChar = (char) => /\s/.test(char)
const isOfClose = (char) => char === '/' || char === '>' || isSpaceChar(char)
const isOfTag = (char) => !isOfClose(char)
const isOfKey = (char) => char !== '=' && !isOfClose(char)
const isSpaceChar = (char) => !char.trim()
const isOfTag = (char) => char !== '/' && char !== '>' && !isSpaceChar(char)
const isOfKey = (char) => char !== '=' && isOfTag(char)
const isQuoteChar = (char) => char === '"' || char === "'"

@@ -624,6 +564,4 @@

let current
for (;;) {
current = tokens.next()
const current = tokens.next()

@@ -663,3 +601,3 @@ if (current.done) break

export const createApp = (state) => {
let viewCalled
let viewCalled = false
let view

@@ -674,3 +612,5 @@

view(typeof state === 'object' ? Object.assign({}, state) : state)
view(get())
viewCalled = false
}

@@ -680,17 +620,22 @@ })

const proxy = (state) =>
typeof state === 'object'
? new Proxy(state, {
set(state, key, val) {
state[key] = val
const proxy = new Proxy(
{},
{
set(_, key, val) {
if (viewCalled) return false
callView()
state[key] = val
return true
}
})
: state
callView()
state = proxy(state)
return true
},
get(_, key) {
return state[key]
}
}
)
const get = () => (typeof state === 'object' ? proxy : state)
return {

@@ -703,3 +648,3 @@ render(v) {

set state(val) {
state = proxy(val)
state = val

@@ -709,5 +654,5 @@ callView()

get state() {
return state
return get()
}
}
}
{
"name": "@erickmerchant/framework",
"version": "41.4.0",
"version": "41.5.0",
"description": "A front-end framework.",

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

@@ -97,3 +97,3 @@ const escape = (str) =>

descendants.push(c.key != null ? c.value : c)
descendants.push(c)
}

@@ -100,0 +100,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