@lrnwebcomponents/hax-body-behaviors
Advanced tools
Comparing version 2.5.0 to 2.6.0
@@ -334,56 +334,3 @@ /** | ||
} | ||
// allow classes to be modified this way | ||
props.settings.advanced.push({ | ||
attribute: "class", | ||
title: "Classes", | ||
description: "CSS classes applied manually to the element", | ||
inputMethod: "textfield" | ||
}); | ||
// allow styles to be modified this way | ||
props.settings.advanced.push({ | ||
attribute: "style", | ||
title: "Styles", | ||
description: "Custom CSS styles as applied to the element", | ||
inputMethod: "textfield" | ||
}); | ||
// allow schema definitions | ||
props.settings.advanced.push({ | ||
attribute: "prefix", | ||
title: "Schema: prefix", | ||
description: "Schema prefixes", | ||
inputMethod: "textfield" | ||
}); | ||
props.settings.advanced.push({ | ||
attribute: "typeof", | ||
title: "Schema: TypeOf", | ||
description: "typeof definition for Schema usage", | ||
inputMethod: "textfield" | ||
}); | ||
props.settings.advanced.push({ | ||
attribute: "property", | ||
title: "Schema: Property", | ||
description: "typeof definition for Schema usage", | ||
inputMethod: "textfield" | ||
}); | ||
props.settings.advanced.push({ | ||
attribute: "resource", | ||
title: "Schema: Resource ID", | ||
description: "Schema resource identifier", | ||
inputMethod: "textfield" | ||
}); | ||
// allow the id to be modified | ||
props.settings.advanced.push({ | ||
attribute: "id", | ||
title: "ID", | ||
description: "element ID, only set this if you know why", | ||
inputMethod: "textfield" | ||
}); | ||
// we need to support slot in the UI but actually shift it around under the hood | ||
// this is so that shadow roots don't get mad when previewing | ||
props.settings.advanced.push({ | ||
attribute: "slot", | ||
title: "slot", | ||
description: "DOM slot area", | ||
inputMethod: "textfield" | ||
}); | ||
props = this.standardAdvancedProps(props); | ||
} | ||
@@ -402,41 +349,3 @@ // support for advanced save options | ||
if (isReady) { | ||
if (tag != "" && typeof window.HaxStore === typeof undefined) { | ||
const evt = new CustomEvent("hax-register-properties", { | ||
bubbles: true, | ||
composed: true, | ||
cancelable: true, | ||
detail: { | ||
tag: tag.toLowerCase(), | ||
properties: props, | ||
polymer: false | ||
} | ||
}); | ||
context.dispatchEvent(evt); | ||
} else if (tag != "") { | ||
const evt = new CustomEvent("hax-register-properties", { | ||
bubbles: true, | ||
composed: true, | ||
cancelable: true, | ||
detail: { | ||
tag: tag.toLowerCase(), | ||
properties: props | ||
} | ||
}); | ||
context.dispatchEvent(evt); | ||
} else if (typeof this.tagName !== typeof undefined) { | ||
const evt = new CustomEvent("hax-register-properties", { | ||
bubbles: true, | ||
composed: true, | ||
cancelable: true, | ||
detail: { | ||
tag: this.tagName.toLowerCase(), | ||
properties: props | ||
} | ||
}); | ||
context.dispatchEvent(evt); | ||
} else { | ||
console.warn( | ||
`${tag} missed our checks and has an issue in implementation with HAX` | ||
); | ||
} | ||
this.readyToFireHAXSchema(tag, props, context); | ||
} | ||
@@ -457,7 +366,108 @@ // only set these when tag hasn't been force fed | ||
console.warn( | ||
"This is't a valid usage of hax API. See hax-body-behaviors/lib/HAXWiring.js for more details on how to implement the API. Most likely your hax item just was placed in an iframe as a fallback as opposed to a custom element." | ||
"This is't a valid usage of hax API. See hax-body-behaviors/lib/HAXWiring.js for more details on how to implement the API. https://haxtheweb.org/hax-schema for details but we will try and guess the wiring" | ||
); | ||
} | ||
}; | ||
this.readyToFireHAXSchema = (tag, props, context) => { | ||
if (tag != "" && typeof window.HaxStore === typeof undefined) { | ||
const evt = new CustomEvent("hax-register-properties", { | ||
bubbles: true, | ||
composed: true, | ||
cancelable: true, | ||
detail: { | ||
tag: tag.toLowerCase(), | ||
properties: props, | ||
polymer: false | ||
} | ||
}); | ||
context.dispatchEvent(evt); | ||
} else if (tag != "") { | ||
const evt = new CustomEvent("hax-register-properties", { | ||
bubbles: true, | ||
composed: true, | ||
cancelable: true, | ||
detail: { | ||
tag: tag.toLowerCase(), | ||
properties: props | ||
} | ||
}); | ||
context.dispatchEvent(evt); | ||
} else if (typeof this.tagName !== typeof undefined) { | ||
const evt = new CustomEvent("hax-register-properties", { | ||
bubbles: true, | ||
composed: true, | ||
cancelable: true, | ||
detail: { | ||
tag: this.tagName.toLowerCase(), | ||
properties: props | ||
} | ||
}); | ||
context.dispatchEvent(evt); | ||
} else { | ||
console.warn( | ||
`${tag} missed our checks and has an issue in implementation with HAX` | ||
); | ||
} | ||
}; | ||
/** | ||
* Standard advanced properties we support for all forms | ||
*/ | ||
this.standardAdvancedProps = props => { | ||
// allow classes to be modified this way | ||
props.settings.advanced.push({ | ||
attribute: "class", | ||
title: "Classes", | ||
description: "CSS classes applied manually to the element", | ||
inputMethod: "textfield" | ||
}); | ||
// allow styles to be modified this way | ||
props.settings.advanced.push({ | ||
attribute: "style", | ||
title: "Styles", | ||
description: "Custom CSS styles as applied to the element", | ||
inputMethod: "textfield" | ||
}); | ||
// allow schema definitions | ||
props.settings.advanced.push({ | ||
attribute: "prefix", | ||
title: "Schema: prefix", | ||
description: "Schema prefixes", | ||
inputMethod: "textfield" | ||
}); | ||
props.settings.advanced.push({ | ||
attribute: "typeof", | ||
title: "Schema: TypeOf", | ||
description: "typeof definition for Schema usage", | ||
inputMethod: "textfield" | ||
}); | ||
props.settings.advanced.push({ | ||
attribute: "property", | ||
title: "Schema: Property", | ||
description: "typeof definition for Schema usage", | ||
inputMethod: "textfield" | ||
}); | ||
props.settings.advanced.push({ | ||
attribute: "resource", | ||
title: "Schema: Resource ID", | ||
description: "Schema resource identifier", | ||
inputMethod: "textfield" | ||
}); | ||
// allow the id to be modified | ||
props.settings.advanced.push({ | ||
attribute: "id", | ||
title: "ID", | ||
description: "element ID, only set this if you know why", | ||
inputMethod: "textfield" | ||
}); | ||
// we need to support slot in the UI but actually shift it around under the hood | ||
// this is so that shadow roots don't get mad when previewing | ||
props.settings.advanced.push({ | ||
attribute: "slot", | ||
title: "slot", | ||
description: "DOM slot area", | ||
inputMethod: "textfield" | ||
}); | ||
return props; | ||
}; | ||
/** | ||
* Validate settings object. | ||
@@ -1135,5 +1145,5 @@ */ | ||
title: "Tag name", | ||
description: "A description", | ||
icon: "av:play-circle-filled", | ||
color: "blue", | ||
description: "", | ||
icon: "icons:android", | ||
color: "purple", | ||
groups: ["Content"], | ||
@@ -1148,3 +1158,3 @@ handles: [ | ||
meta: { | ||
author: "" | ||
author: "auto" | ||
} | ||
@@ -1151,0 +1161,0 @@ }, |
@@ -15,3 +15,3 @@ { | ||
}, | ||
"version": "2.5.0", | ||
"version": "2.6.0", | ||
"description": "Wire any element up to HAX", | ||
@@ -59,3 +59,3 @@ "repository": { | ||
}, | ||
"gitHead": "3f7a6e3d9f51b13c9b2abaa53b1f75f3acb46f70" | ||
"gitHead": "c529d81a7edd75fa73317ffd5cff2859f265cfdc" | ||
} |
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
2133
195421