Comparing version 5.2.0 to 5.2.1
@@ -8,2 +8,6 @@ import { PropsContract } from '../Contracts'; | ||
/** | ||
* Merges the className attribute with the class attribute | ||
*/ | ||
private mergeClassAttributes; | ||
/** | ||
* Find if a key exists inside the props | ||
@@ -35,11 +39,11 @@ */ | ||
*/ | ||
serialize(mergeProps?: any): import("../Template").SafeValue; | ||
serialize(mergeProps?: any, priortizeInline?: boolean): import("../Template").SafeValue; | ||
/** | ||
* Serialize only the given keys to a string of HTML attributes | ||
*/ | ||
serializeOnly(keys: string[], mergeProps?: any): import("../Template").SafeValue; | ||
serializeOnly(keys: string[], mergeProps?: any, priortizeInline?: boolean): import("../Template").SafeValue; | ||
/** | ||
* Serialize except the given keys to a string of HTML attributes | ||
*/ | ||
serializeExcept(keys: string[], mergeProps?: any): import("../Template").SafeValue; | ||
serializeExcept(keys: string[], mergeProps?: any, priortizeInline?: boolean): import("../Template").SafeValue; | ||
} |
@@ -27,2 +27,21 @@ "use strict"; | ||
/** | ||
* Merges the className attribute with the class attribute | ||
*/ | ||
mergeClassAttributes(props) { | ||
if (props.className) { | ||
if (!props.class) { | ||
props.class = []; | ||
} | ||
/** | ||
* Normalize class attribute to be an array | ||
*/ | ||
if (!Array.isArray(props.class)) { | ||
props.class = [props.class]; | ||
} | ||
props.class = props.class.concat(props.className); | ||
props.className = false; | ||
} | ||
return props; | ||
} | ||
/** | ||
* Find if a key exists inside the props | ||
@@ -68,5 +87,10 @@ */ | ||
*/ | ||
serialize(mergeProps) { | ||
const attributes = utils_1.lodash.merge({}, this.all(), mergeProps); | ||
return Template_1.safeValue(stringify_attributes_1.default(attributes)); | ||
serialize(mergeProps, priortizeInline = true) { | ||
/** | ||
* Priortize user attributes when priortizeInline=false | ||
*/ | ||
const attributes = priortizeInline | ||
? utils_1.lodash.merge({}, this.all(), mergeProps) | ||
: utils_1.lodash.merge({}, mergeProps, this.all()); | ||
return Template_1.safeValue(stringify_attributes_1.default(this.mergeClassAttributes(attributes))); | ||
} | ||
@@ -76,5 +100,10 @@ /** | ||
*/ | ||
serializeOnly(keys, mergeProps) { | ||
const attributes = utils_1.lodash.merge({}, this.only(keys), mergeProps); | ||
return Template_1.safeValue(stringify_attributes_1.default(attributes)); | ||
serializeOnly(keys, mergeProps, priortizeInline = true) { | ||
/** | ||
* Priortize user attributes when priortizeInline=false | ||
*/ | ||
const attributes = priortizeInline | ||
? utils_1.lodash.merge({}, this.only(keys), mergeProps) | ||
: utils_1.lodash.merge({}, mergeProps, this.only(keys)); | ||
return Template_1.safeValue(stringify_attributes_1.default(this.mergeClassAttributes(attributes))); | ||
} | ||
@@ -84,7 +113,12 @@ /** | ||
*/ | ||
serializeExcept(keys, mergeProps) { | ||
const attributes = utils_1.lodash.merge({}, this.except(keys), mergeProps); | ||
return Template_1.safeValue(stringify_attributes_1.default(attributes)); | ||
serializeExcept(keys, mergeProps, priortizeInline = true) { | ||
/** | ||
* Priortize user attributes when priortizeInline=false | ||
*/ | ||
const attributes = priortizeInline | ||
? utils_1.lodash.merge({}, this.except(keys), mergeProps) | ||
: utils_1.lodash.merge({}, mergeProps, this.except(keys)); | ||
return Template_1.safeValue(stringify_attributes_1.default(this.mergeClassAttributes(attributes))); | ||
} | ||
} | ||
exports.Props = Props; |
{ | ||
"name": "edge.js", | ||
"version": "5.2.0", | ||
"version": "5.2.1", | ||
"description": "Template engine", | ||
@@ -38,12 +38,10 @@ "main": "build/index.js", | ||
"devDependencies": { | ||
"@adonisjs/mrm-preset": "^3.1.0", | ||
"@adonisjs/mrm-preset": "^4.1.0", | ||
"@adonisjs/require-ts": "^2.0.4", | ||
"@poppinss/dev-utils": "^1.1.2", | ||
"@types/node": "^15.3.0", | ||
"commitizen": "^4.2.4", | ||
"cz-conventional-changelog": "^3.3.0", | ||
"@poppinss/dev-utils": "^1.1.4", | ||
"@types/node": "^15.6.1", | ||
"dedent-js": "^1.0.1", | ||
"del-cli": "^3.0.1", | ||
"doctoc": "^2.0.0", | ||
"eslint": "^7.26.0", | ||
"eslint": "^7.27.0", | ||
"eslint-config-prettier": "^8.3.0", | ||
@@ -55,3 +53,3 @@ "eslint-plugin-adonis": "^1.3.1", | ||
"japa": "^3.1.1", | ||
"mrm": "^3.0.1", | ||
"mrm": "^3.0.2", | ||
"np": "^7.5.0", | ||
@@ -76,8 +74,8 @@ "prettier": "^2.3.0", | ||
"@poppinss/inspect": "^1.0.1", | ||
"@poppinss/utils": "^3.1.1", | ||
"@poppinss/utils": "^3.1.3", | ||
"edge-error": "^2.0.4", | ||
"edge-lexer": "^4.0.5", | ||
"edge-parser": "^8.0.6", | ||
"edge-lexer": "^4.0.6", | ||
"edge-parser": "^8.0.7", | ||
"js-stringify": "^1.0.2", | ||
"macroable": "^5.1.2", | ||
"macroable": "^5.1.3", | ||
"stringify-attributes": "^2.0.0" | ||
@@ -84,0 +82,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
18
4072
139279
63
Updated@poppinss/utils@^3.1.3
Updatededge-lexer@^4.0.6
Updatededge-parser@^8.0.7
Updatedmacroable@^5.1.3