Socket
Socket
Sign inDemoInstall

@lrnwebcomponents/hax-body-behaviors

Package Overview
Dependencies
Maintainers
4
Versions
127
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lrnwebcomponents/hax-body-behaviors - npm Package Compare versions

Comparing version 4.0.4 to 4.0.5

analysis.json

2

hax-body-behaviors.umd.js

@@ -1,1 +0,1 @@

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@lrnwebcomponents/simple-fields/simple-fields.js")):"function"==typeof define&&define.amd?define(["exports","@lrnwebcomponents/simple-fields/simple-fields.js"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).HaxBodyBehaviors={},e.simpleFields_js)}(this,(function(e,t){"use strict";function i(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,n)}return i}function n(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach((function(t){c(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function o(e){return(o="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)}function r(e,t,i,n,o,r,a){try{var s=e[r](a),d=s.value}catch(e){return void i(e)}s.done?t(d):Promise.resolve(d).then(n,o)}function a(e){return function(){var t=this,i=arguments;return new Promise((function(n,o){var a=e.apply(t,i);function s(e){r(a,n,o,s,d,"next",e)}function d(e){r(a,n,o,s,d,"throw",e)}s(void 0)}))}}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function d(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function c(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function u(e){return(u=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function l(e,t){return(l=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function p(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function f(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var i,n=u(e);if(t){var o=u(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return p(this,i)}}function h(e,t,i){return(h="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,i){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=u(e)););return e}(e,t);if(n){var o=Object.getOwnPropertyDescriptor(n,t);return o.get?o.get.call(i):o.value}})(e,t,i||e)}var g;c(g={alt:{defaultSettings:{element:"simple-fields-field",noWrap:!0,attributes:{autofocus:!0,required:!0}}},color:{defaultSettings:{element:"simple-fields-field",noWrap:!0,attributes:{autofocus:!0,type:"color"}}},colorpicker:{defaultSettings:{import:"@lrnwebcomponents/simple-colors/lib/simple-colors-picker.js",element:"simple-colors-picker",attributes:{autofocus:!0}}},date:{defaultSettings:{element:"simple-fields-field",noWrap:!0,attributes:{autofocus:!0,type:"date"}}},"date-time":{defaultSettings:{element:"simple-fields-field",noWrap:!0,attributes:{autofocus:!0,type:"datetime-local"}}}},"date",{defaultSettings:{element:"simple-fields-field",noWrap:!0,attributes:{autofocus:!0,type:"date"}}}),c(g,"email",{defaultSettings:{element:"simple-fields-field",noWrap:!0,attributes:{autofocus:!0,type:"email"}}}),c(g,"fileupload",{defaultSettings:{import:"@lrnwebcomponents/hax-body/lib/hax-upload-field.js",element:"hax-upload-field",noWrap:!0,attributes:{autofocus:!0},properties:{accepts:"accepts"}}}),c(g,"iconpicker",{defaultSettings:{import:"@lrnwebcomponents/simple-icon-picker/simple-icon-picker.js",element:"simple-icon-picker",attributes:{autofocus:!0}}}),c(g,"month",{defaultSettings:{element:"simple-fields-field",noWrap:!0,attributes:{autofocus:!0,type:"month"}}}),c(g,"textarea",{defaultSettings:{element:"simple-fields-field",noWrap:!0,attributes:{autofocus:!0,type:"textarea"}}}),c(g,"time",{defaultSettings:{element:"simple-fields-field",noWrap:!0,attributes:{autofocus:!0,type:"time"}}}),c(g,"uri",{defaultSettings:{element:"simple-fields-field",noWrap:!0,attributes:{autofocus:!0,type:"file"},properties:{accepts:"accepts"}}});var m=function e(){var i=this;s(this,e),this.haxProperties={type:"element",editingElement:"core",canScale:!1,canPosition:!1,canEditSource:!0,settings:{configure:[],advanced:[]},wipeSlot:{}},this.setup=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:i;return"undefined"!==o(i.tagName)&&(t=i.tagName.toLowerCase()),window.addEventListener("hax-store-ready",i._haxStoreReady.bind(i)),"undefined"!==o(window.HaxStore)&&null!=window.HaxStore.instance&&window.HaxStore.instance.ready?i.setHaxProperties(e,t,n,!0):i.setHaxProperties(e,t,n,!1)},this._haxStoreReady=function(e){if(e.detail&&"undefined"!==o(i.tagName)&&"undefined"!==o(i.haxProperties)){var t=i.tagName,n=i.haxProperties,r=i;if(""!=t&&"undefined"===o(window.HaxStore)){var a=new CustomEvent("hax-register-properties",{bubbles:!0,composed:!0,cancelable:!0,detail:{tag:t.toLowerCase(),properties:n}});r.dispatchEvent(a)}else if(""!=t&&"undefined"===o(window.HaxStore.instance.elementList[t.toLowerCase()])){var s=new CustomEvent("hax-register-properties",{bubbles:!0,composed:!0,cancelable:!0,detail:{tag:t.toLowerCase(),properties:n}});r.dispatchEvent(s)}else if("undefined"!==o(i.tagName)&&"undefined"===o(window.HaxStore.instance.elementList[i.tagName.toLowerCase()])){var d=new CustomEvent("hax-register-properties",{bubbles:!0,composed:!0,cancelable:!0,detail:{tag:i.tagName.toLowerCase(),properties:n}});r.dispatchEvent(d)}}},this.setHaxProperties=a(regeneratorRuntime.mark((function e(){var t,n,r,a,s,d,c,u=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=u.length>0&&void 0!==u[0]?u[0]:{},n=u.length>1&&void 0!==u[1]?u[1]:"",r=u.length>2&&void 0!==u[2]?u[2]:document,a=u.length>3&&void 0!==u[3]&&u[3],"string"!=typeof t){e.next=8;break}return e.next=7,fetch(t).then((function(e){return!(!e||!e.json)&&e.json()}));case 7:t=e.sent;case 8:if("undefined"===o(t.api)&&(t.api="1"),"1"==t.api){if("undefined"===o(t.type)&&(t.type="element"),"undefined"===o(t.editingElement)&&(t.editingElement="core"),"undefined"===o(t.canPosition)&&(t.canPosition=!0),"undefined"===o(t.canScale)&&(t.canScale=!0),"undefined"===o(t.canEditSource)&&(t.canEditSource=!1),"undefined"===o(t.contentEditable)&&(t.contentEditable=!1),"undefined"===o(t.gizmo)?t.gizmo=!1:"undefined"!==o(t.gizmo.iconLib)&&(s=window.WCGlobalBasePath?window.WCGlobalBasePath:new URL("./../../../","undefined"==typeof document?new(require("url").URL)("file:"+__filename).href:document.currentScript&&document.currentScript.src||new URL("hax-body-behaviors.umd.js",document.baseURI).href).href,import("".concat(s).concat(t.gizmo.iconLib))),"undefined"!==o(t.settings)){for("undefined"===o(t.settings.configure)&&(t.settings.configure=[]),d=0;d<t.settings.configure.length;d++)t.settings.configure[d]=i.validateSetting(t.settings.configure[d]),t.settings.configure[d]||t.settings.configure.splice(d,1);for("undefined"===o(t.settings.advanced)&&(t.settings.advanced=[]),c=0;c<t.settings.advanced.length;c++)t.settings.advanced[c]=i.validateSetting(t.settings.advanced[c]),t.settings.advanced[c]||t.settings.advanced.splice(c,1);t=i.standardAdvancedProps(t)}"undefined"===o(t.saveOptions)&&(t.saveOptions={wipeSlot:!1}),"undefined"===o(t.demoSchema)&&(t.demoSchema=[]),a&&i.readyToFireHAXSchema(n,t,r),""===n&&("function"==typeof i._setHaxProperties?i._setHaxProperties(t):i.haxProperties=t)}else 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. https://haxtheweb.org/hax-schema for details but we will try and guess the wiring");case 10:case"end":return e.stop()}}),e)}))),this.readyToFireHAXSchema=function(e,t,n){if(""!=e&&"undefined"===o(window.HaxStore)){var r=new CustomEvent("hax-register-properties",{bubbles:!0,composed:!0,cancelable:!0,detail:{tag:e.toLowerCase(),properties:t}});n.dispatchEvent(r)}else if(""!=e){var a=new CustomEvent("hax-register-properties",{bubbles:!0,composed:!0,cancelable:!0,detail:{tag:e.toLowerCase(),properties:t}});n.dispatchEvent(a)}else if("undefined"!==o(i.tagName)){var s=new CustomEvent("hax-register-properties",{bubbles:!0,composed:!0,cancelable:!0,detail:{tag:i.tagName.toLowerCase(),properties:t}});n.dispatchEvent(s)}else if("undefined"!==o(n.tagName)){var d=new CustomEvent("hax-register-properties",{bubbles:!0,composed:!0,cancelable:!0,detail:{tag:n.tagName.toLowerCase(),properties:t}});n.dispatchEvent(d)}else console.warn(n),console.warn("".concat(e," missed our checks and has an issue in implementation with HAX"))},this.standardAdvancedProps=function(e){return 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"}),e},this.validateSetting=function(e){return("undefined"!==o(e.property)||"undefined"!==o(e.slot)||"undefined"!==o(e.attribute))&&("undefined"===o(e.title)&&("undefined"===o(e.attribute)?e.title=e.property:e.title=e.attribute),"undefined"===o(e.description)&&(e.description=""),"undefined"===o(e.inputMethod)&&(e.inputMethod="textfield"),"undefined"===o(e.type)&&(e.type="settings"),"undefined"===o(e.icon)&&(e.icon="android"),"undefined"===o(e.options)&&(e.options={}),"undefined"===o(e.required)&&(e.required=!1),"undefined"===o(e.disabled)&&(e.disabled=!1),"undefined"===o(e.validation)&&(e.validation=".*"),"undefined"===o(e.validationType)&&(e.validationType=""),"undefined"!==o(e.slot)&&("undefined"===o(e.slotWrapper)&&(e.slotWrapper="span"),"undefined"===o(e.slotAttributes)&&(e.slotAttributes={})),e)},this.getHaxProperties=function(){return i.haxProperties},this.getHaxJSONSchema=function(e,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:i;"undefined"===o(e)&&(e="configure"),"undefined"===o(n)&&(n=r.haxProperties);var a=n.settings[e],s={$schema:"http://json-schema.org/schema#",title:"HAX "+e+" form schema",type:"object",properties:{}};if(s.properties=(new t.SimpleFields).fieldsToSchema(a),n.gizmo&&n.gizmo.tag&&window.customElements.get(n.gizmo.tag)){var d=document.createElement(n.gizmo.tag);s="function"==typeof d.postProcessgetHaxJSONSchema?d.postProcessgetHaxJSONSchema(s):r.postProcessgetHaxJSONSchema(s)}else s=r.postProcessgetHaxJSONSchema(s);return s},this.postProcessgetHaxJSONSchema=function(e){return e},this._getHaxJSONSchemaProperty=function(e){return(new t.SimpleFields).fieldsToSchema(e)},this.getHaxJSONSchemaType=function(e){var i=(new t.SimpleFields).fieldsConversion.inputMethod[e]||(new t.SimpleFields).fieldsConversion;return i&&i.defaultSettings&&i.defaultSettings.type?i.defaultSettings.type:"string"},this.validHAXPropertyInputMethod=function(){return Object.keys((new t.SimpleFields).fieldsConversion.inputMethod)},this.prototypeHaxProperties=function(){return{api:"1",canScale:!0,canPosition:!0,canEditSource:!0,contentEditable:!1,gizmo:{title:"Tag name",description:"",icon:"icons:android",color:"purple",groups:["Content"],handles:[{type:"data",type_exclusive:!1,url:"src"}],meta:{author:"auto"},requiresChildren:!1,requiresParent:!1},settings:{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"]},demoSchema:[{tag:"my-tag",content:"<p>inner html</p>",properties:{endPoint:"https://cdn2.thecatapi.com/images/9j5.jpg",primaryColor:"yellow",title:"A cat"}}]}}};window.HAXWiring=new m,window.HAXBehaviors=window.HAXBehaviors||{},window.HAXBehaviors.PropertiesBehaviors={properties:{haxProperties:window.HAXWiring.haxProperties},setHaxProperties:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this;return""==t&&"undefined"!==o(this.tagName)&&(t=this.tagName.toLowerCase()),window.addEventListener("hax-store-ready",this._haxStoreReady.bind(this)),"undefined"!==o(window.HaxStore)&&null!=window.HaxStore.instance&&window.HaxStore.instance.ready?window.HAXWiring.setHaxProperties(e,t,i,!0):window.HAXWiring.setHaxProperties(e,t,i,!1)},_haxStoreReady:function(e){return window.HAXWiring._haxStoreReady(e)},validateSetting:function(e){return window.HAXWiring.validateSetting(e)},getHaxProperties:function(){return this.haxProperties},getHaxJSONSchema:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this;return window.HAXWiring.getHaxJSONSchema(e,t,i)},postProcessgetHaxJSONSchema:function(e){return window.HAXWiring.postProcessgetHaxJSONSchema(e)},_getHaxJSONSchemaProperty:function(e){return(new t.SimpleFields).fieldsToSchema(e)},getHaxJSONSchemaType:function(e){return window.HAXWiring.getHaxJSONSchemaType(e)},validHAXPropertyInputMethod:function(){return window.HAXWiring.validHAXPropertyInputMethod()},prototypeHaxProperties:function(){return window.HAXWiring.prototypeHaxProperties()}},e.HAXElement=function(e){return function(e){!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&&l(e,t)}(p,e);var i,r,a,c=f(p);function p(){var e;return s(this,p),(e=c.call(this)).HAXWiring=new m,e}return i=p,a=[{key:"properties",get:function(){return n(n({},h(u(p),"properties",this)),{},{haxProperties:window.HAXWiring.haxProperties})}}],(r=[{key:"setHaxProperties",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this;return""==t&&"undefined"!==o(this.tagName)&&(t=this.tagName.toLowerCase()),window.HaxStore&&null!=window.HaxStore.instance&&window.HaxStore.instance.ready?this.HAXWiring.setHaxProperties(e,t,i,!0):(window.addEventListener("hax-store-ready",this._haxStoreReady.bind(this)),this.HAXWiring.setHaxProperties(e,t,i,!1))}},{key:"disconnectedCallback",value:function(){window.removeEventListener("hax-store-ready",this._haxStoreReady.bind(this)),h(u(p.prototype),"disconnectedCallback",this)&&h(u(p.prototype),"disconnectedCallback",this).call(this)}},{key:"setup",value:function(e){return this.HAXWiring.setup(e,"",this)}},{key:"_haxStoreReady",value:function(e){return this.HAXWiring._haxStoreReady(e)}},{key:"validateSetting",value:function(e){return this.HAXWiring.validateSetting(e)}},{key:"getHaxProperties",value:function(){return this.haxProperties}},{key:"getHaxJSONSchema",value:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this;return this.HAXWiring.getHaxJSONSchema(e,t,i)}},{key:"postProcessgetHaxJSONSchema",value:function(e){return this.HAXWiring.postProcessgetHaxJSONSchema(e)}},{key:"_getHaxJSONSchemaProperty",value:function(e){return(new t.SimpleFields).fieldsToSchema(e)}},{key:"getHaxJSONSchemaType",value:function(e){return this.HAXWiring.getHaxJSONSchemaType(e)}},{key:"validHAXPropertyInputMethod",value:function(){return this.HAXWiring.validHAXPropertyInputMethod()}},{key:"prototypeHaxProperties",value:function(){return this.HAXWiring.prototypeHaxProperties()}}])&&d(i.prototype,r),a&&d(i,a),p}(e)},e.HAXWiring=m,Object.defineProperty(e,"__esModule",{value:!0})}));
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@lrnwebcomponents/simple-fields/simple-fields.js")):"function"==typeof define&&define.amd?define(["exports","@lrnwebcomponents/simple-fields/simple-fields.js"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).HaxBodyBehaviors={},e.simpleFields_js)}(this,(function(e,t){"use strict";function i(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,n)}return i}function n(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach((function(t){c(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function o(e){return o="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},o(e)}function r(e,t,i,n,o,r,a){try{var s=e[r](a),d=s.value}catch(e){return void i(e)}s.done?t(d):Promise.resolve(d).then(n,o)}function a(e){return function(){var t=this,i=arguments;return new Promise((function(n,o){var a=e.apply(t,i);function s(e){r(a,n,o,s,d,"next",e)}function d(e){r(a,n,o,s,d,"throw",e)}s(void 0)}))}}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function d(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function c(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function l(e,t){return l=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},l(e,t)}function p(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function f(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var i,n=u(e);if(t){var o=u(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return p(this,i)}}function h(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=u(e)););return e}function g(){return g="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,i){var n=h(e,t);if(n){var o=Object.getOwnPropertyDescriptor(n,t);return o.get?o.get.call(arguments.length<3?e:i):o.value}},g.apply(this,arguments)}var m;c(m={alt:{defaultSettings:{element:"simple-fields-field",noWrap:!0,attributes:{autofocus:!0,required:!0}}},color:{defaultSettings:{element:"simple-fields-field",noWrap:!0,attributes:{autofocus:!0,type:"color"}}},colorpicker:{defaultSettings:{import:"@lrnwebcomponents/simple-colors/lib/simple-colors-picker.js",element:"simple-colors-picker",attributes:{autofocus:!0}}},date:{defaultSettings:{element:"simple-fields-field",noWrap:!0,attributes:{autofocus:!0,type:"date"}}},"date-time":{defaultSettings:{element:"simple-fields-field",noWrap:!0,attributes:{autofocus:!0,type:"datetime-local"}}}},"date",{defaultSettings:{element:"simple-fields-field",noWrap:!0,attributes:{autofocus:!0,type:"date"}}}),c(m,"email",{defaultSettings:{element:"simple-fields-field",noWrap:!0,attributes:{autofocus:!0,type:"email"}}}),c(m,"fileupload",{defaultSettings:{import:"@lrnwebcomponents/hax-body/lib/hax-upload-field.js",element:"hax-upload-field",noWrap:!0,attributes:{autofocus:!0},properties:{accepts:"accepts"}}}),c(m,"iconpicker",{defaultSettings:{import:"@lrnwebcomponents/simple-icon-picker/simple-icon-picker.js",element:"simple-icon-picker",attributes:{autofocus:!0}}}),c(m,"month",{defaultSettings:{element:"simple-fields-field",noWrap:!0,attributes:{autofocus:!0,type:"month"}}}),c(m,"textarea",{defaultSettings:{element:"simple-fields-field",noWrap:!0,attributes:{autofocus:!0,type:"textarea"}}}),c(m,"time",{defaultSettings:{element:"simple-fields-field",noWrap:!0,attributes:{autofocus:!0,type:"time"}}}),c(m,"uri",{defaultSettings:{element:"simple-fields-field",noWrap:!0,attributes:{autofocus:!0,type:"file"},properties:{accepts:"accepts"}}});var y=function e(){var i=this;s(this,e),this.haxProperties={type:"element",editingElement:"core",canScale:!1,canPosition:!1,canEditSource:!0,settings:{configure:[],advanced:[]},wipeSlot:{}},this.setup=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:i;return"undefined"!==o(i.tagName)&&(t=i.tagName.toLowerCase()),window.addEventListener("hax-store-ready",i._haxStoreReady.bind(i)),"undefined"!==o(window.HaxStore)&&null!=window.HaxStore.instance&&window.HaxStore.instance.ready?i.setHaxProperties(e,t,n,!0):i.setHaxProperties(e,t,n,!1)},this._haxStoreReady=function(e){if(e.detail&&"undefined"!==o(i.tagName)&&"undefined"!==o(i.haxProperties)){var t=i.tagName,n=i.haxProperties,r=i;if(""!=t&&"undefined"===o(window.HaxStore)){var a=new CustomEvent("hax-register-properties",{bubbles:!0,composed:!0,cancelable:!0,detail:{tag:t.toLowerCase(),properties:n}});r.dispatchEvent(a)}else if(""!=t&&"undefined"===o(window.HaxStore.instance.elementList[t.toLowerCase()])){var s=new CustomEvent("hax-register-properties",{bubbles:!0,composed:!0,cancelable:!0,detail:{tag:t.toLowerCase(),properties:n}});r.dispatchEvent(s)}else if("undefined"!==o(i.tagName)&&"undefined"===o(window.HaxStore.instance.elementList[i.tagName.toLowerCase()])){var d=new CustomEvent("hax-register-properties",{bubbles:!0,composed:!0,cancelable:!0,detail:{tag:i.tagName.toLowerCase(),properties:n}});r.dispatchEvent(d)}}},this.setHaxProperties=a(regeneratorRuntime.mark((function e(){var t,n,r,a,s,d,c,u=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=u.length>0&&void 0!==u[0]?u[0]:{},n=u.length>1&&void 0!==u[1]?u[1]:"",r=u.length>2&&void 0!==u[2]?u[2]:document,a=u.length>3&&void 0!==u[3]&&u[3],"string"!=typeof t){e.next=8;break}return e.next=7,fetch(t).then((function(e){return!(!e||!e.json)&&e.json()}));case 7:t=e.sent;case 8:if("undefined"===o(t.api)&&(t.api="1"),"1"==t.api){if("undefined"===o(t.type)&&(t.type="element"),"undefined"===o(t.editingElement)&&(t.editingElement="core"),"undefined"===o(t.canPosition)&&(t.canPosition=!0),"undefined"===o(t.canScale)&&(t.canScale=!0),"undefined"===o(t.canEditSource)&&(t.canEditSource=!1),"undefined"===o(t.contentEditable)&&(t.contentEditable=!1),"undefined"===o(t.gizmo)?t.gizmo=!1:"undefined"!==o(t.gizmo.iconLib)&&(s=window.WCGlobalBasePath?window.WCGlobalBasePath:new URL("./../../../","undefined"==typeof document?new(require("url").URL)("file:"+__filename).href:document.currentScript&&document.currentScript.src||new URL("hax-body-behaviors.umd.js",document.baseURI).href).href,import("".concat(s).concat(t.gizmo.iconLib))),"undefined"!==o(t.settings)){for("undefined"===o(t.settings.configure)&&(t.settings.configure=[]),d=0;d<t.settings.configure.length;d++)t.settings.configure[d]=i.validateSetting(t.settings.configure[d]),t.settings.configure[d]||t.settings.configure.splice(d,1);for("undefined"===o(t.settings.advanced)&&(t.settings.advanced=[]),c=0;c<t.settings.advanced.length;c++)t.settings.advanced[c]=i.validateSetting(t.settings.advanced[c]),t.settings.advanced[c]||t.settings.advanced.splice(c,1);t=i.standardAdvancedProps(t)}"undefined"===o(t.saveOptions)&&(t.saveOptions={wipeSlot:!1}),"undefined"===o(t.demoSchema)&&(t.demoSchema=[]),a&&i.readyToFireHAXSchema(n,t,r),""===n&&("function"==typeof i._setHaxProperties?i._setHaxProperties(t):i.haxProperties=t)}else 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. https://haxtheweb.org/hax-schema for details but we will try and guess the wiring");case 10:case"end":return e.stop()}}),e)}))),this.readyToFireHAXSchema=function(e,t,n){if(""!=e&&"undefined"===o(window.HaxStore)){var r=new CustomEvent("hax-register-properties",{bubbles:!0,composed:!0,cancelable:!0,detail:{tag:e.toLowerCase(),properties:t}});n.dispatchEvent(r)}else if(""!=e){var a=new CustomEvent("hax-register-properties",{bubbles:!0,composed:!0,cancelable:!0,detail:{tag:e.toLowerCase(),properties:t}});n.dispatchEvent(a)}else if("undefined"!==o(i.tagName)){var s=new CustomEvent("hax-register-properties",{bubbles:!0,composed:!0,cancelable:!0,detail:{tag:i.tagName.toLowerCase(),properties:t}});n.dispatchEvent(s)}else if("undefined"!==o(n.tagName)){var d=new CustomEvent("hax-register-properties",{bubbles:!0,composed:!0,cancelable:!0,detail:{tag:n.tagName.toLowerCase(),properties:t}});n.dispatchEvent(d)}else console.warn(n),console.warn("".concat(e," missed our checks and has an issue in implementation with HAX"))},this.standardAdvancedProps=function(e){return e.settings.advanced.push({attribute:"data-hax-lock",title:"Lock editing",description:"Prevent changes to this element and all its content",inputMethod:"boolean"}),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"}),e},this.validateSetting=function(e){return("undefined"!==o(e.property)||"undefined"!==o(e.slot)||"undefined"!==o(e.attribute))&&("undefined"===o(e.title)&&("undefined"===o(e.attribute)?e.title=e.property:e.title=e.attribute),"undefined"===o(e.description)&&(e.description=""),"undefined"===o(e.inputMethod)&&(e.inputMethod="textfield"),"undefined"===o(e.type)&&(e.type="settings"),"undefined"===o(e.icon)&&(e.icon="android"),"undefined"===o(e.options)&&(e.options={}),"undefined"===o(e.required)&&(e.required=!1),"undefined"===o(e.disabled)&&(e.disabled=!1),"undefined"===o(e.validation)&&(e.validation=".*"),"undefined"===o(e.validationType)&&(e.validationType=""),"undefined"!==o(e.slot)&&("undefined"===o(e.slotWrapper)&&(e.slotWrapper="span"),"undefined"===o(e.slotAttributes)&&(e.slotAttributes={})),e)},this.getHaxProperties=function(){return i.haxProperties},this.getHaxJSONSchema=function(e,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:i;"undefined"===o(e)&&(e="configure"),"undefined"===o(n)&&(n=r.haxProperties);var a=n.settings[e],s={$schema:"http://json-schema.org/schema#",title:"HAX "+e+" form schema",type:"object",properties:{}};if(s.properties=(new t.SimpleFields).fieldsToSchema(a),n.gizmo&&n.gizmo.tag&&window.customElements.get(n.gizmo.tag)){var d=document.createElement(n.gizmo.tag);s="function"==typeof d.postProcessgetHaxJSONSchema?d.postProcessgetHaxJSONSchema(s):r.postProcessgetHaxJSONSchema(s)}else s=r.postProcessgetHaxJSONSchema(s);return s},this.postProcessgetHaxJSONSchema=function(e){return e},this._getHaxJSONSchemaProperty=function(e){return(new t.SimpleFields).fieldsToSchema(e)},this.getHaxJSONSchemaType=function(e){var i=(new t.SimpleFields).fieldsConversion.inputMethod[e]||(new t.SimpleFields).fieldsConversion;return i&&i.defaultSettings&&i.defaultSettings.type?i.defaultSettings.type:"string"},this.validHAXPropertyInputMethod=function(){return Object.keys((new t.SimpleFields).fieldsConversion.inputMethod)},this.prototypeHaxProperties=function(){return{api:"1",canScale:!0,canPosition:!0,canEditSource:!0,contentEditable:!1,gizmo:{title:"Tag name",description:"",icon:"icons:android",color:"purple",groups:["Content"],handles:[{type:"data",type_exclusive:!1,url:"src"}],meta:{author:"auto"},requiresChildren:!1,requiresParent:!1},settings:{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"]},demoSchema:[{tag:"my-tag",content:"<p>inner html</p>",properties:{endPoint:"https://cdn2.thecatapi.com/images/9j5.jpg",primaryColor:"yellow",title:"A cat"}}]}}};window.HAXWiring=new y,window.HAXBehaviors=window.HAXBehaviors||{},window.HAXBehaviors.PropertiesBehaviors={properties:{haxProperties:window.HAXWiring.haxProperties},setHaxProperties:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this;return""==t&&"undefined"!==o(this.tagName)&&(t=this.tagName.toLowerCase()),window.addEventListener("hax-store-ready",this._haxStoreReady.bind(this)),"undefined"!==o(window.HaxStore)&&null!=window.HaxStore.instance&&window.HaxStore.instance.ready?window.HAXWiring.setHaxProperties(e,t,i,!0):window.HAXWiring.setHaxProperties(e,t,i,!1)},_haxStoreReady:function(e){return window.HAXWiring._haxStoreReady(e)},validateSetting:function(e){return window.HAXWiring.validateSetting(e)},getHaxProperties:function(){return this.haxProperties},getHaxJSONSchema:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this;return window.HAXWiring.getHaxJSONSchema(e,t,i)},postProcessgetHaxJSONSchema:function(e){return window.HAXWiring.postProcessgetHaxJSONSchema(e)},_getHaxJSONSchemaProperty:function(e){return(new t.SimpleFields).fieldsToSchema(e)},getHaxJSONSchemaType:function(e){return window.HAXWiring.getHaxJSONSchemaType(e)},validHAXPropertyInputMethod:function(){return window.HAXWiring.validHAXPropertyInputMethod()},prototypeHaxProperties:function(){return window.HAXWiring.prototypeHaxProperties()}},e.HAXElement=function(e){return function(e){!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&&l(e,t)}(p,e);var i,r,a,c=f(p);function p(){var e;return s(this,p),(e=c.call(this)).HAXWiring=new y,e}return i=p,r=[{key:"setHaxProperties",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this;return""==t&&"undefined"!==o(this.tagName)&&(t=this.tagName.toLowerCase()),window.HaxStore&&null!=window.HaxStore.instance&&window.HaxStore.instance.ready?this.HAXWiring.setHaxProperties(e,t,i,!0):(window.addEventListener("hax-store-ready",this._haxStoreReady.bind(this)),this.HAXWiring.setHaxProperties(e,t,i,!1))}},{key:"disconnectedCallback",value:function(){window.removeEventListener("hax-store-ready",this._haxStoreReady.bind(this)),g(u(p.prototype),"disconnectedCallback",this)&&g(u(p.prototype),"disconnectedCallback",this).call(this)}},{key:"setup",value:function(e){return this.HAXWiring.setup(e,"",this)}},{key:"_haxStoreReady",value:function(e){return this.HAXWiring._haxStoreReady(e)}},{key:"validateSetting",value:function(e){return this.HAXWiring.validateSetting(e)}},{key:"getHaxProperties",value:function(){return this.haxProperties}},{key:"getHaxJSONSchema",value:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this;return this.HAXWiring.getHaxJSONSchema(e,t,i)}},{key:"postProcessgetHaxJSONSchema",value:function(e){return this.HAXWiring.postProcessgetHaxJSONSchema(e)}},{key:"_getHaxJSONSchemaProperty",value:function(e){return(new t.SimpleFields).fieldsToSchema(e)}},{key:"getHaxJSONSchemaType",value:function(e){return this.HAXWiring.getHaxJSONSchemaType(e)}},{key:"validHAXPropertyInputMethod",value:function(){return this.HAXWiring.validHAXPropertyInputMethod()}},{key:"prototypeHaxProperties",value:function(){return this.HAXWiring.prototypeHaxProperties()}}],a=[{key:"properties",get:function(){return n(n({},g(u(p),"properties",this)),{},{haxProperties:window.HAXWiring.haxProperties})}}],r&&d(i.prototype,r),a&&d(i,a),p}(e)},e.HAXWiring=y,Object.defineProperty(e,"__esModule",{value:!0})}));

@@ -490,2 +490,9 @@ /**

this.standardAdvancedProps = (props) => {
// specialized attribute to allow locking in hax of anything
props.settings.advanced.push({
attribute: "data-hax-lock",
title: "Lock editing",
description: "Prevent changes to this element and all its content",
inputMethod: "boolean",
});
// allow classes to be modified this way

@@ -492,0 +499,0 @@ props.settings.advanced.push({

@@ -15,3 +15,3 @@ {

},
"version": "4.0.4",
"version": "4.0.5",
"description": "Wire any element up to HAX",

@@ -31,7 +31,6 @@ "repository": {

"watch": "gulp dev --gulpfile=gulpfile.cjs",
"serve": "es-dev-server -c ../../es-dev-server.config.js",
"serve": "web-dev-server -c ../../web-dev-server.config.js",
"lighthouse": "gulp lighthouse --gulpfile=gulpfile.cjs",
"test": "web-test-runner \"test/**/*.test.js\" --node-resolve --config=../../web-test-runner.config.mjs",
"test:watch": "web-test-runner \"test/**/*.test.js\" --node-resolve --config=../../web-test-runner.config.mjs --watch",
"test:browsers": "web-test-runner \"test/**/*.test.js\" --node-resolve --config=../../web-test-runner.config.mjs --playwright --browsers chromium firefox webkit"
"test:watch": "web-test-runner \"test/**/*.test.js\" --node-resolve --config=../../web-test-runner.config.mjs --playwright --browsers chromium firefox --watch",
"test": "web-test-runner \"test/**/*.test.js\" --node-resolve --config=../../web-test-runner.config.mjs --playwright --browsers chromium firefox"
},

