diff --git a/README.md b/README.md index dcef779..47c3916 100644 --- a/README.md +++ b/README.md @@ -68,7 +68,7 @@ To run a local development server that serves the basic demo located in `src/dem [git-url]: https://github.com/EPA-WG/custom-element [github-image]: https://cdnjs.cloudflare.com/ajax/libs/octicons/8.5.0/svg/mark-github.svg -[demo-url]: https://unpkg.com/@epa-wg/custom-element-test@0.0.14/dist/index.html -[storybook-url]: https://unpkg.com/@epa-wg/custom-element-test@0.0.14/storybook-static/index.html?path=/story/welcome--introduction -[coverage-image]: https://unpkg.com/@epa-wg/custom-element-test@0.0.14/coverage/coverage.svg -[coverage-url]: https://unpkg.com/@epa-wg/custom-element-test@0.0.14/coverage/lcov-report/index.html +[demo-url]: https://unpkg.com/@epa-wg/custom-element-test@0.0.16/dist/index.html +[storybook-url]: https://unpkg.com/@epa-wg/custom-element-test@0.0.16/storybook-static/index.html?path=/story/welcome--introduction +[coverage-image]: https://unpkg.com/@epa-wg/custom-element-test@0.0.16/coverage/coverage.svg +[coverage-url]: https://unpkg.com/@epa-wg/custom-element-test@0.0.16/coverage/lcov-report/index.html diff --git a/coverage/coverage.svg b/coverage/coverage.svg index 964b937..341897c 100644 --- a/coverage/coverage.svg +++ b/coverage/coverage.svg @@ -6,5 +6,5 @@ coverage - 94% + 95% diff --git a/coverage/lcov-report/index.html b/coverage/lcov-report/index.html index 8ae7a10..fa68542 100644 --- a/coverage/lcov-report/index.html +++ b/coverage/lcov-report/index.html @@ -23,30 +23,30 @@

All files

- 97.81% + 97.95% Statements - 1342/1372 + 1438/1468
- 95.54% + 95.75% Branches - 193/202 + 203/212
- 88.09% + 88.63% Functions - 74/84 + 78/88
- 97.81% + 97.95% Lines - 1342/1372 + 1438/1468
@@ -80,17 +80,17 @@

All files

src - +
- 95.57% - 627/656 - 94.82% - 165/174 - 86.3% - 63/73 - 95.57% - 627/656 + 95.86% + 673/702 + 95.05% + 173/182 + 86.84% + 66/76 + 95.86% + 673/702 @@ -114,13 +114,13 @@

All files

100% - 656/656 + 706/706 100% - 17/17 + 19/19 100% - 9/9 + 10/10 100% - 656/656 + 706/706 @@ -131,7 +131,7 @@

All files

+ + + + + + \ No newline at end of file diff --git a/coverage/lcov-report/stories/playground.stories.js.html b/coverage/lcov-report/stories/playground.stories.js.html index f3c19e9..c2dfc00 100644 --- a/coverage/lcov-report/stories/playground.stories.js.html +++ b/coverage/lcov-report/stories/playground.stories.js.html @@ -421,7 +421,7 @@

All files / stories pla \ No newline at end of file + window['STORIES'] = [{"titlePrefix":"","directory":"./stories","files":"**/*.stories.mdx","importPathMatcher":"^\\.[\\\\/](?:stories(?:[\\\\/](?!\\.)(?:(?:(?!(?:^|[\\\\/])\\.).)*?)[\\\\/]|[\\\\/]|$)(?!\\.)(?=.)[^\\\\/]*?\\.stories\\.mdx)$"},{"titlePrefix":"","directory":"./stories","files":"**/*.stories.@(js|jsx|ts|tsx)","importPathMatcher":"^\\.[\\\\/](?:stories(?:[\\\\/](?!\\.)(?:(?:(?!(?:^|[\\\\/])\\.).)*?)[\\\\/]|[\\\\/]|$)(?!\\.)(?=.)[^\\\\/]*?\\.stories\\.(js|jsx|ts|tsx))$"}]; \ No newline at end of file diff --git a/storybook-static/main.9c478f4a.iframe.bundle.js b/storybook-static/main.3a7dfb7a.iframe.bundle.js similarity index 54% rename from storybook-static/main.9c478f4a.iframe.bundle.js rename to storybook-static/main.3a7dfb7a.iframe.bundle.js index 4475053..504dc23 100644 --- a/storybook-static/main.9c478f4a.iframe.bundle.js +++ b/storybook-static/main.3a7dfb7a.iframe.bundle.js @@ -1,2 +1,2 @@ -/*! For license information please see main.9c478f4a.iframe.bundle.js.LICENSE.txt */ -(self.webpackChunk_epa_wg_custom_element_test=self.webpackChunk_epa_wg_custom_element_test||[]).push([[179],{"./.storybook/preview.js-generated-config-entry.js":(__unused_webpack_module,__unused_webpack___webpack_exports__,__webpack_require__)=>{"use strict";var preview_namespaceObject={};__webpack_require__.r(preview_namespaceObject),__webpack_require__.d(preview_namespaceObject,{__namedExportsOrder:()=>__namedExportsOrder,decorators:()=>decorators,parameters:()=>parameters});__webpack_require__("./node_modules/core-js/modules/es.object.keys.js"),__webpack_require__("./node_modules/core-js/modules/es.symbol.js"),__webpack_require__("./node_modules/core-js/modules/es.array.filter.js"),__webpack_require__("./node_modules/core-js/modules/es.object.get-own-property-descriptor.js"),__webpack_require__("./node_modules/core-js/modules/es.array.for-each.js"),__webpack_require__("./node_modules/core-js/modules/web.dom-collections.for-each.js"),__webpack_require__("./node_modules/core-js/modules/es.object.get-own-property-descriptors.js"),__webpack_require__("./node_modules/core-js/modules/es.object.define-properties.js"),__webpack_require__("./node_modules/core-js/modules/es.object.define-property.js");var ClientApi=__webpack_require__("./node_modules/@storybook/client-api/dist/esm/ClientApi.js"),dist=__webpack_require__("./node_modules/msw-storybook-addon/dist/index.js"),injectStylesIntoStyleTag=__webpack_require__("./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"),injectStylesIntoStyleTag_default=__webpack_require__.n(injectStylesIntoStyleTag),common=__webpack_require__("./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[8].use[1]!./.storybook/common.css"),options={insert:"head",singleton:!1};injectStylesIntoStyleTag_default()(common.Z,options);common.Z.locals;__webpack_require__("./node_modules/core-js/modules/es.symbol.description.js"),__webpack_require__("./node_modules/core-js/modules/es.object.to-string.js"),__webpack_require__("./node_modules/core-js/modules/es.symbol.iterator.js"),__webpack_require__("./node_modules/core-js/modules/es.string.iterator.js"),__webpack_require__("./node_modules/core-js/modules/es.array.iterator.js"),__webpack_require__("./node_modules/core-js/modules/web.dom-collections.iterator.js"),__webpack_require__("./node_modules/core-js/modules/es.array.is-array.js"),__webpack_require__("./node_modules/core-js/modules/es.array.slice.js"),__webpack_require__("./node_modules/core-js/modules/es.function.name.js"),__webpack_require__("./node_modules/core-js/modules/es.array.from.js"),__webpack_require__("./node_modules/core-js/modules/es.promise.js"),__webpack_require__("./node_modules/core-js/modules/web.timers.js"),__webpack_require__("./node_modules/core-js/modules/es.array.map.js");var lib=__webpack_require__("./node_modules/msw/lib/index.js");const pokemons_mock={count:1279,next:"https://pokeapi.co/api/v2/pokemon?offset=6&limit=6",previous:null,results:[{name:"bulbasaur",url:"https://pokeapi.co/api/v2/pokemon/1/"},{name:"ivysaur",url:"https://pokeapi.co/api/v2/pokemon/2/"},{name:"venusaur",url:"https://pokeapi.co/api/v2/pokemon/3/"},{name:"charmander",url:"https://pokeapi.co/api/v2/pokemon/4/"},{name:"charmeleon",url:"https://pokeapi.co/api/v2/pokemon/5/"},{name:"charizard",url:"https://pokeapi.co/api/v2/pokemon/6/"}]};function _slicedToArray(arr,i){return function _arrayWithHoles(arr){if(Array.isArray(arr))return arr}(arr)||function _iterableToArrayLimit(arr,i){var _i=null==arr?null:"undefined"!=typeof Symbol&&arr[Symbol.iterator]||arr["@@iterator"];if(null!=_i){var _s,_e,_x,_r,_arr=[],_n=!0,_d=!1;try{if(_x=(_i=_i.call(arr)).next,0===i){if(Object(_i)!==_i)return;_n=!1}else for(;!(_n=(_s=_x.call(_i)).done)&&(_arr.push(_s.value),_arr.length!==i);_n=!0);}catch(err){_d=!0,_e=err}finally{try{if(!_n&&null!=_i.return&&(_r=_i.return(),Object(_r)!==_r))return}finally{if(_d)throw _e}}return _arr}}(arr,i)||_unsupportedIterableToArray(arr,i)||function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _toConsumableArray(arr){return function _arrayWithoutHoles(arr){if(Array.isArray(arr))return _arrayLikeToArray(arr)}(arr)||function _iterableToArray(iter){if("undefined"!=typeof Symbol&&null!=iter[Symbol.iterator]||null!=iter["@@iterator"])return Array.from(iter)}(arr)||_unsupportedIterableToArray(arr)||function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _unsupportedIterableToArray(o,minLen){if(o){if("string"==typeof o)return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);return"Object"===n&&o.constructor&&(n=o.constructor.name),"Map"===n||"Set"===n?Array.from(o):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(o,minLen):void 0}}function _arrayLikeToArray(arr,len){(null==len||len>arr.length)&&(len=arr.length);for(var i=0,arr2=new Array(len);i{"use strict";__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{OverrideInPayload:()=>OverrideInPayload,StyleDoesNotLeak:()=>StyleDoesNotLeak,StyleIn2Instances:()=>StyleIn2Instances,__namedExportsOrder:()=>__namedExportsOrder,default:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/core-js/modules/es.function.bind.js"),__webpack_require__("./node_modules/core-js/modules/es.object.assign.js"),__webpack_require__("./src/custom-element.js?e590");const __WEBPACK_DEFAULT_EXPORT__={title:"css-scoping",component:"custom-element",argTypes:{title:{control:"text",defaultValue:"simple payload"},tag:{control:"text",defaultValue:"my-component"},slot:{control:"text",defaultValue:"Hello World"},style:{control:"text",defaultValue:"color:green; border:dashed pink;"},payload:{control:"text",defaultValue:"Hi"}}};function Template(_ref){return"\n
\n "+_ref.title+'\n \n "+_ref.payload+"\n
\n "}var GREEN='green',StyleDoesNotLeak=Template.bind({});StyleDoesNotLeak.args={title:"The default color should stay on label, message in "+GREEN,tag:"dce-1",payload:""};var StyleIn2Instances=Template.bind({});StyleIn2Instances.args={title:"The default color should apply "+GREEN+" in all instances",tag:"dce-2",payload:''};var OverrideInPayload=Template.bind({});OverrideInPayload.args={title:GREEN+' in instance style can be overridden in payload as red',tag:"dce-3",payload:' \n \n \n green '},StyleDoesNotLeak.parameters=Object.assign({storySource:{source:"Template.bind( {} )"}},StyleDoesNotLeak.parameters),StyleIn2Instances.parameters=Object.assign({storySource:{source:"Template.bind( {} )"}},StyleIn2Instances.parameters),OverrideInPayload.parameters=Object.assign({storySource:{source:"Template.bind( {} )"}},OverrideInPayload.parameters);var __namedExportsOrder=["StyleDoesNotLeak","StyleIn2Instances","OverrideInPayload"]},"./stories/dom-merge.stories.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{InputOnChange:()=>InputOnChange,TextareaOnBlur:()=>TextareaOnBlur,__namedExportsOrder:()=>__namedExportsOrder,default:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/core-js/modules/es.function.bind.js"),__webpack_require__("./node_modules/core-js/modules/es.object.assign.js"),__webpack_require__("./src/custom-element.js?e590");const __WEBPACK_DEFAULT_EXPORT__={title:"dom-merge",component:"custom-element",argTypes:{title:{control:"text",defaultValue:"simple payload"},tag:{control:"text",defaultValue:"my-component"},attributes:{control:"text",defaultValue:""},slot:{control:"text",defaultValue:"Hello World"},payload:{control:"text",defaultValue:"🍋"}}};function Template(_ref){var title=_ref.title,tag=_ref.tag,attributes=_ref.attributes;return"\n
\n "+title+'\n \n '+_ref.slot+"\n \n <"+tag+" "+attributes+">"+_ref.payload+"\n
\n "}var TextareaOnBlur=Template.bind({});TextareaOnBlur.args={title:"Textarea value, type and observe char count update on focus change",tag:"",slot:' \n

Char count:\n {string-length(//slice/text-container/text())}\n

\n \n '};var InputOnChange=Template.bind({});InputOnChange.args={title:"input value, type and observe char count update on keyup",slot:' \n Character count:\n {string-length(//slice/txt)} \n \n Word count:\n {string-length(normalize-space(//slice/txt)) -\n string-length(translate(normalize-space(//slice/txt), \' \', \'\')) + 1} \n \n '},TextareaOnBlur.parameters=Object.assign({storySource:{source:"Template.bind( {} )"}},TextareaOnBlur.parameters),InputOnChange.parameters=Object.assign({storySource:{source:"Template.bind( {} )"}},InputOnChange.parameters);var __namedExportsOrder=["TextareaOnBlur","InputOnChange"]},"./stories/http-request.stories.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{Demo:()=>Demo,LifecycleInitialized:()=>LifecycleInitialized,RequestResponceHeaders:()=>RequestResponceHeaders,__namedExportsOrder:()=>__namedExportsOrder,default:()=>http_request_stories});__webpack_require__("./node_modules/core-js/modules/es.array.slice.js"),__webpack_require__("./node_modules/core-js/modules/es.function.bind.js"),__webpack_require__("./node_modules/core-js/modules/es.object.assign.js"),__webpack_require__("./src/custom-element.js?e590"),__webpack_require__("./node_modules/core-js/modules/es.symbol.js"),__webpack_require__("./node_modules/core-js/modules/es.symbol.description.js"),__webpack_require__("./node_modules/core-js/modules/es.object.to-string.js"),__webpack_require__("./node_modules/core-js/modules/es.symbol.iterator.js"),__webpack_require__("./node_modules/core-js/modules/es.string.iterator.js"),__webpack_require__("./node_modules/core-js/modules/es.array.iterator.js"),__webpack_require__("./node_modules/core-js/modules/web.dom-collections.iterator.js"),__webpack_require__("./node_modules/core-js/modules/es.object.define-property.js"),__webpack_require__("./node_modules/core-js/modules/es.symbol.async-iterator.js"),__webpack_require__("./node_modules/core-js/modules/es.symbol.to-string-tag.js"),__webpack_require__("./node_modules/core-js/modules/es.math.to-string-tag.js"),__webpack_require__("./node_modules/core-js/modules/es.json.to-string-tag.js"),__webpack_require__("./node_modules/core-js/modules/es.object.create.js"),__webpack_require__("./node_modules/core-js/modules/es.object.get-prototype-of.js"),__webpack_require__("./node_modules/core-js/modules/es.array.for-each.js"),__webpack_require__("./node_modules/core-js/modules/web.dom-collections.for-each.js"),__webpack_require__("./node_modules/core-js/modules/es.function.name.js"),__webpack_require__("./node_modules/core-js/modules/es.object.set-prototype-of.js"),__webpack_require__("./node_modules/core-js/modules/es.promise.js"),__webpack_require__("./node_modules/core-js/modules/es.array.reverse.js"),__webpack_require__("./node_modules/core-js/modules/es.array.is-array.js"),__webpack_require__("./node_modules/core-js/modules/es.object.keys.js"),__webpack_require__("./node_modules/core-js/modules/es.array.filter.js"),__webpack_require__("./node_modules/core-js/modules/es.object.get-own-property-descriptor.js"),__webpack_require__("./node_modules/core-js/modules/es.object.get-own-property-descriptors.js"),__webpack_require__("./node_modules/core-js/modules/es.object.define-properties.js"),__webpack_require__("./node_modules/core-js/modules/es.array.from.js"),__webpack_require__("./node_modules/core-js/modules/es.symbol.to-primitive.js"),__webpack_require__("./node_modules/core-js/modules/es.date.to-primitive.js"),__webpack_require__("./node_modules/core-js/modules/es.number.constructor.js"),__webpack_require__("./node_modules/core-js/modules/es.reflect.construct.js"),__webpack_require__("./node_modules/core-js/modules/es.map.js"),__webpack_require__("./node_modules/core-js/modules/es.array.index-of.js"),__webpack_require__("./node_modules/core-js/modules/es.regexp.to-string.js"),__webpack_require__("./node_modules/core-js/modules/es.date.to-string.js"),__webpack_require__("./node_modules/core-js/modules/es.array.map.js"),__webpack_require__("./node_modules/core-js/modules/es.string.starts-with.js"),__webpack_require__("./node_modules/core-js/modules/web.timers.js"),__webpack_require__("./node_modules/core-js/modules/es.string.split.js"),__webpack_require__("./node_modules/core-js/modules/es.regexp.exec.js");function _typeof(obj){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},_typeof(obj)}function _regeneratorRuntime(){_regeneratorRuntime=function _regeneratorRuntime(){return exports};var exports={},Op=Object.prototype,hasOwn=Op.hasOwnProperty,defineProperty=Object.defineProperty||function(obj,key,desc){obj[key]=desc.value},$Symbol="function"==typeof Symbol?Symbol:{},iteratorSymbol=$Symbol.iterator||"@@iterator",asyncIteratorSymbol=$Symbol.asyncIterator||"@@asyncIterator",toStringTagSymbol=$Symbol.toStringTag||"@@toStringTag";function define(obj,key,value){return Object.defineProperty(obj,key,{value,enumerable:!0,configurable:!0,writable:!0}),obj[key]}try{define({},"")}catch(err){define=function define(obj,key,value){return obj[key]=value}}function wrap(innerFn,outerFn,self,tryLocsList){var protoGenerator=outerFn&&outerFn.prototype instanceof Generator?outerFn:Generator,generator=Object.create(protoGenerator.prototype),context=new Context(tryLocsList||[]);return defineProperty(generator,"_invoke",{value:makeInvokeMethod(innerFn,self,context)}),generator}function tryCatch(fn,obj,arg){try{return{type:"normal",arg:fn.call(obj,arg)}}catch(err){return{type:"throw",arg:err}}}exports.wrap=wrap;var ContinueSentinel={};function Generator(){}function GeneratorFunction(){}function GeneratorFunctionPrototype(){}var IteratorPrototype={};define(IteratorPrototype,iteratorSymbol,(function(){return this}));var getProto=Object.getPrototypeOf,NativeIteratorPrototype=getProto&&getProto(getProto(values([])));NativeIteratorPrototype&&NativeIteratorPrototype!==Op&&hasOwn.call(NativeIteratorPrototype,iteratorSymbol)&&(IteratorPrototype=NativeIteratorPrototype);var Gp=GeneratorFunctionPrototype.prototype=Generator.prototype=Object.create(IteratorPrototype);function defineIteratorMethods(prototype){["next","throw","return"].forEach((function(method){define(prototype,method,(function(arg){return this._invoke(method,arg)}))}))}function AsyncIterator(generator,PromiseImpl){function invoke(method,arg,resolve,reject){var record=tryCatch(generator[method],generator,arg);if("throw"!==record.type){var result=record.arg,value=result.value;return value&&"object"==_typeof(value)&&hasOwn.call(value,"__await")?PromiseImpl.resolve(value.__await).then((function(value){invoke("next",value,resolve,reject)}),(function(err){invoke("throw",err,resolve,reject)})):PromiseImpl.resolve(value).then((function(unwrapped){result.value=unwrapped,resolve(result)}),(function(error){return invoke("throw",error,resolve,reject)}))}reject(record.arg)}var previousPromise;defineProperty(this,"_invoke",{value:function value(method,arg){function callInvokeWithMethodAndArg(){return new PromiseImpl((function(resolve,reject){invoke(method,arg,resolve,reject)}))}return previousPromise=previousPromise?previousPromise.then(callInvokeWithMethodAndArg,callInvokeWithMethodAndArg):callInvokeWithMethodAndArg()}})}function makeInvokeMethod(innerFn,self,context){var state="suspendedStart";return function(method,arg){if("executing"===state)throw new Error("Generator is already running");if("completed"===state){if("throw"===method)throw arg;return doneResult()}for(context.method=method,context.arg=arg;;){var delegate=context.delegate;if(delegate){var delegateResult=maybeInvokeDelegate(delegate,context);if(delegateResult){if(delegateResult===ContinueSentinel)continue;return delegateResult}}if("next"===context.method)context.sent=context._sent=context.arg;else if("throw"===context.method){if("suspendedStart"===state)throw state="completed",context.arg;context.dispatchException(context.arg)}else"return"===context.method&&context.abrupt("return",context.arg);state="executing";var record=tryCatch(innerFn,self,context);if("normal"===record.type){if(state=context.done?"completed":"suspendedYield",record.arg===ContinueSentinel)continue;return{value:record.arg,done:context.done}}"throw"===record.type&&(state="completed",context.method="throw",context.arg=record.arg)}}}function maybeInvokeDelegate(delegate,context){var methodName=context.method,method=delegate.iterator[methodName];if(void 0===method)return context.delegate=null,"throw"===methodName&&delegate.iterator.return&&(context.method="return",context.arg=void 0,maybeInvokeDelegate(delegate,context),"throw"===context.method)||"return"!==methodName&&(context.method="throw",context.arg=new TypeError("The iterator does not provide a '"+methodName+"' method")),ContinueSentinel;var record=tryCatch(method,delegate.iterator,context.arg);if("throw"===record.type)return context.method="throw",context.arg=record.arg,context.delegate=null,ContinueSentinel;var info=record.arg;return info?info.done?(context[delegate.resultName]=info.value,context.next=delegate.nextLoc,"return"!==context.method&&(context.method="next",context.arg=void 0),context.delegate=null,ContinueSentinel):info:(context.method="throw",context.arg=new TypeError("iterator result is not an object"),context.delegate=null,ContinueSentinel)}function pushTryEntry(locs){var entry={tryLoc:locs[0]};1 in locs&&(entry.catchLoc=locs[1]),2 in locs&&(entry.finallyLoc=locs[2],entry.afterLoc=locs[3]),this.tryEntries.push(entry)}function resetTryEntry(entry){var record=entry.completion||{};record.type="normal",delete record.arg,entry.completion=record}function Context(tryLocsList){this.tryEntries=[{tryLoc:"root"}],tryLocsList.forEach(pushTryEntry,this),this.reset(!0)}function values(iterable){if(iterable){var iteratorMethod=iterable[iteratorSymbol];if(iteratorMethod)return iteratorMethod.call(iterable);if("function"==typeof iterable.next)return iterable;if(!isNaN(iterable.length)){var i=-1,next=function next(){for(;++i=0;--i){var entry=this.tryEntries[i],record=entry.completion;if("root"===entry.tryLoc)return handle("end");if(entry.tryLoc<=this.prev){var hasCatch=hasOwn.call(entry,"catchLoc"),hasFinally=hasOwn.call(entry,"finallyLoc");if(hasCatch&&hasFinally){if(this.prev=0;--i){var entry=this.tryEntries[i];if(entry.tryLoc<=this.prev&&hasOwn.call(entry,"finallyLoc")&&this.prev=0;--i){var entry=this.tryEntries[i];if(entry.finallyLoc===finallyLoc)return this.complete(entry.completion,entry.afterLoc),resetTryEntry(entry),ContinueSentinel}},catch:function _catch(tryLoc){for(var i=this.tryEntries.length-1;i>=0;--i){var entry=this.tryEntries[i];if(entry.tryLoc===tryLoc){var record=entry.completion;if("throw"===record.type){var thrown=record.arg;resetTryEntry(entry)}return thrown}}throw new Error("illegal catch attempt")},delegateYield:function delegateYield(iterable,resultName,nextLoc){return this.delegate={iterator:values(iterable),resultName,nextLoc},"next"===this.method&&(this.arg=void 0),ContinueSentinel}},exports}function _slicedToArray(arr,i){return function _arrayWithHoles(arr){if(Array.isArray(arr))return arr}(arr)||function _iterableToArrayLimit(arr,i){var _i=null==arr?null:"undefined"!=typeof Symbol&&arr[Symbol.iterator]||arr["@@iterator"];if(null!=_i){var _s,_e,_x,_r,_arr=[],_n=!0,_d=!1;try{if(_x=(_i=_i.call(arr)).next,0===i){if(Object(_i)!==_i)return;_n=!1}else for(;!(_n=(_s=_x.call(_i)).done)&&(_arr.push(_s.value),_arr.length!==i);_n=!0);}catch(err){_d=!0,_e=err}finally{try{if(!_n&&null!=_i.return&&(_r=_i.return(),Object(_r)!==_r))return}finally{if(_d)throw _e}}return _arr}}(arr,i)||_unsupportedIterableToArray(arr,i)||function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg),value=info.value}catch(error){return void reject(error)}info.done?resolve(value):Promise.resolve(value).then(_next,_throw)}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise((function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value)}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err)}_next(void 0)}))}}function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);enumerableOnly&&(symbols=symbols.filter((function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable}))),keys.push.apply(keys,symbols)}return keys}function _objectSpread(target){for(var i=1;iarr.length)&&(len=arr.length);for(var i=0,arr2=new Array(len);i\n "+title+'\n \n\n \n <"+tag+">\n \n "}.bind({});Demo.args={title:"url and slice"};var LifecycleInitialized=function LifecycleInitialized(){return'\n
\n http-request with delayed response\n

Before the data become available the request\n is populated into dedicated slice in 10 seconds in this demo\n

\n\n \n\n \n \n
\n'},RequestResponceHeaders=function RequestResponceHeaders(_ref2){var url=_ref2.url;return'\n
\n http-request headers and responce status and headers\n

request headers are populated into dedicated slice/request/headers\n

\n\n \n\nContent of //slice/request_slice is filled by request and response\nfrom '+url+'\n\n

Samples

\n\n\n \n\n \n\n \n
//slice/request_slice/request/headers/@mode
//slice/request_slice/response/headers/@content-type
//slice/request_slice/response/@status
\n\n
    \n \n \n
    \n @\n =\n \n
    \n
    \n \n
    \n \n
      \n \n
    • \n @\n =\n \n
    • \n
      \n \n
    \n
    \n
    \n
\n
\n \n \n
\n'};RequestResponceHeaders.args={url:"https://pokeapi.co/api/v2/reflect"},Demo.parameters=Object.assign({storySource:{source:"Template.bind( {} )"}},Demo.parameters),LifecycleInitialized.parameters=Object.assign({storySource:{source:'()=>`\n
\n http-request with delayed response\n

