Comparing version 1.4.0 to 1.4.1
@@ -6,3 +6,3 @@ { | ||
"author": "rackai", | ||
"version": "1.4.0", | ||
"version": "1.4.1", | ||
"repository": "https://github.com/rackai/domql", | ||
@@ -9,0 +9,0 @@ "publishConfig": { |
@@ -35,2 +35,22 @@ 'use strict' | ||
// if element is proto | ||
if (element.__hash) { | ||
element = { proto: element } | ||
} | ||
// if KEY is PROTO | ||
if (options.components) { | ||
const { components } = options | ||
const k = element.key || key | ||
const keyIsProto = isString(k) && k.charAt(0) === k.charAt(0).toUpperCase() | ||
let component | ||
if (keyIsProto) component = key | ||
// if proto comes from library as string | ||
const fromLibrary = component || isString(element.proto) ? element.proto : element.component | ||
const isInLibrary = components[fromLibrary] | ||
if (isInLibrary) element = { proto: isInLibrary, props: element } | ||
} | ||
// define KEY | ||
@@ -37,0 +57,0 @@ const assignedKey = element.key || key || createID.next().value |
'use strict' | ||
import { deepClone, deepMerge, exec, isArray, isObject } from '../utils' | ||
import { deepClone, deepMerge, exec, isArray, isObject, isString } from '../utils' | ||
const initProps = (element, parent) => { | ||
const { props } = element | ||
const propsStack = [] | ||
if (isObject(element.props)) { | ||
propsStack.push(element.props) | ||
} else if (element.props === 'inherit') { | ||
if (parent && parent.props) propsStack.push(parent.props) | ||
} else if (element.props === 'match') { | ||
if (parent && parent.props) propsStack.push(parent.props[element.key]) | ||
} else if (element.props) propsStack.push(element.props) | ||
const hasMatch = isString(props) && props.indexOf('match') > -1 | ||
const matchParent = parent.props && parent.props[element.key] | ||
if (isObject(props)) { | ||
propsStack.push(props) | ||
} else if (props === 'inherit') { | ||
if (parent.props) propsStack.push(parent.props) | ||
} else if (hasMatch) { | ||
const hasArg = props.split(' ') | ||
if (hasArg[1] && parent.props[hasArg[1]]) propsStack.push(parent.props[hasArg[1]]) | ||
else if (matchParent) propsStack.push(matchParent) | ||
} else if (props) propsStack.push(props) | ||
if (matchParent && props !== 'match') propsStack.push(matchParent) | ||
if (isArray(element.__proto)) { | ||
@@ -17,0 +25,0 @@ element.__proto.map(proto => { |
@@ -54,3 +54,4 @@ 'use strict' | ||
parseDeep: {}, | ||
on: {} | ||
on: {}, | ||
component: {} | ||
} |
@@ -22,12 +22,9 @@ 'use strict' | ||
protoStackRegistry[hash] = stack | ||
return protoStackRegistry[hash] | ||
return stack | ||
} | ||
export const getProtoStackRegistry = (proto, stack) => { | ||
if (proto.__hash) { | ||
if (proto.__hash) | ||
return stack.concat(getHashedProto(proto)) | ||
} else { | ||
setHashedProto(proto, stack) | ||
} | ||
return stack // .concat(hashedProto) | ||
return setHashedProto(proto, stack) // stack .concat(hashedProto) | ||
} | ||
@@ -34,0 +31,0 @@ |
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
53638
1636