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

@domql/element

Package Overview
Dependencies
Maintainers
3
Versions
180
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@domql/element - npm Package Compare versions

Comparing version 2.5.38 to 2.5.40

32

dist/cjs/utils/component.js

@@ -43,17 +43,18 @@ "use strict";

const addAdditionalExtend = (newExtend, element) => {
const { extend } = element;
const preserveExtend = (0, import_utils.isArray)(extend) ? extend : [extend];
return {
...element,
extend: [newExtend].concat(preserveExtend)
};
const { extend: elementExtend } = element;
const originalArray = (0, import_utils.isArray)(elementExtend) ? elementExtend : [elementExtend];
const receivedArray = (0, import_utils.isArray)(newExtend) ? newExtend : [newExtend];
const extend = (0, import_utils.joinArrays)(receivedArray, originalArray);
return { ...element, extend };
};
const extendizeByKey = (element, parent, key) => {
const { tag, extend, props, state, childExtend, childProps, on, if: condition } = element;
const hasComponentAttrs = extend || childExtend || props || state || on || condition;
const componentKey = key.includes("_") ? key.split("_")[0] : key.includes(".") ? key.split(".")[0] : key;
const extendKey = componentKey || key;
if (!hasComponentAttrs || childProps) {
const { context, tag, extend, props, attr, state, childExtend, childProps, on, if: condition } = element;
const hasComponentAttrs = extend || childExtend || props || state || on || condition || attr;
const extendFromKey = key.includes("+") ? key.split("+") : key.includes("_") ? key.split("_")[0] : key.includes(".") ? key.split(".")[0] : key;
const isExtendKeyComponent = context == null ? void 0 : context.components[extendFromKey];
if (element === isExtendKeyComponent)
return element;
else if (!hasComponentAttrs || childProps) {
return {
extend: extendKey,
extend: extendFromKey,
tag,

@@ -66,10 +67,9 @@ props: { ...element }

tag,
extend: extendKey
extend: extendFromKey
};
} else if (extend) {
addAdditionalExtend(extendKey, element);
return addAdditionalExtend(extendFromKey, element);
} else if ((0, import_utils.isFunction)(element)) {
console.log(element);
return {
extend: extendKey,
extend: extendFromKey,
tag,

@@ -76,0 +76,0 @@ props: { ...(0, import_utils.exec)(element, parent) }

{
"name": "@domql/element",
"version": "2.5.38",
"version": "2.5.40",
"license": "MIT",

@@ -34,3 +34,3 @@ "type": "module",

},
"gitHead": "58e7232b8f8553780368bc463000766575565816",
"gitHead": "536a661204a0377cb6dbb415eba1081ac156048d",
"devDependencies": {

@@ -37,0 +37,0 @@ "@babel/core": "^7.12.0"

'use strict'
import { exec, isArray, isFunction, isObject, isString, overwriteDeep } from '@domql/utils'
import { exec, isArray, isFunction, isObject, isString, joinArrays, overwriteDeep } from '@domql/utils'
import { applyExtend } from '../extend'

@@ -15,21 +15,27 @@ const ENV = process.env.NODE_ENV

export const addAdditionalExtend = (newExtend, element) => {
const { extend } = element
const preserveExtend = isArray(extend) ? extend : [extend]
return {
...element,
extend: [newExtend].concat(preserveExtend)
}
const { extend: elementExtend } = element
const originalArray = isArray(elementExtend) ? elementExtend : [elementExtend]
const receivedArray = isArray(newExtend) ? newExtend : [newExtend]
const extend = joinArrays(receivedArray, originalArray)
return { ...element, extend }
}
export const extendizeByKey = (element, parent, key) => {
const { tag, extend, props, state, childExtend, childProps, on, if: condition } = element
const hasComponentAttrs = extend || childExtend || props || state || on || condition
const componentKey = key.includes('_')
? key.split('_')[0]
: key.includes('.') ? key.split('.')[0] : key
const extendKey = componentKey || key
const { context, tag, extend, props, attr, state, childExtend, childProps, on, if: condition } = element
const hasComponentAttrs = extend || childExtend || props || state || on || condition || attr
if (!hasComponentAttrs || childProps) {
const extendFromKey = key.includes('+')
? key.split('+')
: key.includes('_')
? key.split('_')[0]
: key.includes('.')
? key.split('.')[0]
: key
const isExtendKeyComponent = context?.components[extendFromKey]
if (element === isExtendKeyComponent) return element
else if (!hasComponentAttrs || childProps) {
return {
extend: extendKey,
extend: extendFromKey,
tag,

@@ -42,10 +48,9 @@ props: { ...element }

tag,
extend: extendKey
extend: extendFromKey
}
} else if (extend) {
addAdditionalExtend(extendKey, element)
return addAdditionalExtend(extendFromKey, element)
} else if (isFunction(element)) {
console.log(element)
return {
extend: extendKey,
extend: extendFromKey,
tag,

@@ -52,0 +57,0 @@ props: { ...exec(element, parent) }

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