@charlietango/ddb-widget
Advanced tools
Comparing version 0.0.15 to 0.0.16
@@ -6,4 +6,2 @@ export class DdbWidget { | ||
this.isOpen = !this.isOpen; | ||
// prevents scrolling underneath, when overlay is open | ||
// todo: should not do this when not mobile | ||
document.getElementsByTagName('html')[0].style.overflow = this.isOpen ? 'hidden' : 'auto'; | ||
@@ -26,4 +24,2 @@ }; | ||
componentWillLoad() { | ||
// DEV MOCK API | ||
// const api = 'https://9a0b1d09-43bd-4740-b533-4c678f95d94b.mock.pstmn.io/ddb/list' | ||
const api = 'https://ddb-be.s1.umbraco.io/api/ddb/list'; | ||
@@ -30,0 +26,0 @@ return this.fetchWidgetData(api); |
@@ -27,3 +27,2 @@ export class WidgetLauncher { | ||
} | ||
// todo: uses crappy mock logo .png | ||
render() { | ||
@@ -30,0 +29,0 @@ return (h("div", { class: `container |
/*! | ||
* Built with http://stenciljs.com | ||
* 2018-09-08T12:05:45 | ||
* 2018-09-08T12:11:22 | ||
*/ | ||
(function(win, doc, namespace, fsNamespace, resourcesUrl, appCore, appCoreSsr, appCorePolyfilled, hydratedCssClass, components) { | ||
function init(win, doc, namespace, fsNamespace, resourcesUrl, appCore, appCorePolyfilled, hydratedCssClass, components, HTMLElementPrototype, App, x, y, scriptElm) { | ||
// create global namespace if it doesn't already exist | ||
App = win[namespace] = win[namespace] || {}; | ||
App.components = components; | ||
y = components.map(function (c) { return c[0]; }); | ||
if (y.length) { | ||
// auto hide components until they been fully hydrated | ||
// reusing the "x" and "i" variables from the args for funzies | ||
x = doc.createElement('style'); | ||
x.innerHTML = y.join() + '{visibility:hidden}.' + hydratedCssClass + '{visibility:inherit}'; | ||
x.setAttribute('data-styles', ''); | ||
y = doc.head.querySelector('meta[charset]'); | ||
doc.head.insertBefore(x, y ? y.nextSibling : doc.head.firstChild); | ||
} | ||
createComponentOnReadyPrototype(win, namespace, HTMLElementPrototype); | ||
resourcesUrl = resourcesUrl || App.resourcesUrl; | ||
// figure out the script element for this current script | ||
y = doc.querySelectorAll('script'); | ||
for (x = y.length - 1; x >= 0; x--) { | ||
scriptElm = y[x]; | ||
if (scriptElm.src || scriptElm.hasAttribute('data-resources-url')) { | ||
break; | ||
} | ||
} | ||
// get the resource path attribute on this script element | ||
y = scriptElm.getAttribute('data-resources-url'); | ||
if (!resourcesUrl && y) { | ||
// the script element has a data-resources-url attribute, always use that | ||
resourcesUrl = y; | ||
} | ||
if (!resourcesUrl && scriptElm.src) { | ||
// we don't have an exact resourcesUrl, so let's | ||
// figure it out relative to this script's src and app's filesystem namespace | ||
y = scriptElm.src.split('/').slice(0, -1); | ||
resourcesUrl = (y.join('/')) + (y.length ? '/' : '') + fsNamespace + '/'; | ||
} | ||
// request the core this browser needs | ||
// test for native support of custom elements and fetch | ||
// if either of those are not supported, then use the core w/ polyfills | ||
// also check if the page was build with ssr or not | ||
x = doc.createElement('script'); | ||
if (usePolyfills(win, win.location, x, 'import("")')) { | ||
// requires the es5/polyfilled core | ||
x.src = resourcesUrl + appCorePolyfilled; | ||
} | ||
else { | ||
// let's do this! | ||
x.src = resourcesUrl + appCore; | ||
x.setAttribute('type', 'module'); | ||
x.setAttribute('crossorigin', true); | ||
} | ||
x.setAttribute('data-resources-url', resourcesUrl); | ||
x.setAttribute('data-namespace', fsNamespace); | ||
doc.head.appendChild(x); | ||
} | ||
function usePolyfills(win, location, scriptElm, dynamicImportTest) { | ||
// fyi, dev mode has verbose if/return statements | ||
// but it minifies to a nice 'lil one-liner ;) | ||
if (location.search.indexOf('core=esm') > 0) { | ||
// force esm build | ||
return false; | ||
} | ||
if ((location.search.indexOf('core=es5') > 0) || | ||
(location.protocol === 'file:') || | ||
(!(win.customElements && win.customElements.define)) || | ||
(!win.fetch) || | ||
(!(win.CSS && win.CSS.supports && win.CSS.supports('color', 'var(--c)'))) || | ||
(!('noModule' in scriptElm))) { | ||
// es5 build w/ polyfills | ||
return true; | ||
} | ||
// final test to see if this browser support dynamic imports | ||
return doesNotSupportsDynamicImports(dynamicImportTest); | ||
} | ||
function doesNotSupportsDynamicImports(dynamicImportTest) { | ||
try { | ||
new Function(dynamicImportTest); | ||
return false; | ||
} | ||
catch (e) { } | ||
return true; | ||
} | ||
function createComponentOnReadyPrototype(win, namespace, HTMLElementPrototype) { | ||
(win['s-apps'] = win['s-apps'] || []).push(namespace); | ||
if (!HTMLElementPrototype.componentOnReady) { | ||
HTMLElementPrototype.componentOnReady = function componentOnReady() { | ||
/*tslint:disable*/ | ||
var elm = this; | ||
function executor(resolve) { | ||
if (elm.nodeName.indexOf('-') > 0) { | ||
// window hasn't loaded yet and there's a | ||
// good chance this is a custom element | ||
var apps = win['s-apps']; | ||
var appsReady = 0; | ||
// loop through all the app namespaces | ||
for (var i = 0; i < apps.length; i++) { | ||
// see if this app has "componentOnReady" setup | ||
if (win[apps[i]].componentOnReady) { | ||
// this app's core has loaded call its "componentOnReady" | ||
if (win[apps[i]].componentOnReady(elm, resolve)) { | ||
// this component does belong to this app and would | ||
// have fired off the resolve fn | ||
// let's stop here, we're good | ||
return; | ||
} | ||
appsReady++; | ||
} | ||
} | ||
if (appsReady < apps.length) { | ||
// not all apps are ready yet | ||
// add it to the queue to be figured out when they are | ||
(win['s-cr'] = win['s-cr'] || []).push([elm, resolve]); | ||
return; | ||
} | ||
} | ||
// not a recognized app component | ||
resolve(null); | ||
} | ||
// callback wasn't provided, let's return a promise | ||
if (win.Promise) { | ||
// use native/polyfilled promise | ||
return new win.Promise(executor); | ||
} | ||
// promise may not have been polyfilled yet | ||
return { then: executor }; | ||
}; | ||
} | ||
} | ||
init(win, doc, namespace, fsNamespace, resourcesUrl, appCore, appCoreSsr, appCorePolyfilled, hydratedCssClass, components); | ||
})(window, document, "DdbWidget","ddb-widget",0,"ddb-widget.core.js","es5-build-disabled.js","hydrated",[["ddb-widget","ddb-widget",1,[["isOpen",16],["widgetData",16]],1],["link-list","ddb-widget",1,[["color",1,0,1,2],["links",1]],1],["widget-launcher","ddb-widget",1,[["color",1,0,1,2],["isExpanded",16],["isOpen",1,0,"is-open",4],["isReady",16],["logo",1]],1],["widget-window","ddb-widget",1,[["logo",1],["onCloseClick",1]],1]],HTMLElement.prototype); | ||
!function(e,t,n,i,r,s,o,d,c,l,a,u,p,m){for((a=e.DdbWidget=e.DdbWidget||{}).components=c,(p=c.map(function(e){return e[0]})).length&&((u=t.createElement("style")).innerHTML=p.join()+"{visibility:hidden}.hydrated{visibility:inherit}",u.setAttribute("data-styles",""),p=t.head.querySelector("meta[charset]"),t.head.insertBefore(u,p?p.nextSibling:t.head.firstChild)),function(e,t,n){(e["s-apps"]=e["s-apps"]||[]).push("DdbWidget"),n.componentOnReady||(n.componentOnReady=function(){var t=this;function n(n){if(t.nodeName.indexOf("-")>0){for(var i=e["s-apps"],r=0,s=0;s<i.length;s++)if(e[i[s]].componentOnReady){if(e[i[s]].componentOnReady(t,n))return;r++}if(r<i.length)return void(e["s-cr"]=e["s-cr"]||[]).push([t,n])}n(null)}return e.Promise?new e.Promise(n):{then:n}})}(e,0,l),r=r||a.resourcesUrl,u=(p=t.querySelectorAll("script")).length-1;u>=0&&!(m=p[u]).src&&!m.hasAttribute("data-resources-url");u--);p=m.getAttribute("data-resources-url"),!r&&p&&(r=p),!r&&m.src&&(r=(p=m.src.split("/").slice(0,-1)).join("/")+(p.length?"/":"")+"ddb-widget/"),u=t.createElement("script"),function(e,t,n,i){return!(t.search.indexOf("core=esm")>0)&&(!(!(t.search.indexOf("core=es5")>0||"file:"===t.protocol)&&e.customElements&&e.customElements.define&&e.fetch&&e.CSS&&e.CSS.supports&&e.CSS.supports("color","var(--c)")&&"noModule"in n)||function(e){try{return new Function('import("")'),!1}catch(e){}return!0}())}(e,e.location,u)?u.src=r+"ddb-widget.twb6lpzt.js":(u.src=r+"ddb-widget.biglrsa8.js",u.setAttribute("type","module"),u.setAttribute("crossorigin",!0)),u.setAttribute("data-resources-url",r),u.setAttribute("data-namespace","ddb-widget"),t.head.appendChild(u)}(window,document,0,0,0,0,0,0,[["ddb-widget","exlmwtb9",1,[["isOpen",16],["widgetData",16]],1],["link-list","exlmwtb9",1,[["color",1,0,1,2],["links",1]],1],["widget-launcher","exlmwtb9",1,[["color",1,0,1,2],["isExpanded",16],["isOpen",1,0,"is-open",4],["isReady",16],["logo",1]],1],["widget-window","exlmwtb9",1,[["logo",1],["onCloseClick",1]],1]],HTMLElement.prototype); |
{ | ||
"name": "@charlietango/ddb-widget", | ||
"version": "0.0.15", | ||
"version": "0.0.16", | ||
"description": "Web Component built with Stencil by Charlie Tango", | ||
@@ -5,0 +5,0 @@ "module": "dist/esm/index.js", |
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
464862
56
4917
21
10