@charlietango/ddb-widget
Advanced tools
Comparing version 0.0.9 to 0.0.10
@@ -16,4 +16,3 @@ export class DdbWidget { | ||
componentWillLoad() { | ||
const api = 'https://dd2b2b01-1fe6-4f62-abf8-f012c7ba25bc.mock.pstmn.io/get/data'; | ||
// const api = 'https://ddb-be.s1.umbraco.io/api/ddb/list' | ||
const api = 'https://ddb-be.s1.umbraco.io/api/ddb/list'; | ||
return this.fetchWidgetData(api); | ||
@@ -20,0 +19,0 @@ } |
@@ -5,3 +5,3 @@ export class LinkList { | ||
return (h("li", { key: item.href, class: 'list-item' }, | ||
h("a", { class: 'link-item', href: item.href, target: item.target }, | ||
h("a", { class: 'link-item', href: item.href, target: item.target || '_blank', rel: 'noopener noreferrer' }, | ||
h("div", { class: 'top-container' }, | ||
@@ -20,3 +20,2 @@ h("img", { src: item.icon, alt: item.icon }), | ||
render() { | ||
// MOCK AREA | ||
const newLinks = [...this.links, ...this.links]; | ||
@@ -33,3 +32,2 @@ newLinks[0].icon = 'https://image.ibb.co/iZebEK/Screenshot_2018_10_06_at_19_33_20.png'; | ||
newLinks[4].label = 'læs anmeldelser og find din næste læseoplevelse'; | ||
// MOCK AREA END | ||
return (h("ul", { class: 'list' }, newLinks.map(this.renderListItem))); | ||
@@ -36,0 +34,0 @@ } |
@@ -27,3 +27,2 @@ export class WidgetLauncher { | ||
} | ||
// todo: uses crappy mock logo .png | ||
render() { | ||
@@ -30,0 +29,0 @@ return (h("div", { class: `container |
@@ -10,3 +10,2 @@ export class WidgetWindow { | ||
return null; | ||
// MOCK | ||
const mockLogo = 'https://image.ibb.co/kYAiRz/logo.png'; | ||
@@ -13,0 +12,0 @@ return (h("div", { class: 'container', onClick: this.handleWidgetWindowClick }, |
/*! | ||
* Built with http://stenciljs.com | ||
* 2018-09-06T18:21:17 | ||
* 2018-09-06T19:16:04 | ||
*/ | ||
(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,[["isOpen",1,0,"is-open",4],["logo",1]],1]],HTMLElement.prototype); | ||
!function(e,t,r,n,i,s,o,d,c,a,l,u,p,h){for((l=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,r){(e["s-apps"]=e["s-apps"]||[]).push("DdbWidget"),r.componentOnReady||(r.componentOnReady=function(){var t=this;function r(r){if(t.nodeName.indexOf("-")>0){for(var n=e["s-apps"],i=0,s=0;s<n.length;s++)if(e[n[s]].componentOnReady){if(e[n[s]].componentOnReady(t,r))return;i++}if(i<n.length)return void(e["s-cr"]=e["s-cr"]||[]).push([t,r])}r(null)}return e.Promise?new e.Promise(r):{then:r}})}(e,0,a),i=i||l.resourcesUrl,u=(p=t.querySelectorAll("script")).length-1;u>=0&&!(h=p[u]).src&&!h.hasAttribute("data-resources-url");u--);p=h.getAttribute("data-resources-url"),!i&&p&&(i=p),!i&&h.src&&(i=(p=h.src.split("/").slice(0,-1)).join("/")+(p.length?"/":"")+"ddb-widget/"),u=t.createElement("script"),function(e,t,r,n){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 r)||function(e){try{return new Function('import("")'),!1}catch(e){}return!0}())}(e,e.location,u)?u.src=i+"ddb-widget.twb6lpzt.js":(u.src=i+"ddb-widget.biglrsa8.js",u.setAttribute("type","module"),u.setAttribute("crossorigin",!0)),u.setAttribute("data-resources-url",i),u.setAttribute("data-namespace","ddb-widget"),t.head.appendChild(u)}(window,document,0,0,0,0,0,0,[["ddb-widget","ars1ere6",1,[["isOpen",16],["widgetData",16]],1],["link-list","ars1ere6",1,[["color",1,0,1,2],["links",1]],1],["widget-launcher","ars1ere6",1,[["color",1,0,1,2],["isExpanded",16],["isOpen",1,0,"is-open",4],["isReady",16],["logo",1]],1],["widget-window","ars1ere6",1,[["isOpen",1,0,"is-open",4],["logo",1]],1]],HTMLElement.prototype); |
{ | ||
"name": "@charlietango/ddb-widget", | ||
"version": "0.0.9", | ||
"version": "0.0.10", | ||
"description": "Web Component built with Stencil by Charlie Tango", | ||
@@ -5,0 +5,0 @@ "module": "dist/esm/index.js", |
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 not supported yet
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
448662
56
4847
17
10