@lrnwebcomponents/hax-body-behaviors
Advanced tools
Comparing version 0.0.28 to 0.0.29
{ | ||
"schema_version": "1.0.0", | ||
"elements": [ | ||
{ | ||
"description": "`hax-body-behaviors`\n`HAX Body Behaviors to utilize in any element`", | ||
"summary": "", | ||
"path": "hax-body-behaviors.js", | ||
"properties": [ | ||
{ | ||
"name": "templateUrl", | ||
"type": "?", | ||
"description": "A file that contains the HTML template for the element.", | ||
"privacy": "public", | ||
"sourceRange": { | ||
"start": { | ||
"line": 38, | ||
"column": 2 | ||
}, | ||
"end": { | ||
"line": 40, | ||
"column": 3 | ||
} | ||
}, | ||
"metadata": { | ||
"polymer": { | ||
"readOnly": true | ||
} | ||
} | ||
}, | ||
{ | ||
"name": "propertiesUrl", | ||
"type": "?", | ||
"description": "A file that contains the properties that will be wired into this element.", | ||
"privacy": "public", | ||
"sourceRange": { | ||
"start": { | ||
"line": 45, | ||
"column": 2 | ||
}, | ||
"end": { | ||
"line": 47, | ||
"column": 3 | ||
} | ||
}, | ||
"metadata": { | ||
"polymer": { | ||
"readOnly": true | ||
} | ||
} | ||
}, | ||
{ | ||
"name": "styleUrl", | ||
"type": "?", | ||
"description": "A file that contains the css for this element to be mixed into the html block.", | ||
"privacy": "public", | ||
"sourceRange": { | ||
"start": { | ||
"line": 52, | ||
"column": 2 | ||
}, | ||
"end": { | ||
"line": 54, | ||
"column": 3 | ||
} | ||
}, | ||
"metadata": { | ||
"polymer": { | ||
"readOnly": true | ||
} | ||
} | ||
} | ||
], | ||
"methods": [ | ||
{ | ||
"name": "getTemplate", | ||
"description": "", | ||
"privacy": "public", | ||
"sourceRange": { | ||
"start": { | ||
"line": 16, | ||
"column": 2 | ||
}, | ||
"end": { | ||
"line": 22, | ||
"column": 3 | ||
} | ||
}, | ||
"metadata": {}, | ||
"params": [] | ||
}, | ||
{ | ||
"name": "connectedCallback", | ||
"description": "life cycle, element is afixed to the DOM", | ||
"privacy": "public", | ||
"sourceRange": { | ||
"start": { | ||
"line": 87, | ||
"column": 2 | ||
}, | ||
"end": { | ||
"line": 95, | ||
"column": 3 | ||
} | ||
}, | ||
"metadata": {}, | ||
"params": [], | ||
"return": { | ||
"type": "void" | ||
} | ||
}, | ||
{ | ||
"name": "_copyAttribute", | ||
"description": "", | ||
"privacy": "protected", | ||
"sourceRange": { | ||
"start": { | ||
"line": 97, | ||
"column": 2 | ||
}, | ||
"end": { | ||
"line": 104, | ||
"column": 3 | ||
} | ||
}, | ||
"metadata": {}, | ||
"params": [ | ||
{ | ||
"name": "name" | ||
}, | ||
{ | ||
"name": "to" | ||
} | ||
], | ||
"return": { | ||
"type": "void" | ||
} | ||
}, | ||
{ | ||
"name": "_queueAction", | ||
"description": "", | ||
"privacy": "protected", | ||
"sourceRange": { | ||
"start": { | ||
"line": 106, | ||
"column": 2 | ||
}, | ||
"end": { | ||
"line": 108, | ||
"column": 3 | ||
} | ||
}, | ||
"metadata": {}, | ||
"params": [ | ||
{ | ||
"name": "action" | ||
} | ||
], | ||
"return": { | ||
"type": "void" | ||
} | ||
}, | ||
{ | ||
"name": "_processQueue", | ||
"description": "", | ||
"privacy": "protected", | ||
"sourceRange": { | ||
"start": { | ||
"line": 110, | ||
"column": 2 | ||
}, | ||
"end": { | ||
"line": 116, | ||
"column": 3 | ||
} | ||
}, | ||
"metadata": {}, | ||
"params": [], | ||
"return": { | ||
"type": "void" | ||
} | ||
}, | ||
{ | ||
"name": "_setProperty", | ||
"description": "", | ||
"privacy": "protected", | ||
"sourceRange": { | ||
"start": { | ||
"line": 118, | ||
"column": 2 | ||
}, | ||
"end": { | ||
"line": 120, | ||
"column": 3 | ||
} | ||
}, | ||
"metadata": {}, | ||
"params": [ | ||
{ | ||
"name": "{\n name,\n value\n}" | ||
} | ||
], | ||
"return": { | ||
"type": "void" | ||
} | ||
}, | ||
{ | ||
"name": "render", | ||
"description": "", | ||
"privacy": "public", | ||
"sourceRange": { | ||
"start": { | ||
"line": 122, | ||
"column": 2 | ||
}, | ||
"end": { | ||
"line": 130, | ||
"column": 3 | ||
} | ||
}, | ||
"metadata": {}, | ||
"params": [], | ||
"return": { | ||
"type": "void" | ||
} | ||
} | ||
], | ||
"staticMethods": [], | ||
"demos": [ | ||
{ | ||
"url": "demo/index.html", | ||
"description": "" | ||
} | ||
], | ||
"metadata": {}, | ||
"sourceRange": { | ||
"start": { | ||
"line": 15, | ||
"column": 0 | ||
}, | ||
"end": { | ||
"line": 137, | ||
"column": 1 | ||
} | ||
}, | ||
"privacy": "public", | ||
"superclass": "HTMLElement", | ||
"name": "HaxBodyBehaviors", | ||
"attributes": [], | ||
"events": [], | ||
"styling": { | ||
"cssVariables": [], | ||
"selectors": [] | ||
}, | ||
"slots": [] | ||
} | ||
], | ||
"classes": [ | ||
@@ -269,7 +15,7 @@ { | ||
"start": { | ||
"line": 8, | ||
"line": 9, | ||
"column": 7 | ||
}, | ||
"end": { | ||
"line": 816, | ||
"line": 813, | ||
"column": 1 | ||
@@ -276,0 +22,0 @@ } |
@@ -1,160 +0,10 @@ | ||
define(["./lib/HAXWiring.js"], function(_HAXWiring) { | ||
define(["exports", "./lib/HAXWiring.js"], function(_exports, _HAXWiring) { | ||
"use strict"; | ||
var HaxBodyBehaviors = (function(_HTMLElement) { | ||
babelHelpers.inherits(HaxBodyBehaviors, _HTMLElement); | ||
babelHelpers.createClass( | ||
HaxBodyBehaviors, | ||
[ | ||
{ | ||
key: "getTemplate", | ||
value: function getTemplate() { | ||
return "\n<style>\n\n</style>\n"; | ||
} | ||
}, | ||
{ | ||
key: "templateUrl", | ||
get: function get() { | ||
return "hax-body-behaviors.html"; | ||
} | ||
}, | ||
{ | ||
key: "propertiesUrl", | ||
get: function get() { | ||
return "hax-body-behaviors-properties.json"; | ||
} | ||
}, | ||
{ | ||
key: "styleUrl", | ||
get: function get() { | ||
return "hax-body-behaviors.css"; | ||
} | ||
} | ||
], | ||
[ | ||
{ | ||
key: "properties", | ||
get: function get() { | ||
return {}; | ||
} | ||
}, | ||
{ | ||
key: "tag", | ||
get: function get() { | ||
return "hax-body-behaviors"; | ||
} | ||
} | ||
] | ||
); | ||
function HaxBodyBehaviors() { | ||
var _this, | ||
delayRender = | ||
0 < arguments.length && arguments[0] !== void 0 ? arguments[0] : !1; | ||
babelHelpers.classCallCheck(this, HaxBodyBehaviors); | ||
_this = babelHelpers.possibleConstructorReturn( | ||
this, | ||
( | ||
HaxBodyBehaviors.__proto__ || Object.getPrototypeOf(HaxBodyBehaviors) | ||
).call(this) | ||
); | ||
_this.tag = HaxBodyBehaviors.tag; | ||
_this.HAXWiring = new _HAXWiring.HAXWiring(); | ||
var obj = HaxBodyBehaviors.properties; | ||
for (var p in obj) { | ||
if (obj.hasOwnProperty(p)) { | ||
_this[p] = obj[p].value; | ||
} | ||
} | ||
_this._queue = []; | ||
_this.template = document.createElement("template"); | ||
_this.attachShadow({ mode: "open" }); | ||
if (!delayRender) { | ||
_this.render(); | ||
} | ||
return _this; | ||
Object.defineProperty(_exports, "__esModule", { value: !0 }); | ||
Object.defineProperty(_exports, "HAXWiring", { | ||
enumerable: !0, | ||
get: function get() { | ||
return _HAXWiring.HAXWiring; | ||
} | ||
babelHelpers.createClass(HaxBodyBehaviors, [ | ||
{ | ||
key: "connectedCallback", | ||
value: function connectedCallback() { | ||
if (window.ShadyCSS) { | ||
window.ShadyCSS.styleElement(this); | ||
} | ||
if (this._queue.length) { | ||
this._processQueue(); | ||
} | ||
} | ||
}, | ||
{ | ||
key: "_copyAttribute", | ||
value: function _copyAttribute(name, to) { | ||
var recipients = this.shadowRoot.querySelectorAll(to), | ||
value = this.getAttribute(name), | ||
fname = null == value ? "removeAttribute" : "setAttribute", | ||
_iteratorNormalCompletion = !0, | ||
_didIteratorError = !1, | ||
_iteratorError = void 0; | ||
try { | ||
for ( | ||
var _iterator = recipients[Symbol.iterator](), _step, node; | ||
!(_iteratorNormalCompletion = (_step = _iterator.next()).done); | ||
_iteratorNormalCompletion = !0 | ||
) { | ||
node = _step.value; | ||
node[fname](name, value); | ||
} | ||
} catch (err) { | ||
_didIteratorError = !0; | ||
_iteratorError = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion && null != _iterator.return) { | ||
_iterator.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError) { | ||
throw _iteratorError; | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
{ | ||
key: "_queueAction", | ||
value: function _queueAction(action) { | ||
this._queue.push(action); | ||
} | ||
}, | ||
{ | ||
key: "_processQueue", | ||
value: function _processQueue() { | ||
var _this2 = this; | ||
this._queue.forEach(function(action) { | ||
_this2["_".concat(action.type)](action.data); | ||
}); | ||
this._queue = []; | ||
} | ||
}, | ||
{ | ||
key: "_setProperty", | ||
value: function _setProperty(_ref) { | ||
var name = _ref.name, | ||
value = _ref.value; | ||
this[name] = value; | ||
} | ||
}, | ||
{ | ||
key: "render", | ||
value: function render() { | ||
this.shadowRoot.innerHTML = null; | ||
this.template.innerHTML = this.html; | ||
if (window.ShadyCSS) { | ||
window.ShadyCSS.prepareTemplate(this.template, this.tag); | ||
} | ||
this.shadowRoot.appendChild(this.template.content.cloneNode(!0)); | ||
} | ||
} | ||
]); | ||
return HaxBodyBehaviors; | ||
})(HTMLElement); | ||
window.customElements.define(HaxBodyBehaviors.tag, HaxBodyBehaviors); | ||
}); | ||
}); |
@@ -1,6 +0,9 @@ | ||
define(["exports"], function(_exports) { | ||
define([ | ||
"exports", | ||
"../node_modules/@polymer/polymer/lib/legacy/polymer.dom.js" | ||
], function(_exports, _polymerDom) { | ||
"use strict"; | ||
Object.defineProperty(_exports, "__esModule", { value: !0 }); | ||
_exports.HAXWiring = void 0; | ||
_exports.HAXWiring = function HAXWiring() { | ||
var HAXWiring = function HAXWiring() { | ||
var _this = this; | ||
@@ -140,9 +143,9 @@ babelHelpers.classCallCheck(this, HAXWiring); | ||
: babelHelpers.typeof(Polymer)) !== "undefined" && | ||
babelHelpers.typeof(Polymer.HaxStore) !== "undefined" && | ||
babelHelpers.typeof(Polymer.HaxStore.instance) !== "undefined" && | ||
null != Polymer.HaxStore.instance && | ||
babelHelpers.typeof(Polymer.HaxStore.instance.elementList) !== | ||
babelHelpers.typeof(window.HaxStore) !== "undefined" && | ||
babelHelpers.typeof(window.HaxStore.instance) !== "undefined" && | ||
null != window.HaxStore.instance && | ||
babelHelpers.typeof(window.HaxStore.instance.elementList) !== | ||
"undefined" && | ||
babelHelpers.typeof( | ||
Polymer.HaxStore.instance.elementList[tag.toLowerCase()] | ||
window.HaxStore.instance.elementList[tag.toLowerCase()] | ||
) === "undefined" | ||
@@ -160,9 +163,9 @@ ) { | ||
: babelHelpers.typeof(Polymer)) !== "undefined" && | ||
babelHelpers.typeof(Polymer.HaxStore) !== "undefined" && | ||
babelHelpers.typeof(Polymer.HaxStore.instance) !== "undefined" && | ||
null != Polymer.HaxStore.instance && | ||
babelHelpers.typeof(Polymer.HaxStore.instance.elementList) !== | ||
babelHelpers.typeof(window.HaxStore) !== "undefined" && | ||
babelHelpers.typeof(window.HaxStore.instance) !== "undefined" && | ||
null != window.HaxStore.instance && | ||
babelHelpers.typeof(window.HaxStore.instance.elementList) !== | ||
"undefined" && | ||
babelHelpers.typeof( | ||
Polymer.HaxStore.instance.elementList[_this.tagName.toLowerCase()] | ||
window.HaxStore.instance.elementList[_this.tagName.toLowerCase()] | ||
) === "undefined" | ||
@@ -178,3 +181,3 @@ ) { | ||
if ("" === tag) { | ||
_this.setHaxProperties(props); | ||
_this.haxProperties = props; | ||
} | ||
@@ -526,23 +529,19 @@ } else { | ||
var _slot = ""; | ||
if ( | ||
("undefined" === typeof Polymer | ||
? "undefined" | ||
: babelHelpers.typeof(Polymer)) !== "undefined" | ||
) { | ||
for (var i in Polymer.dom(target).childNodes) { | ||
if ( | ||
babelHelpers.typeof(Polymer.dom(target).childNodes[i]) !== | ||
"undefined" | ||
for (var i in (0, _polymerDom.dom)(target).childNodes) { | ||
if ( | ||
babelHelpers.typeof( | ||
(0, _polymerDom.dom)(target).childNodes[i] | ||
) !== "undefined" | ||
) { | ||
if (1 === (0, _polymerDom.dom)(target).childNodes[i].nodeType) { | ||
_slot += (0, _polymerDom.dom)(target).childNodes[i].innerHTML; | ||
} else if ( | ||
1 !== (0, _polymerDom.dom)(target).childNodes[i].nodeType && | ||
babelHelpers.typeof( | ||
(0, _polymerDom.dom)(target).childNodes[i].textContent | ||
) !== "undefined" && | ||
"" !== (0, _polymerDom.dom)(target).childNodes[i].textContent | ||
) { | ||
if (1 === Polymer.dom(target).childNodes[i].nodeType) { | ||
_slot += Polymer.dom(target).childNodes[i].innerHTML; | ||
} else if ( | ||
1 !== Polymer.dom(target).childNodes[i].nodeType && | ||
babelHelpers.typeof( | ||
Polymer.dom(target).childNodes[i].textContent | ||
) !== "undefined" && | ||
"" !== Polymer.dom(target).childNodes[i].textContent | ||
) { | ||
_slot += Polymer.dom(target).childNodes[i].textContent; | ||
} | ||
_slot += (0, _polymerDom.dom)(target).childNodes[i] | ||
.textContent; | ||
} | ||
@@ -700,2 +699,5 @@ } | ||
}; | ||
_exports.HAXWiring = HAXWiring; | ||
window.HAXBehaviors = window.HAXBehaviors || {}; | ||
window.HAXBehaviors.PropertiesBehaviors = new HAXWiring(); | ||
}); |
import { HAXWiring } from "./lib/HAXWiring.js"; | ||
class HaxBodyBehaviors extends HTMLElement { | ||
getTemplate() { | ||
return ` | ||
<style> | ||
</style> | ||
`; | ||
} | ||
static get properties() { | ||
return {}; | ||
} | ||
static get tag() { | ||
return "hax-body-behaviors"; | ||
} | ||
get templateUrl() { | ||
return "hax-body-behaviors.html"; | ||
} | ||
get propertiesUrl() { | ||
return "hax-body-behaviors-properties.json"; | ||
} | ||
get styleUrl() { | ||
return "hax-body-behaviors.css"; | ||
} | ||
constructor(delayRender = !1) { | ||
super(); | ||
this.tag = HaxBodyBehaviors.tag; | ||
this.HAXWiring = new HAXWiring(); | ||
let obj = HaxBodyBehaviors.properties; | ||
for (let p in obj) { | ||
if (obj.hasOwnProperty(p)) { | ||
this[p] = obj[p].value; | ||
} | ||
} | ||
this._queue = []; | ||
this.template = document.createElement("template"); | ||
this.attachShadow({ mode: "open" }); | ||
if (!delayRender) { | ||
this.render(); | ||
} | ||
} | ||
connectedCallback() { | ||
if (window.ShadyCSS) { | ||
window.ShadyCSS.styleElement(this); | ||
} | ||
if (this._queue.length) { | ||
this._processQueue(); | ||
} | ||
} | ||
_copyAttribute(name, to) { | ||
const recipients = this.shadowRoot.querySelectorAll(to), | ||
value = this.getAttribute(name), | ||
fname = null == value ? "removeAttribute" : "setAttribute"; | ||
for (const node of recipients) { | ||
node[fname](name, value); | ||
} | ||
} | ||
_queueAction(action) { | ||
this._queue.push(action); | ||
} | ||
_processQueue() { | ||
this._queue.forEach(action => { | ||
this[`_${action.type}`](action.data); | ||
}); | ||
this._queue = []; | ||
} | ||
_setProperty({ name, value }) { | ||
this[name] = value; | ||
} | ||
render() { | ||
this.shadowRoot.innerHTML = null; | ||
this.template.innerHTML = this.html; | ||
if (window.ShadyCSS) { | ||
window.ShadyCSS.prepareTemplate(this.template, this.tag); | ||
} | ||
this.shadowRoot.appendChild(this.template.content.cloneNode(!0)); | ||
} | ||
} | ||
window.customElements.define(HaxBodyBehaviors.tag, HaxBodyBehaviors); | ||
export { HAXWiring }; |
@@ -0,1 +1,2 @@ | ||
import { dom } from "../node_modules/@polymer/polymer/lib/legacy/polymer.dom.js"; | ||
export class HAXWiring { | ||
@@ -123,7 +124,7 @@ constructor() { | ||
typeof Polymer !== typeof void 0 && | ||
typeof Polymer.HaxStore !== typeof void 0 && | ||
typeof Polymer.HaxStore.instance !== typeof void 0 && | ||
null != Polymer.HaxStore.instance && | ||
typeof Polymer.HaxStore.instance.elementList !== typeof void 0 && | ||
typeof Polymer.HaxStore.instance.elementList[tag.toLowerCase()] === | ||
typeof window.HaxStore !== typeof void 0 && | ||
typeof window.HaxStore.instance !== typeof void 0 && | ||
null != window.HaxStore.instance && | ||
typeof window.HaxStore.instance.elementList !== typeof void 0 && | ||
typeof window.HaxStore.instance.elementList[tag.toLowerCase()] === | ||
typeof void 0 | ||
@@ -139,7 +140,7 @@ ) { | ||
typeof Polymer !== typeof void 0 && | ||
typeof Polymer.HaxStore !== typeof void 0 && | ||
typeof Polymer.HaxStore.instance !== typeof void 0 && | ||
null != Polymer.HaxStore.instance && | ||
typeof Polymer.HaxStore.instance.elementList !== typeof void 0 && | ||
typeof Polymer.HaxStore.instance.elementList[ | ||
typeof window.HaxStore !== typeof void 0 && | ||
typeof window.HaxStore.instance !== typeof void 0 && | ||
null != window.HaxStore.instance && | ||
typeof window.HaxStore.instance.elementList !== typeof void 0 && | ||
typeof window.HaxStore.instance.elementList[ | ||
this.tagName.toLowerCase() | ||
@@ -156,3 +157,3 @@ ] === typeof void 0 | ||
if ("" === tag) { | ||
this.setHaxProperties(props); | ||
this.haxProperties = props; | ||
} | ||
@@ -492,17 +493,13 @@ } else { | ||
let slot = ""; | ||
if (typeof Polymer !== typeof void 0) { | ||
for (var i in Polymer.dom(target).childNodes) { | ||
if ( | ||
typeof Polymer.dom(target).childNodes[i] !== typeof void 0 | ||
for (var i in dom(target).childNodes) { | ||
if (typeof dom(target).childNodes[i] !== typeof void 0) { | ||
if (1 === dom(target).childNodes[i].nodeType) { | ||
slot += dom(target).childNodes[i].innerHTML; | ||
} else if ( | ||
1 !== dom(target).childNodes[i].nodeType && | ||
typeof dom(target).childNodes[i].textContent !== | ||
typeof void 0 && | ||
"" !== dom(target).childNodes[i].textContent | ||
) { | ||
if (1 === Polymer.dom(target).childNodes[i].nodeType) { | ||
slot += Polymer.dom(target).childNodes[i].innerHTML; | ||
} else if ( | ||
1 !== Polymer.dom(target).childNodes[i].nodeType && | ||
typeof Polymer.dom(target).childNodes[i].textContent !== | ||
typeof void 0 && | ||
"" !== Polymer.dom(target).childNodes[i].textContent | ||
) { | ||
slot += Polymer.dom(target).childNodes[i].textContent; | ||
} | ||
slot += dom(target).childNodes[i].textContent; | ||
} | ||
@@ -661,1 +658,3 @@ } | ||
} | ||
window.HAXBehaviors = window.HAXBehaviors || {}; | ||
window.HAXBehaviors.PropertiesBehaviors = new HAXWiring(); |
@@ -17,39 +17,49 @@ const gulp = require("gulp"); | ||
replace( | ||
/extends\s+HTMLElement\s+{/g, | ||
/\/\* REQUIRED FOR TOOLING DO NOT TOUCH \*\//g, | ||
(classStatement, character, jsFile) => { | ||
// extract the templateUrl and styleUrl with regex. Would prefer to do | ||
// this by require'ing hax-body-behaviors.js and asking it directly, but without | ||
// node.js support for ES modules, we're stuck with this. | ||
const oneLineFile = jsFile | ||
.slice(character) | ||
.split("\n") | ||
.join(" "); | ||
const [ | ||
, | ||
templateUrl | ||
] = /templateUrl\([^)]*\)\s*{\s*return\s+"([^"]+)"/.exec(oneLineFile); | ||
// pull these off the package wcfactory files area | ||
let html = fs | ||
.readFileSync(path.join("./src", templateUrl)) | ||
.readFileSync(path.join("./", packageJson.wcfactory.files.html)) | ||
.toString() | ||
.trim(); | ||
html = decomment(html); | ||
let haxString = ""; | ||
if (packageJson.wcfactory.useHAX) { | ||
let HAXProps = fs.readFileSync( | ||
path.join("./", packageJson.wcfactory.files.hax) | ||
); | ||
haxString = ` | ||
// haxProperty definition | ||
static get haxProperties() { | ||
return ${HAXProps}; | ||
}`; | ||
} | ||
let props = "{}"; | ||
// pull together styles from url | ||
const [ | ||
, | ||
styleUrl | ||
] = /styleUrl\([^)]*\)\s*{\s*return\s+"([^"]+)"/.exec(oneLineFile); | ||
const styleFilePath = path.join("./src", styleUrl); | ||
let cssResult = fs.readFileSync(styleFilePath); | ||
props = fs.readFileSync( | ||
path.join("./", packageJson.wcfactory.files.properties) | ||
); | ||
let cssResult = "<style>"; | ||
if ( | ||
packageJson.wcfactory.useSass && | ||
packageJson.wcfactory.files.scss | ||
) { | ||
const sass = require("node-sass"); | ||
cssResult += sass.renderSync({ | ||
file: path.join("./", packageJson.wcfactory.files.scss) | ||
}).css; | ||
} else if (packageJson.wcfactory.files.css) { | ||
cssResult += fs.readFileSync( | ||
path.join("./", packageJson.wcfactory.files.css) | ||
); | ||
} | ||
cssResult += "</style>"; | ||
cssResult = stripCssComments(cssResult).trim(); | ||
return `${classStatement} | ||
getTemplate() { | ||
return \` | ||
<style> | ||
return ` | ||
// render function | ||
static get template() { | ||
return html\` | ||
${cssResult} | ||
</style> | ||
${html}\`; | ||
} | ||
${haxString} | ||
// properties available to the custom element for data binding | ||
@@ -56,0 +66,0 @@ static get properties() { |
@@ -1,1 +0,1 @@ | ||
define(["./lib/HAXWiring.js"],function(_HAXWiring){"use strict";var HaxBodyBehaviors=function(_HTMLElement){babelHelpers.inherits(HaxBodyBehaviors,_HTMLElement);babelHelpers.createClass(HaxBodyBehaviors,[{key:"getTemplate",value:function getTemplate(){return"\n<style>\n\n</style>\n"}},{key:"templateUrl",get:function get(){return"hax-body-behaviors.html"}},{key:"propertiesUrl",get:function get(){return"hax-body-behaviors-properties.json"}},{key:"styleUrl",get:function get(){return"hax-body-behaviors.css"}}],[{key:"properties",get:function get(){return{}}},{key:"tag",get:function get(){return"hax-body-behaviors"}}]);function HaxBodyBehaviors(){var _this,delayRender=0<arguments.length&&arguments[0]!==void 0?arguments[0]:!1;babelHelpers.classCallCheck(this,HaxBodyBehaviors);_this=babelHelpers.possibleConstructorReturn(this,(HaxBodyBehaviors.__proto__||Object.getPrototypeOf(HaxBodyBehaviors)).call(this));_this.tag=HaxBodyBehaviors.tag;_this.HAXWiring=new _HAXWiring.HAXWiring;var obj=HaxBodyBehaviors.properties;for(var p in obj){if(obj.hasOwnProperty(p)){_this[p]=obj[p].value}}_this._queue=[];_this.template=document.createElement("template");_this.attachShadow({mode:"open"});if(!delayRender){_this.render()}return _this}babelHelpers.createClass(HaxBodyBehaviors,[{key:"connectedCallback",value:function connectedCallback(){if(window.ShadyCSS){window.ShadyCSS.styleElement(this)}if(this._queue.length){this._processQueue()}}},{key:"_copyAttribute",value:function _copyAttribute(name,to){var recipients=this.shadowRoot.querySelectorAll(to),value=this.getAttribute(name),fname=null==value?"removeAttribute":"setAttribute",_iteratorNormalCompletion=!0,_didIteratorError=!1,_iteratorError=void 0;try{for(var _iterator=recipients[Symbol.iterator](),_step,node;!(_iteratorNormalCompletion=(_step=_iterator.next()).done);_iteratorNormalCompletion=!0){node=_step.value;node[fname](name,value)}}catch(err){_didIteratorError=!0;_iteratorError=err}finally{try{if(!_iteratorNormalCompletion&&null!=_iterator.return){_iterator.return()}}finally{if(_didIteratorError){throw _iteratorError}}}}},{key:"_queueAction",value:function _queueAction(action){this._queue.push(action)}},{key:"_processQueue",value:function _processQueue(){var _this2=this;this._queue.forEach(function(action){_this2["_".concat(action.type)](action.data)});this._queue=[]}},{key:"_setProperty",value:function _setProperty(_ref){var name=_ref.name,value=_ref.value;this[name]=value}},{key:"render",value:function render(){this.shadowRoot.innerHTML=null;this.template.innerHTML=this.html;if(window.ShadyCSS){window.ShadyCSS.prepareTemplate(this.template,this.tag)}this.shadowRoot.appendChild(this.template.content.cloneNode(!0))}}]);return HaxBodyBehaviors}(HTMLElement);window.customElements.define(HaxBodyBehaviors.tag,HaxBodyBehaviors)}); | ||
define(["exports","./lib/HAXWiring.js"],function(_exports,_HAXWiring){"use strict";Object.defineProperty(_exports,"__esModule",{value:!0});Object.defineProperty(_exports,"HAXWiring",{enumerable:!0,get:function get(){return _HAXWiring.HAXWiring}})}); |
@@ -1,5 +0,1 @@ | ||
import{HAXWiring}from"./lib/HAXWiring.js";class HaxBodyBehaviors extends HTMLElement{getTemplate(){return` | ||
<style> | ||
</style> | ||
`}static get properties(){return{}}static get tag(){return"hax-body-behaviors"}get templateUrl(){return"hax-body-behaviors.html"}get propertiesUrl(){return"hax-body-behaviors-properties.json"}get styleUrl(){return"hax-body-behaviors.css"}constructor(delayRender=!1){super();this.tag=HaxBodyBehaviors.tag;this.HAXWiring=new HAXWiring;let obj=HaxBodyBehaviors.properties;for(let p in obj){if(obj.hasOwnProperty(p)){this[p]=obj[p].value}}this._queue=[];this.template=document.createElement("template");this.attachShadow({mode:"open"});if(!delayRender){this.render()}}connectedCallback(){if(window.ShadyCSS){window.ShadyCSS.styleElement(this)}if(this._queue.length){this._processQueue()}}_copyAttribute(name,to){const recipients=this.shadowRoot.querySelectorAll(to),value=this.getAttribute(name),fname=null==value?"removeAttribute":"setAttribute";for(const node of recipients){node[fname](name,value)}}_queueAction(action){this._queue.push(action)}_processQueue(){this._queue.forEach(action=>{this[`_${action.type}`](action.data)});this._queue=[]}_setProperty({name,value}){this[name]=value}render(){this.shadowRoot.innerHTML=null;this.template.innerHTML=this.html;if(window.ShadyCSS){window.ShadyCSS.prepareTemplate(this.template,this.tag)}this.shadowRoot.appendChild(this.template.content.cloneNode(!0))}}window.customElements.define(HaxBodyBehaviors.tag,HaxBodyBehaviors); | ||
import{HAXWiring}from"./lib/HAXWiring.js";export{HAXWiring}; |
@@ -6,135 +6,2 @@ /** | ||
import { HAXWiring } from "./lib/HAXWiring.js"; | ||
/** | ||
* `hax-body-behaviors` | ||
* `HAX Body Behaviors to utilize in any element` | ||
* | ||
* @microcopy - language worth noting: | ||
* - | ||
* | ||
* @customElement | ||
* @demo demo/index.html | ||
*/ | ||
class HaxBodyBehaviors extends HTMLElement { | ||
getTemplate() { | ||
return ` | ||
<style> | ||
</style> | ||
`; | ||
} | ||
// properties available to the custom element for data binding | ||
static get properties() { | ||
return {}; | ||
} | ||
/** | ||
* Store the tag name to make it easier to obtain directly. | ||
* @notice function name must be here for tooling to operate correctly | ||
*/ | ||
static get tag() { | ||
return "hax-body-behaviors"; | ||
} | ||
/** | ||
* A file that contains the HTML template for the element. | ||
* @notice function name must be here for tooling to operate correctly | ||
*/ | ||
get templateUrl() { | ||
return "hax-body-behaviors.html"; | ||
} | ||
/** | ||
* A file that contains the properties that will be wired into this element. | ||
* @notice function name must be here for tooling to operate correctly | ||
*/ | ||
get propertiesUrl() { | ||
return "hax-body-behaviors-properties.json"; | ||
} | ||
/** | ||
* A file that contains the css for this element to be mixed into the html block. | ||
* @notice function name must be here for tooling to operate correctly | ||
*/ | ||
get styleUrl() { | ||
return "hax-body-behaviors.css"; | ||
} | ||
/** | ||
* life cycle | ||
*/ | ||
constructor(delayRender = false) { | ||
super(); | ||
// set tag for later use | ||
this.tag = HaxBodyBehaviors.tag; | ||
this.HAXWiring = new HAXWiring(); | ||
//this.HAXWiring.setHaxProperties(props, HaxBodyBehaviors.tag, this); | ||
// map our imported properties json to real props on the element | ||
// @notice static getter of properties is built via tooling | ||
// to edit modify src/HaxBodyBehaviors-properties.json | ||
let obj = HaxBodyBehaviors.properties; | ||
for (let p in obj) { | ||
if (obj.hasOwnProperty(p)) { | ||
this[p] = obj[p].value; | ||
} | ||
} | ||
// optional queue for future use | ||
this._queue = []; | ||
this.template = document.createElement("template"); | ||
this.attachShadow({ mode: "open" }); | ||
if (!delayRender) { | ||
this.render(); | ||
} | ||
} | ||
/** | ||
* life cycle, element is afixed to the DOM | ||
*/ | ||
connectedCallback() { | ||
if (window.ShadyCSS) { | ||
window.ShadyCSS.styleElement(this); | ||
} | ||
if (this._queue.length) { | ||
this._processQueue(); | ||
} | ||
} | ||
_copyAttribute(name, to) { | ||
const recipients = this.shadowRoot.querySelectorAll(to); | ||
const value = this.getAttribute(name); | ||
const fname = value == null ? "removeAttribute" : "setAttribute"; | ||
for (const node of recipients) { | ||
node[fname](name, value); | ||
} | ||
} | ||
_queueAction(action) { | ||
this._queue.push(action); | ||
} | ||
_processQueue() { | ||
this._queue.forEach(action => { | ||
this[`_${action.type}`](action.data); | ||
}); | ||
this._queue = []; | ||
} | ||
_setProperty({ name, value }) { | ||
this[name] = value; | ||
} | ||
render() { | ||
this.shadowRoot.innerHTML = null; | ||
this.template.innerHTML = this.html; | ||
if (window.ShadyCSS) { | ||
window.ShadyCSS.prepareTemplate(this.template, this.tag); | ||
} | ||
this.shadowRoot.appendChild(this.template.content.cloneNode(true)); | ||
} | ||
//static get observedAttributes() { | ||
// return []; | ||
//} | ||
// disconnectedCallback() {} | ||
// attributeChangedCallback(attr, oldValue, newValue) {} | ||
} | ||
window.customElements.define(HaxBodyBehaviors.tag, HaxBodyBehaviors); | ||
export { HAXWiring }; |
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t():"function"==typeof define&&define.amd?define(t):t()}(0,function(){"use strict";function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(t)}function t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function i(e,t,i){return t&&r(e.prototype,t),i&&r(e,i),e}function o(e){return(o=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function n(e,t){return(n=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function a(e,t,r){return(a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}()?Reflect.construct:function(e,t,r){var i=[null];i.push.apply(i,t);var o=new(Function.bind.apply(e,i));return r&&n(o,r.prototype),o}).apply(null,arguments)}function u(e){var t="function"==typeof Map?new Map:void 0;return(u=function(e){if(null===e||(r=e,-1===Function.toString.call(r).indexOf("[native code]")))return e;var r;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,i)}function i(){return a(e,arguments,o(this).constructor)}return i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),n(i,e)})(e)}function d(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}var p=function r(){var i=this;t(this,r),this.haxProperties={canScale:!1,canPosition:!1,canEditSource:!1,settings:{quick:[],configure:[],advanced:[]},wipeSlot:{}},this.setHaxProperties=function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:document;if("undefined"===e(t.api)&&(t.api="1"),"1"==t.api){if("undefined"===e(t.canPosition)&&(t.canPosition=!0),"undefined"===e(t.canScale)&&(t.canScale=!0),"undefined"===e(t.canEditSource)&&(t.canEditSource=!1),"undefined"===e(t.gizmo)&&(t.gizmo=!1),"undefined"!==e(t.settings)){"undefined"===e(t.settings.quick)&&(t.settings.quick=[]);for(var n=0;n<t.settings.quick.length;n++)t.settings.quick[n]=i.validateSetting(t.settings.quick[n]),t.settings.quick[n]||t.settings.quick.splice(n,1);"undefined"===e(t.settings.configure)&&(t.settings.configure=[]);for(var a=0;a<t.settings.configure.length;a++)t.settings.configure[a]=i.validateSetting(t.settings.configure[a]),t.settings.configure[a]||t.settings.configure.splice(a,1);"undefined"===e(t.settings.advanced)&&(t.settings.advanced=[]);for(var u=0;u<t.settings.advanced.length;u++)t.settings.advanced[u]=i.validateSetting(t.settings.advanced[u]),t.settings.advanced[u]||t.settings.advanced.splice(u,1);t.settings.advanced.push({attribute:"class",title:"Classes",description:"CSS classes applied manually to the element",inputMethod:"textfield"}),t.settings.advanced.push({attribute:"style",title:"Styles",description:"Custom CSS styles as applied to the element",inputMethod:"textfield"}),t.settings.advanced.push({attribute:"prefix",title:"Schema: prefix",description:"Schema prefixes",inputMethod:"textfield"}),t.settings.advanced.push({attribute:"typeof",title:"Schema: TypeOf",description:"typeof definition for Schema usage",inputMethod:"textfield"}),t.settings.advanced.push({attribute:"property",title:"Schema: Property",description:"typeof definition for Schema usage",inputMethod:"textfield"}),t.settings.advanced.push({attribute:"resource",title:"Schema: Resource ID",description:"Schema resource identifier",inputMethod:"textfield"}),t.settings.advanced.push({attribute:"id",title:"ID",description:"element ID, only set this if you know why",inputMethod:"textfield"}),t.settings.advanced.push({attribute:"slot",title:"slot",description:"DOM slot area",inputMethod:"textfield"})}if("undefined"===e(t.saveOptions)&&(t.saveOptions={wipeSlot:!1}),"undefined"===("undefined"==typeof Polymer?"undefined":e(Polymer))){var d=new CustomEvent("hax-register-properties",{bubbles:!0,cancelable:!0,detail:{tag:r.toLowerCase(),properties:t,polymer:!1}});o.dispatchEvent(d)}else if(""!==r&&"undefined"!==("undefined"==typeof Polymer?"undefined":e(Polymer))&&"undefined"!==e(Polymer.HaxStore)&&"undefined"!==e(Polymer.HaxStore.instance)&&null!=Polymer.HaxStore.instance&&"undefined"!==e(Polymer.HaxStore.instance.elementList)&&"undefined"===e(Polymer.HaxStore.instance.elementList[r.toLowerCase()])){var p=new CustomEvent("hax-register-properties",{bubbles:!0,cancelable:!0,detail:{tag:r.toLowerCase(),properties:t}});o.dispatchEvent(p)}else if("undefined"!==("undefined"==typeof Polymer?"undefined":e(Polymer))&&"undefined"!==e(Polymer.HaxStore)&&"undefined"!==e(Polymer.HaxStore.instance)&&null!=Polymer.HaxStore.instance&&"undefined"!==e(Polymer.HaxStore.instance.elementList)&&"undefined"===e(Polymer.HaxStore.instance.elementList[i.tagName.toLowerCase()])){var s=new CustomEvent("hax-register-properties",{bubbles:!0,cancelable:!0,detail:{tag:i.tagName.toLowerCase(),properties:t}});o.dispatchEvent(s)}""===r&&i.setHaxProperties(t)}else console.log("This is't a valid usage of hax-body-behaviors API. See hax-body-behaviors 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.validateSetting=function(t){return("undefined"!==e(t.property)||"undefined"!==e(t.slot)||"undefined"!==e(t.attribute))&&("undefined"===e(t.title)&&("undefined"===e(t.attribute)?t.title=t.property:t.title=t.attribute),"undefined"===e(t.description)&&(t.description=""),"undefined"===e(t.inputMethod)&&(t.inputMethod="textfield"),"undefined"===e(t.type)&&(t.type="settings"),"undefined"===e(t.icon)&&(t.icon="android"),"undefined"===e(t.options)&&(t.options={}),"undefined"===e(t.required)&&(t.required=!1),"undefined"===e(t.validation)&&(t.validation=".*"),"undefined"===e(t.validationType)&&(t.validationType=""),t)},this.getHaxProperties=function(){return i.haxProperties},this.getHaxJSONSchema=function(t,r){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:i;"undefined"===e(t)&&(t="configure"),"undefined"===e(r)&&(r=o.haxProperties);var n=r.settings[t],a={$schema:"http://json-schema.org/schema#",title:"HAX "+t+" form schema",type:"object",properties:{}};return a.properties=o._getHaxJSONSchemaProperty(n,o),a=o.postProcessgetHaxJSONSchema(a)},this.postProcessgetHaxJSONSchema=function(e){return e},this._getHaxJSONSchemaProperty=function(t,r){var i={};for(var o in t)if(t.hasOwnProperty(o))if("undefined"!==e(t[o].property))switch(i[t[o].property]={title:t[o].title,type:r.getHaxJSONSchemaType(t[o].inputMethod)},"undefined"!==e(r[t[o].property])&&(i[t[o].property].value=r[t[o].property]),"url"==t[o].validationType&&(i[t[o].property].format="uri"),"datepicker"==t[o].inputMethod&&(i[t[o].property].format="date-time"),".*"!=t[o].validation&&(i[t[o].property].pattern=t[o].validation),t[o].inputMethod){case"number":i[t[o].property].component={name:"paper-input",valueProperty:"value",properties:{required:t[o].required},attributes:{type:"number"}};break;case"select":if(slot="","undefined"!==e(t[o].options))for(var n in t[o].options)slot+='<paper-item value="'+n+'">'+t[o].options[n]+"</paper-item>\n";i[t[o].property].component={name:"dropdown-select",valueProperty:"value",slot:slot,properties:{required:t[o].required}};break;case"textarea":i[t[o].property].component={name:"paper-textarea",valueProperty:"value",properties:{required:t[o].required},attributes:{"auto-validate":"auto-validate","char-counter":"char-counter"}};break;case"code-editor":i[t[o].property].component={name:"code-editor",valueProperty:"editorValue",attributes:{id:"haxcodeeditor"},properties:{title:t[o].title,readOnly:!1,theme:"ace/theme/monokai",mode:"ace/mode/html",fontsize:"16px",className:"hax-code-editor"}};break;case"array":i[t[o].property].items={type:"object",properties:r._getHaxJSONSchemaProperty(t[o].properties,r)};break;case"textfield":i[t[o].property].component={name:"paper-input",valueProperty:"value",properties:{required:t[o].required},attributes:{"auto-validate":"auto-validate"}};break;case"alt":i[t[o].property].component={name:"paper-input-flagged",valueProperty:"value",properties:{required:t[o].required},attributes:{"auto-validate":"auto-validate"}};break;case"colorpicker":i[t[o].property].component={name:"paper-swatch-picker",valueProperty:"color",properties:{required:t[o].required}};break;case"iconpicker":i[t[o].property].component={name:"paper-icon-picker",valueProperty:"icon",properties:{required:t[o].required}},t[o].options.constructor===Array&&(i[t[o].property].component.properties.iconList=t[o].options);break;case"datepicker":i[t[o].property].component={name:"app-datepicker",valueProperty:"date",properties:{required:t[o].required,autoUpdateDate:!0}}}else if("undefined"!==e(t[o].attribute))switch(i[t[o].attribute]={title:t[o].title,type:r.getHaxJSONSchemaType(t[o].inputMethod)},"class"===t[o].attribute?i[t[o].attribute].value=r.className:"style"===t[o].attribute?i[t[o].attribute].value=r.style.cssText:"undefined"!==e(r.attributes[t[o].attribute])&&(i[t[o].attribute].value=r.getAttribute(t[o].attribute)),"href"!=o&&"src"!=o||(i[t[o].attribute].format="uri"),"url"==t[o].validationType&&(i[t[o].attribute].format="uri"),"datepicker"==t[o].inputMethod&&(i[t[o].attribute].format="date-time"),".*"!=t[o].validation&&(i[t[o].attribute].pattern=t[o].validation),t[o].inputMethod){case"number":i[t[o].attribute].component={name:"paper-input",valueProperty:"value",properties:{required:t[o].required},attributes:{type:"number"}};break;case"select":if(slot="","undefined"!==e(t[o].options))for(var n in t[o].options)slot+='<paper-item value="'+n+'">'+t[o].options[n]+"</paper-item>\n";i[t[o].attribute].component={name:"dropdown-select",valueProperty:"value",slot:slot,properties:{required:t[o].required}};break;case"textarea":i[t[o].attribute].component={name:"paper-textarea",valueProperty:"value",properties:{required:t[o].required},attributes:{"auto-validate":"auto-validate","char-counter":"char-counter"}};break;case"code-editor":i[t[o].attribute].component={name:"code-editor",valueProperty:"editorValue",attributes:{id:"haxcodeeditor"},properties:{title:t[o].title,readOnly:!1,theme:"ace/theme/monokai",mode:"ace/mode/html",fontsize:"16px",className:"hax-code-editor"}};break;case"textfield":i[t[o].attribute].component={name:"paper-input",valueProperty:"value",properties:{required:t[o].required},attributes:{"auto-validate":"auto-validate"}};break;case"alt":i[t[o].attribute].component={name:"paper-input-flagged",valueProperty:"value",properties:{required:t[o].required},attributes:{"auto-validate":"auto-validate"}};break;case"colorpicker":i[t[o].attribute].component={name:"paper-swatch-picker",valueProperty:"color",properties:{required:t[o].required}}}else{i[t[o].slot]={title:t[o].title,type:r.getHaxJSONSchemaType(t[o].inputMethod),value:"",component:{name:"code-editor",valueProperty:"editorValue",attributes:{id:"haxcodeeditor"},properties:{title:t[o].title,readOnly:!1,theme:"ace/theme/monokai",mode:"ace/mode/html",fontsize:"16px",className:"hax-code-editor"}}};var a="";if("undefined"!==("undefined"==typeof Polymer?"undefined":e(Polymer)))for(var u in Polymer.dom(r).childNodes)"undefined"!==e(Polymer.dom(r).childNodes[u])&&(1===Polymer.dom(r).childNodes[u].nodeType?a+=Polymer.dom(r).childNodes[u].innerHTML:1!==Polymer.dom(r).childNodes[u].nodeType&&"undefined"!==e(Polymer.dom(r).childNodes[u].textContent)&&""!==Polymer.dom(r).childNodes[u].textContent&&(a+=Polymer.dom(r).childNodes[u].textContent));i[t[o].slot].component.slot="<template>"+a+"</template>"}return i},this.getHaxJSONSchemaType=function(e){if(i.validHAXPropertyInputMethod().includes(e))switch(e){case"flipboolean":case"boolean":return"boolean";case"number":return"number";case"select":case"textarea":case"colorpicker":case"iconpicker":case"datepicker":case"textfield":case"alt":return"string";case"array":return"array";default:return"string"}},this.validHAXPropertyInputMethod=function(){return["flipboolean","boolean","select","textfield","textarea","datepicker","colorpicker","iconpicker","alt","number","code-editor","array"]},this.prototypeHaxProperties=function(){return{api:"1",canScale:!0,canPosition:!0,canEditSource:!1,gizmo:{title:"Tag name",description:"A description",icon:"av:play-circle-filled",color:"blue",groups:["Content"],handles:[{type:"data",url:"src"}],meta:{author:""}},settings:{quick:[{property:"title",title:"Title",inputMethod:"textfield",icon:"android"},{property:"primaryColor",title:"Primary color",inputMethod:"colorpicker",icon:"color"}],configure:[{slot:"",title:"Inner content",description:"The slotted content that lives inside the tag",inputMethod:"textfield",icon:"android",required:!0,validationType:"text"},{slot:"button",title:"Button content",description:"The content that can override the button",inputMethod:"textfield",icon:"android",required:!0,validationType:"text"},{property:"title",title:"Title",description:"",inputMethod:"textfield",icon:"android",required:!0,validationType:"text"},{property:"primaryColor",title:"Title",description:"",inputMethod:"textfield",icon:"android",required:!1,validation:".*",validationType:"text"}],advanced:[{property:"secondaryColor",title:"Secondary color",description:"An optional secondary color used in certain edge cases.",inputMethod:"colorpicker",icon:"color"},{property:"endPoint",title:"API endpoint",description:"An optional endpoint to hit and load in more data dymaically.",inputMethod:"textfield",icon:"android",validation:"[a-z0-9]",validationType:"url"}]},saveOptions:{wipeSlot:!1,unsetAttributes:["end-point","secondary-color"]}}}},s=function(e){function r(){var e,i=arguments.length>0&&void 0!==arguments[0]&&arguments[0];t(this,r),(e=d(this,o(r).call(this))).tag=r.tag,e.HAXWiring=new p;var n=r.properties;for(var a in n)n.hasOwnProperty(a)&&(e[a]=n[a].value);return e._queue=[],e.template=document.createElement("template"),e.attachShadow({mode:"open"}),i||e.render(),e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&n(e,t)}(r,u(HTMLElement)),i(r,[{key:"getTemplate",value:function(){return"\n<style>\n\n</style>\n"}},{key:"templateUrl",get:function(){return"hax-body-behaviors.html"}},{key:"propertiesUrl",get:function(){return"hax-body-behaviors-properties.json"}},{key:"styleUrl",get:function(){return"hax-body-behaviors.css"}}],[{key:"properties",get:function(){return{}}},{key:"tag",get:function(){return"hax-body-behaviors"}}]),i(r,[{key:"connectedCallback",value:function(){window.ShadyCSS&&window.ShadyCSS.styleElement(this),this._queue.length&&this._processQueue()}},{key:"_copyAttribute",value:function(e,t){var r=this.shadowRoot.querySelectorAll(t),i=this.getAttribute(e),o=null==i?"removeAttribute":"setAttribute",n=!0,a=!1,u=void 0;try{for(var d,p=r[Symbol.iterator]();!(n=(d=p.next()).done);n=!0){d.value[o](e,i)}}catch(e){a=!0,u=e}finally{try{n||null==p.return||p.return()}finally{if(a)throw u}}}},{key:"_queueAction",value:function(e){this._queue.push(e)}},{key:"_processQueue",value:function(){var e=this;this._queue.forEach(function(t){e["_".concat(t.type)](t.data)}),this._queue=[]}},{key:"_setProperty",value:function(e){var t=e.name,r=e.value;this[t]=r}},{key:"render",value:function(){this.shadowRoot.innerHTML=null,this.template.innerHTML=this.html,window.ShadyCSS&&window.ShadyCSS.prepareTemplate(this.template,this.tag),this.shadowRoot.appendChild(this.template.content.cloneNode(!0))}}]),r}();window.customElements.define(s.tag,s)}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@polymer/polymer/lib/legacy/polymer.dom.js")):"function"==typeof define&&define.amd?define(["exports","@polymer/polymer/lib/legacy/polymer.dom.js"],t):t(e.HaxBodyBehaviors={},e.polymer_dom_js)}(this,function(e,t){"use strict";function i(e){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var r=function e(){var r=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.haxProperties={canScale:!1,canPosition:!1,canEditSource:!1,settings:{quick:[],configure:[],advanced:[]},wipeSlot:{}},this.setHaxProperties=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:document;if("undefined"===i(e.api)&&(e.api="1"),"1"==e.api){if("undefined"===i(e.canPosition)&&(e.canPosition=!0),"undefined"===i(e.canScale)&&(e.canScale=!0),"undefined"===i(e.canEditSource)&&(e.canEditSource=!1),"undefined"===i(e.gizmo)&&(e.gizmo=!1),"undefined"!==i(e.settings)){"undefined"===i(e.settings.quick)&&(e.settings.quick=[]);for(var n=0;n<e.settings.quick.length;n++)e.settings.quick[n]=r.validateSetting(e.settings.quick[n]),e.settings.quick[n]||e.settings.quick.splice(n,1);"undefined"===i(e.settings.configure)&&(e.settings.configure=[]);for(var a=0;a<e.settings.configure.length;a++)e.settings.configure[a]=r.validateSetting(e.settings.configure[a]),e.settings.configure[a]||e.settings.configure.splice(a,1);"undefined"===i(e.settings.advanced)&&(e.settings.advanced=[]);for(var d=0;d<e.settings.advanced.length;d++)e.settings.advanced[d]=r.validateSetting(e.settings.advanced[d]),e.settings.advanced[d]||e.settings.advanced.splice(d,1);e.settings.advanced.push({attribute:"class",title:"Classes",description:"CSS classes applied manually to the element",inputMethod:"textfield"}),e.settings.advanced.push({attribute:"style",title:"Styles",description:"Custom CSS styles as applied to the element",inputMethod:"textfield"}),e.settings.advanced.push({attribute:"prefix",title:"Schema: prefix",description:"Schema prefixes",inputMethod:"textfield"}),e.settings.advanced.push({attribute:"typeof",title:"Schema: TypeOf",description:"typeof definition for Schema usage",inputMethod:"textfield"}),e.settings.advanced.push({attribute:"property",title:"Schema: Property",description:"typeof definition for Schema usage",inputMethod:"textfield"}),e.settings.advanced.push({attribute:"resource",title:"Schema: Resource ID",description:"Schema resource identifier",inputMethod:"textfield"}),e.settings.advanced.push({attribute:"id",title:"ID",description:"element ID, only set this if you know why",inputMethod:"textfield"}),e.settings.advanced.push({attribute:"slot",title:"slot",description:"DOM slot area",inputMethod:"textfield"})}if("undefined"===i(e.saveOptions)&&(e.saveOptions={wipeSlot:!1}),"undefined"===("undefined"==typeof Polymer?"undefined":i(Polymer))){var p=new CustomEvent("hax-register-properties",{bubbles:!0,cancelable:!0,detail:{tag:t.toLowerCase(),properties:e,polymer:!1}});o.dispatchEvent(p)}else if(""!==t&&"undefined"!==("undefined"==typeof Polymer?"undefined":i(Polymer))&&"undefined"!==i(window.HaxStore)&&"undefined"!==i(window.HaxStore.instance)&&null!=window.HaxStore.instance&&"undefined"!==i(window.HaxStore.instance.elementList)&&"undefined"===i(window.HaxStore.instance.elementList[t.toLowerCase()])){var s=new CustomEvent("hax-register-properties",{bubbles:!0,cancelable:!0,detail:{tag:t.toLowerCase(),properties:e}});o.dispatchEvent(s)}else if("undefined"!==("undefined"==typeof Polymer?"undefined":i(Polymer))&&"undefined"!==i(window.HaxStore)&&"undefined"!==i(window.HaxStore.instance)&&null!=window.HaxStore.instance&&"undefined"!==i(window.HaxStore.instance.elementList)&&"undefined"===i(window.HaxStore.instance.elementList[r.tagName.toLowerCase()])){var u=new CustomEvent("hax-register-properties",{bubbles:!0,cancelable:!0,detail:{tag:r.tagName.toLowerCase(),properties:e}});o.dispatchEvent(u)}""===t&&(r.haxProperties=e)}else console.log("This is't a valid usage of hax-body-behaviors API. See hax-body-behaviors 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.validateSetting=function(e){return("undefined"!==i(e.property)||"undefined"!==i(e.slot)||"undefined"!==i(e.attribute))&&("undefined"===i(e.title)&&("undefined"===i(e.attribute)?e.title=e.property:e.title=e.attribute),"undefined"===i(e.description)&&(e.description=""),"undefined"===i(e.inputMethod)&&(e.inputMethod="textfield"),"undefined"===i(e.type)&&(e.type="settings"),"undefined"===i(e.icon)&&(e.icon="android"),"undefined"===i(e.options)&&(e.options={}),"undefined"===i(e.required)&&(e.required=!1),"undefined"===i(e.validation)&&(e.validation=".*"),"undefined"===i(e.validationType)&&(e.validationType=""),e)},this.getHaxProperties=function(){return r.haxProperties},this.getHaxJSONSchema=function(e,t){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:r;"undefined"===i(e)&&(e="configure"),"undefined"===i(t)&&(t=o.haxProperties);var n=t.settings[e],a={$schema:"http://json-schema.org/schema#",title:"HAX "+e+" form schema",type:"object",properties:{}};return a.properties=o._getHaxJSONSchemaProperty(n,o),a=o.postProcessgetHaxJSONSchema(a)},this.postProcessgetHaxJSONSchema=function(e){return e},this._getHaxJSONSchemaProperty=function(e,r){var o={};for(var n in e)if(e.hasOwnProperty(n))if("undefined"!==i(e[n].property))switch(o[e[n].property]={title:e[n].title,type:r.getHaxJSONSchemaType(e[n].inputMethod)},"undefined"!==i(r[e[n].property])&&(o[e[n].property].value=r[e[n].property]),"url"==e[n].validationType&&(o[e[n].property].format="uri"),"datepicker"==e[n].inputMethod&&(o[e[n].property].format="date-time"),".*"!=e[n].validation&&(o[e[n].property].pattern=e[n].validation),e[n].inputMethod){case"number":o[e[n].property].component={name:"paper-input",valueProperty:"value",properties:{required:e[n].required},attributes:{type:"number"}};break;case"select":if(slot="","undefined"!==i(e[n].options))for(var a in e[n].options)slot+='<paper-item value="'+a+'">'+e[n].options[a]+"</paper-item>\n";o[e[n].property].component={name:"dropdown-select",valueProperty:"value",slot:slot,properties:{required:e[n].required}};break;case"textarea":o[e[n].property].component={name:"paper-textarea",valueProperty:"value",properties:{required:e[n].required},attributes:{"auto-validate":"auto-validate","char-counter":"char-counter"}};break;case"code-editor":o[e[n].property].component={name:"code-editor",valueProperty:"editorValue",attributes:{id:"haxcodeeditor"},properties:{title:e[n].title,readOnly:!1,theme:"ace/theme/monokai",mode:"ace/mode/html",fontsize:"16px",className:"hax-code-editor"}};break;case"array":o[e[n].property].items={type:"object",properties:r._getHaxJSONSchemaProperty(e[n].properties,r)};break;case"textfield":o[e[n].property].component={name:"paper-input",valueProperty:"value",properties:{required:e[n].required},attributes:{"auto-validate":"auto-validate"}};break;case"alt":o[e[n].property].component={name:"paper-input-flagged",valueProperty:"value",properties:{required:e[n].required},attributes:{"auto-validate":"auto-validate"}};break;case"colorpicker":o[e[n].property].component={name:"paper-swatch-picker",valueProperty:"color",properties:{required:e[n].required}};break;case"iconpicker":o[e[n].property].component={name:"paper-icon-picker",valueProperty:"icon",properties:{required:e[n].required}},e[n].options.constructor===Array&&(o[e[n].property].component.properties.iconList=e[n].options);break;case"datepicker":o[e[n].property].component={name:"app-datepicker",valueProperty:"date",properties:{required:e[n].required,autoUpdateDate:!0}}}else if("undefined"!==i(e[n].attribute))switch(o[e[n].attribute]={title:e[n].title,type:r.getHaxJSONSchemaType(e[n].inputMethod)},"class"===e[n].attribute?o[e[n].attribute].value=r.className:"style"===e[n].attribute?o[e[n].attribute].value=r.style.cssText:"undefined"!==i(r.attributes[e[n].attribute])&&(o[e[n].attribute].value=r.getAttribute(e[n].attribute)),"href"!=n&&"src"!=n||(o[e[n].attribute].format="uri"),"url"==e[n].validationType&&(o[e[n].attribute].format="uri"),"datepicker"==e[n].inputMethod&&(o[e[n].attribute].format="date-time"),".*"!=e[n].validation&&(o[e[n].attribute].pattern=e[n].validation),e[n].inputMethod){case"number":o[e[n].attribute].component={name:"paper-input",valueProperty:"value",properties:{required:e[n].required},attributes:{type:"number"}};break;case"select":if(slot="","undefined"!==i(e[n].options))for(var a in e[n].options)slot+='<paper-item value="'+a+'">'+e[n].options[a]+"</paper-item>\n";o[e[n].attribute].component={name:"dropdown-select",valueProperty:"value",slot:slot,properties:{required:e[n].required}};break;case"textarea":o[e[n].attribute].component={name:"paper-textarea",valueProperty:"value",properties:{required:e[n].required},attributes:{"auto-validate":"auto-validate","char-counter":"char-counter"}};break;case"code-editor":o[e[n].attribute].component={name:"code-editor",valueProperty:"editorValue",attributes:{id:"haxcodeeditor"},properties:{title:e[n].title,readOnly:!1,theme:"ace/theme/monokai",mode:"ace/mode/html",fontsize:"16px",className:"hax-code-editor"}};break;case"textfield":o[e[n].attribute].component={name:"paper-input",valueProperty:"value",properties:{required:e[n].required},attributes:{"auto-validate":"auto-validate"}};break;case"alt":o[e[n].attribute].component={name:"paper-input-flagged",valueProperty:"value",properties:{required:e[n].required},attributes:{"auto-validate":"auto-validate"}};break;case"colorpicker":o[e[n].attribute].component={name:"paper-swatch-picker",valueProperty:"color",properties:{required:e[n].required}}}else{o[e[n].slot]={title:e[n].title,type:r.getHaxJSONSchemaType(e[n].inputMethod),value:"",component:{name:"code-editor",valueProperty:"editorValue",attributes:{id:"haxcodeeditor"},properties:{title:e[n].title,readOnly:!1,theme:"ace/theme/monokai",mode:"ace/mode/html",fontsize:"16px",className:"hax-code-editor"}}};var d="";for(var p in t.dom(r).childNodes)"undefined"!==i(t.dom(r).childNodes[p])&&(1===t.dom(r).childNodes[p].nodeType?d+=t.dom(r).childNodes[p].innerHTML:1!==t.dom(r).childNodes[p].nodeType&&"undefined"!==i(t.dom(r).childNodes[p].textContent)&&""!==t.dom(r).childNodes[p].textContent&&(d+=t.dom(r).childNodes[p].textContent));o[e[n].slot].component.slot="<template>"+d+"</template>"}return o},this.getHaxJSONSchemaType=function(e){if(r.validHAXPropertyInputMethod().includes(e))switch(e){case"flipboolean":case"boolean":return"boolean";case"number":return"number";case"select":case"textarea":case"colorpicker":case"iconpicker":case"datepicker":case"textfield":case"alt":return"string";case"array":return"array";default:return"string"}},this.validHAXPropertyInputMethod=function(){return["flipboolean","boolean","select","textfield","textarea","datepicker","colorpicker","iconpicker","alt","number","code-editor","array"]},this.prototypeHaxProperties=function(){return{api:"1",canScale:!0,canPosition:!0,canEditSource:!1,gizmo:{title:"Tag name",description:"A description",icon:"av:play-circle-filled",color:"blue",groups:["Content"],handles:[{type:"data",url:"src"}],meta:{author:""}},settings:{quick:[{property:"title",title:"Title",inputMethod:"textfield",icon:"android"},{property:"primaryColor",title:"Primary color",inputMethod:"colorpicker",icon:"color"}],configure:[{slot:"",title:"Inner content",description:"The slotted content that lives inside the tag",inputMethod:"textfield",icon:"android",required:!0,validationType:"text"},{slot:"button",title:"Button content",description:"The content that can override the button",inputMethod:"textfield",icon:"android",required:!0,validationType:"text"},{property:"title",title:"Title",description:"",inputMethod:"textfield",icon:"android",required:!0,validationType:"text"},{property:"primaryColor",title:"Title",description:"",inputMethod:"textfield",icon:"android",required:!1,validation:".*",validationType:"text"}],advanced:[{property:"secondaryColor",title:"Secondary color",description:"An optional secondary color used in certain edge cases.",inputMethod:"colorpicker",icon:"color"},{property:"endPoint",title:"API endpoint",description:"An optional endpoint to hit and load in more data dymaically.",inputMethod:"textfield",icon:"android",validation:"[a-z0-9]",validationType:"url"}]},saveOptions:{wipeSlot:!1,unsetAttributes:["end-point","secondary-color"]}}}};window.HAXBehaviors=window.HAXBehaviors||{},window.HAXBehaviors.PropertiesBehaviors=new r,e.HAXWiring=r,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
//# sourceMappingURL=hax-body-behaviors.umd.js.map |
@@ -5,2 +5,3 @@ /** | ||
*/ | ||
import { dom } from "@polymer/polymer/lib/legacy/polymer.dom.js"; | ||
@@ -174,7 +175,7 @@ /** | ||
typeof Polymer !== typeof undefined && | ||
typeof Polymer.HaxStore !== typeof undefined && | ||
typeof Polymer.HaxStore.instance !== typeof undefined && | ||
Polymer.HaxStore.instance != null && | ||
typeof Polymer.HaxStore.instance.elementList !== typeof undefined && | ||
typeof Polymer.HaxStore.instance.elementList[tag.toLowerCase()] === | ||
typeof window.HaxStore !== typeof undefined && | ||
typeof window.HaxStore.instance !== typeof undefined && | ||
window.HaxStore.instance != null && | ||
typeof window.HaxStore.instance.elementList !== typeof undefined && | ||
typeof window.HaxStore.instance.elementList[tag.toLowerCase()] === | ||
typeof undefined | ||
@@ -193,7 +194,7 @@ ) { | ||
typeof Polymer !== typeof undefined && | ||
typeof Polymer.HaxStore !== typeof undefined && | ||
typeof Polymer.HaxStore.instance !== typeof undefined && | ||
Polymer.HaxStore.instance != null && | ||
typeof Polymer.HaxStore.instance.elementList !== typeof undefined && | ||
typeof Polymer.HaxStore.instance.elementList[ | ||
typeof window.HaxStore !== typeof undefined && | ||
typeof window.HaxStore.instance !== typeof undefined && | ||
window.HaxStore.instance != null && | ||
typeof window.HaxStore.instance.elementList !== typeof undefined && | ||
typeof window.HaxStore.instance.elementList[ | ||
this.tagName.toLowerCase() | ||
@@ -633,18 +634,14 @@ ] === typeof undefined | ||
// test for slotted content values names is tricky | ||
if (typeof Polymer !== typeof undefined) { | ||
for (var i in Polymer.dom(target).childNodes) { | ||
// this is crazy... you know that right | ||
if ( | ||
typeof Polymer.dom(target).childNodes[i] !== typeof undefined | ||
for (var i in dom(target).childNodes) { | ||
// this is crazy... you know that right | ||
if (typeof dom(target).childNodes[i] !== typeof undefined) { | ||
if (dom(target).childNodes[i].nodeType === 1) { | ||
slot += dom(target).childNodes[i].innerHTML; | ||
} else if ( | ||
dom(target).childNodes[i].nodeType !== 1 && | ||
typeof dom(target).childNodes[i].textContent !== | ||
typeof undefined && | ||
dom(target).childNodes[i].textContent !== "" | ||
) { | ||
if (Polymer.dom(target).childNodes[i].nodeType === 1) { | ||
slot += Polymer.dom(target).childNodes[i].innerHTML; | ||
} else if ( | ||
Polymer.dom(target).childNodes[i].nodeType !== 1 && | ||
typeof Polymer.dom(target).childNodes[i].textContent !== | ||
typeof undefined && | ||
Polymer.dom(target).childNodes[i].textContent !== "" | ||
) { | ||
slot += Polymer.dom(target).childNodes[i].textContent; | ||
} | ||
slot += dom(target).childNodes[i].textContent; | ||
} | ||
@@ -651,0 +648,0 @@ } |
@@ -7,5 +7,10 @@ { | ||
"elementName": "hax-body-behaviors", | ||
"generator-wcfactory-version": "" | ||
"generator-wcfactory-version": "0.3.1", | ||
"useHAX": false, | ||
"useSass": false, | ||
"files": { | ||
"js": "src/hax-body-behaviors.js" | ||
} | ||
}, | ||
"version": "0.0.28", | ||
"version": "0.0.29", | ||
"description": "Wire any element up to HAX", | ||
@@ -33,2 +38,5 @@ "repository": { | ||
"license": "Apache-2.0", | ||
"dependencies": { | ||
"@polymer/polymer": "^3.0.0" | ||
}, | ||
"devDependencies": { | ||
@@ -42,5 +50,5 @@ "@polymer/iron-component-page": "github:PolymerElements/iron-component-page", | ||
"lodash": "4.17.11", | ||
"polymer-build": "3.0.4", | ||
"polymer-cli": "1.8.0", | ||
"wct-browser-legacy": "1.0.1" | ||
"polymer-build": "3.1.0", | ||
"polymer-cli": "1.8.1", | ||
"wct-browser-legacy": "1.0.2" | ||
}, | ||
@@ -51,3 +59,3 @@ "private": false, | ||
}, | ||
"gitHead": "67f5e266e92a62dd4f359dae42b86159fc10f54e" | ||
"gitHead": "9a19006247e8f5523b63bdc4adb4e358fcf59090" | ||
} |
@@ -6,125 +6,2 @@ /** | ||
import { HAXWiring } from "./lib/HAXWiring.js"; | ||
export { HaxBodyBehaviors }; | ||
/** | ||
* `hax-body-behaviors` | ||
* `HAX Body Behaviors to utilize in any element` | ||
* | ||
* @microcopy - language worth noting: | ||
* - | ||
* | ||
* @customElement | ||
* @demo demo/index.html | ||
*/ | ||
class HaxBodyBehaviors extends HTMLElement { | ||
/** | ||
* Store the tag name to make it easier to obtain directly. | ||
* @notice function name must be here for tooling to operate correctly | ||
*/ | ||
static get tag() { | ||
return "hax-body-behaviors"; | ||
} | ||
/** | ||
* A file that contains the HTML template for the element. | ||
* @notice function name must be here for tooling to operate correctly | ||
*/ | ||
get templateUrl() { | ||
return "hax-body-behaviors.html"; | ||
} | ||
/** | ||
* A file that contains the properties that will be wired into this element. | ||
* @notice function name must be here for tooling to operate correctly | ||
*/ | ||
get propertiesUrl() { | ||
return "hax-body-behaviors-properties.json"; | ||
} | ||
/** | ||
* A file that contains the css for this element to be mixed into the html block. | ||
* @notice function name must be here for tooling to operate correctly | ||
*/ | ||
get styleUrl() { | ||
return "hax-body-behaviors.css"; | ||
} | ||
/** | ||
* life cycle | ||
*/ | ||
constructor(delayRender = false) { | ||
super(); | ||
// set tag for later use | ||
this.tag = HaxBodyBehaviors.tag; | ||
this.HAXWiring = new HAXWiring(); | ||
//this.HAXWiring.setHaxProperties(props, HaxBodyBehaviors.tag, this); | ||
// map our imported properties json to real props on the element | ||
// @notice static getter of properties is built via tooling | ||
// to edit modify src/HaxBodyBehaviors-properties.json | ||
let obj = HaxBodyBehaviors.properties; | ||
for (let p in obj) { | ||
if (obj.hasOwnProperty(p)) { | ||
this[p] = obj[p].value; | ||
} | ||
} | ||
// optional queue for future use | ||
this._queue = []; | ||
this.template = document.createElement("template"); | ||
this.attachShadow({ mode: "open" }); | ||
if (!delayRender) { | ||
this.render(); | ||
} | ||
} | ||
/** | ||
* life cycle, element is afixed to the DOM | ||
*/ | ||
connectedCallback() { | ||
if (window.ShadyCSS) { | ||
window.ShadyCSS.styleElement(this); | ||
} | ||
if (this._queue.length) { | ||
this._processQueue(); | ||
} | ||
} | ||
_copyAttribute(name, to) { | ||
const recipients = this.shadowRoot.querySelectorAll(to); | ||
const value = this.getAttribute(name); | ||
const fname = value == null ? "removeAttribute" : "setAttribute"; | ||
for (const node of recipients) { | ||
node[fname](name, value); | ||
} | ||
} | ||
_queueAction(action) { | ||
this._queue.push(action); | ||
} | ||
_processQueue() { | ||
this._queue.forEach(action => { | ||
this[`_${action.type}`](action.data); | ||
}); | ||
this._queue = []; | ||
} | ||
_setProperty({ name, value }) { | ||
this[name] = value; | ||
} | ||
render() { | ||
this.shadowRoot.innerHTML = null; | ||
this.template.innerHTML = this.html; | ||
if (window.ShadyCSS) { | ||
window.ShadyCSS.prepareTemplate(this.template, this.tag); | ||
} | ||
this.shadowRoot.appendChild(this.template.content.cloneNode(true)); | ||
} | ||
//static get observedAttributes() { | ||
// return []; | ||
//} | ||
// disconnectedCallback() {} | ||
// attributeChangedCallback(attr, oldValue, newValue) {} | ||
} | ||
window.customElements.define(HaxBodyBehaviors.tag, HaxBodyBehaviors); | ||
export { HAXWiring }; |
Sorry, the diff of this file is not supported yet
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
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
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
181443
1
29
2534
3
+ Added@polymer/polymer@^3.0.0
+ Added@polymer/polymer@3.5.1(transitive)
+ Added@webcomponents/shadycss@1.11.2(transitive)