Comparing version 1.4.7 to 1.4.8
@@ -6,3 +6,3 @@ { | ||
"author": "rackai", | ||
"version": "1.4.7", | ||
"version": "1.4.8", | ||
"repository": "https://github.com/rackai/domql", | ||
@@ -30,15 +30,19 @@ "publishConfig": { | ||
"devDependencies": { | ||
"@babel/core": "^7.10.4", | ||
"@babel/preset-env": "^7.10.4", | ||
"babel-eslint": "^10.0.3", | ||
"babel-jest": "^28.1.0", | ||
"babel-preset-env": "^1.7.0", | ||
"coveralls": "^3.0.5", | ||
"eslint": "^8.10.0", | ||
"eslint-plugin-jest": "^26.1.0", | ||
"jest": "^28.1.0", | ||
"@babel/core": "^7.16.0", | ||
"@babel/eslint-parser": "^7.16.3", | ||
"@babel/preset-env": "^7.16.4", | ||
"@parcel/babel-preset-env": "^2.0.1", | ||
"babel-jest": "^27.4.4", | ||
"esbuild": "^0.14.47", | ||
"eslint": "^8.4.0", | ||
"eslint-config-standard": "^16.0.3", | ||
"eslint-plugin-import": "^2.25.3", | ||
"eslint-plugin-jest": "^25.3.0", | ||
"eslint-plugin-node": "^11.1.0", | ||
"jest": "^27.4.4", | ||
"jsdom": "^19.0.0", | ||
"nodemon": "^2.0.6", | ||
"np": "^7.2.0", | ||
"parcel-bundler": "^1.12.4", | ||
"standard": "^17.0.0" | ||
"parcel": "^2.0.1", | ||
"standard": "^16.0.1" | ||
}, | ||
@@ -45,0 +49,0 @@ "jest": { |
@@ -7,2 +7,3 @@ 'use strict' | ||
import createEmotion from '@emotion/css/create-instance' | ||
const ENV = process.env.NODE_ENV | ||
@@ -37,3 +38,3 @@ const { | ||
if (!prop) continue | ||
prop.label = key || element.key | ||
if (ENV === 'test' || ENV === 'development') prop.label = key || element.key | ||
const CSSed = css(prop) | ||
@@ -40,0 +41,0 @@ classObjHelper[key] = CSSed |
@@ -80,2 +80,12 @@ 'use strict' | ||
// don't render IF in condition | ||
if (isFunction(element.if)) { | ||
// TODO: move as fragment | ||
if (!element.if(element, element.state)) { | ||
const ifFragment = cacheNode({ tag: 'fragment' }) | ||
element.__ifFragment = appendNode(ifFragment, parent.node) | ||
element.__ifFalsy = true | ||
} | ||
} | ||
// set the PATH | ||
@@ -87,13 +97,4 @@ if (ENV === 'test' || ENV === 'development') { | ||
// don't render IF in condition | ||
if (isFunction(element.if) && !element.if(element, element.state)) { | ||
// TODO: move as fragment | ||
const ifFragment = cacheNode({ tag: 'fragment' }) | ||
element.__ifFragment = appendNode(ifFragment, parent.node) | ||
element.__ifFalsy = true | ||
return | ||
} | ||
// if it already HAS A NODE | ||
if (element.node) { | ||
if (element.node) { // TODO: check on if | ||
// console.log('hasNode!') | ||
@@ -133,3 +134,3 @@ // console.groupEnd('Create:') | ||
// apply props settings | ||
createProps(element, parent) | ||
if (!element.__ifFalsy) createProps(element, parent) | ||
@@ -152,5 +153,14 @@ // run `on.init` | ||
// console.group('create') | ||
// console.log(element.path) | ||
// console.log(element) | ||
// console.groupEnd('create') | ||
// if (parent.key === 'footer' && key === '0') debugger | ||
// CREATE a real NODE | ||
createNode(element, options) | ||
if (element.__ifFalsy) return element | ||
// assign NODE | ||
@@ -157,0 +167,0 @@ assignNode(element, parent, key) |
@@ -41,5 +41,9 @@ 'use strict' | ||
// if (element.__ifFalsy) return element | ||
if (!node) { | ||
isNewNode = true | ||
if (element.__ifFalsy) return element | ||
if (tag === 'shadow') { | ||
@@ -62,2 +66,4 @@ node = element.node = element.parent.node.attachShadow({ mode: 'open' }) | ||
if (element.__ifFalsy) return element | ||
// iterate through all given params | ||
@@ -77,2 +83,7 @@ if (element.tag !== 'string' || element.tag !== 'fragment') { | ||
// console.group('createNode') | ||
// console.log(param) | ||
// console.log(prop) | ||
// console.groupEnd('createNode') | ||
if (isMethod(param) || isObject(registry[param]) || prop === undefined) continue | ||
@@ -79,0 +90,0 @@ |
@@ -12,2 +12,7 @@ 'use strict' | ||
const objectizeStringProperty = propValue => { | ||
if (isString(propValue)) return { inheritedString: propValue } | ||
return propValue | ||
} | ||
if (isObject(props)) { | ||
@@ -19,4 +24,14 @@ propsStack.push(props) | ||
const hasArg = props.split(' ') | ||
if (hasArg[1] && parent.props[hasArg[1]]) propsStack.push(parent.props[hasArg[1]]) | ||
else if (matchParent) propsStack.push(matchParent) | ||
let matchParentValue | ||
if (hasArg[1] && parent.props[hasArg[1]]) { | ||
const secondArgasParentMatchProp = parent.props[hasArg[1]] | ||
propsStack.push( | ||
objectizeStringProperty(secondArgasParentMatchProp) | ||
) | ||
} else if (matchParent) { | ||
propsStack.push( | ||
objectizeStringProperty(matchParent) | ||
) | ||
} | ||
propsStack.push(matchParentValue) | ||
} else if (props) propsStack.push(props) | ||
@@ -23,0 +38,0 @@ |
@@ -50,2 +50,8 @@ 'use strict' | ||
// console.group('proto') | ||
// console.log(protoLength) | ||
// console.log(childProtoLength) | ||
// console.log(element) | ||
// console.groupEnd('proto') | ||
let stack = [] | ||
@@ -52,0 +58,0 @@ if (protoLength && childProtoLength) { |
@@ -28,2 +28,24 @@ 'use strict' | ||
if (isFunction(element.if)) { | ||
// TODO: move as fragment | ||
const ifPassed = element.if(element, element.state) | ||
// console.group('updateLoop') | ||
// console.log(element) | ||
// console.log(element.__ifFalsy) | ||
// console.log(ifPassed) | ||
// console.groupEnd('updateLoop') | ||
// if (element.__ifFalsy && ifPassed) { | ||
if (ifPassed) delete element.__ifFalsy | ||
if (element.__ifFalsy && ifPassed) { | ||
createNode(element) | ||
appendNode(element.node, element.__ifFragment) | ||
} else if (element.node && !ifPassed) { | ||
element.node.remove() | ||
element.__ifFalsy = true | ||
} | ||
} | ||
if (element.on && isFunction(element.on.initUpdate) && !options.ignoreInitUpdate) { | ||
@@ -33,8 +55,12 @@ preventUpdate = on.initUpdate(element.on.initUpdate, element, element.state) | ||
// console.group('update') | ||
// console.log(element.path) | ||
// console.log(element) | ||
// if (params.props) { | ||
// console.log('INSIDE:') | ||
// console.log(params.props) | ||
// console.log('INSIDE:') | ||
// console.log(params.props) | ||
// } | ||
updateProps(params.props, element, parent) | ||
if (!element.__ifFalsy) updateProps(params.props, element, parent) | ||
// const state = params.state || element.state | ||
@@ -55,16 +81,11 @@ // element.state = createState({ state }, parent) | ||
if (isFunction(element.if)) { | ||
// TODO: move as fragment | ||
const ifPassed = element.if(element, element.state) | ||
if (element.__ifFalsy && ifPassed) { | ||
createNode(element) | ||
appendNode(element.node, element.__ifFragment) | ||
delete element.__ifFalsy | ||
} else if (element.node && !ifPassed) { | ||
element.node.remove() | ||
element.__ifFalsy = true | ||
} | ||
// console.log(element.key, element.__ifFalsy) | ||
if (element.__ifFalsy || options.preventRecursive) return element | ||
if (!node) { | ||
return | ||
// return createNode(element, options) | ||
} | ||
if (!node || options.preventRecursive) return | ||
// console.warn(element.key) | ||
// console.groupEnd('update') | ||
@@ -74,2 +95,8 @@ for (const param in element) { | ||
// console.group('updateLoop') | ||
// console.log(param) | ||
// console.log(prop) | ||
// console.groupEnd('updateLoop') | ||
// if (element.key === 'span' && param === 'node') debugger | ||
if (options.preventContentUpdate && param === 'content') continue | ||
@@ -76,0 +103,0 @@ if (isMethod(param) || isObject(registry[param]) || prop === undefined) continue |
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
56202
1700
17
6