Before the data become available the request\n is populated into dedicated slice in 10 seconds in this demo\n

\n\n \n\n \n \n
\n`'}},LifecycleInitialized.parameters),RequestResponceHeaders.parameters=Object.assign({storySource:{source:'({url})=>`\n
\n http-request headers and responce status and headers\n

request headers are populated into dedicated slice/request/headers\n

\n\n \n\nContent of //slice/request_slice is filled by request and response\nfrom ${url}\n\n

Samples

\n\n\n \n\n \n\n \n
//slice/request_slice/request/headers/@mode
//slice/request_slice/response/headers/@content-type
//slice/request_slice/response/@status
\n\n
    \n \n \n
    \n @\n =\n \n
    \n
    \n \n
    \n \n
      \n \n
    • \n @\n =\n \n
    • \n
      \n \n
    \n
    \n
    \n
\n
\n \n \n
\n`'}},RequestResponceHeaders.parameters);var __namedExportsOrder=["Demo","LifecycleInitialized","RequestResponceHeaders"]},"./stories/local-storage.stories.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{LocalStorageLive:()=>LocalStorageLive,LocalStorageLoad:()=>LocalStorageLoad,__namedExportsOrder:()=>__namedExportsOrder,default:()=>local_storage_stories});__webpack_require__("./node_modules/core-js/modules/es.array.slice.js"),__webpack_require__("./node_modules/core-js/modules/es.function.bind.js"),__webpack_require__("./node_modules/core-js/modules/es.object.assign.js"),__webpack_require__("./src/custom-element.js?e590"),__webpack_require__("./node_modules/core-js/modules/es.symbol.js"),__webpack_require__("./node_modules/core-js/modules/es.symbol.description.js"),__webpack_require__("./node_modules/core-js/modules/es.object.to-string.js"),__webpack_require__("./node_modules/core-js/modules/es.symbol.iterator.js"),__webpack_require__("./node_modules/core-js/modules/es.string.iterator.js"),__webpack_require__("./node_modules/core-js/modules/es.array.iterator.js"),__webpack_require__("./node_modules/core-js/modules/web.dom-collections.iterator.js"),__webpack_require__("./node_modules/core-js/modules/es.object.define-property.js"),__webpack_require__("./node_modules/core-js/modules/es.symbol.async-iterator.js"),__webpack_require__("./node_modules/core-js/modules/es.symbol.to-string-tag.js"),__webpack_require__("./node_modules/core-js/modules/es.math.to-string-tag.js"),__webpack_require__("./node_modules/core-js/modules/es.json.to-string-tag.js"),__webpack_require__("./node_modules/core-js/modules/es.object.create.js"),__webpack_require__("./node_modules/core-js/modules/es.object.get-prototype-of.js"),__webpack_require__("./node_modules/core-js/modules/es.array.for-each.js"),__webpack_require__("./node_modules/core-js/modules/web.dom-collections.for-each.js"),__webpack_require__("./node_modules/core-js/modules/es.function.name.js"),__webpack_require__("./node_modules/core-js/modules/es.object.set-prototype-of.js"),__webpack_require__("./node_modules/core-js/modules/es.promise.js"),__webpack_require__("./node_modules/core-js/modules/es.array.reverse.js"),__webpack_require__("./node_modules/core-js/modules/es.symbol.to-primitive.js"),__webpack_require__("./node_modules/core-js/modules/es.date.to-primitive.js"),__webpack_require__("./node_modules/core-js/modules/es.number.constructor.js"),__webpack_require__("./node_modules/core-js/modules/es.reflect.construct.js"),__webpack_require__("./node_modules/core-js/modules/es.map.js"),__webpack_require__("./node_modules/core-js/modules/es.array.index-of.js"),__webpack_require__("./node_modules/core-js/modules/es.regexp.to-string.js"),__webpack_require__("./node_modules/core-js/modules/es.date.to-string.js"),__webpack_require__("./node_modules/core-js/modules/es.string.includes.js");function _typeof(obj){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},_typeof(obj)}function _regeneratorRuntime(){_regeneratorRuntime=function _regeneratorRuntime(){return exports};var exports={},Op=Object.prototype,hasOwn=Op.hasOwnProperty,defineProperty=Object.defineProperty||function(obj,key,desc){obj[key]=desc.value},$Symbol="function"==typeof Symbol?Symbol:{},iteratorSymbol=$Symbol.iterator||"@@iterator",asyncIteratorSymbol=$Symbol.asyncIterator||"@@asyncIterator",toStringTagSymbol=$Symbol.toStringTag||"@@toStringTag";function define(obj,key,value){return Object.defineProperty(obj,key,{value,enumerable:!0,configurable:!0,writable:!0}),obj[key]}try{define({},"")}catch(err){define=function define(obj,key,value){return obj[key]=value}}function wrap(innerFn,outerFn,self,tryLocsList){var protoGenerator=outerFn&&outerFn.prototype instanceof Generator?outerFn:Generator,generator=Object.create(protoGenerator.prototype),context=new Context(tryLocsList||[]);return defineProperty(generator,"_invoke",{value:makeInvokeMethod(innerFn,self,context)}),generator}function tryCatch(fn,obj,arg){try{return{type:"normal",arg:fn.call(obj,arg)}}catch(err){return{type:"throw",arg:err}}}exports.wrap=wrap;var ContinueSentinel={};function Generator(){}function GeneratorFunction(){}function GeneratorFunctionPrototype(){}var IteratorPrototype={};define(IteratorPrototype,iteratorSymbol,(function(){return this}));var getProto=Object.getPrototypeOf,NativeIteratorPrototype=getProto&&getProto(getProto(values([])));NativeIteratorPrototype&&NativeIteratorPrototype!==Op&&hasOwn.call(NativeIteratorPrototype,iteratorSymbol)&&(IteratorPrototype=NativeIteratorPrototype);var Gp=GeneratorFunctionPrototype.prototype=Generator.prototype=Object.create(IteratorPrototype);function defineIteratorMethods(prototype){["next","throw","return"].forEach((function(method){define(prototype,method,(function(arg){return this._invoke(method,arg)}))}))}function AsyncIterator(generator,PromiseImpl){function invoke(method,arg,resolve,reject){var record=tryCatch(generator[method],generator,arg);if("throw"!==record.type){var result=record.arg,value=result.value;return value&&"object"==_typeof(value)&&hasOwn.call(value,"__await")?PromiseImpl.resolve(value.__await).then((function(value){invoke("next",value,resolve,reject)}),(function(err){invoke("throw",err,resolve,reject)})):PromiseImpl.resolve(value).then((function(unwrapped){result.value=unwrapped,resolve(result)}),(function(error){return invoke("throw",error,resolve,reject)}))}reject(record.arg)}var previousPromise;defineProperty(this,"_invoke",{value:function value(method,arg){function callInvokeWithMethodAndArg(){return new PromiseImpl((function(resolve,reject){invoke(method,arg,resolve,reject)}))}return previousPromise=previousPromise?previousPromise.then(callInvokeWithMethodAndArg,callInvokeWithMethodAndArg):callInvokeWithMethodAndArg()}})}function makeInvokeMethod(innerFn,self,context){var state="suspendedStart";return function(method,arg){if("executing"===state)throw new Error("Generator is already running");if("completed"===state){if("throw"===method)throw arg;return doneResult()}for(context.method=method,context.arg=arg;;){var delegate=context.delegate;if(delegate){var delegateResult=maybeInvokeDelegate(delegate,context);if(delegateResult){if(delegateResult===ContinueSentinel)continue;return delegateResult}}if("next"===context.method)context.sent=context._sent=context.arg;else if("throw"===context.method){if("suspendedStart"===state)throw state="completed",context.arg;context.dispatchException(context.arg)}else"return"===context.method&&context.abrupt("return",context.arg);state="executing";var record=tryCatch(innerFn,self,context);if("normal"===record.type){if(state=context.done?"completed":"suspendedYield",record.arg===ContinueSentinel)continue;return{value:record.arg,done:context.done}}"throw"===record.type&&(state="completed",context.method="throw",context.arg=record.arg)}}}function maybeInvokeDelegate(delegate,context){var methodName=context.method,method=delegate.iterator[methodName];if(void 0===method)return context.delegate=null,"throw"===methodName&&delegate.iterator.return&&(context.method="return",context.arg=void 0,maybeInvokeDelegate(delegate,context),"throw"===context.method)||"return"!==methodName&&(context.method="throw",context.arg=new TypeError("The iterator does not provide a '"+methodName+"' method")),ContinueSentinel;var record=tryCatch(method,delegate.iterator,context.arg);if("throw"===record.type)return context.method="throw",context.arg=record.arg,context.delegate=null,ContinueSentinel;var info=record.arg;return info?info.done?(context[delegate.resultName]=info.value,context.next=delegate.nextLoc,"return"!==context.method&&(context.method="next",context.arg=void 0),context.delegate=null,ContinueSentinel):info:(context.method="throw",context.arg=new TypeError("iterator result is not an object"),context.delegate=null,ContinueSentinel)}function pushTryEntry(locs){var entry={tryLoc:locs[0]};1 in locs&&(entry.catchLoc=locs[1]),2 in locs&&(entry.finallyLoc=locs[2],entry.afterLoc=locs[3]),this.tryEntries.push(entry)}function resetTryEntry(entry){var record=entry.completion||{};record.type="normal",delete record.arg,entry.completion=record}function Context(tryLocsList){this.tryEntries=[{tryLoc:"root"}],tryLocsList.forEach(pushTryEntry,this),this.reset(!0)}function values(iterable){if(iterable){var iteratorMethod=iterable[iteratorSymbol];if(iteratorMethod)return iteratorMethod.call(iterable);if("function"==typeof iterable.next)return iterable;if(!isNaN(iterable.length)){var i=-1,next=function next(){for(;++i=0;--i){var entry=this.tryEntries[i],record=entry.completion;if("root"===entry.tryLoc)return handle("end");if(entry.tryLoc<=this.prev){var hasCatch=hasOwn.call(entry,"catchLoc"),hasFinally=hasOwn.call(entry,"finallyLoc");if(hasCatch&&hasFinally){if(this.prev=0;--i){var entry=this.tryEntries[i];if(entry.tryLoc<=this.prev&&hasOwn.call(entry,"finallyLoc")&&this.prev=0;--i){var entry=this.tryEntries[i];if(entry.finallyLoc===finallyLoc)return this.complete(entry.completion,entry.afterLoc),resetTryEntry(entry),ContinueSentinel}},catch:function _catch(tryLoc){for(var i=this.tryEntries.length-1;i>=0;--i){var entry=this.tryEntries[i];if(entry.tryLoc===tryLoc){var record=entry.completion;if("throw"===record.type){var thrown=record.arg;resetTryEntry(entry)}return thrown}}throw new Error("illegal catch attempt")},delegateYield:function delegateYield(iterable,resultName,nextLoc){return this.delegate={iterator:values(iterable),resultName,nextLoc},"next"===this.method&&(this.arg=void 0),ContinueSentinel}},exports}function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg),value=info.value}catch(error){return void reject(error)}info.done?resolve(value):Promise.resolve(value).then(_next,_throw)}function _defineProperties(target,props){for(var i=0;i'},key:{control:"text",type:{name:"string",required:!0},defaultValue:"cherries"},value:{control:"text",type:{name:"string",required:!0},defaultValue:"🍒 from localStorage"},slice:{control:"text",type:{name:"string",required:!0},defaultValue:"fruits"},type:{control:"text",type:{name:"string",required:!0},defaultValue:"string",description:"string|json|input type"},live:{control:"boolean",type:{name:"boolean",required:!0},defaultValue:!1,description:"string|json|input type"}},parameters:{controls:{sort:"requiredFirst"}}};function Template(_ref){var title=_ref.title,tag=_ref.tag,body=_ref.body,key=_ref.key,value=_ref.value,slice=_ref.slice,type=_ref.type,live=_ref.live;return localStorage.setItem(key,value),"\n
\n "+title+". localStorage["+key+']="'+localStorage[key]+'"\n \n \n "+body+"\n \n <"+tag+">\n
\n "}var LocalStorageLoad=Template.bind({});LocalStorageLoad.args={body:'fruits slice: '};var LocalStorageLive=Template.bind({});LocalStorageLive.args={title:"Live update and JSON",type:"json",live:!0,key:"basket",slice:"basket",value:'{"cherries": 12, "lemons":1 }',tag:"ls-live-component",body:'\n \n \n \n \n \n \n \n \n 🤔\n \n \n \n '},LocalStorageLoad.parameters=Object.assign({storySource:{source:"Template.bind( {} )"}},LocalStorageLoad.parameters),LocalStorageLive.parameters=Object.assign({storySource:{source:"Template.bind( {} )"}},LocalStorageLive.parameters);var __namedExportsOrder=["LocalStorageLoad","LocalStorageLive"]},"./stories/location-element.stories.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{LocationElementLive:()=>LocationElementLive,LocationElementLoad:()=>LocationElementLoad,LocationElementSrc:()=>LocationElementSrc,__namedExportsOrder:()=>__namedExportsOrder,default:()=>location_element_stories});__webpack_require__("./node_modules/core-js/modules/es.array.slice.js"),__webpack_require__("./node_modules/core-js/modules/es.function.bind.js"),__webpack_require__("./node_modules/core-js/modules/es.object.assign.js"),__webpack_require__("./src/custom-element.js?e590"),__webpack_require__("./node_modules/core-js/modules/es.symbol.js"),__webpack_require__("./node_modules/core-js/modules/es.symbol.description.js"),__webpack_require__("./node_modules/core-js/modules/es.object.to-string.js"),__webpack_require__("./node_modules/core-js/modules/es.symbol.iterator.js"),__webpack_require__("./node_modules/core-js/modules/es.string.iterator.js"),__webpack_require__("./node_modules/core-js/modules/es.array.iterator.js"),__webpack_require__("./node_modules/core-js/modules/web.dom-collections.iterator.js"),__webpack_require__("./node_modules/core-js/modules/es.array.is-array.js"),__webpack_require__("./node_modules/core-js/modules/es.function.name.js"),__webpack_require__("./node_modules/core-js/modules/es.array.from.js"),__webpack_require__("./node_modules/core-js/modules/es.object.define-property.js"),__webpack_require__("./node_modules/core-js/modules/es.symbol.to-primitive.js"),__webpack_require__("./node_modules/core-js/modules/es.date.to-primitive.js"),__webpack_require__("./node_modules/core-js/modules/es.number.constructor.js"),__webpack_require__("./node_modules/core-js/modules/es.object.create.js"),__webpack_require__("./node_modules/core-js/modules/es.reflect.construct.js"),__webpack_require__("./node_modules/core-js/modules/es.map.js"),__webpack_require__("./node_modules/core-js/modules/es.array.index-of.js"),__webpack_require__("./node_modules/core-js/modules/es.regexp.to-string.js"),__webpack_require__("./node_modules/core-js/modules/es.date.to-string.js"),__webpack_require__("./node_modules/core-js/modules/es.object.set-prototype-of.js"),__webpack_require__("./node_modules/core-js/modules/es.object.get-prototype-of.js"),__webpack_require__("./node_modules/core-js/modules/web.url.js"),__webpack_require__("./node_modules/core-js/modules/es.string.search.js"),__webpack_require__("./node_modules/core-js/modules/es.regexp.exec.js");function _typeof(obj){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},_typeof(obj)}function _createForOfIteratorHelper(o,allowArrayLike){var it="undefined"!=typeof Symbol&&o[Symbol.iterator]||o["@@iterator"];if(!it){if(Array.isArray(o)||(it=function _unsupportedIterableToArray(o,minLen){if(!o)return;if("string"==typeof o)return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);"Object"===n&&o.constructor&&(n=o.constructor.name);if("Map"===n||"Set"===n)return Array.from(o);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _arrayLikeToArray(o,minLen)}(o))||allowArrayLike&&o&&"number"==typeof o.length){it&&(o=it);var i=0,F=function F(){};return{s:F,n:function n(){return i>=o.length?{done:!0}:{done:!1,value:o[i++]}},e:function e(_e){throw _e},f:F}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var err,normalCompletion=!0,didErr=!1;return{s:function s(){it=it.call(o)},n:function n(){var step=it.next();return normalCompletion=step.done,step},e:function e(_e2){didErr=!0,err=_e2},f:function f(){try{normalCompletion||null==it.return||it.return()}finally{if(didErr)throw err}}}}function _arrayLikeToArray(arr,len){(null==len||len>arr.length)&&(len=arr.length);for(var i=0,arr2=new Array(len);i\n "+title+'\n

Change the URL by one of the methods bellow

\n
\n #a1\n #a2\n\n \n \n
\n
\n \n \n \n <'+tag+">\n \n "}var LocationElementLoad=Template.bind({});LocationElementLoad.args={};var LocationElementLive=Template.bind({});LocationElementLive.args={title:"Live update",live:!0,tag:"ls-live-component"};var LocationElementSrc=Template.bind({});LocationElementSrc.args={title:"SCR attribute",live:!0,tag:"location-src-component",src:"https://my.example?a=1&b=2#3"},LocationElementLoad.parameters=Object.assign({storySource:{source:"Template.bind( {} )"}},LocationElementLoad.parameters),LocationElementLive.parameters=Object.assign({storySource:{source:"Template.bind( {} )"}},LocationElementLive.parameters),LocationElementSrc.parameters=Object.assign({storySource:{source:"Template.bind( {} )"}},LocationElementSrc.parameters);var __namedExportsOrder=["LocationElementLoad","LocationElementLive","LocationElementSrc"]},"./stories/playground.stories.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{DefaultSlot:()=>DefaultSlot,DoubleSlot:()=>DoubleSlot,NamedDefaultSlot:()=>NamedDefaultSlot,NamedSlot:()=>NamedSlot,NamedUnnamedDefaultSlot:()=>NamedUnnamedDefaultSlot,Regular:()=>Regular,TemplateWithAttributesAndCondition:()=>TemplateWithAttributesAndCondition,__namedExportsOrder:()=>__namedExportsOrder,default:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("./node_modules/core-js/modules/es.function.bind.js"),__webpack_require__("./node_modules/core-js/modules/es.object.assign.js"),__webpack_require__("./src/custom-element.js?e590");const __WEBPACK_DEFAULT_EXPORT__={title:"custom-element",component:"custom-element",argTypes:{title:{control:"text",defaultValue:"simple payload"},tag:{control:"text",defaultValue:"my-component"},attributes:{control:"text",defaultValue:""},slot:{control:"text",defaultValue:"Hello World"},payload:{control:"text",defaultValue:"🍋"}}};function Template(_ref){var title=_ref.title,tag=_ref.tag,attributes=_ref.attributes;return"\n
\n "+title+'\n \n '+_ref.slot+"\n \n <"+tag+" "+attributes+">"+_ref.payload+"\n
\n "}var Regular=Template.bind({}),NamedSlot=Template.bind({});NamedSlot.args={title:"named slot",tag:"dce-1-slot",slot:' 🥦',payload:'🥕'};var DoubleSlot=Template.bind({});DoubleSlot.args={title:"same slot can be used multiple times in template",tag:"dce-2-slots",slot:' 😃 and again: 😃',payload:'🥕'};var NamedDefaultSlot=Template.bind({});NamedDefaultSlot.args={title:"two named default slot",tag:"dce-3-slot",slot:'#1 😃
\n #2 😃',payload:'🥕'};var NamedUnnamedDefaultSlot=Template.bind({});NamedUnnamedDefaultSlot.args={title:"named and un-named default slot",tag:"dce-4-slot",slot:'#1 😃
\n #2 😃',payload:'🥕'};var DefaultSlot=Template.bind({});DefaultSlot.args={title:"default slot",tag:"greet-element",slot:" Hello World!",payload:"👋"};var TemplateWithAttributesAndCondition=Template.bind({});TemplateWithAttributesAndCondition.args={title:"💪 DCE template",tag:"pokemon-tile",attributes:' title="bulbasaur" data-smile="👼" pokemon-id="1" ',slot:'\n\n',payload:'

Bulbasaur is a cute Pokémon born with a large seed firmly affixed to its back;\n the seed grows in size as the Pokémon does.

\n
    \n
  • ivysaur
  • \n
  • venusaur
  • \n
\n'},Regular.parameters=Object.assign({storySource:{source:"Template.bind( {} )"}},Regular.parameters),NamedSlot.parameters=Object.assign({storySource:{source:"Template.bind( {} )"}},NamedSlot.parameters),DoubleSlot.parameters=Object.assign({storySource:{source:"Template.bind( {} )"}},DoubleSlot.parameters),NamedDefaultSlot.parameters=Object.assign({storySource:{source:"Template.bind( {} )"}},NamedDefaultSlot.parameters),NamedUnnamedDefaultSlot.parameters=Object.assign({storySource:{source:"Template.bind( {} )"}},NamedUnnamedDefaultSlot.parameters),DefaultSlot.parameters=Object.assign({storySource:{source:"Template.bind( {} )"}},DefaultSlot.parameters),TemplateWithAttributesAndCondition.parameters=Object.assign({storySource:{source:"Template.bind( {} )"}},TemplateWithAttributesAndCondition.parameters);var __namedExportsOrder=["Regular","NamedSlot","DoubleSlot","NamedDefaultSlot","NamedUnnamedDefaultSlot","DefaultSlot","TemplateWithAttributesAndCondition"]},"./stories/welcome.stories.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{Introduction:()=>Introduction,__namedExportsOrder:()=>__namedExportsOrder,default:()=>welcome_stories});__webpack_require__("./node_modules/core-js/modules/es.function.bind.js"),__webpack_require__("./node_modules/core-js/modules/es.object.assign.js"),__webpack_require__("./src/custom-element.js?e590");var getUrl=__webpack_require__("./node_modules/html-loader/dist/runtime/getUrl.js"),getUrl_default=__webpack_require__.n(getUrl),___HTML_LOADER_IMPORT_0___=new URL(__webpack_require__("./src/demo/wc-square.svg"),__webpack_require__.b),___HTML_LOADER_IMPORT_1___=new URL(__webpack_require__("./src/custom-element.js?33a0"),__webpack_require__.b);const cjs_js_src=' custom-element Declarative Custom Element implementation demo + + + + + + + + + + + + + + + diff --git a/storybook-static/src/demo/s.xslt b/storybook-static/src/demo/s.xslt index 3cc854b..8218be6 100644 --- a/storybook-static/src/demo/s.xslt +++ b/storybook-static/src/demo/s.xslt @@ -1,29 +1,20 @@ - + + - - - - - + + + + + + + + + + + + + p1:
p2:
p3: +
diff --git a/storybook-static/src/demo/z.html b/storybook-static/src/demo/z.html index a5cbe1e..9b174d8 100644 --- a/storybook-static/src/demo/z.html +++ b/storybook-static/src/demo/z.html @@ -38,23 +38,13 @@ - - - - - - + + + + + + diff --git a/test/parameters.test.js b/test/parameters.test.js new file mode 100644 index 0000000..7991f19 --- /dev/null +++ b/test/parameters.test.js @@ -0,0 +1,70 @@ +import {fixture, expect, aTimeout} from '@open-wc/testing'; + +import '../src/custom-element.js'; +import defaults, { + EmbeddedDce, + HtmlById, + HtmlTemplate, + NoSvg, + NoTag, Svg, + TemplateInPage, Xsl, XsltById, + +} from '../stories/src-attribute.stories.js'; +import {AttributeChange, AttributeDefaults, AttributeUse} from "../stories/parameters.stories"; + +const defs = {}; +Object.keys(defaults.argTypes).map(k => defs[k] = defaults.argTypes[k].defaultValue); +const renderStory = async (story) => fixture(story({...defs, ...story.args})); + +const $ = (css, node) => node.querySelector(css); + +describe('DCE attributes definition', () => +{ + it('Binding to DCE class, defaults ', async () => + { + const el = await renderStory(AttributeDefaults); + const attrs = window.customElements.get('dce-1').observedAttributes; + + expect(attrs.length).to.equal(3); + expect(attrs).to.include(`p1`); + expect(attrs).to.include(`p2`); + expect(attrs).to.include(`p3`); + + const dce1 = $('#dce1',el); + expect(dce1.innerText).to.include('p1:def_p1'); + expect(dce1.innerText).to.include('p2:always_p2'); + expect(dce1.innerText).to.include('p3:default_P3'); + + }); + + it('attributes override', async () => + { + const el = await renderStory(AttributeUse); + + const dce2 = $('#dce2',el); + expect(dce2.innerText).to.include('p1:123'); + expect(dce2.innerText).to.include('p2:always_p2'); + expect(dce2.innerText).to.include('p3:P3'); + }); + + it('dynamic attributes change', async () => + { + const el = await renderStory(AttributeChange); + + const dce3 = $('#dce3',el); + expect(dce3.innerText).to.include('p1:123'); + expect(dce3.innerText).to.include('p2:always_p2'); + expect(dce3.innerText).to.include('p3:default_P3'); + + dce3.setAttribute('p1','changed_p1'); + expect(dce3.innerText).to.include('p1:changed_p1'); + + dce3.setAttribute('p2','changed_p2'); // does not affect as select="'always_p2'' sets it explicitly + expect(dce3.innerText).to.include('p2:always_p2'); + + dce3.setAttribute('p3','changed_p3'); + expect(dce3.innerText).to.include('p3:changed_p3'); + + }); + +});