@miyaoka/miyaoka-components
Advanced tools
Comparing version 0.3.1 to 0.3.2
@@ -135,3 +135,3 @@ 'use strict'; | ||
const host = location.host; | ||
const linkList = Array.from(document.querySelectorAll('a')); | ||
const linkList = Array.from(document.querySelectorAll('a[data-prefetch]')); | ||
const hrefMap = {}; | ||
@@ -138,0 +138,0 @@ const sameHostLinks = linkList.filter(({ href }) => { |
@@ -5,3 +5,3 @@ import { Component } from '@stencil/core'; | ||
const host = location.host; | ||
const linkList = Array.from(document.querySelectorAll('a')); | ||
const linkList = Array.from(document.querySelectorAll('a[data-prefetch]')); | ||
const hrefMap = {}; | ||
@@ -8,0 +8,0 @@ const sameHostLinks = linkList.filter(({ href }) => { |
@@ -1,1 +0,1 @@ | ||
var __awaiter=this&&this.__awaiter||function(t,e,r,i){function n(t){return t instanceof r?t:new r((function(e){e(t)}))}return new(r||(r=Promise))((function(r,o){function a(t){try{c(i.next(t))}catch(e){o(e)}}function s(t){try{c(i["throw"](t))}catch(e){o(e)}}function c(t){t.done?r(t.value):n(t.value).then(a,s)}c((i=i.apply(t,e||[])).next())}))};var __generator=this&&this.__generator||function(t,e){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},i,n,o,a;return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(t){return function(e){return c([t,e])}}function c(a){if(i)throw new TypeError("Generator is already executing.");while(r)try{if(i=1,n&&(o=a[0]&2?n["return"]:a[0]?n["throw"]||((o=n["return"])&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;if(n=0,o)a=[a[0]&2,o.value];switch(a[0]){case 0:case 1:o=a;break;case 4:r.label++;return{value:a[1],done:false};case 5:r.label++;n=a[1];a=[0];continue;case 7:a=r.ops.pop();r.trys.pop();continue;default:if(!(o=r.trys,o=o.length>0&&o[o.length-1])&&(a[0]===6||a[0]===2)){r=0;continue}if(a[0]===3&&(!o||a[1]>o[0]&&a[1]<o[3])){r.label=a[1];break}if(a[0]===6&&r.label<o[1]){r.label=o[1];o=a;break}if(o&&r.label<o[2]){r.label=o[2];r.ops.push(a);break}if(o[2])r.ops.pop();r.trys.pop();continue}a=e.call(t,r)}catch(s){a=[6,s];n=0}finally{i=o=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};import{r as registerInstance,h,H as Host,g as getElement}from"./index-a4c6996c.js";function loadScript(t){var e=t.src,r=t.id;var i=r?document.getElementById(r):null;return new Promise((function(t,n){if(i){t()}var o=document.createElement("script");o.setAttribute("src",e);document.head.appendChild(o);o.onload=function(){if(r)o.setAttribute("id",r);t()};o.onerror=function(t){return n(t)}}))}var miyaokaEmbedTweetCss=":host{display:block}";var twReg=new RegExp("https://twitter.com/[^/]+/status/(\\d+)");var twWidgetSrc="https://platform.twitter.com/widgets.js";var MiyaokaEmbedTweet=function(){function t(t){registerInstance(this,t);this.src=""}t.prototype.connectedCallback=function(){var t=this;var e=this.src.match(twReg);if(!e)return;var r=e[1];var i=new IntersectionObserver((function(e){e.forEach((function(e){if(!e.isIntersecting)return;i.unobserve(t.el);t.embedTweet(r)}))}),{rootMargin:"200%"});i.observe(this.el)};t.prototype.embedTweet=function(t){return __awaiter(this,void 0,void 0,(function(){var e,r,i,n;return __generator(this,(function(o){switch(o.label){case 0:n=window;if(!!((e=n.twttr)===null||e===void 0?void 0:e.ready))return[3,2];return[4,loadScript({src:twWidgetSrc,id:"twitter-widgets"})];case 1:o.sent();o.label=2;case 2:return[4,(i=(r=n.twttr)===null||r===void 0?void 0:r.widgets)===null||i===void 0?void 0:i.createTweet(t,this.el,{align:"center"})];case 3:o.sent();this.el.children[0].remove();this.el.classList.add("embedTweetLoaded");return[2]}}))}))};t.prototype.render=function(){return h(Host,null,h("p",null,h("a",{href:this.src,target:"_blank",rel:"noopener noreferrer"},this.src)))};Object.defineProperty(t.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});return t}();MiyaokaEmbedTweet.style=miyaokaEmbedTweetCss;var miyaokaImgLoaderCss=":host{width:100%;height:100%;overflow:hidden}img{width:100%;height:100%}";var MiyaokaImgLoader=function(){function t(t){registerInstance(this,t);this.alt="image";this.loading="lazy";this.scale=.5;this.rotate=90;this.opacity=0;this.duration=200;this.delay=50;this.isLoaded=false}t.prototype.componentDidLoad=function(){var t=this;if(!this.img)return;if(this.img.complete){requestAnimationFrame((function(){return t.resetTransform()}));return}this.img.onload=function(){t.resetTransform()}};t.prototype.resetTransform=function(){this.isLoaded=true};t.prototype.render=function(){var t=this;var e=this.isLoaded?{}:{transform:"scale("+this.scale+") rotate("+this.rotate+"deg)",opacity:""+this.opacity};return h(Host,null,h("img",{ref:function(e){t.img=e},src:this.src,alt:this.alt,loading:this.loading,style:Object.assign(Object.assign({},e),{transitionDuration:this.duration+"ms",transitionDelay:this.delay+"ms"})}))};return t}();MiyaokaImgLoader.style=miyaokaImgLoaderCss;var miyaokaLightboxCss=":host{display:block}.container{cursor:pointer;display:inline}.backdrop{position:fixed;top:0;right:0;left:0;bottom:0;z-index:100;background-color:rgba(64, 62, 62, 0.9)}.backdrop img{width:100%;height:100%;-o-object-fit:contain;object-fit:contain}";var MiyaokaLightbox=function(){function t(t){registerInstance(this,t);this.visible=false}t.prototype.render=function(){var t=this;return h(Host,null,h("div",{onClick:function(){return t.visible=true},class:"container"},this.visible&&h("div",{onClick:function(e){e.stopPropagation();t.visible=false},class:"backdrop"},h("img",{src:this.src})),h("slot",null)))};return t}();MiyaokaLightbox.style=miyaokaLightboxCss;var MiyaokaPrefetch=function(){function t(t){registerInstance(this,t)}t.prototype.componentDidLoad=function(){var t=this;var e=location.host;var r=Array.from(document.querySelectorAll("a"));var i={};var n=r.filter((function(t){var r=t.href;var n=new URL(r);if(n.host!==e||i[r])return false;i[r]=true;return true}));n.forEach((function(e){var r=new IntersectionObserver((function(i){i.forEach((function(i){if(!i.isIntersecting)return;r.unobserve(e);t.addPrefetch(e.href)}))}));r.observe(e)}))};t.prototype.addPrefetch=function(t){var e=document.createElement("link");e.rel="prefetch";e.href=t;document.head.appendChild(e)};return t}();export{MiyaokaEmbedTweet as miyaoka_embed_tweet,MiyaokaImgLoader as miyaoka_img_loader,MiyaokaLightbox as miyaoka_lightbox,MiyaokaPrefetch as miyaoka_prefetch}; | ||
var __awaiter=this&&this.__awaiter||function(t,e,r,i){function n(t){return t instanceof r?t:new r((function(e){e(t)}))}return new(r||(r=Promise))((function(r,o){function a(t){try{c(i.next(t))}catch(e){o(e)}}function s(t){try{c(i["throw"](t))}catch(e){o(e)}}function c(t){t.done?r(t.value):n(t.value).then(a,s)}c((i=i.apply(t,e||[])).next())}))};var __generator=this&&this.__generator||function(t,e){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},i,n,o,a;return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(t){return function(e){return c([t,e])}}function c(a){if(i)throw new TypeError("Generator is already executing.");while(r)try{if(i=1,n&&(o=a[0]&2?n["return"]:a[0]?n["throw"]||((o=n["return"])&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;if(n=0,o)a=[a[0]&2,o.value];switch(a[0]){case 0:case 1:o=a;break;case 4:r.label++;return{value:a[1],done:false};case 5:r.label++;n=a[1];a=[0];continue;case 7:a=r.ops.pop();r.trys.pop();continue;default:if(!(o=r.trys,o=o.length>0&&o[o.length-1])&&(a[0]===6||a[0]===2)){r=0;continue}if(a[0]===3&&(!o||a[1]>o[0]&&a[1]<o[3])){r.label=a[1];break}if(a[0]===6&&r.label<o[1]){r.label=o[1];o=a;break}if(o&&r.label<o[2]){r.label=o[2];r.ops.push(a);break}if(o[2])r.ops.pop();r.trys.pop();continue}a=e.call(t,r)}catch(s){a=[6,s];n=0}finally{i=o=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};import{r as registerInstance,h,H as Host,g as getElement}from"./index-a4c6996c.js";function loadScript(t){var e=t.src,r=t.id;var i=r?document.getElementById(r):null;return new Promise((function(t,n){if(i){t()}var o=document.createElement("script");o.setAttribute("src",e);document.head.appendChild(o);o.onload=function(){if(r)o.setAttribute("id",r);t()};o.onerror=function(t){return n(t)}}))}var miyaokaEmbedTweetCss=":host{display:block}";var twReg=new RegExp("https://twitter.com/[^/]+/status/(\\d+)");var twWidgetSrc="https://platform.twitter.com/widgets.js";var MiyaokaEmbedTweet=function(){function t(t){registerInstance(this,t);this.src=""}t.prototype.connectedCallback=function(){var t=this;var e=this.src.match(twReg);if(!e)return;var r=e[1];var i=new IntersectionObserver((function(e){e.forEach((function(e){if(!e.isIntersecting)return;i.unobserve(t.el);t.embedTweet(r)}))}),{rootMargin:"200%"});i.observe(this.el)};t.prototype.embedTweet=function(t){return __awaiter(this,void 0,void 0,(function(){var e,r,i,n;return __generator(this,(function(o){switch(o.label){case 0:n=window;if(!!((e=n.twttr)===null||e===void 0?void 0:e.ready))return[3,2];return[4,loadScript({src:twWidgetSrc,id:"twitter-widgets"})];case 1:o.sent();o.label=2;case 2:return[4,(i=(r=n.twttr)===null||r===void 0?void 0:r.widgets)===null||i===void 0?void 0:i.createTweet(t,this.el,{align:"center"})];case 3:o.sent();this.el.children[0].remove();this.el.classList.add("embedTweetLoaded");return[2]}}))}))};t.prototype.render=function(){return h(Host,null,h("p",null,h("a",{href:this.src,target:"_blank",rel:"noopener noreferrer"},this.src)))};Object.defineProperty(t.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});return t}();MiyaokaEmbedTweet.style=miyaokaEmbedTweetCss;var miyaokaImgLoaderCss=":host{width:100%;height:100%;overflow:hidden}img{width:100%;height:100%}";var MiyaokaImgLoader=function(){function t(t){registerInstance(this,t);this.alt="image";this.loading="lazy";this.scale=.5;this.rotate=90;this.opacity=0;this.duration=200;this.delay=50;this.isLoaded=false}t.prototype.componentDidLoad=function(){var t=this;if(!this.img)return;if(this.img.complete){requestAnimationFrame((function(){return t.resetTransform()}));return}this.img.onload=function(){t.resetTransform()}};t.prototype.resetTransform=function(){this.isLoaded=true};t.prototype.render=function(){var t=this;var e=this.isLoaded?{}:{transform:"scale("+this.scale+") rotate("+this.rotate+"deg)",opacity:""+this.opacity};return h(Host,null,h("img",{ref:function(e){t.img=e},src:this.src,alt:this.alt,loading:this.loading,style:Object.assign(Object.assign({},e),{transitionDuration:this.duration+"ms",transitionDelay:this.delay+"ms"})}))};return t}();MiyaokaImgLoader.style=miyaokaImgLoaderCss;var miyaokaLightboxCss=":host{display:block}.container{cursor:pointer;display:inline}.backdrop{position:fixed;top:0;right:0;left:0;bottom:0;z-index:100;background-color:rgba(64, 62, 62, 0.9)}.backdrop img{width:100%;height:100%;-o-object-fit:contain;object-fit:contain}";var MiyaokaLightbox=function(){function t(t){registerInstance(this,t);this.visible=false}t.prototype.render=function(){var t=this;return h(Host,null,h("div",{onClick:function(){return t.visible=true},class:"container"},this.visible&&h("div",{onClick:function(e){e.stopPropagation();t.visible=false},class:"backdrop"},h("img",{src:this.src})),h("slot",null)))};return t}();MiyaokaLightbox.style=miyaokaLightboxCss;var MiyaokaPrefetch=function(){function t(t){registerInstance(this,t)}t.prototype.componentDidLoad=function(){var t=this;var e=location.host;var r=Array.from(document.querySelectorAll("a[data-prefetch]"));var i={};var n=r.filter((function(t){var r=t.href;var n=new URL(r);if(n.host!==e||i[r])return false;i[r]=true;return true}));n.forEach((function(e){var r=new IntersectionObserver((function(i){i.forEach((function(i){if(!i.isIntersecting)return;r.unobserve(e);t.addPrefetch(e.href)}))}));r.observe(e)}))};t.prototype.addPrefetch=function(t){var e=document.createElement("link");e.rel="prefetch";e.href=t;document.head.appendChild(e)};return t}();export{MiyaokaEmbedTweet as miyaoka_embed_tweet,MiyaokaImgLoader as miyaoka_img_loader,MiyaokaLightbox as miyaoka_lightbox,MiyaokaPrefetch as miyaoka_prefetch}; |
@@ -131,3 +131,3 @@ import { r as registerInstance, h, H as Host, g as getElement } from './index-a4c6996c.js'; | ||
const host = location.host; | ||
const linkList = Array.from(document.querySelectorAll('a')); | ||
const linkList = Array.from(document.querySelectorAll('a[data-prefetch]')); | ||
const hrefMap = {}; | ||
@@ -134,0 +134,0 @@ const sameHostLinks = linkList.filter(({ href }) => { |
@@ -1,1 +0,1 @@ | ||
import{p as a,w as e,d as t,N as o,a as s,b as r}from"./p-45677803.js";(()=>{a.t=e.__cssshim;const r=Array.from(t.querySelectorAll("script")).find((a=>new RegExp(`/${o}(\\.esm)?\\.js($|\\?|#)`).test(a.src)||a.getAttribute("data-stencil-namespace")===o)),i=r["data-opts"]||{};return"onbeforeload"in r&&!history.scrollRestoration?{then(){}}:(i.resourcesUrl=new URL(".",new URL(r.getAttribute("data-resources-url")||r.src,e.location.href)).href,((a,s)=>{const r=`__sc_import_${o.replace(/\s|-/g,"_")}`;try{e[r]=new Function("w",`return import(w);//${Math.random()}`)}catch(i){const o=new Map;e[r]=i=>{const n=new URL(i,a).href;let c=o.get(n);if(!c){const a=t.createElement("script");a.type="module",a.crossOrigin=s.crossOrigin,a.src=URL.createObjectURL(new Blob([`import * as m from '${n}'; window.${r}.m = m;`],{type:"application/javascript"})),c=new Promise((t=>{a.onload=()=>{t(e[r].m),a.remove()}})),o.set(n,c),t.head.appendChild(a)}return c}}})(i.resourcesUrl,r),e.customElements?s(i):__sc_import_miyaoka_components("./p-db46d0d3.js").then((()=>i)))})().then((a=>r([["p-692a90ba",[[0,"miyaoka-embed-tweet",{src:[1]}],[1,"miyaoka-img-loader",{src:[1],alt:[1],loading:[1],scale:[2],rotate:[2],opacity:[2],duration:[2],delay:[2],img:[32],isLoaded:[32]}],[1,"miyaoka-lightbox",{src:[1],visible:[32]}],[1,"miyaoka-prefetch"]]]],a))); | ||
import{p as a,w as e,d as t,N as o,a as s,b as r}from"./p-45677803.js";(()=>{a.t=e.__cssshim;const r=Array.from(t.querySelectorAll("script")).find((a=>new RegExp(`/${o}(\\.esm)?\\.js($|\\?|#)`).test(a.src)||a.getAttribute("data-stencil-namespace")===o)),i=r["data-opts"]||{};return"onbeforeload"in r&&!history.scrollRestoration?{then(){}}:(i.resourcesUrl=new URL(".",new URL(r.getAttribute("data-resources-url")||r.src,e.location.href)).href,((a,s)=>{const r=`__sc_import_${o.replace(/\s|-/g,"_")}`;try{e[r]=new Function("w",`return import(w);//${Math.random()}`)}catch(i){const o=new Map;e[r]=i=>{const n=new URL(i,a).href;let c=o.get(n);if(!c){const a=t.createElement("script");a.type="module",a.crossOrigin=s.crossOrigin,a.src=URL.createObjectURL(new Blob([`import * as m from '${n}'; window.${r}.m = m;`],{type:"application/javascript"})),c=new Promise((t=>{a.onload=()=>{t(e[r].m),a.remove()}})),o.set(n,c),t.head.appendChild(a)}return c}}})(i.resourcesUrl,r),e.customElements?s(i):__sc_import_miyaoka_components("./p-db46d0d3.js").then((()=>i)))})().then((a=>r([["p-28e30639",[[0,"miyaoka-embed-tweet",{src:[1]}],[1,"miyaoka-img-loader",{src:[1],alt:[1],loading:[1],scale:[2],rotate:[2],opacity:[2],duration:[2],delay:[2],img:[32],isLoaded:[32]}],[1,"miyaoka-lightbox",{src:[1],visible:[32]}],[1,"miyaoka-prefetch"]]]],a))); |
@@ -1,1 +0,1 @@ | ||
System.register(["./p-154d9dcb.system.js"],(function(e,r){"use strict";var t,n,i,o,s,a;return{setters:[function(e){t=e.p;n=e.w;i=e.d;o=e.N;s=e.a;a=e.b}],execute:function(){var e=function(e){return"__sc_import_"+e.replace(/\s|-/g,"_")};var c=function(){{t.$cssShim$=n.__cssshim}var e=Array.from(i.querySelectorAll("script")).find((function(e){return new RegExp("/"+o+"(\\.esm)?\\.js($|\\?|#)").test(e.src)||e.getAttribute("data-stencil-namespace")===o}));var a=e["data-opts"]||{};if("onbeforeload"in e&&!history.scrollRestoration){return{then:function(){}}}{a.resourcesUrl=new URL(".",new URL(e.getAttribute("data-resources-url")||e.src,n.location.href)).href;{u(a.resourcesUrl,e)}if(!n.customElements){return r.import("./p-9b1d8162.system.js").then((function(){return a}))}}return s(a)};var u=function(r,t){var s=e(o);try{n[s]=new Function("w","return import(w);//"+Math.random())}catch(c){var a=new Map;n[s]=function(e){var o=new URL(e,r).href;var c=a.get(o);if(!c){var u=i.createElement("script");u.type="module";u.crossOrigin=t.crossOrigin;u.src=URL.createObjectURL(new Blob(["import * as m from '"+o+"'; window."+s+".m = m;"],{type:"application/javascript"}));c=new Promise((function(e){u.onload=function(){e(n[s].m);u.remove()}}));a.set(o,c);i.head.appendChild(u)}return c}}};c().then((function(e){return a([["p-63685b2f.system",[[0,"miyaoka-embed-tweet",{src:[1]}],[1,"miyaoka-img-loader",{src:[1],alt:[1],loading:[1],scale:[2],rotate:[2],opacity:[2],duration:[2],delay:[2],img:[32],isLoaded:[32]}],[1,"miyaoka-lightbox",{src:[1],visible:[32]}],[1,"miyaoka-prefetch"]]]],e)}))}}})); | ||
System.register(["./p-154d9dcb.system.js"],(function(e,r){"use strict";var t,n,i,o,s,a;return{setters:[function(e){t=e.p;n=e.w;i=e.d;o=e.N;s=e.a;a=e.b}],execute:function(){var e=function(e){return"__sc_import_"+e.replace(/\s|-/g,"_")};var c=function(){{t.$cssShim$=n.__cssshim}var e=Array.from(i.querySelectorAll("script")).find((function(e){return new RegExp("/"+o+"(\\.esm)?\\.js($|\\?|#)").test(e.src)||e.getAttribute("data-stencil-namespace")===o}));var a=e["data-opts"]||{};if("onbeforeload"in e&&!history.scrollRestoration){return{then:function(){}}}{a.resourcesUrl=new URL(".",new URL(e.getAttribute("data-resources-url")||e.src,n.location.href)).href;{u(a.resourcesUrl,e)}if(!n.customElements){return r.import("./p-9b1d8162.system.js").then((function(){return a}))}}return s(a)};var u=function(r,t){var s=e(o);try{n[s]=new Function("w","return import(w);//"+Math.random())}catch(c){var a=new Map;n[s]=function(e){var o=new URL(e,r).href;var c=a.get(o);if(!c){var u=i.createElement("script");u.type="module";u.crossOrigin=t.crossOrigin;u.src=URL.createObjectURL(new Blob(["import * as m from '"+o+"'; window."+s+".m = m;"],{type:"application/javascript"}));c=new Promise((function(e){u.onload=function(){e(n[s].m);u.remove()}}));a.set(o,c);i.head.appendChild(u)}return c}}};c().then((function(e){return a([["p-c5f465f9.system",[[0,"miyaoka-embed-tweet",{src:[1]}],[1,"miyaoka-img-loader",{src:[1],alt:[1],loading:[1],scale:[2],rotate:[2],opacity:[2],duration:[2],delay:[2],img:[32],isLoaded:[32]}],[1,"miyaoka-lightbox",{src:[1],visible:[32]}],[1,"miyaoka-prefetch"]]]],e)}))}}})); |
{ | ||
"name": "@miyaoka/miyaoka-components", | ||
"version": "0.3.1", | ||
"version": "0.3.2", | ||
"description": "Stencil Component Starter", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
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
749055