@maggioli-design-system/mds-icon
Advanced tools
Comparing version 2.0.2 to 2.0.3
@@ -5,6 +5,6 @@ 'use strict'; | ||
const index = require('./index-20ea01f1.js'); | ||
const index = require('./index-e7e249b2.js'); | ||
/* | ||
Stencil Client Patch Esm v2.15.2 | MIT Licensed | https://stenciljs.com | ||
Stencil Client Patch Esm v2.16.1 | MIT Licensed | https://stenciljs.com | ||
*/ | ||
@@ -11,0 +11,0 @@ const patchEsm = () => { |
@@ -5,3 +5,3 @@ 'use strict'; | ||
const index = require('./index-20ea01f1.js'); | ||
const index = require('./index-e7e249b2.js'); | ||
@@ -164,2 +164,3 @@ /** | ||
catch (e) { | ||
console.error('isCacheAvailable error', e); | ||
return false; | ||
@@ -177,3 +178,3 @@ } | ||
catch (e) { | ||
console.error(e); | ||
console.error('setCache error', e); | ||
} | ||
@@ -230,3 +231,3 @@ }; | ||
catch (e) { | ||
console.error(e); | ||
console.error('fetchSvg error', e); | ||
return ''; | ||
@@ -259,2 +260,4 @@ } | ||
async updateIconHref() { | ||
if (!this.name) | ||
return Promise.resolve(); | ||
const svgPath = IconsSetService.getSvgPath() || window.sessionStorage.getItem(MdsIcon._svgPathKey); | ||
@@ -261,0 +264,0 @@ this._iconHref = svgPath && !this.name.startsWith('http') ? window.location.origin.concat(svgPath.concat(this.name).concat('.svg')) : this.name; |
'use strict'; | ||
const index = require('./index-20ea01f1.js'); | ||
const index = require('./index-e7e249b2.js'); | ||
/* | ||
Stencil Client Patch Browser v2.15.2 | MIT Licensed | https://stenciljs.com | ||
Stencil Client Patch Browser v2.16.1 | MIT Licensed | https://stenciljs.com | ||
*/ | ||
@@ -8,0 +8,0 @@ const patchBrowser = () => { |
@@ -7,3 +7,3 @@ { | ||
"name": "@stencil/core", | ||
"version": "2.15.2", | ||
"version": "2.16.1", | ||
"typescriptVersion": "4.5.4" | ||
@@ -10,0 +10,0 @@ }, |
@@ -19,2 +19,4 @@ import { Component, Element, h, Host, Method, Prop, State, Watch } from '@stencil/core'; | ||
async updateIconHref() { | ||
if (!this.name) | ||
return Promise.resolve(); | ||
const svgPath = IconsSetService.getSvgPath() || window.sessionStorage.getItem(MdsIcon._svgPathKey); | ||
@@ -21,0 +23,0 @@ this._iconHref = svgPath && !this.name.startsWith('http') ? window.location.origin.concat(svgPath.concat(this.name).concat('.svg')) : this.name; |
@@ -23,2 +23,3 @@ import { get, set, del } from 'idb-keyval'; | ||
catch (e) { | ||
console.error('isCacheAvailable error', e); | ||
return false; | ||
@@ -36,3 +37,3 @@ } | ||
catch (e) { | ||
console.error(e); | ||
console.error('setCache error', e); | ||
} | ||
@@ -89,3 +90,3 @@ }; | ||
catch (e) { | ||
console.error(e); | ||
console.error('fetchSvg error', e); | ||
return ''; | ||
@@ -92,0 +93,0 @@ } |
@@ -25,1 +25,2 @@ import { h } from '@stencil/core'; | ||
}; | ||
export const NoIcon = Template.bind({}); |
@@ -43,2 +43,7 @@ const typographyDictionary = [ | ||
]; | ||
export { typographyDictionary, typographyMonoDictionary, typographyPrimaryDictionary, typographySecondaryDictionary, typographySmallerDictionary, }; | ||
const typographyTooltipDictionary = [ | ||
'caption', | ||
'detail', | ||
'tip', | ||
]; | ||
export { typographyDictionary, typographyMonoDictionary, typographyPrimaryDictionary, typographySecondaryDictionary, typographySmallerDictionary, typographyTooltipDictionary, }; |
@@ -159,2 +159,3 @@ import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client'; | ||
catch (e) { | ||
console.error('isCacheAvailable error', e); | ||
return false; | ||
@@ -172,3 +173,3 @@ } | ||
catch (e) { | ||
console.error(e); | ||
console.error('setCache error', e); | ||
} | ||
@@ -225,3 +226,3 @@ }; | ||
catch (e) { | ||
console.error(e); | ||
console.error('fetchSvg error', e); | ||
return ''; | ||
@@ -256,2 +257,4 @@ } | ||
async updateIconHref() { | ||
if (!this.name) | ||
return Promise.resolve(); | ||
const svgPath = IconsSetService.getSvgPath() || window.sessionStorage.getItem(MdsIcon$1._svgPathKey); | ||
@@ -258,0 +261,0 @@ this._iconHref = svgPath && !this.name.startsWith('http') ? window.location.origin.concat(svgPath.concat(this.name).concat('.svg')) : this.name; |
@@ -1,1 +0,1 @@ | ||
import{p as promiseResolve,b as bootstrapLazy}from"./index-4ff36ed4.js";var patchEsm=function(){return promiseResolve()};var defineCustomElements=function(e,n){if(typeof window==="undefined")return Promise.resolve();return patchEsm().then((function(){return bootstrapLazy([["mds-icon",[[1,"mds-icon",{name:[513],_iconHref:[32],setSvgPath:[64]}]]]],n)}))};export{defineCustomElements}; | ||
import{p as promiseResolve,b as bootstrapLazy}from"./index-ad9adcc2.js";var patchEsm=function(){return promiseResolve()};var defineCustomElements=function(e,n){if(typeof window==="undefined")return Promise.resolve();return patchEsm().then((function(){return bootstrapLazy([["mds-icon",[[1,"mds-icon",{name:[513],_iconHref:[32],setSvgPath:[64]}]]]],n)}))};export{defineCustomElements}; |
@@ -1,1 +0,1 @@ | ||
var __awaiter=this&&this.__awaiter||function(e,t,n,r){function o(e){return e instanceof n?e:new n((function(t){t(e)}))}return new(n||(n=Promise))((function(n,a){function i(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r["throw"](e))}catch(e){a(e)}}function c(e){e.done?n(e.value):o(e.value).then(i,s)}c((r=r.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var n={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},r,o,a,i;return i={next:s(0),throw:s(1),return:s(2)},typeof Symbol==="function"&&(i[Symbol.iterator]=function(){return this}),i;function s(e){return function(t){return c([e,t])}}function c(i){if(r)throw new TypeError("Generator is already executing.");while(n)try{if(r=1,o&&(a=i[0]&2?o["return"]:i[0]?o["throw"]||((a=o["return"])&&a.call(o),0):o.next)&&!(a=a.call(o,i[1])).done)return a;if(o=0,a)i=[i[0]&2,a.value];switch(i[0]){case 0:case 1:a=i;break;case 4:n.label++;return{value:i[1],done:false};case 5:n.label++;o=i[1];i=[0];continue;case 7:i=n.ops.pop();n.trys.pop();continue;default:if(!(a=n.trys,a=a.length>0&&a[a.length-1])&&(i[0]===6||i[0]===2)){n=0;continue}if(i[0]===3&&(!a||i[1]>a[0]&&i[1]<a[3])){n.label=i[1];break}if(i[0]===6&&n.label<a[1]){n.label=a[1];a=i;break}if(a&&n.label<a[2]){n.label=a[2];n.ops.push(i);break}if(a[2])n.ops.pop();n.trys.pop();continue}i=t.call(e,n)}catch(e){i=[6,e];o=0}finally{r=a=0}if(i[0]&5)throw i[1];return{value:i[0]?i[1]:void 0,done:true}}};import{r as registerInstance,h,g as getElement,H as Host}from"./index-4ff36ed4.js";function idbReady(){var e=!navigator.userAgentData&&/Safari\//.test(navigator.userAgent)&&!/Chrom(e|ium)\//.test(navigator.userAgent);if(!e||!indexedDB.databases)return Promise.resolve();var t;return new Promise((function(e){var n=function(){return indexedDB.databases().finally(e)};t=setInterval(n,100);n()})).finally((function(){return clearInterval(t)}))}function promisifyRequest(e){return new Promise((function(t,n){e.oncomplete=e.onsuccess=function(){return t(e.result)};e.onabort=e.onerror=function(){return n(e.error)}}))}function createStore(e,t){var n=idbReady().then((function(){var n=indexedDB.open(e);n.onupgradeneeded=function(){return n.result.createObjectStore(t)};return promisifyRequest(n)}));return function(e,r){return n.then((function(n){return r(n.transaction(t,e).objectStore(t))}))}}var defaultGetStoreFunc;function defaultGetStore(){if(!defaultGetStoreFunc){defaultGetStoreFunc=createStore("keyval-store","keyval")}return defaultGetStoreFunc}function get(e){var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:defaultGetStore();return t("readonly",(function(t){return promisifyRequest(t.get(e))}))}function set(e,t){var n=arguments.length>2&&arguments[2]!==undefined?arguments[2]:defaultGetStore();return n("readwrite",(function(n){n.put(t,e);return promisifyRequest(n.transaction)}))}function del(e){var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:defaultGetStore();return t("readwrite",(function(t){t.delete(e);return promisifyRequest(t.transaction)}))}var MdsIconSet=function(){function e(e,t,n){this.name=e;this.path=t;this._resolveIconName=n}e.prototype.resolveIconName=function(e){console.log("resolveIconName - iconName: ".concat(e," | name: ").concat(this.name," | path: ").concat(this.path));return this._resolveIconName(e,this.name,this.path)};Object.defineProperty(e.prototype,"resolver",{get:function(){return this._resolveIconName},enumerable:false,configurable:true});return e}();var IconsSetController=function(){function e(){var e=this;this._iconsSets=new Map;this.cacheExp=60*60*1e3*24;this.memoryCache={};this.isCacheAvailable=function(t){return __awaiter(e,void 0,void 0,(function(){var e,n,r;return __generator(this,(function(o){switch(o.label){case 0:o.trys.push([0,2,,3]);return[4,get("loader_".concat(t))];case 1:e=o.sent();if(!e){return[2,false]}n=JSON.parse(e);if(Date.now()<n.expiry){return[2,n.data]}del("loader_".concat(t));return[2,false];case 2:r=o.sent();return[2,false];case 3:return[2]}}))}))};this.setCache=function(t,n){return __awaiter(e,void 0,void 0,(function(){var e;return __generator(this,(function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);return[4,set("loader_".concat(t),JSON.stringify({data:n,expiry:Date.now()+this.cacheExp}))];case 1:r.sent();return[3,3];case 2:e=r.sent();console.error(e);return[3,3];case 3:return[2]}}))}))}}e.prototype.addIconSet=function(e,t,n){var r=n;var o=this._iconsSets.get(e);if(!r&&o&&typeof o.resolver==="function"){r=o.resolver}else if(r&&typeof r!=="function"){console.error("MdsIconSvg: the third input of addIconSet should be a function that parses and returns the icons's filename.");return false}else if(!r){console.error("MdsIconSvg: the set ".concat(e," needs a resolve function for the icon names."));return false}this._iconsSets.set(e,new MdsIconSet(e,t,r));return true};e.prototype.getIconSet=function(e){if(!e)return{set:null};return{set:this._iconsSets.get(e.split("/")[0])}};e.prototype.setSvgPath=function(e){this._svgPath=e};e.prototype.getSvgPath=function(){return this._svgPath};e.prototype.fetchSvg=function(e){return __awaiter(this,void 0,void 0,(function(){var t,n,r,o,a;return __generator(this,(function(i){switch(i.label){case 0:i.trys.push([0,4,,5]);return[4,this.isCacheAvailable(e)];case 1:t=i.sent();if(this.memoryCache[e]||t){return[2,this.memoryCache[e]||t]}return[4,fetch(e)];case 2:n=i.sent();if(!n.ok){throw Error("Request for '".concat(e,"' returned ").concat(n.status," (").concat(n.statusText,")"))}return[4,n.text()];case 3:r=i.sent();o=r.toLowerCase().trim();if(!(o.startsWith("<svg")||o.startsWith("<?xml"))){throw Error("Resource '".concat(e,"' returned an invalid SVG file"))}this.setCache(e,r);this.memoryCache[e]=r;return[2,r];case 4:a=i.sent();console.error(a);return[2,""];case 5:return[2]}}))}))};return e}();var IconsSetService=new IconsSetController;var mdsIconCss=".static{position:static}.fixed{position:fixed}.absolute{position:absolute}.border{border-width:1px}.fill-label-blue-05{fill:rgb(var(--label-blue-05))}.fill-label-green-06{fill:rgb(var(--label-green-06))}.shadow{--tw-shadow:0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);-webkit-box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}:host{display:-ms-inline-flexbox;display:inline-flex;aspect-ratio:1 / 1;width:1.5rem;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center}svg{aspect-ratio:1 / 1;height:100%;width:100%}";var MdsIcon=function(){function e(e){registerInstance(this,e)}e.prototype.componentWillLoad=function(){this.updateIconHref()};e.setSvgPathStatic=function(e){IconsSetService.setSvgPath(e)};e.prototype.setSvgPath=function(e){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){IconsSetService.setSvgPath(e);this.updateIconHref();return[2]}))}))};e.prototype.updateIconHref=function(){return __awaiter(this,void 0,void 0,(function(){var e,t;return __generator(this,(function(n){switch(n.label){case 0:e=IconsSetService.getSvgPath()||window.sessionStorage.getItem(MdsIcon._svgPathKey);this._iconHref=e&&!this.name.startsWith("http")?window.location.origin.concat(e.concat(this.name).concat(".svg")):this.name;return[4,IconsSetService.fetchSvg(this._iconHref)];case 1:t=n.sent();if(t!=="")this.hostElement.shadowRoot.innerHTML=t;return[2]}}))}))};e.prototype.render=function(){return h(Host,null)};Object.defineProperty(e.prototype,"hostElement",{get:function(){return getElement(this)},enumerable:false,configurable:true});Object.defineProperty(e,"watchers",{get:function(){return{name:["updateIconHref"]}},enumerable:false,configurable:true});return e}();MdsIcon._svgPathKey="mdsIconSvgPath";MdsIcon.style=mdsIconCss;export{MdsIcon as mds_icon}; | ||
var __awaiter=this&&this.__awaiter||function(e,t,r,n){function o(e){return e instanceof r?e:new r((function(t){t(e)}))}return new(r||(r=Promise))((function(r,a){function i(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n["throw"](e))}catch(e){a(e)}}function c(e){e.done?r(e.value):o(e.value).then(i,s)}c((n=n.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var r={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},n,o,a,i;return i={next:s(0),throw:s(1),return:s(2)},typeof Symbol==="function"&&(i[Symbol.iterator]=function(){return this}),i;function s(e){return function(t){return c([e,t])}}function c(i){if(n)throw new TypeError("Generator is already executing.");while(r)try{if(n=1,o&&(a=i[0]&2?o["return"]:i[0]?o["throw"]||((a=o["return"])&&a.call(o),0):o.next)&&!(a=a.call(o,i[1])).done)return a;if(o=0,a)i=[i[0]&2,a.value];switch(i[0]){case 0:case 1:a=i;break;case 4:r.label++;return{value:i[1],done:false};case 5:r.label++;o=i[1];i=[0];continue;case 7:i=r.ops.pop();r.trys.pop();continue;default:if(!(a=r.trys,a=a.length>0&&a[a.length-1])&&(i[0]===6||i[0]===2)){r=0;continue}if(i[0]===3&&(!a||i[1]>a[0]&&i[1]<a[3])){r.label=i[1];break}if(i[0]===6&&r.label<a[1]){r.label=a[1];a=i;break}if(a&&r.label<a[2]){r.label=a[2];r.ops.push(i);break}if(a[2])r.ops.pop();r.trys.pop();continue}i=t.call(e,r)}catch(e){i=[6,e];o=0}finally{n=a=0}if(i[0]&5)throw i[1];return{value:i[0]?i[1]:void 0,done:true}}};import{r as registerInstance,h,g as getElement,H as Host}from"./index-ad9adcc2.js";function idbReady(){var e=!navigator.userAgentData&&/Safari\//.test(navigator.userAgent)&&!/Chrom(e|ium)\//.test(navigator.userAgent);if(!e||!indexedDB.databases)return Promise.resolve();var t;return new Promise((function(e){var r=function(){return indexedDB.databases().finally(e)};t=setInterval(r,100);r()})).finally((function(){return clearInterval(t)}))}function promisifyRequest(e){return new Promise((function(t,r){e.oncomplete=e.onsuccess=function(){return t(e.result)};e.onabort=e.onerror=function(){return r(e.error)}}))}function createStore(e,t){var r=idbReady().then((function(){var r=indexedDB.open(e);r.onupgradeneeded=function(){return r.result.createObjectStore(t)};return promisifyRequest(r)}));return function(e,n){return r.then((function(r){return n(r.transaction(t,e).objectStore(t))}))}}var defaultGetStoreFunc;function defaultGetStore(){if(!defaultGetStoreFunc){defaultGetStoreFunc=createStore("keyval-store","keyval")}return defaultGetStoreFunc}function get(e){var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:defaultGetStore();return t("readonly",(function(t){return promisifyRequest(t.get(e))}))}function set(e,t){var r=arguments.length>2&&arguments[2]!==undefined?arguments[2]:defaultGetStore();return r("readwrite",(function(r){r.put(t,e);return promisifyRequest(r.transaction)}))}function del(e){var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:defaultGetStore();return t("readwrite",(function(t){t.delete(e);return promisifyRequest(t.transaction)}))}var MdsIconSet=function(){function e(e,t,r){this.name=e;this.path=t;this._resolveIconName=r}e.prototype.resolveIconName=function(e){console.log("resolveIconName - iconName: ".concat(e," | name: ").concat(this.name," | path: ").concat(this.path));return this._resolveIconName(e,this.name,this.path)};Object.defineProperty(e.prototype,"resolver",{get:function(){return this._resolveIconName},enumerable:false,configurable:true});return e}();var IconsSetController=function(){function e(){var e=this;this._iconsSets=new Map;this.cacheExp=60*60*1e3*24;this.memoryCache={};this.isCacheAvailable=function(t){return __awaiter(e,void 0,void 0,(function(){var e,r,n;return __generator(this,(function(o){switch(o.label){case 0:o.trys.push([0,2,,3]);return[4,get("loader_".concat(t))];case 1:e=o.sent();if(!e){return[2,false]}r=JSON.parse(e);if(Date.now()<r.expiry){return[2,r.data]}del("loader_".concat(t));return[2,false];case 2:n=o.sent();console.error("isCacheAvailable error",n);return[2,false];case 3:return[2]}}))}))};this.setCache=function(t,r){return __awaiter(e,void 0,void 0,(function(){var e;return __generator(this,(function(n){switch(n.label){case 0:n.trys.push([0,2,,3]);return[4,set("loader_".concat(t),JSON.stringify({data:r,expiry:Date.now()+this.cacheExp}))];case 1:n.sent();return[3,3];case 2:e=n.sent();console.error("setCache error",e);return[3,3];case 3:return[2]}}))}))}}e.prototype.addIconSet=function(e,t,r){var n=r;var o=this._iconsSets.get(e);if(!n&&o&&typeof o.resolver==="function"){n=o.resolver}else if(n&&typeof n!=="function"){console.error("MdsIconSvg: the third input of addIconSet should be a function that parses and returns the icons's filename.");return false}else if(!n){console.error("MdsIconSvg: the set ".concat(e," needs a resolve function for the icon names."));return false}this._iconsSets.set(e,new MdsIconSet(e,t,n));return true};e.prototype.getIconSet=function(e){if(!e)return{set:null};return{set:this._iconsSets.get(e.split("/")[0])}};e.prototype.setSvgPath=function(e){this._svgPath=e};e.prototype.getSvgPath=function(){return this._svgPath};e.prototype.fetchSvg=function(e){return __awaiter(this,void 0,void 0,(function(){var t,r,n,o,a;return __generator(this,(function(i){switch(i.label){case 0:i.trys.push([0,4,,5]);return[4,this.isCacheAvailable(e)];case 1:t=i.sent();if(this.memoryCache[e]||t){return[2,this.memoryCache[e]||t]}return[4,fetch(e)];case 2:r=i.sent();if(!r.ok){throw Error("Request for '".concat(e,"' returned ").concat(r.status," (").concat(r.statusText,")"))}return[4,r.text()];case 3:n=i.sent();o=n.toLowerCase().trim();if(!(o.startsWith("<svg")||o.startsWith("<?xml"))){throw Error("Resource '".concat(e,"' returned an invalid SVG file"))}this.setCache(e,n);this.memoryCache[e]=n;return[2,n];case 4:a=i.sent();console.error("fetchSvg error",a);return[2,""];case 5:return[2]}}))}))};return e}();var IconsSetService=new IconsSetController;var mdsIconCss=".static{position:static}.fixed{position:fixed}.absolute{position:absolute}.border{border-width:1px}.fill-label-blue-05{fill:rgb(var(--label-blue-05))}.fill-label-green-06{fill:rgb(var(--label-green-06))}.shadow{--tw-shadow:0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);-webkit-box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}:host{display:-ms-inline-flexbox;display:inline-flex;aspect-ratio:1 / 1;width:1.5rem;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center}svg{aspect-ratio:1 / 1;height:100%;width:100%}";var MdsIcon=function(){function e(e){registerInstance(this,e)}e.prototype.componentWillLoad=function(){this.updateIconHref()};e.setSvgPathStatic=function(e){IconsSetService.setSvgPath(e)};e.prototype.setSvgPath=function(e){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){IconsSetService.setSvgPath(e);this.updateIconHref();return[2]}))}))};e.prototype.updateIconHref=function(){return __awaiter(this,void 0,void 0,(function(){var e,t;return __generator(this,(function(r){switch(r.label){case 0:if(!this.name)return[2,Promise.resolve()];e=IconsSetService.getSvgPath()||window.sessionStorage.getItem(MdsIcon._svgPathKey);this._iconHref=e&&!this.name.startsWith("http")?window.location.origin.concat(e.concat(this.name).concat(".svg")):this.name;return[4,IconsSetService.fetchSvg(this._iconHref)];case 1:t=r.sent();if(t!=="")this.hostElement.shadowRoot.innerHTML=t;return[2]}}))}))};e.prototype.render=function(){return h(Host,null)};Object.defineProperty(e.prototype,"hostElement",{get:function(){return getElement(this)},enumerable:false,configurable:true});Object.defineProperty(e,"watchers",{get:function(){return{name:["updateIconHref"]}},enumerable:false,configurable:true});return e}();MdsIcon._svgPathKey="mdsIconSvgPath";MdsIcon.style=mdsIconCss;export{MdsIcon as mds_icon}; |
@@ -1,1 +0,1 @@ | ||
import{p as promiseResolve,b as bootstrapLazy}from"./index-4ff36ed4.js";var patchBrowser=function(){var r=import.meta.url;var e={};if(r!==""){e.resourcesUrl=new URL(".",r).href}return promiseResolve(e)};patchBrowser().then((function(r){return bootstrapLazy([["mds-icon",[[1,"mds-icon",{name:[513],_iconHref:[32],setSvgPath:[64]}]]]],r)})); | ||
import{p as promiseResolve,b as bootstrapLazy}from"./index-ad9adcc2.js";var patchBrowser=function(){var r=import.meta.url;var e={};if(r!==""){e.resourcesUrl=new URL(".",r).href}return promiseResolve(e)};patchBrowser().then((function(r){return bootstrapLazy([["mds-icon",[[1,"mds-icon",{name:[513],_iconHref:[32],setSvgPath:[64]}]]]],r)})); |
@@ -1,5 +0,5 @@ | ||
import { p as promiseResolve, b as bootstrapLazy } from './index-4ff36ed4.js'; | ||
import { p as promiseResolve, b as bootstrapLazy } from './index-ad9adcc2.js'; | ||
/* | ||
Stencil Client Patch Esm v2.15.2 | MIT Licensed | https://stenciljs.com | ||
Stencil Client Patch Esm v2.16.1 | MIT Licensed | https://stenciljs.com | ||
*/ | ||
@@ -6,0 +6,0 @@ const patchEsm = () => { |
@@ -1,2 +0,2 @@ | ||
import { r as registerInstance, h, g as getElement, H as Host } from './index-4ff36ed4.js'; | ||
import { r as registerInstance, h, g as getElement, H as Host } from './index-ad9adcc2.js'; | ||
@@ -159,2 +159,3 @@ /** | ||
catch (e) { | ||
console.error('isCacheAvailable error', e); | ||
return false; | ||
@@ -172,3 +173,3 @@ } | ||
catch (e) { | ||
console.error(e); | ||
console.error('setCache error', e); | ||
} | ||
@@ -225,3 +226,3 @@ }; | ||
catch (e) { | ||
console.error(e); | ||
console.error('fetchSvg error', e); | ||
return ''; | ||
@@ -254,2 +255,4 @@ } | ||
async updateIconHref() { | ||
if (!this.name) | ||
return Promise.resolve(); | ||
const svgPath = IconsSetService.getSvgPath() || window.sessionStorage.getItem(MdsIcon._svgPathKey); | ||
@@ -256,0 +259,0 @@ this._iconHref = svgPath && !this.name.startsWith('http') ? window.location.origin.concat(svgPath.concat(this.name).concat('.svg')) : this.name; |
@@ -1,5 +0,5 @@ | ||
import { p as promiseResolve, b as bootstrapLazy } from './index-4ff36ed4.js'; | ||
import { p as promiseResolve, b as bootstrapLazy } from './index-ad9adcc2.js'; | ||
/* | ||
Stencil Client Patch Browser v2.15.2 | MIT Licensed | https://stenciljs.com | ||
Stencil Client Patch Browser v2.16.1 | MIT Licensed | https://stenciljs.com | ||
*/ | ||
@@ -6,0 +6,0 @@ const patchBrowser = () => { |
@@ -1,1 +0,1 @@ | ||
import{p as e,b as n}from"./p-411ebf09.js";(()=>{const n=import.meta.url,o={};return""!==n&&(o.resourcesUrl=new URL(".",n).href),e(o)})().then((e=>n([["p-de3a08ec",[[1,"mds-icon",{name:[513],_iconHref:[32],setSvgPath:[64]}]]]],e))); | ||
import{p as e,b as n}from"./p-f3276f1b.js";(()=>{const n=import.meta.url,o={};return""!==n&&(o.resourcesUrl=new URL(".",n).href),e(o)})().then((e=>n([["p-453e4497",[[1,"mds-icon",{name:[513],_iconHref:[32],setSvgPath:[64]}]]]],e))); |
{ | ||
"timestamp": "2022-05-26T10:55:59", | ||
"timestamp": "2022-06-22T13:14:29", | ||
"compiler": { | ||
"name": "node", | ||
"version": "16.13.2" | ||
"version": "18.3.0" | ||
}, | ||
@@ -58,3 +58,3 @@ "app": { | ||
"generatedFiles": [ | ||
"./dist/cjs/index-20ea01f1.js", | ||
"./dist/cjs/index-e7e249b2.js", | ||
"./dist/cjs/index.cjs.js", | ||
@@ -64,3 +64,3 @@ "./dist/cjs/loader.cjs.js", | ||
"./dist/cjs/mds-icon.cjs.js", | ||
"./dist/esm-es5/index-4ff36ed4.js", | ||
"./dist/esm-es5/index-ad9adcc2.js", | ||
"./dist/esm-es5/index.js", | ||
@@ -70,3 +70,3 @@ "./dist/esm-es5/loader.js", | ||
"./dist/esm-es5/mds-icon.js", | ||
"./dist/esm/index-4ff36ed4.js", | ||
"./dist/esm/index-ad9adcc2.js", | ||
"./dist/esm/index.js", | ||
@@ -81,17 +81,17 @@ "./dist/esm/loader.js", | ||
"./dist/mds-icon/mds-icon.js", | ||
"./dist/mds-icon/p-20fd6ed6.system.js", | ||
"./dist/mds-icon/p-411ebf09.js", | ||
"./dist/mds-icon/p-453e4497.entry.js", | ||
"./dist/mds-icon/p-50ea2036.system.js", | ||
"./dist/mds-icon/p-9b2b846e.system.js", | ||
"./dist/mds-icon/p-de3a08ec.entry.js", | ||
"./dist/mds-icon/p-fe16c3eb.system.entry.js", | ||
"./dist/mds-icon/p-c161adbc.system.js", | ||
"./dist/mds-icon/p-ea5cc092.system.entry.js", | ||
"./dist/mds-icon/p-f06ca2e9.system.js", | ||
"./dist/mds-icon/p-f3276f1b.js", | ||
"./www/build/index.esm.js", | ||
"./www/build/mds-icon.esm.js", | ||
"./www/build/mds-icon.js", | ||
"./www/build/p-20fd6ed6.system.js", | ||
"./www/build/p-411ebf09.js", | ||
"./www/build/p-453e4497.entry.js", | ||
"./www/build/p-50ea2036.system.js", | ||
"./www/build/p-9b2b846e.system.js", | ||
"./www/build/p-de3a08ec.entry.js", | ||
"./www/build/p-fe16c3eb.system.entry.js" | ||
"./www/build/p-c161adbc.system.js", | ||
"./www/build/p-ea5cc092.system.entry.js", | ||
"./www/build/p-f06ca2e9.system.js", | ||
"./www/build/p-f3276f1b.js" | ||
] | ||
@@ -129,8 +129,8 @@ }, | ||
], | ||
"bundleId": "p-de3a08ec", | ||
"fileName": "p-de3a08ec.entry.js", | ||
"bundleId": "p-453e4497", | ||
"fileName": "p-453e4497.entry.js", | ||
"imports": [ | ||
"p-411ebf09.js" | ||
"p-f3276f1b.js" | ||
], | ||
"originalByteSize": 9279 | ||
"originalByteSize": 9419 | ||
} | ||
@@ -147,5 +147,5 @@ ], | ||
"imports": [ | ||
"index-4ff36ed4.js" | ||
"index-ad9adcc2.js" | ||
], | ||
"originalByteSize": 9283 | ||
"originalByteSize": 9423 | ||
} | ||
@@ -162,5 +162,5 @@ ], | ||
"imports": [ | ||
"index-4ff36ed4.js" | ||
"index-ad9adcc2.js" | ||
], | ||
"originalByteSize": 9283 | ||
"originalByteSize": 9423 | ||
} | ||
@@ -174,8 +174,8 @@ ], | ||
], | ||
"bundleId": "p-fe16c3eb.system", | ||
"fileName": "p-fe16c3eb.system.entry.js", | ||
"bundleId": "p-ea5cc092.system", | ||
"fileName": "p-ea5cc092.system.entry.js", | ||
"imports": [ | ||
"p-20fd6ed6.system.js" | ||
"p-c161adbc.system.js" | ||
], | ||
"originalByteSize": 12496 | ||
"originalByteSize": 12672 | ||
} | ||
@@ -192,5 +192,5 @@ ], | ||
"imports": [ | ||
"index-20ea01f1.js" | ||
"index-e7e249b2.js" | ||
], | ||
"originalByteSize": 9336 | ||
"originalByteSize": 9476 | ||
} | ||
@@ -457,3 +457,3 @@ ] | ||
"sc-mds-icon": [ | ||
"p-411ebf09.js" | ||
"p-f3276f1b.js" | ||
] | ||
@@ -460,0 +460,0 @@ }, |
@@ -19,1 +19,2 @@ declare const _default: { | ||
export declare const ExternalSVG: any; | ||
export declare const NoIcon: any; |
@@ -6,2 +6,3 @@ declare const typographyDictionary: string[]; | ||
declare const typographySmallerDictionary: string[]; | ||
export { typographyDictionary, typographyMonoDictionary, typographyPrimaryDictionary, typographySecondaryDictionary, typographySmallerDictionary, }; | ||
declare const typographyTooltipDictionary: string[]; | ||
export { typographyDictionary, typographyMonoDictionary, typographyPrimaryDictionary, typographySecondaryDictionary, typographySmallerDictionary, typographyTooltipDictionary, }; |
@@ -6,1 +6,2 @@ export declare type TypographyType = 'action' | 'caption' | 'code' | 'detail' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'hack' | 'label' | 'option' | 'paragraph' | 'tip'; | ||
export declare type TypographyMonoType = 'code' | 'hack'; | ||
export declare type TypographyTooltipType = 'caption' | 'detail' | 'tip'; |
{ | ||
"name": "@maggioli-design-system/mds-icon", | ||
"version": "2.0.2", | ||
"version": "2.0.3", | ||
"description": "mds-icon is a web-component from Maggioli Design System Magma, built with StencilJS, TypeScript, Storybook. It's based on the web-component standard and it's designed to be agnostic from the JavaScirpt framework you are using.", | ||
@@ -25,3 +25,3 @@ "main": "dist/index.cjs.js", | ||
"dependencies": { | ||
"@stencil/core": "^2.15.2", | ||
"@stencil/core": "^2.16.1", | ||
"idb-keyval": "6.1.0" | ||
@@ -28,0 +28,0 @@ }, |
@@ -77,2 +77,5 @@ # mds-icon | ||
## Dependencies | ||
@@ -79,0 +82,0 @@ |
@@ -61,2 +61,3 @@ import { get, set, del } from 'idb-keyval' | ||
} catch (e) { | ||
console.error('isCacheAvailable error', e) | ||
return false | ||
@@ -75,3 +76,3 @@ } | ||
} catch (e) { | ||
console.error(e) | ||
console.error('setCache error', e) | ||
} | ||
@@ -92,2 +93,3 @@ } | ||
} | ||
const body = await response.text() | ||
@@ -106,3 +108,3 @@ const bodyLower = body.toLowerCase().trim() | ||
} catch (e) { | ||
console.error(e) | ||
console.error('fetchSvg error', e) | ||
return '' | ||
@@ -109,0 +111,0 @@ } |
@@ -1,12 +0,72 @@ | ||
import { newE2EPage } from '@stencil/core/testing' | ||
const mdiAlien = '<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="mdi-alien" width="24" height="24" viewBox="0 0 24 24"><path d="M12,3C16.97,3 21,6.58 21,11C21,15.42 15,21 12,21C9,21 3,15.42 3,11C3,6.58 7.03,3 12,3M10.31,10.93C9.29,9.29 7.47,8.58 6.25,9.34C5.03,10.1 4.87,12.05 5.89,13.69C6.92,15.33 8.74,16.04 9.96,15.28C11.18,14.5 11.33,12.57 10.31,10.93M13.69,10.93C12.67,12.57 12.82,14.5 14.04,15.28C15.26,16.04 17.08,15.33 18.11,13.69C19.13,12.05 18.97,10.1 17.75,9.34C16.53,8.58 14.71,9.29 13.69,10.93M12,17.75C10,17.75 9.5,17 9.5,17C9.5,17.03 10,19 12,19C14,19 14.5,17 14.5,17C14.5,17 14,17.75 12,17.75Z" /></svg>' | ||
const fooBarIcon = 'foo/bar' | ||
jest.mock('idb-keyval', () => { | ||
return { | ||
get: () => Promise.resolve(''), | ||
set: () => Promise.resolve(), | ||
del: () => Promise.resolve(), | ||
} | ||
}) | ||
jest.spyOn(global, 'fetch').mockImplementation((src: string) => { | ||
if (!src.includes(fooBarIcon)){ | ||
return Promise.resolve({ | ||
ok: true, | ||
text: () => Promise.resolve(mdiAlien), | ||
} as Response) | ||
} | ||
return Promise.resolve({ | ||
ok: false, | ||
status: 404, | ||
statusText: 'mocked status text', | ||
} as Response) | ||
}) | ||
import { newSpecPage, SpecPage } from '@stencil/core/testing' | ||
import { MdsIcon } from '../mds-icon' | ||
describe('mds-icon', () => { | ||
it('renders', async () => { | ||
const page = await newE2EPage() | ||
let page: SpecPage | ||
beforeEach(async () => { | ||
page = await newSpecPage({ | ||
components: [MdsIcon], | ||
}) | ||
await page.setContent('<mds-icon></mds-icon>') | ||
await page.waitForChanges() | ||
// const element = await page.find('mds-icon') | ||
// expect(element).toHaveClass('hydrated') | ||
expect(true).toBe(true) | ||
const element: HTMLMdsIconElement = page.body.querySelector('mds-icon') | ||
element.setSvgPath('assets/svg/') | ||
await page.waitForChanges() | ||
}) | ||
it('renders', async () => { | ||
const element = page.body.querySelector('mds-icon') | ||
expect(element).not.toBeNull() | ||
}) | ||
it('renders mdi/alien', async () => { | ||
await page.setContent('<mds-icon name="mdi/alien"></mds-icon>') | ||
await page.waitForChanges() | ||
const mdsicon = page.body.querySelector('mds-icon') | ||
expect(mdsicon).not.toBeNull() | ||
const svg = mdsicon.shadowRoot.querySelector('svg') | ||
expect(svg).not.toBeNull() | ||
}) | ||
it('shouldn\'t render unknown icon', async () => { | ||
await page.setContent(`<mds-icon name="${fooBarIcon}"></mds-icon>`) | ||
await page.waitForChanges() | ||
const mdsicon = page.body.querySelector('mds-icon') | ||
expect(mdsicon).not.toBeNull() | ||
const svg = mdsicon.shadowRoot.querySelector('svg') | ||
expect(svg).toBeNull() | ||
}) | ||
}) |
@@ -48,2 +48,8 @@ const typographyDictionary = [ | ||
const typographyTooltipDictionary = [ | ||
'caption', | ||
'detail', | ||
'tip', | ||
] | ||
export { | ||
@@ -55,2 +61,3 @@ typographyDictionary, | ||
typographySmallerDictionary, | ||
typographyTooltipDictionary, | ||
} |
@@ -42,1 +42,6 @@ export type TypographyType = | ||
| 'hack' | ||
export type TypographyTooltipType = | ||
| 'caption' | ||
| 'detail' | ||
| 'tip' |
@@ -1,1 +0,1 @@ | ||
import{p as e,b as n}from"./p-411ebf09.js";(()=>{const n=import.meta.url,o={};return""!==n&&(o.resourcesUrl=new URL(".",n).href),e(o)})().then((e=>n([["p-de3a08ec",[[1,"mds-icon",{name:[513],_iconHref:[32],setSvgPath:[64]}]]]],e))); | ||
import{p as e,b as n}from"./p-f3276f1b.js";(()=>{const n=import.meta.url,o={};return""!==n&&(o.resourcesUrl=new URL(".",n).href),e(o)})().then((e=>n([["p-453e4497",[[1,"mds-icon",{name:[513],_iconHref:[32],setSvgPath:[64]}]]]],e))); |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
712905
8892
118
Updated@stencil/core@^2.16.1