@@ -44,10 +43,7 @@ "author": {

"@lrnwebcomponents/deduping-fix": "^4.0.0",
"@lrnwebcomponents/storybook-utilities": "^4.0.4",
"@open-wc/testing": "2.5.33",
"@lrnwebcomponents/storybook-utilities": "^4.0.5",
"@open-wc/testing": "3.0.3",
"@polymer/iron-component-page": "github:PolymerElements/iron-component-page",
"@polymer/iron-demo-helpers": "3.1.0",
"@web/test-runner": "0.13.5",
"@web/test-runner-commands": "0.4.5",
"@web/test-runner-playwright": "0.8.6",
"@web/test-runner-puppeteer": "0.10.0",
"@web/dev-server": "0.1.28",
"@webcomponents/webcomponentsjs": "2.6.0",

@@ -57,3 +53,2 @@ "concurrently": "5.3.0",

"lodash": "^4.17.21",
"polymer-cli": "1.9.11",
"wct-browser-legacy": "1.0.2"

@@ -70,3 +65,3 @@ },

],
"gitHead": "d4cd14c5c57b408201bf4fa8f41d714de8b88f11"
"gitHead": "ca4a1abb2fc0e1822268b994850d371d92e0df54"
}

@@ -1,28 +0,19 @@

import {
expect,
fixture,
html,
assert,
elementUpdated,
fixtureCleanup,
} from "@open-wc/testing";
import { setViewport } from "@web/test-runner-commands";
import { fixture, expect, html } from "@open-wc/testing";
import "../hax-body-behaviors.js";
/*
* Instantiation test
* create element and see if an attribute binds to the element
*/
describe("Instantiation Test", () => {
it("hax-body-behaviors instantiates", async () => {
const el = await fixture(
describe("hax-body-behaviors test", () => {
let element;
beforeEach(async () => {
element = await fixture(
html` <hax-body-behaviors title="test-title"></hax-body-behaviors> `
);
await expect(el.getAttribute("title")).to.equal("test-title");
});
it("passes the a11y audit", async () => {
await expect(element).shadowDom.to.be.accessible();
});
});
/*
* A11y Accessibility tests
*/
describe("A11y/chai axe tests", () => {

@@ -83,6 +74,1 @@ it("hax-body-behaviors passes accessibility test", async () => {

}) */
// clean up fixtures after all tests are complete
afterEach(() => {
fixtureCleanup();
});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc